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

192
gradlew.bat vendored
View File

@ -1,103 +1,89 @@
@rem @rem
@rem Copyright 2015 the original author or authors. @rem Copyright 2015 the original author or authors.
@rem @rem
@rem Licensed under the Apache License, Version 2.0 (the "License"); @rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License. @rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at @rem You may obtain a copy of the License at
@rem @rem
@rem https://www.apache.org/licenses/LICENSE-2.0 @rem https://www.apache.org/licenses/LICENSE-2.0
@rem @rem
@rem Unless required by applicable law or agreed to in writing, software @rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS, @rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@rem @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter. @rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome 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.
echo. echo.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
goto fail goto fail
:findJavaFromJavaHome :findJavaFromJavaHome
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%
echo. echo.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
goto fail goto fail
:init :execute
@rem Get command-line arguments, handling Windows variants @rem Setup the command line
if not "%OS%" == "Windows_NT" goto win9xME_args set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:win9xME_args
@rem Slurp the command line arguments. @rem Execute Gradle
set CMD_LINE_ARGS= "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
set _SKIP=2
:end
:win9xME_args_slurp @rem End local scope for the variables with windows NT shell
if "x%~1" == "x" goto execute if "%ERRORLEVEL%"=="0" goto mainEnd
set CMD_LINE_ARGS=%* :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
:execute rem the _cmd.exe /c_ return code!
@rem Setup the command line if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:mainEnd
@rem Execute Gradle if "%OS%"=="Windows_NT" endlocal
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:omega
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

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());