small steps forward

This commit is contained in:
Jörg Henke 2021-07-17 16:02:02 +02:00
parent cbcf128f3d
commit 9de896b6d8
9 changed files with 107 additions and 120 deletions

Binary file not shown.

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

4
gradlew vendored
View File

@ -72,7 +72,7 @@ case "`uname`" in
Darwin* ) Darwin* )
darwin=true darwin=true
;; ;;
MINGW* ) MSYS* | MINGW* )
msys=true msys=true
;; ;;
NONSTOP* ) NONSTOP* )
@ -82,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath

22
gradlew.bat vendored
View File

@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -64,28 +64,14 @@ echo location of your Java installation.
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell

View File

@ -6,8 +6,8 @@ import java.util.List;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.GravelBlock; import net.minecraft.block.GravelBlock;
import net.minecraft.block.MapColor;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.loot.context.LootContext.Builder; import net.minecraft.loot.context.LootContext.Builder;
@ -21,7 +21,7 @@ import net.minecraft.sound.BlockSoundGroup;
public class BlockKelpstack extends GravelBlock { public class BlockKelpstack extends GravelBlock {
public BlockKelpstack() { public BlockKelpstack() {
super(FabricBlockSettings.of(Material.SOLID_ORGANIC, MaterialColor.GREEN).hardness(0.1f).slipperiness(1.0f) super(FabricBlockSettings.of(Material.SOLID_ORGANIC, MapColor.GREEN).hardness(0.1f).slipperiness(1.0f)
.breakInstantly().sounds(BlockSoundGroup.WET_GRASS)); .breakInstantly().sounds(BlockSoundGroup.WET_GRASS));
} }

View File

@ -11,6 +11,8 @@ import net.minecraft.block.Material;
import net.minecraft.block.OreBlock; import net.minecraft.block.OreBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext.Builder; import net.minecraft.loot.context.LootContext.Builder;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
/** /**
* *

View File

@ -4,9 +4,8 @@ import de.jottyfan.minecraft.quickiefabric.items.ItemBackpack;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.SimpleInventory; import net.minecraft.inventory.SimpleInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents; import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
@ -66,19 +65,19 @@ public class BackpackInventory extends SimpleInventory {
} }
private void readItemsFromTag(Integer size, NbtCompound tag) { private void readItemsFromTag(Integer size, NbtCompound tag) {
ListTag listTag = tag.getList("items", 10); NbtList listTag = tag.getList("items", 10);
for (int i = 0; i < listTag.size(); ++i) { for (int i = 0; i < listTag.size(); ++i) {
NbtCompound compoundTag = listTag.getCompound(i); NbtCompound compoundTag = listTag.getCompound(i);
int slot = compoundTag.getInt("slot"); int slot = compoundTag.getInt("slot");
if (slot >= 0 && slot < size) { if (slot >= 0 && slot < size) {
super.setStack(slot, ItemStack.fromTag(compoundTag)); super.setStack(slot, ItemStack.fromNbt(compoundTag));
} }
} }
} }
private NbtCompound writeItemsToTag() { private NbtCompound writeItemsToTag() {
ListTag listTag = new ListTag(); NbtList listTag = new NbtList();
for (int i = 0; i < super.size(); ++i) { for (int i = 0; i < super.size(); ++i) {
ItemStack itemStack = (ItemStack) super.getStack(i); ItemStack itemStack = (ItemStack) super.getStack(i);
if (!(itemStack == null) && !itemStack.isEmpty()) { if (!(itemStack == null) && !itemStack.isEmpty()) {

View File

@ -34,7 +34,7 @@ public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
@Override @Override
protected void init() { protected void init() {
super.init(); super.init();
this.x = (this.width - this.containerWidth) / 2; this.titleX = (this.width - this.containerWidth) / 2;
} }
private void drawSlots(MatrixStack matrices, int guiX, int guiY) { private void drawSlots(MatrixStack matrices, int guiX, int guiY) {
@ -55,9 +55,9 @@ public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
@Override @Override
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) { protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); // GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.client.getTextureManager().bindTexture(TEXTURE); this.client.getTextureManager().bindTexture(TEXTURE);
int guiX = this.x; int guiX = this.titleX;
int guiY = (this.height - this.containerHeight) / 2; int guiY = (this.height - this.containerHeight) / 2;
this.drawTexture(matrices, guiX, guiY, 0, 0, this.containerWidth, this.containerHeight); this.drawTexture(matrices, guiX, guiY, 0, 0, this.containerWidth, this.containerHeight);

View File

@ -2,7 +2,6 @@ package de.jottyfan.minecraft.quickiefabric.init;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.function.Supplier;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -37,16 +36,15 @@ import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.loot.ConstantLootTableRange;
import net.minecraft.loot.condition.RandomChanceLootCondition; import net.minecraft.loot.condition.RandomChanceLootCondition;
import net.minecraft.loot.entry.ItemEntry; import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
import net.minecraft.screen.ScreenHandlerType; import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.structure.rule.BlockMatchRuleTest; import net.minecraft.structure.rule.BlockMatchRuleTest;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.HeightContext;
import net.minecraft.world.gen.YOffset; import net.minecraft.world.gen.YOffset;
import net.minecraft.world.gen.decorator.Decorator; import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig; import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
@ -165,7 +163,7 @@ public class RegistryManager {
} }
public static final <T extends BlockEntity> BlockEntityType<? extends T> registerBlockEntity(String name, public static final <T extends BlockEntity> BlockEntityType<? extends T> registerBlockEntity(String name,
Supplier<? extends T> supplier, Block... blocks) { BlockEntityType<? extends T> supplier, Block... blocks) {
String fullname = new StringBuilder().append(QUICKIEFABRIC).append(":").append(name).toString(); String fullname = new StringBuilder().append(QUICKIEFABRIC).append(":").append(name).toString();
Builder<? extends T> builder = BlockEntityType.Builder.create(supplier, blocks); Builder<? extends T> builder = BlockEntityType.Builder.create(supplier, blocks);
BlockEntityType<? extends T> blockEntityType = builder.build(null); BlockEntityType<? extends T> blockEntityType = builder.build(null);
@ -295,7 +293,7 @@ public class RegistryManager {
public static final void registerLootings() { public static final void registerLootings() {
LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> { LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> {
if (isGrass(id)) { if (isGrass(id)) {
FabricLootPoolBuilder poolBuilder = FabricLootPoolBuilder.builder().rolls(ConstantLootTableRange.create(1)) FabricLootPoolBuilder poolBuilder = FabricLootPoolBuilder.builder().rolls(ConstantLootNumberProvider.create(1))
.withCondition(RandomChanceLootCondition.builder(0.125f).build()) .withCondition(RandomChanceLootCondition.builder(0.125f).build())
.withEntry(ItemEntry.builder(QuickieItems.COTTONSEED).build()); .withEntry(ItemEntry.builder(QuickieItems.COTTONSEED).build());
supplier.withPool(poolBuilder.build()); supplier.withPool(poolBuilder.build());