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
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
zipStorePath=wrapper/dists

4
gradlew vendored
View File

@ -72,7 +72,7 @@ case "`uname`" in
Darwin* )
darwin=true
;;
MINGW* )
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
@ -82,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# 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
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
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_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -64,28 +64,14 @@ echo location of your Java installation.
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
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@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
@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.minecraft.block.BlockState;
import net.minecraft.block.GravelBlock;
import net.minecraft.block.MapColor;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.loot.context.LootContext.Builder;
@ -21,7 +21,7 @@ import net.minecraft.sound.BlockSoundGroup;
public class BlockKelpstack extends GravelBlock {
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));
}

View File

@ -11,6 +11,8 @@ import net.minecraft.block.Material;
import net.minecraft.block.OreBlock;
import net.minecraft.item.ItemStack;
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.inventory.SimpleInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Hand;
@ -66,19 +65,19 @@ public class BackpackInventory extends SimpleInventory {
}
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) {
NbtCompound compoundTag = listTag.getCompound(i);
int slot = compoundTag.getInt("slot");
if (slot >= 0 && slot < size) {
super.setStack(slot, ItemStack.fromTag(compoundTag));
super.setStack(slot, ItemStack.fromNbt(compoundTag));
}
}
}
private NbtCompound writeItemsToTag() {
ListTag listTag = new ListTag();
NbtList listTag = new NbtList();
for (int i = 0; i < super.size(); ++i) {
ItemStack itemStack = (ItemStack) super.getStack(i);
if (!(itemStack == null) && !itemStack.isEmpty()) {

View File

@ -34,7 +34,7 @@ public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
@Override
protected void 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) {
@ -55,9 +55,9 @@ public class BackpackScreen extends HandledScreen<BackpackScreenHandler>
@Override
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);
int guiX = this.x;
int guiX = this.titleX;
int guiY = (this.height - this.containerHeight) / 2;
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.List;
import java.util.function.Supplier;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -37,16 +36,15 @@ import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.ConstantLootTableRange;
import net.minecraft.loot.condition.RandomChanceLootCondition;
import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.structure.rule.BlockMatchRuleTest;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.HeightContext;
import net.minecraft.world.gen.YOffset;
import net.minecraft.world.gen.decorator.Decorator;
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,
Supplier<? extends T> supplier, Block... blocks) {
BlockEntityType<? extends T> supplier, Block... blocks) {
String fullname = new StringBuilder().append(QUICKIEFABRIC).append(":").append(name).toString();
Builder<? extends T> builder = BlockEntityType.Builder.create(supplier, blocks);
BlockEntityType<? extends T> blockEntityType = builder.build(null);
@ -295,7 +293,7 @@ public class RegistryManager {
public static final void registerLootings() {
LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> {
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())
.withEntry(ItemEntry.builder(QuickieItems.COTTONSEED).build());
supplier.withPool(poolBuilder.build());