Merge remote-tracking branch 'upstream/mc1.16/dev' into

mc1.16/creative-cake

Conflicts:
	src/main/java/com/simibubi/create/AllBlocks.java
	src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerBlock.java
	src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerHandler.java
	src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java
	src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInteractionPoint.java
This commit is contained in:
PepperBell 2021-07-15 13:21:47 -07:00
commit 7ec02fd040
1012 changed files with 13344 additions and 12860 deletions

View file

@ -29,10 +29,10 @@ version = "mc${minecraft_version}_v${mod_version}" + (dev ? "+${buildnumber}" :
group = 'com.simibubi.create' group = 'com.simibubi.create'
archivesBaseName = 'create' archivesBaseName = 'create'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' java.toolchain.languageVersion = JavaLanguageVersion.of(8)
minecraft { minecraft {
mappings channel: 'snapshot', version: '20200920-mixed-1.16.3' mappings channel: 'official', version: "${minecraft_version}"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs { runs {
@ -42,7 +42,8 @@ minecraft {
//jvmArgs '-XX:+UnlockCommercialFeatures' // uncomment for profiling //jvmArgs '-XX:+UnlockCommercialFeatures' // uncomment for profiling
property 'forge.logging.console.level', 'info' property 'forge.logging.console.level', 'info'
property 'fml.earlyprogresswindow', 'false' property 'fml.earlyprogresswindow', 'false'
property 'mixin.env.disableRefMap', 'true' property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods { mods {
create { create {
source sourceSets.main source sourceSets.main
@ -54,6 +55,8 @@ minecraft {
workingDirectory project.file('run/server') workingDirectory project.file('run/server')
arg '-mixin.config=create.mixins.json' arg '-mixin.config=create.mixins.json'
property 'forge.logging.console.level', 'info' property 'forge.logging.console.level', 'info'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods { mods {
create { create {
source sourceSets.main source sourceSets.main
@ -66,6 +69,8 @@ minecraft {
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP' property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
property 'fml.earlyprogresswindow', 'false' property 'fml.earlyprogresswindow', 'false'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
args '--mod', 'create', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources') args '--mod', 'create', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources')
mods { mods {
create { create {

View file

@ -9,7 +9,7 @@ minecraft_version = 1.16.5
forge_version = 36.1.32 forge_version = 36.1.32
# build dependency versions # build dependency versions
forgegradle_version = 3.+ forgegradle_version = 4.1.+
mixingradle_version = 0.7-SNAPSHOT mixingradle_version = 0.7-SNAPSHOT
shadow_version = 5.2.0 shadow_version = 5.2.0
cursegradle_version = 1.4.0 cursegradle_version = 1.4.0

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-5.6.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

31
gradlew vendored
View file

@ -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
@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else else
eval `echo args$i`="\"$arg\"" eval `echo args$i`="\"$arg\""
fi fi
i=$((i+1)) i=`expr $i + 1`
done done
case $i in case $i in
(0) set -- ;; 0) set -- ;;
(1) set -- "$args0" ;; 1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;; 2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;; 3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;; 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
@ -175,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " " echo " "
} }
APP_ARGS=$(save "$@") APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules # Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

25
gradlew.bat vendored
View file

@ -29,6 +29,9 @@ 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.
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"
@ -37,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.
@ -51,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%
@ -61,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

@ -127,14 +127,14 @@ public class AllBlockPartials {
Map<Direction, PartialModel> map = new HashMap<>(); Map<Direction, PartialModel> map = new HashMap<>();
for (Direction d : Iterate.directions) { for (Direction d : Iterate.directions) {
String asId = Lang.asId(type.name()); String asId = Lang.asId(type.name());
map.put(d, get("fluid_pipe/" + asId + "/" + Lang.asId(d.getString()))); map.put(d, get("fluid_pipe/" + asId + "/" + Lang.asId(d.getSerializedName())));
} }
PIPE_ATTACHMENTS.put(type, map); PIPE_ATTACHMENTS.put(type, map);
} }
for (BlazeBurnerBlock.HeatLevel heat : BlazeBurnerBlock.HeatLevel.values()) { for (BlazeBurnerBlock.HeatLevel heat : BlazeBurnerBlock.HeatLevel.values()) {
if (heat == BlazeBurnerBlock.HeatLevel.NONE) if (heat == BlazeBurnerBlock.HeatLevel.NONE)
continue; continue;
BLAZES.put(heat, get("blaze_burner/blaze/" + heat.getString())); BLAZES.put(heat, get("blaze_burner/blaze/" + heat.getSerializedName()));
} }
} }

View file

@ -221,14 +221,14 @@ public class AllBlocks {
.initialProperties(() -> Blocks.DISPENSER) .initialProperties(() -> Blocks.DISPENSER)
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov))) .blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov)))
.loot((lt, block) -> { .loot((lt, block) -> {
Builder builder = LootTable.builder(); Builder builder = LootTable.lootTable();
IBuilder survivesExplosion = SurvivesExplosion.builder(); IBuilder survivesExplosion = SurvivesExplosion.survivesExplosion();
lt.registerLootTable(block, builder.addLootPool(LootPool.builder() lt.add(block, builder.withPool(LootPool.lootPool()
.acceptCondition(survivesExplosion) .when(survivesExplosion)
.rolls(ConstantRange.of(1)) .setRolls(ConstantRange.exactly(1))
.addEntry(ItemLootEntry.builder(AllBlocks.SCHEMATICANNON.get().asItem()) .add(ItemLootEntry.lootTableItem(AllBlocks.SCHEMATICANNON.get().asItem())
.acceptFunction(CopyNbt.func_215881_a(CopyNbt.Source.BLOCK_ENTITY) .apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY)
.func_216056_a("Options", "BlockEntityTag.Options"))))); .copy("Options", "BlockEntityTag.Options")))));
}) })
.item() .item()
.transform(customItemModel()) .transform(customItemModel())
@ -289,11 +289,11 @@ public class AllBlocks {
public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new) public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact()) .transform(StressConfigDefaults.setNoImpact())
.onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(AllSpriteShifts.ANDESITE_CASING))) .onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(AllSpriteShifts.ANDESITE_CASING)))
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.ANDESITE_CASING, .onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.ANDESITE_CASING,
(s, f) -> f.getAxis() == s.get(GearboxBlock.AXIS)))) (s, f) -> f.getAxis() == s.getValue(GearboxBlock.AXIS))))
.blockstate((c, p) -> axisBlock(c, p, $ -> AssetLookup.partialBaseModel(c, p), true)) .blockstate((c, p) -> axisBlock(c, p, $ -> AssetLookup.partialBaseModel(c, p), true))
.item() .item()
.transform(customItemModel()) .transform(customItemModel())
@ -301,7 +301,7 @@ public class AllBlocks {
public static final BlockEntry<ClutchBlock> CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new) public static final BlockEntry<ClutchBlock> CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact()) .transform(StressConfigDefaults.setNoImpact())
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p))) .blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
.item() .item()
@ -310,7 +310,7 @@ public class AllBlocks {
public static final BlockEntry<GearshiftBlock> GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new) public static final BlockEntry<GearshiftBlock> GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact()) .transform(StressConfigDefaults.setNoImpact())
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p))) .blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
.item() .item()
@ -320,7 +320,7 @@ public class AllBlocks {
public static final BlockEntry<EncasedBeltBlock> ENCASED_CHAIN_DRIVE = public static final BlockEntry<EncasedBeltBlock> ENCASED_CHAIN_DRIVE =
REGISTRATE.block("encased_chain_drive", EncasedBeltBlock::new) REGISTRATE.block("encased_chain_drive", EncasedBeltBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact()) .transform(StressConfigDefaults.setNoImpact())
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> p.models() .blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> p.models()
.getExistingFile(p.modLoc("block/" + c.getName() + "/" + suffix))).generate(c, p)) .getExistingFile(p.modLoc("block/" + c.getName() + "/" + suffix))).generate(c, p))
@ -331,10 +331,10 @@ public class AllBlocks {
public static final BlockEntry<AdjustablePulleyBlock> ADJUSTABLE_CHAIN_GEARSHIFT = public static final BlockEntry<AdjustablePulleyBlock> ADJUSTABLE_CHAIN_GEARSHIFT =
REGISTRATE.block("adjustable_chain_gearshift", AdjustablePulleyBlock::new) REGISTRATE.block("adjustable_chain_gearshift", AdjustablePulleyBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact()) .transform(StressConfigDefaults.setNoImpact())
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> { .blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> {
String powered = state.get(AdjustablePulleyBlock.POWERED) ? "_powered" : ""; String powered = state.getValue(AdjustablePulleyBlock.POWERED) ? "_powered" : "";
return p.models() return p.models()
.withExistingParent(c.getName() + "_" + suffix + powered, .withExistingParent(c.getName() + "_" + suffix + powered,
p.modLoc("block/encased_chain_drive/" + suffix)) p.modLoc("block/encased_chain_drive/" + suffix))
@ -347,9 +347,9 @@ public class AllBlocks {
.register(); .register();
public static final BlockEntry<BeltBlock> BELT = REGISTRATE.block("belt", BeltBlock::new) public static final BlockEntry<BeltBlock> BELT = REGISTRATE.block("belt", BeltBlock::new)
.initialProperties(SharedProperties.beltMaterial, MaterialColor.GRAY) .initialProperties(SharedProperties.beltMaterial, MaterialColor.COLOR_GRAY)
.properties(p -> p.sound(SoundType.CLOTH)) .properties(p -> p.sound(SoundType.WOOL))
.properties(p -> p.hardnessAndResistance(0.8F)) .properties(p -> p.strength(0.8F))
.blockstate(new BeltGenerator()::generate) .blockstate(new BeltGenerator()::generate)
.transform(StressConfigDefaults.setImpact(1.0)) .transform(StressConfigDefaults.setImpact(1.0))
.onRegister(CreateRegistrate.blockModel(() -> BeltModel::new)) .onRegister(CreateRegistrate.blockModel(() -> BeltModel::new))
@ -368,9 +368,9 @@ public class AllBlocks {
public static final BlockEntry<WaterWheelBlock> WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new) public static final BlockEntry<WaterWheelBlock> WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new)
.initialProperties(SharedProperties::wooden) .initialProperties(SharedProperties::wooden)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(false)) .blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(false))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.transform(StressConfigDefaults.setCapacity(16.0)) .transform(StressConfigDefaults.setCapacity(16.0))
.simpleItem() .simpleItem()
.register(); .register();
@ -378,7 +378,7 @@ public class AllBlocks {
public static final BlockEntry<EncasedFanBlock> ENCASED_FAN = REGISTRATE.block("encased_fan", EncasedFanBlock::new) public static final BlockEntry<EncasedFanBlock> ENCASED_FAN = REGISTRATE.block("encased_fan", EncasedFanBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.blockstate(BlockStateGen.directionalBlockProvider(true)) .blockstate(BlockStateGen.directionalBlockProvider(true))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.transform(StressConfigDefaults.setCapacity(16.0)) .transform(StressConfigDefaults.setCapacity(16.0))
.transform(StressConfigDefaults.setImpact(2.0)) .transform(StressConfigDefaults.setImpact(2.0))
.item() .item()
@ -389,7 +389,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.tag(AllBlockTags.BRITTLE.tag) .tag(AllBlockTags.BRITTLE.tag)
.blockstate(BlockStateGen.directionalBlockProvider(true)) .blockstate(BlockStateGen.directionalBlockProvider(true))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.item() .item()
.transform(customItemModel()) .transform(customItemModel())
.register(); .register();
@ -434,9 +434,9 @@ public class AllBlocks {
public static final BlockEntry<CrushingWheelBlock> CRUSHING_WHEEL = public static final BlockEntry<CrushingWheelBlock> CRUSHING_WHEEL =
REGISTRATE.block("crushing_wheel", CrushingWheelBlock::new) REGISTRATE.block("crushing_wheel", CrushingWheelBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.axisBlockProvider(false)) .blockstate(BlockStateGen.axisBlockProvider(false))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.transform(StressConfigDefaults.setImpact(8.0)) .transform(StressConfigDefaults.setImpact(8.0))
.simpleItem() .simpleItem()
.register(); .register();
@ -454,7 +454,7 @@ public class AllBlocks {
public static final BlockEntry<MechanicalPressBlock> MECHANICAL_PRESS = public static final BlockEntry<MechanicalPressBlock> MECHANICAL_PRESS =
REGISTRATE.block("mechanical_press", MechanicalPressBlock::new) REGISTRATE.block("mechanical_press", MechanicalPressBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.horizontalBlockProvider(true)) .blockstate(BlockStateGen.horizontalBlockProvider(true))
.transform(StressConfigDefaults.setImpact(8.0)) .transform(StressConfigDefaults.setImpact(8.0))
.item(AssemblyOperatorBlockItem::new) .item(AssemblyOperatorBlockItem::new)
@ -464,9 +464,9 @@ public class AllBlocks {
public static final BlockEntry<MechanicalMixerBlock> MECHANICAL_MIXER = public static final BlockEntry<MechanicalMixerBlock> MECHANICAL_MIXER =
REGISTRATE.block("mechanical_mixer", MechanicalMixerBlock::new) REGISTRATE.block("mechanical_mixer", MechanicalMixerBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p))) .blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.transform(StressConfigDefaults.setImpact(4.0)) .transform(StressConfigDefaults.setImpact(4.0))
.item(AssemblyOperatorBlockItem::new) .item(AssemblyOperatorBlockItem::new)
.transform(customItemModel()) .transform(customItemModel())
@ -474,7 +474,7 @@ public class AllBlocks {
public static final BlockEntry<BasinBlock> BASIN = REGISTRATE.block("basin", BasinBlock::new) public static final BlockEntry<BasinBlock> BASIN = REGISTRATE.block("basin", BasinBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(p -> p.sound(SoundType.NETHERITE)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.blockstate(new BasinGenerator()::generate) .blockstate(new BasinGenerator()::generate)
.onRegister(addMovementBehaviour(new BasinMovementBehaviour())) .onRegister(addMovementBehaviour(new BasinMovementBehaviour()))
.item() .item()
@ -484,10 +484,10 @@ public class AllBlocks {
public static final BlockEntry<BlazeBurnerBlock> BLAZE_BURNER = public static final BlockEntry<BlazeBurnerBlock> BLAZE_BURNER =
REGISTRATE.block("blaze_burner", BlazeBurnerBlock::new) REGISTRATE.block("blaze_burner", BlazeBurnerBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(p -> p.luminance(BlazeBurnerBlock::getLight)) .properties(p -> p.lightLevel(BlazeBurnerBlock::getLight))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.tag(AllBlockTags.FAN_TRANSPARENT.tag, AllBlockTags.FAN_HEATERS.tag) .tag(AllBlockTags.FAN_TRANSPARENT.tag, AllBlockTags.FAN_HEATERS.tag)
.loot((lt, block) -> lt.registerLootTable(block, BlazeBurnerBlock.buildLootTable())) .loot((lt, block) -> lt.add(block, BlazeBurnerBlock.buildLootTable()))
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p))) .blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
.item(BlazeBurnerBlockItem::withBlaze) .item(BlazeBurnerBlockItem::withBlaze)
.model(AssetLookup.<BlazeBurnerBlockItem>customBlockItemModel("blaze_burner", "block_with_blaze")) .model(AssetLookup.<BlazeBurnerBlockItem>customBlockItemModel("blaze_burner", "block_with_blaze"))
@ -497,14 +497,14 @@ public class AllBlocks {
public static final BlockEntry<LitBlazeBurnerBlock> LIT_BLAZE_BURNER = public static final BlockEntry<LitBlazeBurnerBlock> LIT_BLAZE_BURNER =
REGISTRATE.block("lit_blaze_burner", LitBlazeBurnerBlock::new) REGISTRATE.block("lit_blaze_burner", LitBlazeBurnerBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(p -> p.luminance(LitBlazeBurnerBlock::getLight)) .properties(p -> p.lightLevel(LitBlazeBurnerBlock::getLight))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.tag(AllBlockTags.FAN_TRANSPARENT.tag, AllBlockTags.FAN_HEATERS.tag) .tag(AllBlockTags.FAN_TRANSPARENT.tag, AllBlockTags.FAN_HEATERS.tag)
.loot((lt, block) -> lt.registerDropping(block, AllItems.EMPTY_BLAZE_BURNER.get())) .loot((lt, block) -> lt.dropOther(block, AllItems.EMPTY_BLAZE_BURNER.get()))
.blockstate((c, p) -> p.getVariantBuilder(c.get()).forAllStates(state -> .blockstate((c, p) -> p.getVariantBuilder(c.get()).forAllStates(state ->
ConfiguredModel.builder() ConfiguredModel.builder()
.modelFile(p.models().getExistingFile(p.modLoc( .modelFile(p.models().getExistingFile(p.modLoc(
"block/blaze_burner/" + (state.get(LitBlazeBurnerBlock.FLAME_TYPE) == LitBlazeBurnerBlock.FlameType.SOUL ? "block_with_soul_fire" : "block_with_fire") "block/blaze_burner/" + (state.getValue(LitBlazeBurnerBlock.FLAME_TYPE) == LitBlazeBurnerBlock.FlameType.SOUL ? "block_with_soul_fire" : "block_with_fire")
))) )))
.build())) .build()))
.register(); .register();
@ -519,7 +519,7 @@ public class AllBlocks {
public static final BlockEntry<EjectorBlock> WEIGHTED_EJECTOR = public static final BlockEntry<EjectorBlock> WEIGHTED_EJECTOR =
REGISTRATE.block("weighted_ejector", EjectorBlock::new) REGISTRATE.block("weighted_ejector", EjectorBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(Block.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180)) .blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180))
.transform(StressConfigDefaults.setImpact(2.0)) .transform(StressConfigDefaults.setImpact(2.0))
.item(EjectorItem::new) .item(EjectorItem::new)
@ -528,8 +528,8 @@ public class AllBlocks {
public static final BlockEntry<ChuteBlock> CHUTE = REGISTRATE.block("chute", ChuteBlock::new) public static final BlockEntry<ChuteBlock> CHUTE = REGISTRATE.block("chute", ChuteBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(p -> p.sound(SoundType.NETHERITE)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.blockstate(new ChuteGenerator()::generate) .blockstate(new ChuteGenerator()::generate)
.item(ChuteItem::new) .item(ChuteItem::new)
.transform(customItemModel("_", "block")) .transform(customItemModel("_", "block"))
@ -537,7 +537,7 @@ public class AllBlocks {
public static final BlockEntry<SmartChuteBlock> SMART_CHUTE = REGISTRATE.block("smart_chute", SmartChuteBlock::new) public static final BlockEntry<SmartChuteBlock> SMART_CHUTE = REGISTRATE.block("smart_chute", SmartChuteBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(p -> p.sound(SoundType.NETHERITE)) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.blockstate((c, p) -> BlockStateGen.simpleBlock(c, p, AssetLookup.forPowered(c, p))) .blockstate((c, p) -> BlockStateGen.simpleBlock(c, p, AssetLookup.forPowered(c, p)))
.item() .item()
.transform(customItemModel("_", "block")) .transform(customItemModel("_", "block"))
@ -584,23 +584,23 @@ public class AllBlocks {
public static final BlockEntry<EncasedPipeBlock> ENCASED_FLUID_PIPE = public static final BlockEntry<EncasedPipeBlock> ENCASED_FLUID_PIPE =
REGISTRATE.block("encased_fluid_pipe", EncasedPipeBlock::new) REGISTRATE.block("encased_fluid_pipe", EncasedPipeBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(Block.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.encasedPipe()) .blockstate(BlockStateGen.encasedPipe())
.onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(AllSpriteShifts.COPPER_CASING))) .onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(AllSpriteShifts.COPPER_CASING)))
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.COPPER_CASING, .onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.COPPER_CASING,
(s, f) -> !s.get(EncasedPipeBlock.FACING_TO_PROPERTY_MAP.get(f))))) (s, f) -> !s.getValue(EncasedPipeBlock.FACING_TO_PROPERTY_MAP.get(f)))))
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new)) .onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
.loot((p, b) -> p.registerDropping(b, FLUID_PIPE.get())) .loot((p, b) -> p.dropOther(b, FLUID_PIPE.get()))
.register(); .register();
public static final BlockEntry<GlassFluidPipeBlock> GLASS_FLUID_PIPE = public static final BlockEntry<GlassFluidPipeBlock> GLASS_FLUID_PIPE =
REGISTRATE.block("glass_fluid_pipe", GlassFluidPipeBlock::new) REGISTRATE.block("glass_fluid_pipe", GlassFluidPipeBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, s -> p.models() .blockstate((c, p) -> BlockStateGen.axisBlock(c, p, s -> p.models()
.getExistingFile(p.modLoc("block/fluid_pipe/window" + (s.get(GlassFluidPipeBlock.ALT) ? "_alt" : ""))))) .getExistingFile(p.modLoc("block/fluid_pipe/window" + (s.getValue(GlassFluidPipeBlock.ALT) ? "_alt" : "")))))
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new)) .onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
.loot((p, b) -> p.registerDropping(b, FLUID_PIPE.get())) .loot((p, b) -> p.dropOther(b, FLUID_PIPE.get()))
.register(); .register();
public static final BlockEntry<PumpBlock> MECHANICAL_PUMP = REGISTRATE.block("mechanical_pump", PumpBlock::new) public static final BlockEntry<PumpBlock> MECHANICAL_PUMP = REGISTRATE.block("mechanical_pump", PumpBlock::new)
@ -625,7 +625,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.blockstate((c, p) -> BlockStateGen.directionalAxisBlock(c, p, .blockstate((c, p) -> BlockStateGen.directionalAxisBlock(c, p,
(state, vertical) -> AssetLookup.partialBaseModel(c, p, vertical ? "vertical" : "horizontal", (state, vertical) -> AssetLookup.partialBaseModel(c, p, vertical ? "vertical" : "horizontal",
state.get(FluidValveBlock.ENABLED) ? "open" : "closed"))) state.getValue(FluidValveBlock.ENABLED) ? "open" : "closed")))
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new)) .onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
.item() .item()
.transform(customItemModel()) .transform(customItemModel())
@ -637,25 +637,25 @@ public class AllBlocks {
.register(); .register();
public static final DyedBlockList<ValveHandleBlock> DYED_VALVE_HANDLES = new DyedBlockList<>(colour -> { public static final DyedBlockList<ValveHandleBlock> DYED_VALVE_HANDLES = new DyedBlockList<>(colour -> {
String colourName = colour.getString(); String colourName = colour.getSerializedName();
return REGISTRATE.block(colourName + "_valve_handle", ValveHandleBlock::dyed) return REGISTRATE.block(colourName + "_valve_handle", ValveHandleBlock::dyed)
.transform(BuilderTransformers.valveHandle(colour)) .transform(BuilderTransformers.valveHandle(colour))
.recipe((c, p) -> ShapedRecipeBuilder.shapedRecipe(c.get()) .recipe((c, p) -> ShapedRecipeBuilder.shaped(c.get())
.patternLine("#") .pattern("#")
.patternLine("-") .pattern("-")
.key('#', DyeHelper.getTagOfDye(colour)) .define('#', DyeHelper.getTagOfDye(colour))
.key('-', AllItemTags.VALVE_HANDLES.tag) .define('-', AllItemTags.VALVE_HANDLES.tag)
.addCriterion("has_valve", RegistrateRecipeProvider.hasItem(AllItemTags.VALVE_HANDLES.tag)) .unlockedBy("has_valve", RegistrateRecipeProvider.hasItem(AllItemTags.VALVE_HANDLES.tag))
.build(p, Create.asResource("crafting/kinetics/" + c.getName() + "_from_other_valve_handle"))) .save(p, Create.asResource("crafting/kinetics/" + c.getName() + "_from_other_valve_handle")))
.register(); .register();
}); });
public static final BlockEntry<FluidTankBlock> FLUID_TANK = REGISTRATE.block("fluid_tank", FluidTankBlock::regular) public static final BlockEntry<FluidTankBlock> FLUID_TANK = REGISTRATE.block("fluid_tank", FluidTankBlock::regular)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate(new FluidTankGenerator()::generate) .blockstate(new FluidTankGenerator()::generate)
.onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::standard)) .onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::standard))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.item(FluidTankItem::new) .item(FluidTankItem::new)
.model(AssetLookup.<FluidTankItem>customBlockItemModel("_", "block_single_window")) .model(AssetLookup.<FluidTankItem>customBlockItemModel("_", "block_single_window"))
.build() .build()
@ -665,10 +665,10 @@ public class AllBlocks {
REGISTRATE.block("creative_fluid_tank", FluidTankBlock::creative) REGISTRATE.block("creative_fluid_tank", FluidTankBlock::creative)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.tag(AllBlockTags.SAFE_NBT.tag) .tag(AllBlockTags.SAFE_NBT.tag)
.properties(Block.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate(new FluidTankGenerator("creative_")::generate) .blockstate(new FluidTankGenerator("creative_")::generate)
.onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::creative)) .onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::creative))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.item(FluidTankItem::new) .item(FluidTankItem::new)
.properties(p -> p.rarity(Rarity.EPIC)) .properties(p -> p.rarity(Rarity.EPIC))
.model((c, p) -> p.withExistingParent(c.getName(), p.modLoc("block/fluid_tank/block_single_window")) .model((c, p) -> p.withExistingParent(c.getName(), p.modLoc("block/fluid_tank/block_single_window"))
@ -688,7 +688,7 @@ public class AllBlocks {
public static final BlockEntry<ItemDrainBlock> ITEM_DRAIN = REGISTRATE.block("item_drain", ItemDrainBlock::new) public static final BlockEntry<ItemDrainBlock> ITEM_DRAIN = REGISTRATE.block("item_drain", ItemDrainBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.blockstate((c, p) -> p.simpleBlock(c.get(), AssetLookup.standardModel(c, p))) .blockstate((c, p) -> p.simpleBlock(c.get(), AssetLookup.standardModel(c, p)))
.simpleItem() .simpleItem()
.register(); .register();
@ -696,7 +696,7 @@ public class AllBlocks {
public static final BlockEntry<SpoutBlock> SPOUT = REGISTRATE.block("spout", SpoutBlock::new) public static final BlockEntry<SpoutBlock> SPOUT = REGISTRATE.block("spout", SpoutBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov))) .blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov)))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.item(AssemblyOperatorBlockItem::new) .item(AssemblyOperatorBlockItem::new)
.transform(customItemModel()) .transform(customItemModel())
.register(); .register();
@ -734,16 +734,16 @@ public class AllBlocks {
public static final BlockEntry<MechanicalPistonHeadBlock> MECHANICAL_PISTON_HEAD = public static final BlockEntry<MechanicalPistonHeadBlock> MECHANICAL_PISTON_HEAD =
REGISTRATE.block("mechanical_piston_head", MechanicalPistonHeadBlock::new) REGISTRATE.block("mechanical_piston_head", MechanicalPistonHeadBlock::new)
.initialProperties(() -> Blocks.PISTON_HEAD) .initialProperties(() -> Blocks.PISTON_HEAD)
.loot((p, b) -> p.registerDropping(b, PISTON_EXTENSION_POLE.get())) .loot((p, b) -> p.dropOther(b, PISTON_EXTENSION_POLE.get()))
.blockstate((c, p) -> BlockStateGen.directionalBlockIgnoresWaterlogged(c, p, state -> p.models() .blockstate((c, p) -> BlockStateGen.directionalBlockIgnoresWaterlogged(c, p, state -> p.models()
.getExistingFile(p.modLoc("block/mechanical_piston/" + state.get(MechanicalPistonHeadBlock.TYPE) .getExistingFile(p.modLoc("block/mechanical_piston/" + state.getValue(MechanicalPistonHeadBlock.TYPE)
.getString() + "/head")))) .getSerializedName() + "/head"))))
.register(); .register();
public static final BlockEntry<GantryCarriageBlock> GANTRY_CARRIAGE = public static final BlockEntry<GantryCarriageBlock> GANTRY_CARRIAGE =
REGISTRATE.block("gantry_carriage", GantryCarriageBlock::new) REGISTRATE.block("gantry_carriage", GantryCarriageBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(Block.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.directionalAxisBlockProvider()) .blockstate(BlockStateGen.directionalAxisBlockProvider())
.item() .item()
.transform(customItemModel()) .transform(customItemModel())
@ -753,11 +753,11 @@ public class AllBlocks {
REGISTRATE.block("gantry_shaft", GantryShaftBlock::new) REGISTRATE.block("gantry_shaft", GantryShaftBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.blockstate((c, p) -> p.directionalBlock(c.get(), s -> { .blockstate((c, p) -> p.directionalBlock(c.get(), s -> {
boolean isPowered = s.get(GantryShaftBlock.POWERED); boolean isPowered = s.getValue(GantryShaftBlock.POWERED);
boolean isFlipped = s.get(GantryShaftBlock.FACING) boolean isFlipped = s.getValue(GantryShaftBlock.FACING)
.getAxisDirection() == AxisDirection.NEGATIVE; .getAxisDirection() == AxisDirection.NEGATIVE;
String partName = s.get(GantryShaftBlock.PART) String partName = s.getValue(GantryShaftBlock.PART)
.getString(); .getSerializedName();
String flipped = isFlipped ? "_flipped" : ""; String flipped = isFlipped ? "_flipped" : "";
String powered = isPowered ? "_powered" : ""; String powered = isPowered ? "_powered" : "";
ModelFile existing = AssetLookup.partialBaseModel(c, p, partName); ModelFile existing = AssetLookup.partialBaseModel(c, p, partName);
@ -804,9 +804,9 @@ public class AllBlocks {
.register(); .register();
public static final BlockEntry<PulleyBlock.RopeBlock> ROPE = REGISTRATE.block("rope", PulleyBlock.RopeBlock::new) public static final BlockEntry<PulleyBlock.RopeBlock> ROPE = REGISTRATE.block("rope", PulleyBlock.RopeBlock::new)
.initialProperties(SharedProperties.beltMaterial, MaterialColor.BROWN) .initialProperties(SharedProperties.beltMaterial, MaterialColor.COLOR_BROWN)
.tag(AllBlockTags.BRITTLE.tag) .tag(AllBlockTags.BRITTLE.tag)
.properties(p -> p.sound(SoundType.CLOTH)) .properties(p -> p.sound(SoundType.WOOL))
.blockstate((c, p) -> p.simpleBlock(c.get(), p.models() .blockstate((c, p) -> p.simpleBlock(c.get(), p.models()
.getExistingFile(p.modLoc("block/rope_pulley/" + c.getName())))) .getExistingFile(p.modLoc("block/rope_pulley/" + c.getName()))))
.register(); .register();
@ -822,9 +822,9 @@ public class AllBlocks {
public static final BlockEntry<CartAssemblerBlock> CART_ASSEMBLER = public static final BlockEntry<CartAssemblerBlock> CART_ASSEMBLER =
REGISTRATE.block("cart_assembler", CartAssemblerBlock::new) REGISTRATE.block("cart_assembler", CartAssemblerBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.cartAssembler()) .blockstate(BlockStateGen.cartAssembler())
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.tag(BlockTags.RAILS, AllBlockTags.SAFE_NBT.tag) .tag(BlockTags.RAILS, AllBlockTags.SAFE_NBT.tag)
.item(CartAssemblerBlockItem::new) .item(CartAssemblerBlockItem::new)
.transform(customItemModel()) .transform(customItemModel())
@ -833,9 +833,9 @@ public class AllBlocks {
public static final BlockEntry<ReinforcedRailBlock> REINFORCED_RAIL = public static final BlockEntry<ReinforcedRailBlock> REINFORCED_RAIL =
REGISTRATE.block("reinforced_rail", ReinforcedRailBlock::new) REGISTRATE.block("reinforced_rail", ReinforcedRailBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.reinforcedRail()) .blockstate(BlockStateGen.reinforcedRail())
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.tag(BlockTags.RAILS) .tag(BlockTags.RAILS)
.item() .item()
.model((c, p) -> p.blockItem(() -> c.getEntry() .model((c, p) -> p.blockItem(() -> c.getEntry()
@ -847,7 +847,7 @@ public class AllBlocks {
REGISTRATE.block("controller_rail", ControllerRailBlock::new) REGISTRATE.block("controller_rail", ControllerRailBlock::new)
.initialProperties(() -> Blocks.POWERED_RAIL) .initialProperties(() -> Blocks.POWERED_RAIL)
.blockstate(new ControllerRailGenerator()::generate) .blockstate(new ControllerRailGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.color(() -> ColorHandlers::getRedstonePower) .color(() -> ColorHandlers::getRedstonePower)
.tag(BlockTags.RAILS) .tag(BlockTags.RAILS)
.item() .item()
@ -896,8 +896,8 @@ public class AllBlocks {
public static final BlockEntry<StickerBlock> STICKER = REGISTRATE.block("sticker", StickerBlock::new) public static final BlockEntry<StickerBlock> STICKER = REGISTRATE.block("sticker", StickerBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(Block.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p))) .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p)))
.item() .item()
.transform(customItemModel()) .transform(customItemModel())
@ -917,7 +917,7 @@ public class AllBlocks {
.blockstate(new SawGenerator()::generate) .blockstate(new SawGenerator()::generate)
.transform(StressConfigDefaults.setImpact(4.0)) .transform(StressConfigDefaults.setImpact(4.0))
.onRegister(addMovementBehaviour(new SawMovementBehaviour())) .onRegister(addMovementBehaviour(new SawMovementBehaviour()))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.item() .item()
.transform(customItemModel()) .transform(customItemModel())
.register(); .register();
@ -954,7 +954,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.onRegister(addMovementBehaviour(new HarvesterMovementBehaviour())) .onRegister(addMovementBehaviour(new HarvesterMovementBehaviour()))
.blockstate(BlockStateGen.horizontalBlockProvider(true)) .blockstate(BlockStateGen.horizontalBlockProvider(true))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.item() .item()
.transform(customItemModel()) .transform(customItemModel())
.register(); .register();
@ -968,7 +968,7 @@ public class AllBlocks {
.register(); .register();
public static final DyedBlockList<SeatBlock> SEATS = new DyedBlockList<>(colour -> { public static final DyedBlockList<SeatBlock> SEATS = new DyedBlockList<>(colour -> {
String colourName = colour.getString(); String colourName = colour.getSerializedName();
SeatMovementBehaviour movementBehaviour = new SeatMovementBehaviour(); SeatMovementBehaviour movementBehaviour = new SeatMovementBehaviour();
return REGISTRATE.block(colourName + "_seat", p -> new SeatBlock(p, colour == DyeColor.RED)) return REGISTRATE.block(colourName + "_seat", p -> new SeatBlock(p, colour == DyeColor.RED))
.initialProperties(SharedProperties::wooden) .initialProperties(SharedProperties::wooden)
@ -980,20 +980,20 @@ public class AllBlocks {
.texture("2", p.modLoc("block/seat/side_" + colourName))); .texture("2", p.modLoc("block/seat/side_" + colourName)));
}) })
.recipe((c, p) -> { .recipe((c, p) -> {
ShapedRecipeBuilder.shapedRecipe(c.get()) ShapedRecipeBuilder.shaped(c.get())
.patternLine("#") .pattern("#")
.patternLine("-") .pattern("-")
.key('#', DyeHelper.getWoolOfDye(colour)) .define('#', DyeHelper.getWoolOfDye(colour))
.key('-', ItemTags.WOODEN_SLABS) .define('-', ItemTags.WOODEN_SLABS)
.addCriterion("has_wool", RegistrateRecipeProvider.hasItem(ItemTags.WOOL)) .unlockedBy("has_wool", RegistrateRecipeProvider.hasItem(ItemTags.WOOL))
.build(p, Create.asResource("crafting/kinetics/" + c.getName())); .save(p, Create.asResource("crafting/kinetics/" + c.getName()));
ShapedRecipeBuilder.shapedRecipe(c.get()) ShapedRecipeBuilder.shaped(c.get())
.patternLine("#") .pattern("#")
.patternLine("-") .pattern("-")
.key('#', DyeHelper.getTagOfDye(colour)) .define('#', DyeHelper.getTagOfDye(colour))
.key('-', AllItemTags.SEATS.tag) .define('-', AllItemTags.SEATS.tag)
.addCriterion("has_seat", RegistrateRecipeProvider.hasItem(AllItemTags.SEATS.tag)) .unlockedBy("has_seat", RegistrateRecipeProvider.hasItem(AllItemTags.SEATS.tag))
.build(p, Create.asResource("crafting/kinetics/" + c.getName() + "_from_other_seat")); .save(p, Create.asResource("crafting/kinetics/" + c.getName() + "_from_other_seat"));
}) })
.onRegisterAfter(Item.class, v -> TooltipHelper.referTo(v, "block.create.seat")) .onRegisterAfter(Item.class, v -> TooltipHelper.referTo(v, "block.create.seat"))
.tag(AllBlockTags.SEATS.tag) .tag(AllBlockTags.SEATS.tag)
@ -1005,7 +1005,7 @@ public class AllBlocks {
public static final BlockEntry<SailBlock> SAIL_FRAME = REGISTRATE.block("sail_frame", p -> SailBlock.frame(p)) public static final BlockEntry<SailBlock> SAIL_FRAME = REGISTRATE.block("sail_frame", p -> SailBlock.frame(p))
.initialProperties(SharedProperties::wooden) .initialProperties(SharedProperties::wooden)
.properties(Block.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.directionalBlockProvider(false)) .blockstate(BlockStateGen.directionalBlockProvider(false))
.tag(AllBlockTags.WINDMILL_SAILS.tag) .tag(AllBlockTags.WINDMILL_SAILS.tag)
.tag(AllBlockTags.FAN_TRANSPARENT.tag) .tag(AllBlockTags.FAN_TRANSPARENT.tag)
@ -1014,7 +1014,7 @@ public class AllBlocks {
public static final BlockEntry<SailBlock> SAIL = REGISTRATE.block("white_sail", p -> SailBlock.withCanvas(p)) public static final BlockEntry<SailBlock> SAIL = REGISTRATE.block("white_sail", p -> SailBlock.withCanvas(p))
.initialProperties(SharedProperties::wooden) .initialProperties(SharedProperties::wooden)
.properties(Block.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.directionalBlockProvider(false)) .blockstate(BlockStateGen.directionalBlockProvider(false))
.tag(AllBlockTags.WINDMILL_SAILS.tag) .tag(AllBlockTags.WINDMILL_SAILS.tag)
.simpleItem() .simpleItem()
@ -1024,16 +1024,16 @@ public class AllBlocks {
if (colour == DyeColor.WHITE) { if (colour == DyeColor.WHITE) {
return SAIL; return SAIL;
} }
String colourName = colour.getString(); String colourName = colour.getSerializedName();
return REGISTRATE.block(colourName + "_sail", p -> SailBlock.withCanvas(p)) return REGISTRATE.block(colourName + "_sail", p -> SailBlock.withCanvas(p))
.properties(Block.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.initialProperties(SharedProperties::wooden) .initialProperties(SharedProperties::wooden)
.blockstate((c, p) -> p.directionalBlock(c.get(), p.models() .blockstate((c, p) -> p.directionalBlock(c.get(), p.models()
.withExistingParent(colourName + "_sail", p.modLoc("block/white_sail")) .withExistingParent(colourName + "_sail", p.modLoc("block/white_sail"))
.texture("0", p.modLoc("block/sail/canvas_" + colourName)))) .texture("0", p.modLoc("block/sail/canvas_" + colourName))))
.tag(AllBlockTags.WINDMILL_SAILS.tag) .tag(AllBlockTags.WINDMILL_SAILS.tag)
.tag(AllBlockTags.SAILS.tag) .tag(AllBlockTags.SAILS.tag)
.loot((p, b) -> p.registerDropping(b, SAIL.get())) .loot((p, b) -> p.dropOther(b, SAIL.get()))
.register(); .register();
}); });
@ -1058,18 +1058,18 @@ public class AllBlocks {
public static final BlockEntry<CasingBlock> REFINED_RADIANCE_CASING = public static final BlockEntry<CasingBlock> REFINED_RADIANCE_CASING =
REGISTRATE.block("refined_radiance_casing", CasingBlock::new) REGISTRATE.block("refined_radiance_casing", CasingBlock::new)
.transform(BuilderTransformers.casing(AllSpriteShifts.REFINED_RADIANCE_CASING)) .transform(BuilderTransformers.casing(AllSpriteShifts.REFINED_RADIANCE_CASING))
.properties(p -> p.luminance($ -> 12)) .properties(p -> p.lightLevel($ -> 12))
.lang("Radiant Casing") .lang("Radiant Casing")
.register(); .register();
public static final BlockEntry<MechanicalCrafterBlock> MECHANICAL_CRAFTER = public static final BlockEntry<MechanicalCrafterBlock> MECHANICAL_CRAFTER =
REGISTRATE.block("mechanical_crafter", MechanicalCrafterBlock::new) REGISTRATE.block("mechanical_crafter", MechanicalCrafterBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.blockstate(BlockStateGen.horizontalBlockProvider(true)) .blockstate(BlockStateGen.horizontalBlockProvider(true))
.transform(StressConfigDefaults.setImpact(2.0)) .transform(StressConfigDefaults.setImpact(2.0))
.onRegister(CreateRegistrate.connectedTextures(new CrafterCTBehaviour())) .onRegister(CreateRegistrate.connectedTextures(new CrafterCTBehaviour()))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.item() .item()
.transform(customItemModel()) .transform(customItemModel())
.register(); .register();
@ -1078,7 +1078,7 @@ public class AllBlocks {
REGISTRATE.block("sequenced_gearshift", SequencedGearshiftBlock::new) REGISTRATE.block("sequenced_gearshift", SequencedGearshiftBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.tag(AllBlockTags.SAFE_NBT.tag) .tag(AllBlockTags.SAFE_NBT.tag)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact()) .transform(StressConfigDefaults.setNoImpact())
.blockstate(new SequencedGearshiftGenerator()::generate) .blockstate(new SequencedGearshiftGenerator()::generate)
.item() .item()
@ -1087,7 +1087,7 @@ public class AllBlocks {
public static final BlockEntry<FlywheelBlock> FLYWHEEL = REGISTRATE.block("flywheel", FlywheelBlock::new) public static final BlockEntry<FlywheelBlock> FLYWHEEL = REGISTRATE.block("flywheel", FlywheelBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(AbstractBlock.Properties::nonOpaque) .properties(AbstractBlock.Properties::noOcclusion)
.transform(StressConfigDefaults.setNoImpact()) .transform(StressConfigDefaults.setNoImpact())
.blockstate(new FlywheelGenerator()::generate) .blockstate(new FlywheelGenerator()::generate)
.item() .item()
@ -1125,7 +1125,7 @@ public class AllBlocks {
.blockstate((c, p) -> p.getVariantBuilder(c.get()) .blockstate((c, p) -> p.getVariantBuilder(c.get())
.forAllStates(s -> ConfiguredModel.builder() .forAllStates(s -> ConfiguredModel.builder()
.modelFile(AssetLookup.partialBaseModel(c, p)) .modelFile(AssetLookup.partialBaseModel(c, p))
.rotationX(s.get(ArmBlock.CEILING) ? 180 : 0) .rotationX(s.getValue(ArmBlock.CEILING) ? 180 : 0)
.build())) .build()))
.transform(StressConfigDefaults.setImpact(2.0)) .transform(StressConfigDefaults.setImpact(2.0))
.item(ArmItem::new) .item(ArmItem::new)
@ -1148,7 +1148,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.tag(AllBlockTags.SAFE_NBT.tag) .tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(new BeltFunnelGenerator("andesite", new ResourceLocation("block/polished_andesite"))::generate) .blockstate(new BeltFunnelGenerator("andesite", new ResourceLocation("block/polished_andesite"))::generate)
.loot((p, b) -> p.registerDropping(b, ANDESITE_FUNNEL.get())) .loot((p, b) -> p.dropOther(b, ANDESITE_FUNNEL.get()))
.register(); .register();
public static final BlockEntry<BrassFunnelBlock> BRASS_FUNNEL = public static final BlockEntry<BrassFunnelBlock> BRASS_FUNNEL =
@ -1167,7 +1167,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.tag(AllBlockTags.SAFE_NBT.tag) .tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(new BeltFunnelGenerator("brass", Create.asResource("block/brass_block"))::generate) .blockstate(new BeltFunnelGenerator("brass", Create.asResource("block/brass_block"))::generate)
.loot((p, b) -> p.registerDropping(b, BRASS_FUNNEL.get())) .loot((p, b) -> p.dropOther(b, BRASS_FUNNEL.get()))
.register(); .register();
public static final BlockEntry<BeltTunnelBlock> ANDESITE_TUNNEL = public static final BlockEntry<BeltTunnelBlock> ANDESITE_TUNNEL =
@ -1211,9 +1211,9 @@ public class AllBlocks {
public static final BlockEntry<NixieTubeBlock> ORANGE_NIXIE_TUBE = public static final BlockEntry<NixieTubeBlock> ORANGE_NIXIE_TUBE =
REGISTRATE.block("nixie_tube", p -> new NixieTubeBlock(p, DyeColor.ORANGE)) REGISTRATE.block("nixie_tube", p -> new NixieTubeBlock(p, DyeColor.ORANGE))
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(p -> p.luminance($ -> 5)) .properties(p -> p.lightLevel($ -> 5))
.blockstate(new NixieTubeGenerator()::generate) .blockstate(new NixieTubeGenerator()::generate)
.addLayer(() -> RenderType::getTranslucent) .addLayer(() -> RenderType::translucent)
.item() .item()
.transform(customItemModel()) .transform(customItemModel())
.register(); .register();
@ -1221,13 +1221,13 @@ public class AllBlocks {
public static final DyedBlockList<NixieTubeBlock> NIXIE_TUBES = new DyedBlockList<>(colour -> { public static final DyedBlockList<NixieTubeBlock> NIXIE_TUBES = new DyedBlockList<>(colour -> {
if (colour == DyeColor.ORANGE) if (colour == DyeColor.ORANGE)
return ORANGE_NIXIE_TUBE; return ORANGE_NIXIE_TUBE;
String colourName = colour.getString(); String colourName = colour.getSerializedName();
return REGISTRATE.block(colourName + "_nixie_tube", p -> new NixieTubeBlock(p, colour)) return REGISTRATE.block(colourName + "_nixie_tube", p -> new NixieTubeBlock(p, colour))
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(p -> p.luminance($ -> 5)) .properties(p -> p.lightLevel($ -> 5))
.blockstate(new NixieTubeGenerator()::generate) .blockstate(new NixieTubeGenerator()::generate)
.loot((p, b) -> p.registerDropping(b, ORANGE_NIXIE_TUBE.get())) .loot((p, b) -> p.dropOther(b, ORANGE_NIXIE_TUBE.get()))
.addLayer(() -> RenderType::getTranslucent) .addLayer(() -> RenderType::translucent)
.register(); .register();
}); });
@ -1236,7 +1236,7 @@ public class AllBlocks {
.initialProperties(SharedProperties::wooden) .initialProperties(SharedProperties::wooden)
.tag(AllBlockTags.BRITTLE.tag, AllBlockTags.SAFE_NBT.tag) .tag(AllBlockTags.BRITTLE.tag, AllBlockTags.SAFE_NBT.tag)
.blockstate(new RedstoneLinkGenerator()::generate) .blockstate(new RedstoneLinkGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.item() .item()
.transform(customItemModel("_", "transmitter")) .transform(customItemModel("_", "transmitter"))
.register(); .register();
@ -1255,7 +1255,7 @@ public class AllBlocks {
REGISTRATE.block("pulse_repeater", PulseRepeaterBlock::new) REGISTRATE.block("pulse_repeater", PulseRepeaterBlock::new)
.initialProperties(() -> Blocks.REPEATER) .initialProperties(() -> Blocks.REPEATER)
.blockstate(new PulseRepeaterGenerator()::generate) .blockstate(new PulseRepeaterGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.item() .item()
.transform(customItemModel("diodes", "pulse_repeater")) .transform(customItemModel("diodes", "pulse_repeater"))
.register(); .register();
@ -1275,7 +1275,7 @@ public class AllBlocks {
.initialProperties(() -> Blocks.REPEATER) .initialProperties(() -> Blocks.REPEATER)
.tag(AllBlockTags.SAFE_NBT.tag) .tag(AllBlockTags.SAFE_NBT.tag)
.blockstate(new AdjustableRepeaterGenerator()::generate) .blockstate(new AdjustableRepeaterGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.item() .item()
.model(AbstractDiodeGenerator.diodeItemModel(true)) .model(AbstractDiodeGenerator.diodeItemModel(true))
.build() .build()
@ -1285,7 +1285,7 @@ public class AllBlocks {
REGISTRATE.block("powered_latch", PoweredLatchBlock::new) REGISTRATE.block("powered_latch", PoweredLatchBlock::new)
.initialProperties(() -> Blocks.REPEATER) .initialProperties(() -> Blocks.REPEATER)
.blockstate(new PoweredLatchGenerator()::generate) .blockstate(new PoweredLatchGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.simpleItem() .simpleItem()
.register(); .register();
@ -1293,7 +1293,7 @@ public class AllBlocks {
REGISTRATE.block("powered_toggle_latch", ToggleLatchBlock::new) REGISTRATE.block("powered_toggle_latch", ToggleLatchBlock::new)
.initialProperties(() -> Blocks.REPEATER) .initialProperties(() -> Blocks.REPEATER)
.blockstate(new ToggleLatchGenerator()::generate) .blockstate(new ToggleLatchGenerator()::generate)
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.item() .item()
.transform(customItemModel("diodes", "latch_off")) .transform(customItemModel("diodes", "latch_off"))
.register(); .register();
@ -1303,7 +1303,7 @@ public class AllBlocks {
.initialProperties(() -> Blocks.LECTERN) .initialProperties(() -> Blocks.LECTERN)
.blockstate((c,p) -> p.horizontalBlock(c.get(), p.models() .blockstate((c,p) -> p.horizontalBlock(c.get(), p.models()
.getExistingFile(p.mcLoc("block/lectern")))) .getExistingFile(p.mcLoc("block/lectern"))))
.loot((lt, block) -> lt.registerDropping(block, Blocks.LECTERN)) .loot((lt, block) -> lt.dropOther(block, Blocks.LECTERN))
.register(); .register();
@ -1317,20 +1317,20 @@ public class AllBlocks {
REGISTRATE.block("copper_backtank", CopperBacktankBlock::new) REGISTRATE.block("copper_backtank", CopperBacktankBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p))) .blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
.addLayer(() -> RenderType::getCutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.transform(StressConfigDefaults.setImpact(4.0)) .transform(StressConfigDefaults.setImpact(4.0))
.loot((lt, block) -> { .loot((lt, block) -> {
Builder builder = LootTable.builder(); Builder builder = LootTable.lootTable();
IBuilder survivesExplosion = SurvivesExplosion.builder(); IBuilder survivesExplosion = SurvivesExplosion.survivesExplosion();
lt.registerLootTable(block, builder.addLootPool(LootPool.builder() lt.add(block, builder.withPool(LootPool.lootPool()
.acceptCondition(survivesExplosion) .when(survivesExplosion)
.rolls(ConstantRange.of(1)) .setRolls(ConstantRange.exactly(1))
.addEntry(ItemLootEntry.builder(AllItems.COPPER_BACKTANK.get()) .add(ItemLootEntry.lootTableItem(AllItems.COPPER_BACKTANK.get())
.acceptFunction(CopyName.builder(CopyName.Source.BLOCK_ENTITY)) .apply(CopyName.copyName(CopyName.Source.BLOCK_ENTITY))
.acceptFunction(CopyNbt.func_215881_a(CopyNbt.Source.BLOCK_ENTITY) .apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY)
.func_216056_a("Air", "Air")) .copy("Air", "Air"))
.acceptFunction(CopyNbt.func_215881_a(CopyNbt.Source.BLOCK_ENTITY) .apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY)
.func_216056_a("Enchantments", "Enchantments"))))); .copy("Enchantments", "Enchantments")))));
}) })
.register(); .register();

View file

@ -72,7 +72,7 @@ public class AllEntityTypes {
.properties(propertyBuilder) .properties(propertyBuilder)
.properties(b -> { .properties(b -> {
if (immuneToFire) if (immuneToFire)
b.immuneToFire(); b.fireImmune();
}) })
.renderer(renderer); .renderer(renderer);
} }

View file

@ -23,6 +23,8 @@ import net.minecraftforge.common.Tags;
import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.ForgeFlowingFluid; import net.minecraftforge.fluids.ForgeFlowingFluid;
import net.minecraftforge.fluids.FluidAttributes.Builder;
public class AllFluids { public class AllFluids {
private static final CreateRegistrate REGISTRATE = Create.registrate(); private static final CreateRegistrate REGISTRATE = Create.registrate();
@ -53,7 +55,7 @@ public class AllFluids {
.explosionResistance(100f)) .explosionResistance(100f))
.tag(AllFluidTags.HONEY.tag) .tag(AllFluidTags.HONEY.tag)
.bucket() .bucket()
.properties(p -> p.maxStackSize(1)) .properties(p -> p.stacksTo(1))
.build() .build()
.register(); .register();
@ -68,7 +70,7 @@ public class AllFluids {
.slopeFindDistance(3) .slopeFindDistance(3)
.explosionResistance(100f)) .explosionResistance(100f))
.bucket() .bucket()
.properties(p -> p.maxStackSize(1)) .properties(p -> p.stacksTo(1))
.build() .build()
.register(); .register();
@ -82,18 +84,18 @@ public class AllFluids {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
private static void makeTranslucent(FluidEntry<?> entry) { private static void makeTranslucent(FluidEntry<?> entry) {
ForgeFlowingFluid fluid = entry.get(); ForgeFlowingFluid fluid = entry.get();
RenderTypeLookup.setRenderLayer(fluid, RenderType.getTranslucent()); RenderTypeLookup.setRenderLayer(fluid, RenderType.translucent());
RenderTypeLookup.setRenderLayer(fluid.getStillFluid(), RenderType.getTranslucent()); RenderTypeLookup.setRenderLayer(fluid.getSource(), RenderType.translucent());
} }
@Nullable @Nullable
public static BlockState getLavaInteraction(FluidState fluidState) { public static BlockState getLavaInteraction(FluidState fluidState) {
Fluid fluid = fluidState.getFluid(); Fluid fluid = fluidState.getType();
if (fluid.isEquivalentTo(HONEY.get())) if (fluid.isSame(HONEY.get()))
return fluidState.isSource() ? AllPaletteBlocks.LIMESTONE.getDefaultState() return fluidState.isSource() ? AllPaletteBlocks.LIMESTONE.getDefaultState()
: AllPaletteBlocks.LIMESTONE_VARIANTS.registeredBlocks.get(0) : AllPaletteBlocks.LIMESTONE_VARIANTS.registeredBlocks.get(0)
.getDefaultState(); .getDefaultState();
if (fluid.isEquivalentTo(CHOCOLATE.get())) if (fluid.isSame(CHOCOLATE.get()))
return fluidState.isSource() ? AllPaletteBlocks.SCORIA.getDefaultState() return fluidState.isSource() ? AllPaletteBlocks.SCORIA.getDefaultState()
: AllPaletteBlocks.SCORIA_VARIANTS.registeredBlocks.get(0) : AllPaletteBlocks.SCORIA_VARIANTS.registeredBlocks.get(0)
.getDefaultState(); .getDefaultState();

View file

@ -115,33 +115,33 @@ public class AllItems {
.register(); .register();
public static final ItemEntry<Item> BAR_OF_CHOCOLATE = REGISTRATE.item("bar_of_chocolate", Item::new) public static final ItemEntry<Item> BAR_OF_CHOCOLATE = REGISTRATE.item("bar_of_chocolate", Item::new)
.properties(p -> p.food(new Food.Builder().hunger(6) .properties(p -> p.food(new Food.Builder().nutrition(6)
.saturation(0.3F) .saturationMod(0.3F)
.build())) .build()))
.lang("Bar of Chocolate") .lang("Bar of Chocolate")
.register(); .register();
public static final ItemEntry<Item> SWEET_ROLL = REGISTRATE.item("sweet_roll", Item::new) public static final ItemEntry<Item> SWEET_ROLL = REGISTRATE.item("sweet_roll", Item::new)
.properties(p -> p.food(new Food.Builder().hunger(6) .properties(p -> p.food(new Food.Builder().nutrition(6)
.saturation(0.8F) .saturationMod(0.8F)
.build())) .build()))
.register(); .register();
public static final ItemEntry<Item> CHOCOLATE_BERRIES = REGISTRATE.item("chocolate_glazed_berries", Item::new) public static final ItemEntry<Item> CHOCOLATE_BERRIES = REGISTRATE.item("chocolate_glazed_berries", Item::new)
.properties(p -> p.food(new Food.Builder().hunger(7) .properties(p -> p.food(new Food.Builder().nutrition(7)
.saturation(0.8F) .saturationMod(0.8F)
.build())) .build()))
.register(); .register();
public static final ItemEntry<Item> HONEYED_APPLE = REGISTRATE.item("honeyed_apple", Item::new) public static final ItemEntry<Item> HONEYED_APPLE = REGISTRATE.item("honeyed_apple", Item::new)
.properties(p -> p.food(new Food.Builder().hunger(8) .properties(p -> p.food(new Food.Builder().nutrition(8)
.saturation(0.8F) .saturationMod(0.8F)
.build())) .build()))
.register(); .register();
public static final ItemEntry<BuildersTeaItem> BUILDERS_TEA = REGISTRATE.item("builders_tea", BuildersTeaItem::new) public static final ItemEntry<BuildersTeaItem> BUILDERS_TEA = REGISTRATE.item("builders_tea", BuildersTeaItem::new)
.tag(AllItemTags.UPRIGHT_ON_BELT.tag) .tag(AllItemTags.UPRIGHT_ON_BELT.tag)
.properties(p -> p.maxStackSize(16)) .properties(p -> p.stacksTo(16))
.lang("Builder's Tea") .lang("Builder's Tea")
.register(); .register();
@ -210,7 +210,7 @@ public class AllItems {
.register(); .register();
public static final ItemEntry<GogglesItem> GOGGLES = REGISTRATE.item("goggles", GogglesItem::new) public static final ItemEntry<GogglesItem> GOGGLES = REGISTRATE.item("goggles", GogglesItem::new)
.properties(p -> p.maxStackSize(1)) .properties(p -> p.stacksTo(1))
.onRegister(CreateRegistrate.itemModel(() -> GogglesModel::new)) .onRegister(CreateRegistrate.itemModel(() -> GogglesModel::new))
.lang("Engineer's Goggles") .lang("Engineer's Goggles")
.register(); .register();
@ -236,7 +236,7 @@ public class AllItems {
.register(); .register();
public static final ItemEntry<WrenchItem> WRENCH = REGISTRATE.item("wrench", WrenchItem::new) public static final ItemEntry<WrenchItem> WRENCH = REGISTRATE.item("wrench", WrenchItem::new)
.properties(p -> p.maxStackSize(1)) .properties(p -> p.stacksTo(1))
.transform(CreateRegistrate.customRenderedItem(() -> WrenchModel::new)) .transform(CreateRegistrate.customRenderedItem(() -> WrenchModel::new))
.model(AssetLookup.itemModelWithPartials()) .model(AssetLookup.itemModelWithPartials())
.register(); .register();
@ -261,14 +261,14 @@ public class AllItems {
public static final ItemEntry<LinkedControllerItem> LINKED_CONTROLLER = public static final ItemEntry<LinkedControllerItem> LINKED_CONTROLLER =
REGISTRATE.item("linked_controller", LinkedControllerItem::new) REGISTRATE.item("linked_controller", LinkedControllerItem::new)
.properties(p -> p.maxStackSize(1)) .properties(p -> p.stacksTo(1))
.transform(CreateRegistrate.customRenderedItem(() -> LinkedControllerModel::new)) .transform(CreateRegistrate.customRenderedItem(() -> LinkedControllerModel::new))
.model(AssetLookup.itemModelWithPartials()) .model(AssetLookup.itemModelWithPartials())
.register(); .register();
public static final ItemEntry<PotatoCannonItem> POTATO_CANNON = public static final ItemEntry<PotatoCannonItem> POTATO_CANNON =
REGISTRATE.item("potato_cannon", PotatoCannonItem::new) REGISTRATE.item("potato_cannon", PotatoCannonItem::new)
.properties(p -> p.maxStackSize(1)) .properties(p -> p.stacksTo(1))
.transform(CreateRegistrate.customRenderedItem(() -> PotatoCannonModel::new)) .transform(CreateRegistrate.customRenderedItem(() -> PotatoCannonModel::new))
.model(AssetLookup.itemModelWithPartials()) .model(AssetLookup.itemModelWithPartials())
.register(); .register();
@ -332,16 +332,16 @@ public class AllItems {
} }
public static final ItemEntry<Item> EMPTY_SCHEMATIC = REGISTRATE.item("empty_schematic", Item::new) public static final ItemEntry<Item> EMPTY_SCHEMATIC = REGISTRATE.item("empty_schematic", Item::new)
.properties(p -> p.maxStackSize(1)) .properties(p -> p.stacksTo(1))
.register(); .register();
public static final ItemEntry<SchematicAndQuillItem> SCHEMATIC_AND_QUILL = public static final ItemEntry<SchematicAndQuillItem> SCHEMATIC_AND_QUILL =
REGISTRATE.item("schematic_and_quill", SchematicAndQuillItem::new) REGISTRATE.item("schematic_and_quill", SchematicAndQuillItem::new)
.properties(p -> p.maxStackSize(1)) .properties(p -> p.stacksTo(1))
.register(); .register();
public static final ItemEntry<SchematicItem> SCHEMATIC = REGISTRATE.item("schematic", SchematicItem::new) public static final ItemEntry<SchematicItem> SCHEMATIC = REGISTRATE.item("schematic", SchematicItem::new)
.properties(p -> p.maxStackSize(1)) .properties(p -> p.stacksTo(1))
.register(); .register();
// Shortcuts // Shortcuts

View file

@ -42,24 +42,24 @@ public enum AllKeys {
public boolean isPressed() { public boolean isPressed() {
if (!modifiable) if (!modifiable)
return isKeyDown(key); return isKeyDown(key);
return keybind.isKeyDown(); return keybind.isDown();
} }
public String getBoundKey() { public String getBoundKey() {
return keybind.getBoundKeyLocalizedText() return keybind.getTranslatedKeyMessage()
.getString() .getString()
.toUpperCase(); .toUpperCase();
} }
public int getBoundCode() { public int getBoundCode() {
return keybind.getKey() return keybind.getKey()
.getKeyCode(); .getValue();
} }
public static boolean isKeyDown(int key) { public static boolean isKeyDown(int key) {
return GLFW.glfwGetKey(Minecraft.getInstance() return GLFW.glfwGetKey(Minecraft.getInstance()
.getWindow() .getWindow()
.getHandle(), key) != 0; .getWindow(), key) != 0;
} }
public static boolean ctrlDown() { public static boolean ctrlDown() {

View file

@ -54,7 +54,7 @@ public enum AllParticleTypes {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void registerFactories(ParticleFactoryRegisterEvent event) { public static void registerFactories(ParticleFactoryRegisterEvent event) {
ParticleManager particles = Minecraft.getInstance().particles; ParticleManager particles = Minecraft.getInstance().particleEngine;
for (AllParticleTypes particle : values()) for (AllParticleTypes particle : values())
particle.entry.registerFactory(particles); particle.entry.registerFactory(particles);
} }

View file

@ -101,6 +101,6 @@ public enum AllRecipeTypes {
public <C extends IInventory, T extends IRecipe<C>> Optional<T> find(C inv, World world) { public <C extends IInventory, T extends IRecipe<C>> Optional<T> find(C inv, World world) {
return world.getRecipeManager() return world.getRecipeManager()
.getRecipe(getType(), inv, world); .getRecipeFor(getType(), inv, world);
} }
} }

View file

@ -123,9 +123,9 @@ public class AllShapes {
// Internally Shared Shapes // Internally Shared Shapes
private static final VoxelShape private static final VoxelShape
PISTON_HEAD = Blocks.PISTON_HEAD.getDefaultState() PISTON_HEAD = Blocks.PISTON_HEAD.defaultBlockState()
.with(DirectionalBlock.FACING, UP) .setValue(DirectionalBlock.FACING, UP)
.with(PistonHeadBlock.SHORT, true) .setValue(PistonHeadBlock.SHORT, true)
.getShape(null, null), PISTON_EXTENDED = .getShape(null, null), PISTON_EXTENDED =
shape(CASING_12PX.get(UP)).add(FOUR_VOXEL_POLE.get(Axis.Y)) shape(CASING_12PX.get(UP)).add(FOUR_VOXEL_POLE.get(Axis.Y))
.build(), .build(),
@ -159,7 +159,7 @@ public class AllShapes {
HEATER_BLOCK_SPECIAL_COLLISION_SHAPE = shape(0, 0, 0, 16, 4, 16).build(), HEATER_BLOCK_SPECIAL_COLLISION_SHAPE = shape(0, 0, 0, 16, 4, 16).build(),
CRUSHING_WHEEL_COLLISION_SHAPE = cuboid(0, 0, 0, 16, 16, 16), SEAT = cuboid(0, 0, 0, 16, 8, 16), CRUSHING_WHEEL_COLLISION_SHAPE = cuboid(0, 0, 0, 16, 16, 16), SEAT = cuboid(0, 0, 0, 16, 8, 16),
SEAT_COLLISION = cuboid(0, 0, 0, 16, 6, 16), SEAT_COLLISION = cuboid(0, 0, 0, 16, 6, 16),
MECHANICAL_PROCESSOR_SHAPE = shape(VoxelShapes.fullCube()).erase(4, 0, 4, 12, 16, 12) MECHANICAL_PROCESSOR_SHAPE = shape(VoxelShapes.block()).erase(4, 0, 4, 12, 16, 12)
.build(), .build(),
TURNTABLE_SHAPE = shape(1, 4, 1, 15, 8, 15).add(5, 0, 5, 11, 4, 11) TURNTABLE_SHAPE = shape(1, 4, 1, 15, 8, 15).add(5, 0, 5, 11, 4, 11)
.build(), .build(),
@ -237,7 +237,7 @@ public class AllShapes {
} }
private static VoxelShape cuboid(double x1, double y1, double z1, double x2, double y2, double z2) { private static VoxelShape cuboid(double x1, double y1, double z1, double x2, double y2, double z2) {
return Block.makeCuboidShape(x1, y1, z1, x2, y2, z2); return Block.box(x1, y1, z1, x2, y2, z2);
} }
public static class Builder { public static class Builder {
@ -258,7 +258,7 @@ public class AllShapes {
public Builder erase(double x1, double y1, double z1, double x2, double y2, double z2) { public Builder erase(double x1, double y1, double z1, double x2, double y2, double z2) {
this.shape = this.shape =
VoxelShapes.combineAndSimplify(shape, cuboid(x1, y1, z1, x2, y2, z2), IBooleanFunction.ONLY_FIRST); VoxelShapes.join(shape, cuboid(x1, y1, z1, x2, y2, z2), IBooleanFunction.ONLY_FIRST);
return this; return this;
} }

View file

@ -37,78 +37,78 @@ public class AllSoundEvents {
public static final SoundEntry public static final SoundEntry
SCHEMATICANNON_LAUNCH_BLOCK = create("schematicannon_launch_block").subtitle("Schematicannon fires") SCHEMATICANNON_LAUNCH_BLOCK = create("schematicannon_launch_block").subtitle("Schematicannon fires")
.playExisting(SoundEvents.ENTITY_GENERIC_EXPLODE, .1f, 1.1f) .playExisting(SoundEvents.GENERIC_EXPLODE, .1f, 1.1f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
SCHEMATICANNON_FINISH = create("schematicannon_finish").subtitle("Schematicannon dings") SCHEMATICANNON_FINISH = create("schematicannon_finish").subtitle("Schematicannon dings")
.playExisting(SoundEvents.BLOCK_NOTE_BLOCK_BELL, 1, .7f) .playExisting(SoundEvents.NOTE_BLOCK_BELL, 1, .7f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
DEPOT_SLIDE = create("depot_slide").subtitle("Item slides") DEPOT_SLIDE = create("depot_slide").subtitle("Item slides")
.playExisting(SoundEvents.BLOCK_SAND_BREAK, .125f, 1.5f) .playExisting(SoundEvents.SAND_BREAK, .125f, 1.5f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
DEPOT_PLOP = create("depot_plop").subtitle("Item lands") DEPOT_PLOP = create("depot_plop").subtitle("Item lands")
.playExisting(SoundEvents.ENTITY_ITEM_FRAME_ADD_ITEM, .25f, 1.25f) .playExisting(SoundEvents.ITEM_FRAME_ADD_ITEM, .25f, 1.25f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
FUNNEL_FLAP = create("funnel_flap").subtitle("Funnel Flaps") FUNNEL_FLAP = create("funnel_flap").subtitle("Funnel Flaps")
.playExisting(SoundEvents.ENTITY_ITEM_FRAME_ROTATE_ITEM, .125f, 1.5f) .playExisting(SoundEvents.ITEM_FRAME_ROTATE_ITEM, .125f, 1.5f)
.playExisting(SoundEvents.BLOCK_WOOL_BREAK, .0425f, .75f) .playExisting(SoundEvents.WOOL_BREAK, .0425f, .75f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
SLIME_ADDED = create("slime_added").subtitle("Slime squishes") SLIME_ADDED = create("slime_added").subtitle("Slime squishes")
.playExisting(SoundEvents.BLOCK_SLIME_BLOCK_PLACE) .playExisting(SoundEvents.SLIME_BLOCK_PLACE)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
MECHANICAL_PRESS_ACTIVATION = create("mechanical_press_activation").subtitle("Mechanical Press clangs") MECHANICAL_PRESS_ACTIVATION = create("mechanical_press_activation").subtitle("Mechanical Press clangs")
.playExisting(SoundEvents.BLOCK_ANVIL_LAND, .125f, 1f) .playExisting(SoundEvents.ANVIL_LAND, .125f, 1f)
.playExisting(SoundEvents.ENTITY_ITEM_BREAK, .5f, 1f) .playExisting(SoundEvents.ITEM_BREAK, .5f, 1f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
MECHANICAL_PRESS_ACTIVATION_ON_BELT = MECHANICAL_PRESS_ACTIVATION_ON_BELT =
create("mechanical_press_activation_belt").subtitle("Mechanical Press bonks") create("mechanical_press_activation_belt").subtitle("Mechanical Press bonks")
.playExisting(SoundEvents.BLOCK_WOOL_HIT, .75f, 1f) .playExisting(SoundEvents.WOOL_HIT, .75f, 1f)
.playExisting(SoundEvents.ENTITY_ITEM_BREAK, .15f, .75f) .playExisting(SoundEvents.ITEM_BREAK, .15f, .75f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
MIXING = create("mixing").subtitle("Mixing Noises") MIXING = create("mixing").subtitle("Mixing Noises")
.playExisting(SoundEvents.BLOCK_GILDED_BLACKSTONE_BREAK, .125f, .5f) .playExisting(SoundEvents.GILDED_BLACKSTONE_BREAK, .125f, .5f)
.playExisting(SoundEvents.BLOCK_NETHERRACK_BREAK, .125f, .5f) .playExisting(SoundEvents.NETHERRACK_BREAK, .125f, .5f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
CRANKING = create("cranking").subtitle("Hand Crank turns") CRANKING = create("cranking").subtitle("Hand Crank turns")
.playExisting(SoundEvents.BLOCK_WOOD_PLACE, .075f, .5f) .playExisting(SoundEvents.WOOD_PLACE, .075f, .5f)
.playExisting(SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, .025f, .5f) .playExisting(SoundEvents.WOODEN_BUTTON_CLICK_OFF, .025f, .5f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
WORLDSHAPER_PLACE = create("worldshaper_place").subtitle("Worldshaper zaps") WORLDSHAPER_PLACE = create("worldshaper_place").subtitle("Worldshaper zaps")
.playExisting(SoundEvents.BLOCK_NOTE_BLOCK_BASEDRUM) .playExisting(SoundEvents.NOTE_BLOCK_BASEDRUM)
.category(SoundCategory.PLAYERS) .category(SoundCategory.PLAYERS)
.build(), .build(),
SCROLL_VALUE = create("scroll_value").subtitle("Scroll-input clicks") SCROLL_VALUE = create("scroll_value").subtitle("Scroll-input clicks")
.playExisting(SoundEvents.BLOCK_NOTE_BLOCK_HAT, .124f, 1f) .playExisting(SoundEvents.NOTE_BLOCK_HAT, .124f, 1f)
.category(SoundCategory.PLAYERS) .category(SoundCategory.PLAYERS)
.build(), .build(),
CONFIRM = create("confirm").subtitle("Affirmative ding") CONFIRM = create("confirm").subtitle("Affirmative ding")
.playExisting(SoundEvents.BLOCK_NOTE_BLOCK_BELL, 0.5f, 0.8f) .playExisting(SoundEvents.NOTE_BLOCK_BELL, 0.5f, 0.8f)
.category(SoundCategory.PLAYERS) .category(SoundCategory.PLAYERS)
.build(), .build(),
DENY = create("deny").subtitle("Declining boop") DENY = create("deny").subtitle("Declining boop")
.playExisting(SoundEvents.BLOCK_NOTE_BLOCK_BASS, 1f, 0.5f) .playExisting(SoundEvents.NOTE_BLOCK_BASS, 1f, 0.5f)
.category(SoundCategory.PLAYERS) .category(SoundCategory.PLAYERS)
.build(), .build(),
@ -121,46 +121,46 @@ public class AllSoundEvents {
.build(), .build(),
POTATO_HIT = create("potato_hit").subtitle("Vegetable impacts") POTATO_HIT = create("potato_hit").subtitle("Vegetable impacts")
.playExisting(SoundEvents.ENTITY_ITEM_FRAME_BREAK, .75f, .75f) .playExisting(SoundEvents.ITEM_FRAME_BREAK, .75f, .75f)
.playExisting(SoundEvents.BLOCK_WEEPING_VINES_BREAK, .75f, 1.25f) .playExisting(SoundEvents.WEEPING_VINES_BREAK, .75f, 1.25f)
.category(SoundCategory.PLAYERS) .category(SoundCategory.PLAYERS)
.build(), .build(),
CONTRAPTION_ASSEMBLE = create("contraption_assemble").subtitle("Contraption moves") CONTRAPTION_ASSEMBLE = create("contraption_assemble").subtitle("Contraption moves")
.playExisting(SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN, .5f, .5f) .playExisting(SoundEvents.WOODEN_TRAPDOOR_OPEN, .5f, .5f)
.playExisting(SoundEvents.BLOCK_CHEST_OPEN, .045f, .74f) .playExisting(SoundEvents.CHEST_OPEN, .045f, .74f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
CONTRAPTION_DISASSEMBLE = create("contraption_disassemble").subtitle("Contraption stops") CONTRAPTION_DISASSEMBLE = create("contraption_disassemble").subtitle("Contraption stops")
.playExisting(SoundEvents.BLOCK_IRON_TRAPDOOR_CLOSE, .35f, .75f) .playExisting(SoundEvents.IRON_TRAPDOOR_CLOSE, .35f, .75f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
WRENCH_ROTATE = create("wrench_rotate").subtitle("Wrench used") WRENCH_ROTATE = create("wrench_rotate").subtitle("Wrench used")
.playExisting(SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, .25f, 1.25f) .playExisting(SoundEvents.WOODEN_TRAPDOOR_CLOSE, .25f, 1.25f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
WRENCH_REMOVE = create("wrench_remove").subtitle("Component breaks") WRENCH_REMOVE = create("wrench_remove").subtitle("Component breaks")
.playExisting(SoundEvents.ENTITY_ITEM_PICKUP, .25f, .75f) .playExisting(SoundEvents.ITEM_PICKUP, .25f, .75f)
.playExisting(SoundEvents.BLOCK_NETHERITE_BLOCK_HIT, .25f, .75f) .playExisting(SoundEvents.NETHERITE_BLOCK_HIT, .25f, .75f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
CRAFTER_CLICK = create("crafter_click").subtitle("Crafter clicks") CRAFTER_CLICK = create("crafter_click").subtitle("Crafter clicks")
.playExisting(SoundEvents.BLOCK_NETHERITE_BLOCK_HIT, .25f, 1) .playExisting(SoundEvents.NETHERITE_BLOCK_HIT, .25f, 1)
.playExisting(SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN, .125f, 1) .playExisting(SoundEvents.WOODEN_TRAPDOOR_OPEN, .125f, 1)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
CRAFTER_CRAFT = create("crafter_craft").subtitle("Crafter crafts") CRAFTER_CRAFT = create("crafter_craft").subtitle("Crafter crafts")
.playExisting(SoundEvents.ENTITY_ITEM_BREAK, .125f, .75f) .playExisting(SoundEvents.ITEM_BREAK, .125f, .75f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
COPPER_ARMOR_EQUIP = create("copper_armor_equip").subtitle("Diving equipment clinks") COPPER_ARMOR_EQUIP = create("copper_armor_equip").subtitle("Diving equipment clinks")
.playExisting(SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 1f, 1f) .playExisting(SoundEvents.ARMOR_EQUIP_GOLD, 1f, 1f)
.category(SoundCategory.PLAYERS) .category(SoundCategory.PLAYERS)
.build(), .build(),
@ -170,22 +170,22 @@ public class AllSoundEvents {
.build(), .build(),
CONTROLLER_CLICK = create("controller_click").subtitle("Controller clicks") CONTROLLER_CLICK = create("controller_click").subtitle("Controller clicks")
.playExisting(SoundEvents.ENTITY_ITEM_FRAME_ADD_ITEM, .35f, 1f) .playExisting(SoundEvents.ITEM_FRAME_ADD_ITEM, .35f, 1f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
CONTROLLER_PUT = create("controller_put").subtitle("Controller thumps") CONTROLLER_PUT = create("controller_put").subtitle("Controller thumps")
.playExisting(SoundEvents.ITEM_BOOK_PUT, 1f, 1f) .playExisting(SoundEvents.BOOK_PUT, 1f, 1f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
CONTROLLER_TAKE = create("controller_take").subtitle("Lectern empties") CONTROLLER_TAKE = create("controller_take").subtitle("Lectern empties")
.playExisting(SoundEvents.ENTITY_ITEM_FRAME_REMOVE_ITEM, 1f, 1f) .playExisting(SoundEvents.ITEM_FRAME_REMOVE_ITEM, 1f, 1f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
SAW_ACTIVATE_WOOD = create("saw_activate_wood").subtitle("Mechanical Saw activates") SAW_ACTIVATE_WOOD = create("saw_activate_wood").subtitle("Mechanical Saw activates")
.playExisting(SoundEvents.ENTITY_BOAT_PADDLE_LAND, .75f, 1.5f) .playExisting(SoundEvents.BOAT_PADDLE_LAND, .75f, 1.5f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
@ -195,27 +195,27 @@ public class AllSoundEvents {
.build(), .build(),
BLAZE_MUNCH = create("blaze_munch").subtitle("Blaze Burner munches") BLAZE_MUNCH = create("blaze_munch").subtitle("Blaze Burner munches")
.playExisting(SoundEvents.ENTITY_GENERIC_EAT, .5f, 1f) .playExisting(SoundEvents.GENERIC_EAT, .5f, 1f)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
CRUSHING_1 = create("crushing_1").subtitle("Crushing noises") CRUSHING_1 = create("crushing_1").subtitle("Crushing noises")
.playExisting(SoundEvents.BLOCK_NETHERRACK_HIT) .playExisting(SoundEvents.NETHERRACK_HIT)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
CRUSHING_2 = create("crushing_2").noSubtitle() CRUSHING_2 = create("crushing_2").noSubtitle()
.playExisting(SoundEvents.BLOCK_GRAVEL_PLACE) .playExisting(SoundEvents.GRAVEL_PLACE)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
CRUSHING_3 = create("crushing_3").noSubtitle() CRUSHING_3 = create("crushing_3").noSubtitle()
.playExisting(SoundEvents.BLOCK_NETHERITE_BLOCK_BREAK) .playExisting(SoundEvents.NETHERITE_BLOCK_BREAK)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
PECULIAR_BELL_USE = create("peculiar_bell_use").subtitle("Peculiar Bell tolls") PECULIAR_BELL_USE = create("peculiar_bell_use").subtitle("Peculiar Bell tolls")
.playExisting(SoundEvents.BLOCK_BELL_USE) .playExisting(SoundEvents.BELL_BLOCK)
.category(SoundCategory.BLOCKS) .category(SoundCategory.BLOCKS)
.build(), .build(),
@ -273,7 +273,7 @@ public class AllSoundEvents {
} }
@Override @Override
public void act(DirectoryCache cache) throws IOException { public void run(DirectoryCache cache) throws IOException {
generate(generator.getOutputFolder(), cache); generate(generator.getOutputFolder(), cache);
} }
@ -409,7 +409,7 @@ public class AllSoundEvents {
public void playFrom(Entity entity, float volume, float pitch) { public void playFrom(Entity entity, float volume, float pitch) {
if (!entity.isSilent()) if (!entity.isSilent())
play(entity.world, null, entity.getBlockPos(), volume, pitch); play(entity.level, null, entity.blockPosition(), volume, pitch);
} }
public void play(World world, PlayerEntity entity, BlockPos pos, float volume, float pitch) { public void play(World world, PlayerEntity entity, BlockPos pos, float volume, float pitch) {
@ -417,7 +417,7 @@ public class AllSoundEvents {
} }
public void play(World world, PlayerEntity entity, Vector3d pos, float volume, float pitch) { public void play(World world, PlayerEntity entity, Vector3d pos, float volume, float pitch) {
play(world, entity, pos.getX(), pos.getY(), pos.getZ(), volume, pitch); play(world, entity, pos.x(), pos.y(), pos.z(), volume, pitch);
} }
public abstract void play(World world, PlayerEntity entity, double x, double y, double z, float volume, float pitch); public abstract void play(World world, PlayerEntity entity, double x, double y, double z, float volume, float pitch);
@ -427,7 +427,7 @@ public class AllSoundEvents {
} }
public void playAt(World world, Vector3d pos, float volume, float pitch, boolean fade) { public void playAt(World world, Vector3d pos, float volume, float pitch, boolean fade) {
playAt(world, pos.getX(), pos.getY(), pos.getZ(), volume, pitch, fade); playAt(world, pos.x(), pos.y(), pos.z(), volume, pitch, fade);
} }
public abstract void playAt(World world, double x, double y, double z, float volume, float pitch, boolean fade); public abstract void playAt(World world, double x, double y, double z, float volume, float pitch, boolean fade);
@ -480,7 +480,7 @@ public class AllSoundEvents {
JsonArray list = new JsonArray(); JsonArray list = new JsonArray();
JsonObject s = new JsonObject(); JsonObject s = new JsonObject();
s.addProperty("name", pair.getFirst() s.addProperty("name", pair.getFirst()
.getName() .getLocation()
.toString()); .toString());
s.addProperty("type", "event"); s.addProperty("type", "event");
list.add(s); list.add(s);
@ -504,7 +504,7 @@ public class AllSoundEvents {
public void playAt(World world, double x, double y, double z, float volume, float pitch, boolean fade) { public void playAt(World world, double x, double y, double z, float volume, float pitch, boolean fade) {
for (Pair<SoundEvent, Couple<Float>> pair : compiledEvents) { for (Pair<SoundEvent, Couple<Float>> pair : compiledEvents) {
Couple<Float> volPitch = pair.getSecond(); Couple<Float> volPitch = pair.getSecond();
world.playSound(x, y, z, pair.getFirst(), category, volPitch.getFirst() * volume, world.playLocalSound(x, y, z, pair.getFirst(), category, volPitch.getFirst() * volume,
volPitch.getSecond() * pitch, fade); volPitch.getSecond() * pitch, fade);
} }
} }
@ -551,7 +551,7 @@ public class AllSoundEvents {
@Override @Override
public void playAt(World world, double x, double y, double z, float volume, float pitch, boolean fade) { public void playAt(World world, double x, double y, double z, float volume, float pitch, boolean fade) {
world.playSound(x, y, z, event, category, volume, pitch, fade); world.playLocalSound(x, y, z, event, category, volume, pitch, fade);
} }
} }

View file

@ -24,7 +24,7 @@ public enum AllSpecialTextures {
public void bind() { public void bind() {
Minecraft.getInstance() Minecraft.getInstance()
.getTextureManager() .getTextureManager()
.bindTexture(location); .bind(location);
} }
public ResourceLocation getLocation() { public ResourceLocation getLocation() {

View file

@ -83,7 +83,7 @@ public class AllSpriteShifts {
WoodType.CRIMSON, WoodType.WARPED WoodType.CRIMSON, WoodType.WARPED
}; };
Arrays.stream(supportedWoodTypes) Arrays.stream(supportedWoodTypes)
.forEach(woodType -> WOODEN_WINDOWS.put(woodType, vertical("palettes/" + woodType.getName() + "_window"))); .forEach(woodType -> WOODEN_WINDOWS.put(woodType, vertical("palettes/" + woodType.name() + "_window")));
for (PaletteStoneVariants paletteStoneVariants : PaletteStoneVariants.values()) { for (PaletteStoneVariants paletteStoneVariants : PaletteStoneVariants.values()) {
String variantName = Lang.asId(paletteStoneVariants.name()); String variantName = Lang.asId(paletteStoneVariants.name());
@ -98,7 +98,7 @@ public class AllSpriteShifts {
} }
for (DyeColor color : DyeColor.values()) { for (DyeColor color : DyeColor.values()) {
String id = color.getString(); String id = color.getSerializedName();
DYED_BELTS.put(color, SpriteShifter.get("block/belt", "block/belt/" + id + "_scroll")); DYED_BELTS.put(color, SpriteShifter.get("block/belt", "block/belt/" + id + "_scroll"));
DYED_OFFSET_BELTS.put(color, SpriteShifter.get("block/belt_offset", "block/belt/" + id + "_scroll")); DYED_OFFSET_BELTS.put(color, SpriteShifter.get("block/belt_offset", "block/belt/" + id + "_scroll"));
DYED_DIAGONAL_BELTS.put(color, DYED_DIAGONAL_BELTS.put(color,

View file

@ -41,15 +41,15 @@ public class AllTags {
} }
public static ITag.INamedTag<Block> forgeBlockTag(String name) { public static ITag.INamedTag<Block> forgeBlockTag(String name) {
return forgeTag(BlockTags::makeWrapperTag, name); return forgeTag(BlockTags::bind, name);
} }
public static ITag.INamedTag<Item> forgeItemTag(String name) { public static ITag.INamedTag<Item> forgeItemTag(String name) {
return forgeTag(ItemTags::makeWrapperTag, name); return forgeTag(ItemTags::bind, name);
} }
public static ITag.INamedTag<Fluid> forgeFluidTag(String name) { public static ITag.INamedTag<Fluid> forgeFluidTag(String name) {
return forgeTag(FluidTags::makeWrapperTag, name); return forgeTag(FluidTags::bind, name);
} }
public static <T> ITag.INamedTag<T> forgeTag(Function<String, ITag.INamedTag<T>> wrapperFactory, String name) { public static <T> ITag.INamedTag<T> forgeTag(Function<String, ITag.INamedTag<T>> wrapperFactory, String name) {
@ -95,9 +95,9 @@ public class AllTags {
} }
private AllItemTags(NameSpace namespace, String path) { private AllItemTags(NameSpace namespace, String path) {
tag = ItemTags.makeWrapperTag( tag = ItemTags.bind(
new ResourceLocation(namespace.id, (path.isEmpty() ? "" : path + "/") + Lang.asId(name())).toString()); new ResourceLocation(namespace.id, (path.isEmpty() ? "" : path + "/") + Lang.asId(name())).toString());
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.getOrCreateTagBuilder(tag)); REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag));
} }
public boolean matches(ItemStack stack) { public boolean matches(ItemStack stack) {
@ -105,12 +105,12 @@ public class AllTags {
} }
public void add(Item... values) { public void add(Item... values) {
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.getOrCreateTagBuilder(tag) REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag)
.add(values)); .add(values));
} }
public void includeIn(AllItemTags parent) { public void includeIn(AllItemTags parent) {
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.getOrCreateTagBuilder(parent.tag) REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(parent.tag)
.addTag(tag)); .addTag(tag));
} }
} }
@ -137,7 +137,7 @@ public class AllTags {
} }
public boolean matches(Fluid fluid) { public boolean matches(Fluid fluid) {
return fluid != null && fluid.isIn(tag); return fluid != null && fluid.is(tag);
} }
static void loadClass() {} static void loadClass() {}
@ -173,8 +173,8 @@ public class AllTags {
new ResourceLocation(namespace.id, (path.isEmpty() ? "" : path + "/") + Lang.asId(name())); new ResourceLocation(namespace.id, (path.isEmpty() ? "" : path + "/") + Lang.asId(name()));
if (ModList.get() if (ModList.get()
.isLoaded(namespace.id)) { .isLoaded(namespace.id)) {
tag = BlockTags.makeWrapperTag(id.toString()); tag = BlockTags.bind(id.toString());
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(tag)); REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag));
} else { } else {
tag = new EmptyNamedTag<>(id); tag = new EmptyNamedTag<>(id);
} }
@ -186,17 +186,17 @@ public class AllTags {
} }
public void includeIn(AllBlockTags parent) { public void includeIn(AllBlockTags parent) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(parent.tag) REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(parent.tag)
.addTag(tag)); .addTag(tag));
} }
public void includeAll(ITag.INamedTag<Block> child) { public void includeAll(ITag.INamedTag<Block> child) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(tag) REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag)
.addTag(child)); .addTag(child));
} }
public void add(Block... values) { public void add(Block... values) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(tag) REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag)
.add(values)); .add(values));
} }
} }

View file

@ -110,7 +110,7 @@ public class CreateClient {
IResourceManager resourceManager = Minecraft.getInstance() IResourceManager resourceManager = Minecraft.getInstance()
.getResourceManager(); .getResourceManager();
if (resourceManager instanceof IReloadableResourceManager) if (resourceManager instanceof IReloadableResourceManager)
((IReloadableResourceManager) resourceManager).addReloadListener(new ResourceReloadHandler()); ((IReloadableResourceManager) resourceManager).registerReloadListener(new ResourceReloadHandler());
event.enqueueWork(() -> { event.enqueueWork(() -> {
CopperBacktankArmorLayer.register(); CopperBacktankArmorLayer.register();
@ -119,8 +119,8 @@ public class CreateClient {
public static void onTextureStitch(TextureStitchEvent.Pre event) { public static void onTextureStitch(TextureStitchEvent.Pre event) {
if (!event.getMap() if (!event.getMap()
.getId() .location()
.equals(PlayerContainer.BLOCK_ATLAS_TEXTURE)) .equals(PlayerContainer.BLOCK_ATLAS))
return; return;
SpriteShifter.getAllTargetSprites() SpriteShifter.getAllTargetSprites()
.forEach(event::addSprite); .forEach(event::addSprite);
@ -151,10 +151,10 @@ public class CreateClient {
protected static List<ModelResourceLocation> getAllBlockStateModelLocations(Block block) { protected static List<ModelResourceLocation> getAllBlockStateModelLocations(Block block) {
List<ModelResourceLocation> models = new ArrayList<>(); List<ModelResourceLocation> models = new ArrayList<>();
block.getStateContainer() block.getStateDefinition()
.getValidStates() .getPossibleStates()
.forEach(state -> { .forEach(state -> {
models.add(getBlockModelLocation(block, BlockModelShapes.getPropertyMapString(state.getValues()))); models.add(getBlockModelLocation(block, BlockModelShapes.statePropertiesToString(state.getValues())));
}); });
return models; return models;
} }
@ -210,21 +210,21 @@ public class CreateClient {
if (mc.player == null) if (mc.player == null)
return; return;
if (mc.gameSettings.graphicsMode != GraphicsFanciness.FABULOUS) if (mc.options.graphicsMode != GraphicsFanciness.FABULOUS)
return; return;
if (AllConfigs.CLIENT.ignoreFabulousWarning.get()) if (AllConfigs.CLIENT.ignoreFabulousWarning.get())
return; return;
IFormattableTextComponent text = TextComponentUtils.bracketed(new StringTextComponent("WARN")) IFormattableTextComponent text = TextComponentUtils.wrapInSquareBrackets(new StringTextComponent("WARN"))
.formatted(TextFormatting.GOLD) .withStyle(TextFormatting.GOLD)
.append(new StringTextComponent( .append(new StringTextComponent(
" Some of Create's visual features will not be available while Fabulous graphics are enabled!")) " Some of Create's visual features will not be available while Fabulous graphics are enabled!"))
.styled(style -> style .withStyle(style -> style
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning")) .withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning"))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new StringTextComponent("Click here to disable this warning")))); new StringTextComponent("Click here to disable this warning"))));
mc.ingameGUI.addChatMessage(ChatType.CHAT, text, mc.player.getUniqueID()); mc.gui.handleChat(ChatType.CHAT, text, mc.player.getUUID());
} }
} }

View file

@ -35,13 +35,13 @@ public class DynamicTree extends AbstractBlockBreakQueue {
return; return;
// Play and render block break sound and particles // Play and render block break sound and particles
world.playEvent(null, 2001, startCutPos, Block.getStateId(world.getBlockState(startCutPos))); world.levelEvent(null, 2001, startCutPos, Block.getId(world.getBlockState(startCutPos)));
// Actually breaks the tree // Actually breaks the tree
BranchDestructionData data = start.destroyBranchFromNode(world, startCutPos, Direction.DOWN, false, playerEntity); BranchDestructionData data = start.destroyBranchFromNode(world, startCutPos, Direction.DOWN, false, playerEntity);
// Feed all the tree drops to drop bi-consumer // Feed all the tree drops to drop bi-consumer
data.leavesDrops.forEach(stackPos -> drop.accept(stackPos.pos.add(startCutPos), stackPos.stack)); data.leavesDrops.forEach(stackPos -> drop.accept(stackPos.pos.offset(startCutPos), stackPos.stack));
start.getLogDrops(world, startCutPos, data.species, data.woodVolume).forEach(stack -> drop.accept(startCutPos, stack)); start.getLogDrops(world, startCutPos, data.species, data.woodVolume).forEach(stack -> drop.accept(startCutPos, stack));
} }

View file

@ -25,7 +25,7 @@ public class ConversionRecipe extends ProcessingRecipe<RecipeWrapper> {
public static ConversionRecipe create(ItemStack from, ItemStack to) { public static ConversionRecipe create(ItemStack from, ItemStack to) {
ResourceLocation recipeId = Create.asResource("conversion_" + counter++); ResourceLocation recipeId = Create.asResource("conversion_" + counter++);
return new ProcessingRecipeBuilder<>(ConversionRecipe::new, recipeId) return new ProcessingRecipeBuilder<>(ConversionRecipe::new, recipeId)
.withItemIngredients(Ingredient.fromStacks(from)) .withItemIngredients(Ingredient.of(from))
.withSingleItemOutput(to) .withSingleItemOutput(to)
.build(); .build();
} }

View file

@ -127,7 +127,7 @@ public class CreateJEI implements IModPlugin {
.build(), .build(),
autoShapeless = register("automatic_shapeless", MixingCategory::autoShapeless) autoShapeless = register("automatic_shapeless", MixingCategory::autoShapeless)
.recipes(r -> r.getSerializer() == IRecipeSerializer.CRAFTING_SHAPELESS && r.getIngredients() .recipes(r -> r.getSerializer() == IRecipeSerializer.SHAPELESS_RECIPE && r.getIngredients()
.size() > 1 && !MechanicalPressTileEntity.canCompress(r.getIngredients()), .size() > 1 && !MechanicalPressTileEntity.canCompress(r.getIngredients()),
BasinRecipe::convertShapeless) BasinRecipe::convertShapeless)
.catalyst(AllBlocks.MECHANICAL_MIXER::get) .catalyst(AllBlocks.MECHANICAL_MIXER::get)
@ -153,7 +153,7 @@ public class CreateJEI implements IModPlugin {
woodCutting = register("wood_cutting", () -> new BlockCuttingCategory(Items.OAK_STAIRS)) woodCutting = register("wood_cutting", () -> new BlockCuttingCategory(Items.OAK_STAIRS))
.recipeList(() -> CondensedBlockCuttingRecipe .recipeList(() -> CondensedBlockCuttingRecipe
.condenseRecipes(findRecipesByType(SawTileEntity.woodcuttingRecipeType.getValue()))) .condenseRecipes(findRecipesByType(SawTileEntity.woodcuttingRecipeType.get())))
.catalyst(AllBlocks.MECHANICAL_SAW::get) .catalyst(AllBlocks.MECHANICAL_SAW::get)
.enableWhenBool(c -> c.allowWoodcuttingOnSaw.get() && ModList.get() .enableWhenBool(c -> c.allowWoodcuttingOnSaw.get() && ModList.get()
.isLoaded("druidcraft")) .isLoaded("druidcraft"))
@ -202,7 +202,7 @@ public class CreateJEI implements IModPlugin {
.build(), .build(),
autoShaped = register("automatic_shaped", MechanicalCraftingCategory::new) autoShaped = register("automatic_shaped", MechanicalCraftingCategory::new)
.recipes(r -> r.getSerializer() == IRecipeSerializer.CRAFTING_SHAPELESS && r.getIngredients() .recipes(r -> r.getSerializer() == IRecipeSerializer.SHAPELESS_RECIPE && r.getIngredients()
.size() == 1) .size() == 1)
.recipes( .recipes(
r -> (r.getType() == IRecipeType.CRAFTING && r.getType() != AllRecipeTypes.MECHANICAL_CRAFTING.type) r -> (r.getType() == IRecipeType.CRAFTING && r.getType() != AllRecipeTypes.MECHANICAL_CRAFTING.type)
@ -359,7 +359,7 @@ public class CreateJEI implements IModPlugin {
} }
public static List<IRecipe<?>> findRecipes(Predicate<IRecipe<?>> predicate) { public static List<IRecipe<?>> findRecipes(Predicate<IRecipe<?>> predicate) {
return Minecraft.getInstance().world.getRecipeManager() return Minecraft.getInstance().level.getRecipeManager()
.getRecipes() .getRecipes()
.stream() .stream()
.filter(predicate) .filter(predicate)
@ -396,7 +396,7 @@ public class CreateJEI implements IModPlugin {
public static boolean doInputsMatch(IRecipe<?> recipe1, IRecipe<?> recipe2) { public static boolean doInputsMatch(IRecipe<?> recipe1, IRecipe<?> recipe2) {
ItemStack[] matchingStacks = recipe1.getIngredients() ItemStack[] matchingStacks = recipe1.getIngredients()
.get(0) .get(0)
.getMatchingStacks(); .getItems();
if (matchingStacks.length == 0) if (matchingStacks.length == 0)
return true; return true;
if (recipe2.getIngredients() if (recipe2.getIngredients()

View file

@ -39,26 +39,26 @@ public class DoubleItemIcon implements IDrawable {
secondaryStack = secondarySupplier.get(); secondaryStack = secondarySupplier.get();
} }
RenderHelper.enable(); RenderHelper.turnBackOn();
RenderSystem.color4f(1, 1, 1, 1); RenderSystem.color4f(1, 1, 1, 1);
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 0); matrixStack.translate(xOffset, yOffset, 0);
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(1, 1, 0); matrixStack.translate(1, 1, 0);
GuiGameElement.of(primaryStack) GuiGameElement.of(primaryStack)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(10, 10, 100); matrixStack.translate(10, 10, 100);
matrixStack.scale(.5f, .5f, .5f); matrixStack.scale(.5f, .5f, .5f);
GuiGameElement.of(secondaryStack) GuiGameElement.of(secondaryStack)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
matrixStack.pop(); matrixStack.popPose();
RenderSystem.enableBlend(); RenderSystem.enableBlend();
} }

View file

@ -17,6 +17,8 @@ import net.minecraft.client.renderer.Rectangle2d;
import net.minecraft.inventory.container.Slot; import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import mezz.jei.api.gui.handlers.IGhostIngredientHandler.Target;
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
public class GhostIngredientHandler<T extends GhostItemContainer<?>> public class GhostIngredientHandler<T extends GhostItemContainer<?>>
@ -28,7 +30,7 @@ public class GhostIngredientHandler<T extends GhostItemContainer<?>>
boolean isAttributeFilter = gui instanceof AttributeFilterScreen; boolean isAttributeFilter = gui instanceof AttributeFilterScreen;
if (ingredient instanceof ItemStack) { if (ingredient instanceof ItemStack) {
for (int i = 36; i < gui.getContainer().inventorySlots.size(); i++) { for (int i = 36; i < gui.getMenu().slots.size(); i++) {
targets.add(new GhostTarget<>(gui, i - 36, isAttributeFilter)); targets.add(new GhostTarget<>(gui, i - 36, isAttributeFilter));
// Only accept items in 1st slot. 2nd is used for functionality, don't wanna override that one // Only accept items in 1st slot. 2nd is used for functionality, don't wanna override that one
@ -61,8 +63,8 @@ public class GhostIngredientHandler<T extends GhostItemContainer<?>>
this.gui = gui; this.gui = gui;
this.slotIndex = slotIndex; this.slotIndex = slotIndex;
this.isAttributeFilter = isAttributeFilter; this.isAttributeFilter = isAttributeFilter;
Slot slot = gui.getContainer().inventorySlots.get(slotIndex + 36); Slot slot = gui.getMenu().slots.get(slotIndex + 36);
this.area = new Rectangle2d(gui.getGuiLeft() + slot.xPos, gui.getGuiTop() + slot.yPos, 16, 16); this.area = new Rectangle2d(gui.getGuiLeft() + slot.x, gui.getGuiTop() + slot.y, 16, 16);
} }
@Override @Override
@ -74,7 +76,7 @@ public class GhostIngredientHandler<T extends GhostItemContainer<?>>
public void accept(I ingredient) { public void accept(I ingredient) {
ItemStack stack = ((ItemStack) ingredient).copy(); ItemStack stack = ((ItemStack) ingredient).copy();
stack.setCount(1); stack.setCount(1);
gui.getContainer().ghostInventory.setStackInSlot(slotIndex, stack); gui.getMenu().ghostInventory.setStackInSlot(slotIndex, stack);
if (isAttributeFilter) if (isAttributeFilter)
return; return;

View file

@ -27,7 +27,7 @@ public class ScreenResourceWrapper implements IDrawable {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
resource.bind(); resource.bind();
AbstractGui.drawTexture(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width, AbstractGui.blit(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width,
resource.height, 256, 256); resource.height, 256, 256);
} }

View file

@ -51,9 +51,9 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
HeatCondition requiredHeat = recipe.getRequiredHeat(); HeatCondition requiredHeat = recipe.getRequiredHeat();
if (!requiredHeat.testBlazeBurner(HeatLevel.NONE)) if (!requiredHeat.testBlazeBurner(HeatLevel.NONE))
itemIngredients.add(Ingredient.fromItems(AllBlocks.BLAZE_BURNER.get())); itemIngredients.add(Ingredient.of(AllBlocks.BLAZE_BURNER.get()));
if (!requiredHeat.testBlazeBurner(HeatLevel.KINDLED)) if (!requiredHeat.testBlazeBurner(HeatLevel.KINDLED))
itemIngredients.add(Ingredient.fromItems(AllItems.BLAZE_CAKE.get())); itemIngredients.add(Ingredient.of(AllItems.BLAZE_CAKE.get()));
ingredients.setInputIngredients(itemIngredients); ingredients.setInputIngredients(itemIngredients);
ingredients.setInputLists(VanillaTypes.FLUID, recipe.getFluidIngredients() ingredients.setInputLists(VanillaTypes.FLUID, recipe.getFluidIngredients()
@ -62,7 +62,7 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
.collect(Collectors.toList())); .collect(Collectors.toList()));
if (!recipe.getRollableResults() if (!recipe.getRollableResults()
.isEmpty()) .isEmpty())
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput()); ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
if (!recipe.getFluidResults() if (!recipe.getFluidResults()
.isEmpty()) .isEmpty())
ingredients.setOutputs(VanillaTypes.FLUID, recipe.getFluidResults()); ingredients.setOutputs(VanillaTypes.FLUID, recipe.getFluidResults());
@ -97,7 +97,7 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
Ingredient ingredient = pair.getFirst(); Ingredient ingredient = pair.getFirst();
MutableInt amount = pair.getSecond(); MutableInt amount = pair.getSecond();
for (ItemStack itemStack : ingredient.getMatchingStacks()) { for (ItemStack itemStack : ingredient.getItems()) {
ItemStack stack = itemStack.copy(); ItemStack stack = itemStack.copy();
stack.setCount(amount.getValue()); stack.setCount(amount.getValue());
stacks.add(stack); stacks.add(stack);
@ -117,7 +117,7 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
if (!itemOutput.isEmpty()) { if (!itemOutput.isEmpty()) {
itemStacks.init(i, false, 141, 50 + yOffset); itemStacks.init(i, false, 141, 50 + yOffset);
itemStacks.set(i, recipe.getRecipeOutput() itemStacks.set(i, recipe.getResultItem()
.getStack()); .getStack());
yOffset -= 19; yOffset -= 19;
} }
@ -165,7 +165,7 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
AllGuiTextures heatBar = noHeat ? AllGuiTextures.JEI_NO_HEAT_BAR : AllGuiTextures.JEI_HEAT_BAR; AllGuiTextures heatBar = noHeat ? AllGuiTextures.JEI_NO_HEAT_BAR : AllGuiTextures.JEI_HEAT_BAR;
heatBar.draw(matrixStack, 4, 80); heatBar.draw(matrixStack, 4, 80);
Minecraft.getInstance().fontRenderer.draw(matrixStack, Lang.translate(requiredHeat.getTranslationKey()), 9, Minecraft.getInstance().font.draw(matrixStack, Lang.translate(requiredHeat.getTranslationKey()), 9,
86, requiredHeat.getColor()); 86, requiredHeat.getColor());
} }

View file

@ -45,7 +45,7 @@ public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCut
public void setRecipe(IRecipeLayout recipeLayout, CondensedBlockCuttingRecipe recipe, IIngredients ingredients) { public void setRecipe(IRecipeLayout recipeLayout, CondensedBlockCuttingRecipe recipe, IIngredients ingredients) {
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 4, 4); itemStacks.init(0, true, 4, 4);
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks())); itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getItems()));
List<List<ItemStack>> results = recipe.getCondensedOutputs(); List<List<ItemStack>> results = recipe.getCondensedOutputs();
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) { for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {
@ -110,19 +110,19 @@ public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCut
Ingredient i1 = recipe.getIngredients().get(0); Ingredient i1 = recipe.getIngredients().get(0);
for (CondensedBlockCuttingRecipe condensedRecipe : condensed) { for (CondensedBlockCuttingRecipe condensedRecipe : condensed) {
if (ItemHelper.matchIngredients(i1, condensedRecipe.getIngredients().get(0))) { if (ItemHelper.matchIngredients(i1, condensedRecipe.getIngredients().get(0))) {
condensedRecipe.addOutput(recipe.getRecipeOutput()); condensedRecipe.addOutput(recipe.getResultItem());
continue Recipes; continue Recipes;
} }
} }
CondensedBlockCuttingRecipe cr = new CondensedBlockCuttingRecipe(i1); CondensedBlockCuttingRecipe cr = new CondensedBlockCuttingRecipe(i1);
cr.addOutput(recipe.getRecipeOutput()); cr.addOutput(recipe.getResultItem());
condensed.add(cr); condensed.add(cr);
} }
return condensed; return condensed;
} }
@Override @Override
public boolean isDynamic() { public boolean isSpecial() {
return true; return true;
} }

View file

@ -105,7 +105,7 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
float chance = output.getChance(); float chance = output.getChance();
if (chance != 1) if (chance != 1)
tooltip.add(1, Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100)) tooltip.add(1, Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100))
.formatted(TextFormatting.GOLD)); .withStyle(TextFormatting.GOLD));
}); });
} }
@ -138,7 +138,7 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
return; return;
if (fluid.getFluid() if (fluid.getFluid()
.isEquivalentTo(AllFluids.POTION.get())) { .isSame(AllFluids.POTION.get())) {
ITextComponent name = fluid.getDisplayName(); ITextComponent name = fluid.getDisplayName();
if (tooltip.isEmpty()) if (tooltip.isEmpty())
tooltip.add(0, name); tooltip.add(0, name);
@ -152,7 +152,7 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
} }
int amount = amounts.get(index != -1 ? 0 : slotIndex); int amount = amounts.get(index != -1 ? 0 : slotIndex);
ITextComponent text = (Lang.translate("generic.unit.millibuckets", amount)).formatted(TextFormatting.GOLD); ITextComponent text = (Lang.translate("generic.unit.millibuckets", amount)).withStyle(TextFormatting.GOLD);
if (tooltip.isEmpty()) if (tooltip.isEmpty())
tooltip.add(0, text); tooltip.add(0, text);
else { else {

View file

@ -41,7 +41,7 @@ public class CrushingCategory extends CreateRecipeCategory<AbstractCrushingRecip
itemStacks.init(0, true, 50, 2); itemStacks.init(0, true, 50, 2);
itemStacks.set(0, Arrays.asList(recipe.getIngredients() itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0) .get(0)
.getMatchingStacks())); .getItems()));
List<ProcessingOutput> results = recipe.getRollableResults(); List<ProcessingOutput> results = recipe.getRollableResults();
int size = results.size(); int size = results.size();

View file

@ -39,7 +39,7 @@ public class DeployingCategory extends CreateRecipeCategory<DeployerApplicationR
if (!recipe.getRollableResults() if (!recipe.getRollableResults()
.isEmpty()) .isEmpty())
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput()); ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
} }
@Override @Override
@ -47,12 +47,12 @@ public class DeployingCategory extends CreateRecipeCategory<DeployerApplicationR
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 26, 50); itemStacks.init(0, true, 26, 50);
itemStacks.set(0, Arrays.asList(recipe.getProcessedItem() itemStacks.set(0, Arrays.asList(recipe.getProcessedItem()
.getMatchingStacks())); .getItems()));
itemStacks.init(1, true, 50, 4); itemStacks.init(1, true, 50, 4);
itemStacks.set(1, Arrays.asList(recipe.getRequiredHeldItem() itemStacks.set(1, Arrays.asList(recipe.getRequiredHeldItem()
.getMatchingStacks())); .getItems()));
itemStacks.init(2, false, 131, 50); itemStacks.init(2, false, 131, 50);
itemStacks.set(2, recipe.getRecipeOutput()); itemStacks.set(2, recipe.getResultItem());
} }
@Override @Override

View file

@ -21,14 +21,14 @@ public class FanBlastingCategory extends ProcessingViaFanCategory<AbstractCookin
@Override @Override
public void renderAttachedBlock(MatrixStack matrixStack) { public void renderAttachedBlock(MatrixStack matrixStack) {
matrixStack.push(); matrixStack.pushPose();
GuiGameElement.of(Fluids.LAVA) GuiGameElement.of(Fluids.LAVA)
.scale(24) .scale(24)
.atLocal(0, 0, 2) .atLocal(0, 0, 2)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
} }
} }

View file

@ -21,7 +21,7 @@ public class FanSmokingCategory extends ProcessingViaFanCategory<SmokingRecipe>
@Override @Override
public void renderAttachedBlock(MatrixStack matrixStack) { public void renderAttachedBlock(MatrixStack matrixStack) {
GuiGameElement.of(Blocks.FIRE.getDefaultState()) GuiGameElement.of(Blocks.FIRE.defaultBlockState())
.scale(24) .scale(24)
.atLocal(0, 0, 2) .atLocal(0, 0, 2)
.render(matrixStack); .render(matrixStack);

View file

@ -40,7 +40,7 @@ public class FanWashingCategory extends ProcessingViaFanCategory<SplashingRecipe
itemStacks.init(0, true, 12, 47); itemStacks.init(0, true, 12, 47);
itemStacks.set(0, Arrays.asList(recipe.getIngredients() itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0) .get(0)
.getMatchingStacks())); .getItems()));
List<ProcessingOutput> results = recipe.getRollableResults(); List<ProcessingOutput> results = recipe.getRollableResults();
boolean single = results.size() == 1; boolean single = results.size() == 1;
@ -86,14 +86,14 @@ public class FanWashingCategory extends ProcessingViaFanCategory<SplashingRecipe
@Override @Override
public void renderAttachedBlock(MatrixStack matrixStack) { public void renderAttachedBlock(MatrixStack matrixStack) {
matrixStack.push(); matrixStack.pushPose();
GuiGameElement.of(Fluids.WATER) GuiGameElement.of(Fluids.WATER)
.scale(24) .scale(24)
.atLocal(0, 0, 2) .atLocal(0, 0, 2)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
} }
} }

View file

@ -49,7 +49,7 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
.forEach(stack -> { .forEach(stack -> {
if (stack.getItem() instanceof PotionItem) { if (stack.getItem() instanceof PotionItem) {
FluidStack fluidFromPotionItem = PotionFluidHandler.getFluidFromPotionItem(stack); FluidStack fluidFromPotionItem = PotionFluidHandler.getFluidFromPotionItem(stack);
Ingredient potion = Ingredient.fromStacks(stack); Ingredient potion = Ingredient.of(stack);
recipes.add(new ProcessingRecipeBuilder<>(EmptyingRecipe::new, Create.asResource("potions")) recipes.add(new ProcessingRecipeBuilder<>(EmptyingRecipe::new, Create.asResource("potions"))
.withItemIngredients(potion) .withItemIngredients(potion)
.withFluidOutputs(fluidFromPotionItem) .withFluidOutputs(fluidFromPotionItem)
@ -71,7 +71,7 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
if (extracted.isEmpty()) if (extracted.isEmpty())
return; return;
Ingredient ingredient = Ingredient.fromStacks(stack); Ingredient ingredient = Ingredient.of(stack);
ResourceLocation itemName = stack.getItem() ResourceLocation itemName = stack.getItem()
.getRegistryName(); .getRegistryName();
ResourceLocation fluidName = extracted.getFluid() ResourceLocation fluidName = extracted.getFluid()
@ -99,7 +99,7 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
if (!recipe.getRollableResults() if (!recipe.getRollableResults()
.isEmpty()) .isEmpty())
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput()); ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
if (!recipe.getFluidResults() if (!recipe.getFluidResults()
.isEmpty()) .isEmpty())
ingredients.setOutputs(VanillaTypes.FLUID, recipe.getFluidResults()); ingredients.setOutputs(VanillaTypes.FLUID, recipe.getFluidResults());
@ -112,14 +112,14 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
FluidStack fluidOutput = recipe.getResultingFluid(); FluidStack fluidOutput = recipe.getResultingFluid();
List<ItemStack> matchingIngredients = Arrays.asList(recipe.getIngredients() List<ItemStack> matchingIngredients = Arrays.asList(recipe.getIngredients()
.get(0) .get(0)
.getMatchingStacks()); .getItems());
fluidStacks.init(0, true, 132, 8); fluidStacks.init(0, true, 132, 8);
fluidStacks.set(0, withImprovedVisibility(fluidOutput)); fluidStacks.set(0, withImprovedVisibility(fluidOutput));
itemStacks.init(0, true, 26, 7); itemStacks.init(0, true, 26, 7);
itemStacks.set(0, matchingIngredients); itemStacks.set(0, matchingIngredients);
itemStacks.init(1, false, 131, 26); itemStacks.init(1, false, 131, 26);
itemStacks.set(1, recipe.getRecipeOutput()); itemStacks.set(1, recipe.getResultItem());
addFluidTooltip(fluidStacks, Collections.emptyList(), ImmutableList.of(fluidOutput)); addFluidTooltip(fluidStacks, Collections.emptyList(), ImmutableList.of(fluidOutput));
} }

View file

@ -41,7 +41,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
@Override @Override
public void setIngredients(ICraftingRecipe recipe, IIngredients ingredients) { public void setIngredients(ICraftingRecipe recipe, IIngredients ingredients) {
ingredients.setInputIngredients(recipe.getIngredients()); ingredients.setInputIngredients(recipe.getIngredients());
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput()); ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
} }
@Override @Override
@ -50,7 +50,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
NonNullList<Ingredient> recipeIngredients = recipe.getIngredients(); NonNullList<Ingredient> recipeIngredients = recipe.getIngredients();
itemStacks.init(0, false, 133, 80); itemStacks.init(0, false, 133, 80);
itemStacks.set(0, recipe.getRecipeOutput() itemStacks.set(0, recipe.getResultItem()
.getStack()); .getStack());
int x = getXPadding(recipe); int x = getXPadding(recipe);
@ -66,7 +66,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
int yPosition = (int) (y + 1 + (i / getWidth(recipe)) * f); int yPosition = (int) (y + 1 + (i / getWidth(recipe)) * f);
itemStacks.init(i + 1, true, renderer, xPosition, yPosition, slotSize, slotSize, 0, 0); itemStacks.init(i + 1, true, renderer, xPosition, yPosition, slotSize, slotSize, 0, 0);
itemStacks.set(i + 1, Arrays.asList(recipeIngredients.get(i) itemStacks.set(i + 1, Arrays.asList(recipeIngredients.get(i)
.getMatchingStacks())); .getItems()));
} }
} }
@ -97,7 +97,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
@Override @Override
public void draw(ICraftingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(ICraftingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
matrixStack.push(); matrixStack.pushPose();
float scale = getScale(recipe); float scale = getScale(recipe);
matrixStack.translate(getXPadding(recipe), getYPadding(recipe), 0); matrixStack.translate(getXPadding(recipe), getYPadding(recipe), 0);
@ -105,24 +105,24 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
for (int col = 0; col < getWidth(recipe); col++) for (int col = 0; col < getWidth(recipe); col++)
if (!recipe.getIngredients() if (!recipe.getIngredients()
.get(row * getWidth(recipe) + col) .get(row * getWidth(recipe) + col)
.hasNoMatchingItems()) { .isEmpty()) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(col * 19 * scale, row * 19 * scale, 0); matrixStack.translate(col * 19 * scale, row * 19 * scale, 0);
matrixStack.scale(scale, scale, scale); matrixStack.scale(scale, scale, scale);
AllGuiTextures.JEI_SLOT.draw(matrixStack, 0, 0); AllGuiTextures.JEI_SLOT.draw(matrixStack, 0, 0);
matrixStack.pop(); matrixStack.popPose();
} }
matrixStack.pop(); matrixStack.popPose();
AllGuiTextures.JEI_SLOT.draw(matrixStack, 133, 80); AllGuiTextures.JEI_SLOT.draw(matrixStack, 133, 80);
AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 128, 59); AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 128, 59);
crafter.draw(matrixStack, 129, 25); crafter.draw(matrixStack, 129, 25);
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(0, 0, 300); matrixStack.translate(0, 0, 300);
RenderHelper.disableStandardItemLighting(); RenderHelper.turnOff();
int amount = 0; int amount = 0;
for (Ingredient ingredient : recipe.getIngredients()) { for (Ingredient ingredient : recipe.getIngredients()) {
if (Ingredient.EMPTY == ingredient) if (Ingredient.EMPTY == ingredient)
@ -130,8 +130,8 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
amount++; amount++;
} }
Minecraft.getInstance().fontRenderer.drawWithShadow(matrixStack, amount + "", 142, 39, 0xFFFFFF); Minecraft.getInstance().font.drawShadow(matrixStack, amount + "", 142, 39, 0xFFFFFF);
matrixStack.pop(); matrixStack.popPose();
} }
@Override @Override
@ -149,27 +149,27 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
@Override @Override
public void render(MatrixStack matrixStack, int xPosition, int yPosition, ItemStack ingredient) { public void render(MatrixStack matrixStack, int xPosition, int yPosition, ItemStack ingredient) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(xPosition, yPosition, 0); matrixStack.translate(xPosition, yPosition, 0);
float scale = getScale(recipe); float scale = getScale(recipe);
matrixStack.scale(scale, scale, scale); matrixStack.scale(scale, scale, scale);
if (ingredient != null) { if (ingredient != null) {
RenderSystem.pushMatrix(); RenderSystem.pushMatrix();
RenderSystem.multMatrix(matrixStack.peek().getModel()); RenderSystem.multMatrix(matrixStack.last().pose());
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
RenderHelper.enable(); RenderHelper.turnBackOn();
Minecraft minecraft = Minecraft.getInstance(); Minecraft minecraft = Minecraft.getInstance();
FontRenderer font = getFontRenderer(minecraft, ingredient); FontRenderer font = getFontRenderer(minecraft, ingredient);
ItemRenderer itemRenderer = minecraft.getItemRenderer(); ItemRenderer itemRenderer = minecraft.getItemRenderer();
itemRenderer.renderItemAndEffectIntoGUI(null, ingredient, 0, 0); itemRenderer.renderAndDecorateItem(null, ingredient, 0, 0);
itemRenderer.renderItemOverlayIntoGUI(font, ingredient, 0, 0, null); itemRenderer.renderGuiItemDecorations(font, ingredient, 0, 0, null);
RenderSystem.disableBlend(); RenderSystem.disableBlend();
RenderHelper.disableStandardItemLighting(); RenderHelper.turnOff();
RenderSystem.popMatrix(); RenderSystem.popMatrix();
} }
matrixStack.pop(); matrixStack.popPose();
} }
@Override @Override
@ -177,11 +177,11 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
Minecraft minecraft = Minecraft.getInstance(); Minecraft minecraft = Minecraft.getInstance();
PlayerEntity player = minecraft.player; PlayerEntity player = minecraft.player;
try { try {
return ingredient.getTooltip(player, tooltipFlag); return ingredient.getTooltipLines(player, tooltipFlag);
} catch (RuntimeException | LinkageError e) { } catch (RuntimeException | LinkageError e) {
List<ITextComponent> list = new ArrayList<>(); List<ITextComponent> list = new ArrayList<>();
TranslationTextComponent crash = new TranslationTextComponent("jei.tooltip.error.crash"); TranslationTextComponent crash = new TranslationTextComponent("jei.tooltip.error.crash");
list.add(crash.formatted(TextFormatting.RED)); list.add(crash.withStyle(TextFormatting.RED));
return list; return list;
} }
} }

View file

@ -41,7 +41,7 @@ public class MillingCategory extends CreateRecipeCategory<AbstractCrushingRecipe
itemStacks.init(0, true, 14, 8); itemStacks.init(0, true, 14, 8);
itemStacks.set(0, Arrays.asList(recipe.getIngredients() itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0) .get(0)
.getMatchingStacks())); .getItems()));
List<ProcessingOutput> results = recipe.getRollableResults(); List<ProcessingOutput> results = recipe.getRollableResults();
boolean single = results.size() == 1; boolean single = results.size() == 1;

View file

@ -47,7 +47,7 @@ public class MysteriousItemConversionCategory extends CreateRecipeCategory<Conve
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
List<ProcessingOutput> results = recipe.getRollableResults(); List<ProcessingOutput> results = recipe.getRollableResults();
itemStacks.init(0, true, 26, 16); itemStacks.init(0, true, 26, 16);
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks())); itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getItems()));
itemStacks.init(1, false, 131, 16); itemStacks.init(1, false, 131, 16);
itemStacks.set(1, results.get(0).getStack()); itemStacks.set(1, results.get(0).getStack());
} }

View file

@ -55,12 +55,12 @@ public class PackingCategory extends BasinCategory {
while (i < size) { while (i < size) {
Ingredient ingredient = ingredients2.get(i); Ingredient ingredient = ingredients2.get(i);
itemStacks.init(i, true, (rows == 2 ? 26 : 17) + (i % rows) * 19, 50 - (i / rows) * 19); itemStacks.init(i, true, (rows == 2 ? 26 : 17) + (i % rows) * 19, 50 - (i / rows) * 19);
itemStacks.set(i, Arrays.asList(ingredient.getMatchingStacks())); itemStacks.set(i, Arrays.asList(ingredient.getItems()));
i++; i++;
} }
itemStacks.init(i, false, 141, 50); itemStacks.init(i, false, 141, 50);
itemStacks.set(i, recipe.getRecipeOutput()); itemStacks.set(i, recipe.getResultItem());
} }
@Override @Override

View file

@ -47,7 +47,7 @@ public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRe
itemStacks.init(0, true, 26, 28); itemStacks.init(0, true, 26, 28);
itemStacks.set(0, Arrays.asList(recipe.getIngredients() itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0) .get(0)
.getMatchingStacks())); .getItems()));
itemStacks.init(1, false, 131, 28); itemStacks.init(1, false, 131, 28);
itemStacks.set(1, results.get(0) itemStacks.set(1, results.get(0)
.getStack()); .getStack());
@ -64,7 +64,7 @@ public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRe
NonNullList<Ingredient> ingredients = recipe.getIngredients(); NonNullList<Ingredient> ingredients = recipe.getIngredients();
ItemStack[] matchingStacks = ingredients.get(0) ItemStack[] matchingStacks = ingredients.get(0)
.getMatchingStacks(); .getItems();
if (matchingStacks.length == 0) if (matchingStacks.length == 0)
return; return;

View file

@ -41,7 +41,7 @@ public class PressingCategory extends CreateRecipeCategory<PressingRecipe> {
itemStacks.init(0, true, 26, 50); itemStacks.init(0, true, 26, 50);
itemStacks.set(0, Arrays.asList(recipe.getIngredients() itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0) .get(0)
.getMatchingStacks())); .getItems()));
List<ProcessingOutput> results = recipe.getRollableResults(); List<ProcessingOutput> results = recipe.getRollableResults();
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) { for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {

View file

@ -35,12 +35,12 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
@Override @Override
public void setIngredients(T recipe, IIngredients ingredients) { public void setIngredients(T recipe, IIngredients ingredients) {
ingredients.setInputIngredients(recipe.getIngredients()); ingredients.setInputIngredients(recipe.getIngredients());
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput()); ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
} }
public static Supplier<ItemStack> getFan(String name) { public static Supplier<ItemStack> getFan(String name) {
return () -> AllBlocks.ENCASED_FAN.asStack() return () -> AllBlocks.ENCASED_FAN.asStack()
.setDisplayName(Lang.translate("recipe." + name + ".fan").styled(style -> style.withItalic(false))); .setHoverName(Lang.translate("recipe." + name + ".fan").withStyle(style -> style.withItalic(false)));
} }
@Override @Override
@ -49,10 +49,10 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
itemStacks.init(0, true, 20, 47); itemStacks.init(0, true, 20, 47);
itemStacks.set(0, Arrays.asList(recipe.getIngredients() itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0) .get(0)
.getMatchingStacks())); .getItems()));
itemStacks.init(1, false, 139, 47); itemStacks.init(1, false, 139, 47);
itemStacks.set(1, recipe.getRecipeOutput()); itemStacks.set(1, recipe.getResultItem());
} }
protected void renderWidgets(MatrixStack matrixStack, T recipe, double mouseX, double mouseY) { protected void renderWidgets(MatrixStack matrixStack, T recipe, double mouseX, double mouseY) {
@ -69,10 +69,10 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
return; return;
renderWidgets(matrixStack, recipe, mouseX, mouseY); renderWidgets(matrixStack, recipe, mouseX, mouseY);
matrixStack.push(); matrixStack.pushPose();
translateFan(matrixStack); translateFan(matrixStack);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-12.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-12.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f)); matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = 24; int scale = 24;
GuiGameElement.of(AllBlockPartials.ENCASED_FAN_INNER) GuiGameElement.of(AllBlockPartials.ENCASED_FAN_INNER)
@ -89,7 +89,7 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
.render(matrixStack); .render(matrixStack);
renderAttachedBlock(matrixStack); renderAttachedBlock(matrixStack);
matrixStack.pop(); matrixStack.popPose();
} }
protected void translateFan(MatrixStack matrixStack) { protected void translateFan(MatrixStack matrixStack) {

View file

@ -41,7 +41,7 @@ public class SawingCategory extends CreateRecipeCategory<CuttingRecipe> {
itemStacks.init(0, true, 43, 4); itemStacks.init(0, true, 43, 4);
itemStacks.set(0, Arrays.asList(recipe.getIngredients() itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0) .get(0)
.getMatchingStacks())); .getItems()));
List<ProcessingOutput> results = recipe.getRollableResults(); List<ProcessingOutput> results = recipe.getRollableResults();
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) { for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {

View file

@ -58,7 +58,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
.map(FluidIngredient::getMatchingFluidStacks) .map(FluidIngredient::getMatchingFluidStacks)
.collect(Collectors.toList())); .collect(Collectors.toList()));
ingredients.setOutputs(VanillaTypes.ITEM, ingredients.setOutputs(VanillaTypes.ITEM,
ImmutableList.of(recipe.getRecipeOutput(), recipe.getTransitionalItem())); ImmutableList.of(recipe.getResultItem(), recipe.getTransitionalItem()));
} }
@Override @Override
@ -69,9 +69,9 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
itemStacks.init(0, true, 26 + xOffset, 90); itemStacks.init(0, true, 26 + xOffset, 90);
itemStacks.set(0, Arrays.asList(recipe.getIngredient() itemStacks.set(0, Arrays.asList(recipe.getIngredient()
.getMatchingStacks())); .getItems()));
ItemStack result = recipe.getRecipeOutput(); ItemStack result = recipe.getResultItem();
itemStacks.init(1, false, 131 + xOffset, 90); itemStacks.init(1, false, 131 + xOffset, 90);
itemStacks.set(1, result); itemStacks.set(1, result);
@ -107,7 +107,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
float chance = recipe.getOutputChance(); float chance = recipe.getOutputChance();
if (chance != 1) if (chance != 1)
tooltip.add(1, Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100)) tooltip.add(1, Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100))
.formatted(TextFormatting.GOLD)); .withStyle(TextFormatting.GOLD));
}); });
} }
@ -126,9 +126,9 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
@Override @Override
public void draw(SequencedAssemblyRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(SequencedAssemblyRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
FontRenderer font = Minecraft.getInstance().fontRenderer; FontRenderer font = Minecraft.getInstance().font;
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(0, 15, 0); matrixStack.translate(0, 15, 0);
boolean singleOutput = recipe.getOutputChance() == 1; boolean singleOutput = recipe.getOutputChance() == 1;
int xOffset = singleOutput ? 0 : -7; int xOffset = singleOutput ? 0 : -7;
@ -137,23 +137,23 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 52 + xOffset, 79); AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 52 + xOffset, 79);
if (!singleOutput) { if (!singleOutput) {
AllGuiTextures.JEI_CHANCE_SLOT.draw(matrixStack, 150 + xOffset, 75); AllGuiTextures.JEI_CHANCE_SLOT.draw(matrixStack, 150 + xOffset, 75);
ITextComponent component = new StringTextComponent("?").formatted(TextFormatting.BOLD); ITextComponent component = new StringTextComponent("?").withStyle(TextFormatting.BOLD);
font.drawWithShadow(matrixStack, component, font.getWidth(component) / -2 + 8 + 150 + xOffset, 2 + 78, font.drawShadow(matrixStack, component, font.width(component) / -2 + 8 + 150 + xOffset, 2 + 78,
0xefefef); 0xefefef);
} }
if (recipe.getLoops() > 1) { if (recipe.getLoops() > 1) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(15, 9, 0); matrixStack.translate(15, 9, 0);
RenderSystem.color4f(.65f, .65f, .65f, 1); RenderSystem.color4f(.65f, .65f, .65f, 1);
AllIcons.I_REFRESH.draw(matrixStack, 50 + xOffset, 75); AllIcons.I_REFRESH.draw(matrixStack, 50 + xOffset, 75);
RenderSystem.color4f(1, 1, 1, 1); RenderSystem.color4f(1, 1, 1, 1);
ITextComponent repeat = new StringTextComponent("x" + recipe.getLoops()); ITextComponent repeat = new StringTextComponent("x" + recipe.getLoops());
font.draw(matrixStack, repeat, 66 + xOffset, 80, 0x888888); font.draw(matrixStack, repeat, 66 + xOffset, 80, 0x888888);
matrixStack.pop(); matrixStack.popPose();
} }
matrixStack.pop(); matrixStack.popPose();
int width = 0; int width = 0;
int margin = 3; int margin = 3;
@ -162,18 +162,18 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
width -= margin; width -= margin;
matrixStack.translate(width / -2 + getBackground().getWidth() / 2, 0, 0); matrixStack.translate(width / -2 + getBackground().getWidth() / 2, 0, 0);
matrixStack.push(); matrixStack.pushPose();
List<SequencedRecipe<?>> sequence = recipe.getSequence(); List<SequencedRecipe<?>> sequence = recipe.getSequence();
for (int i = 0; i < sequence.size(); i++) { for (int i = 0; i < sequence.size(); i++) {
SequencedRecipe<?> sequencedRecipe = sequence.get(i); SequencedRecipe<?> sequencedRecipe = sequence.get(i);
SequencedAssemblySubCategory subCategory = getSubCategory(sequencedRecipe); SequencedAssemblySubCategory subCategory = getSubCategory(sequencedRecipe);
int subWidth = subCategory.getWidth(); int subWidth = subCategory.getWidth();
StringTextComponent component = new StringTextComponent("" + romans[Math.min(i, 6)]); StringTextComponent component = new StringTextComponent("" + romans[Math.min(i, 6)]);
font.draw(matrixStack, component, font.getWidth(component) / -2 + subWidth / 2, 2, 0x888888); font.draw(matrixStack, component, font.width(component) / -2 + subWidth / 2, 2, 0x888888);
subCategory.draw(sequencedRecipe, matrixStack, mouseX, mouseY, i); subCategory.draw(sequencedRecipe, matrixStack, mouseX, mouseY, i);
matrixStack.translate(subWidth + margin, 0, 0); matrixStack.translate(subWidth + margin, 0, 0);
} }
matrixStack.pop(); matrixStack.popPose();
} }
@Override @Override
@ -194,7 +194,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
float chance = recipe.getOutputChance(); float chance = recipe.getOutputChance();
tooltip.add(junk); tooltip.add(junk);
tooltip.add(Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : 100 - (int) (chance * 100)) tooltip.add(Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : 100 - (int) (chance * 100))
.formatted(TextFormatting.GOLD)); .withStyle(TextFormatting.GOLD));
return tooltip; return tooltip;
} }
@ -224,8 +224,8 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
tooltip.add(Lang.translate("recipe.assembly.step", i + 1)); tooltip.add(Lang.translate("recipe.assembly.step", i + 1));
tooltip.add(sequencedRecipe.getAsAssemblyRecipe() tooltip.add(sequencedRecipe.getAsAssemblyRecipe()
.getDescriptionForAssembly() .getDescriptionForAssembly()
.copy() .plainCopy()
.formatted(TextFormatting.DARK_GREEN)); .withStyle(TextFormatting.DARK_GREEN));
return tooltip; return tooltip;
} }
relativeX -= subCategory.getWidth() + margin; relativeX -= subCategory.getWidth() + margin;
@ -244,7 +244,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
private List<Ingredient> getAllItemIngredients(SequencedAssemblyRecipe recipe) { private List<Ingredient> getAllItemIngredients(SequencedAssemblyRecipe recipe) {
List<Ingredient> assemblyIngredients = new ArrayList<>(); List<Ingredient> assemblyIngredients = new ArrayList<>();
assemblyIngredients.add(recipe.getIngredient()); assemblyIngredients.add(recipe.getIngredient());
assemblyIngredients.add(Ingredient.fromStacks(recipe.getTransitionalItem())); assemblyIngredients.add(Ingredient.of(recipe.getTransitionalItem()));
recipe.addAdditionalIngredientsAndMachines(assemblyIngredients); recipe.addAdditionalIngredientsAndMachines(assemblyIngredients);
return assemblyIngredients; return assemblyIngredients;
} }

View file

@ -52,7 +52,7 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
.forEach(stack -> { .forEach(stack -> {
if (stack.getItem() instanceof PotionItem) { if (stack.getItem() instanceof PotionItem) {
FluidStack fluidFromPotionItem = PotionFluidHandler.getFluidFromPotionItem(stack); FluidStack fluidFromPotionItem = PotionFluidHandler.getFluidFromPotionItem(stack);
Ingredient bottle = Ingredient.fromItems(Items.GLASS_BOTTLE); Ingredient bottle = Ingredient.of(Items.GLASS_BOTTLE);
recipes.add(new ProcessingRecipeBuilder<>(FillingRecipe::new, Create.asResource("potions")) recipes.add(new ProcessingRecipeBuilder<>(FillingRecipe::new, Create.asResource("potions"))
.withItemIngredients(bottle) .withItemIngredients(bottle)
.withFluidIngredients(FluidIngredient.fromFluidStack(fluidFromPotionItem)) .withFluidIngredients(FluidIngredient.fromFluidStack(fluidFromPotionItem))
@ -78,12 +78,12 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
fluidCopy.setAmount(1000); fluidCopy.setAmount(1000);
fhi.fill(fluidCopy, FluidAction.EXECUTE); fhi.fill(fluidCopy, FluidAction.EXECUTE);
ItemStack container = fhi.getContainer(); ItemStack container = fhi.getContainer();
if (container.isItemEqual(copy)) if (container.sameItem(copy))
return; return;
if (container.isEmpty()) if (container.isEmpty())
return; return;
Ingredient bucket = Ingredient.fromStacks(stack); Ingredient bucket = Ingredient.of(stack);
ResourceLocation itemName = stack.getItem() ResourceLocation itemName = stack.getItem()
.getRegistryName(); .getRegistryName();
ResourceLocation fluidName = fluidCopy.getFluid() ResourceLocation fluidName = fluidCopy.getFluid()
@ -117,7 +117,7 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
if (!recipe.getRollableResults() if (!recipe.getRollableResults()
.isEmpty()) .isEmpty())
ingredients.setOutput(VanillaTypes.ITEM, recipe.getRecipeOutput()); ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
if (!recipe.getFluidResults() if (!recipe.getFluidResults()
.isEmpty()) .isEmpty())
ingredients.setOutputs(VanillaTypes.FLUID, recipe.getFluidResults()); ingredients.setOutputs(VanillaTypes.FLUID, recipe.getFluidResults());
@ -130,14 +130,14 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
FluidIngredient fluidIngredient = recipe.getRequiredFluid(); FluidIngredient fluidIngredient = recipe.getRequiredFluid();
List<ItemStack> matchingIngredients = Arrays.asList(recipe.getIngredients() List<ItemStack> matchingIngredients = Arrays.asList(recipe.getIngredients()
.get(0) .get(0)
.getMatchingStacks()); .getItems());
fluidStacks.init(0, true, 27, 32); fluidStacks.init(0, true, 27, 32);
fluidStacks.set(0, withImprovedVisibility(fluidIngredient.getMatchingFluidStacks())); fluidStacks.set(0, withImprovedVisibility(fluidIngredient.getMatchingFluidStacks()));
itemStacks.init(0, true, 26, 50); itemStacks.init(0, true, 26, 50);
itemStacks.set(0, matchingIngredients); itemStacks.set(0, matchingIngredients);
itemStacks.init(1, false, 131, 50); itemStacks.init(1, false, 131, 50);
itemStacks.set(1, recipe.getRecipeOutput()); itemStacks.set(1, recipe.getResultItem());
addFluidTooltip(fluidStacks, ImmutableList.of(fluidIngredient), Collections.emptyList()); addFluidTooltip(fluidStacks, ImmutableList.of(fluidIngredient), Collections.emptyList());
} }

View file

@ -20,10 +20,10 @@ public class AnimatedBlazeBurner extends AnimatedKinetics {
} }
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 200); matrixStack.translate(xOffset, yOffset, 200);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f)); matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = 23; int scale = 23;
defaultBlockElement(AllBlocks.BLAZE_BURNER.getDefaultState()) defaultBlockElement(AllBlocks.BLAZE_BURNER.getDefaultState())
@ -39,7 +39,7 @@ public class AnimatedBlazeBurner extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
} }
} }

View file

@ -9,7 +9,7 @@ public class AnimatedCrafter extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 0); matrixStack.translate(xOffset, yOffset, 0);
AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13); AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13);
@ -29,7 +29,7 @@ public class AnimatedCrafter extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
} }
} }

View file

@ -11,13 +11,13 @@ import net.minecraft.util.math.vector.Vector3f;
public class AnimatedCrushingWheels extends AnimatedKinetics { public class AnimatedCrushingWheels extends AnimatedKinetics {
private final BlockState wheel = AllBlocks.CRUSHING_WHEEL.getDefaultState() private final BlockState wheel = AllBlocks.CRUSHING_WHEEL.getDefaultState()
.with(BlockStateProperties.AXIS, Axis.X); .setValue(BlockStateProperties.AXIS, Axis.X);
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100); matrixStack.translate(xOffset, yOffset, 100);
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-22.5f)); matrixStack.mulPose(Vector3f.YP.rotationDegrees(-22.5f));
int scale = 22; int scale = 22;
defaultBlockElement(wheel) defaultBlockElement(wheel)
@ -31,7 +31,7 @@ public class AnimatedCrushingWheels extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
} }
} }

View file

@ -14,10 +14,10 @@ public class AnimatedDeployer extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100); matrixStack.translate(xOffset, yOffset, 100);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f)); matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = 20; int scale = 20;
defaultBlockElement(shaft(Axis.Z)) defaultBlockElement(shaft(Axis.Z))
@ -26,15 +26,15 @@ public class AnimatedDeployer extends AnimatedKinetics {
.render(matrixStack); .render(matrixStack);
defaultBlockElement(AllBlocks.DEPLOYER.getDefaultState() defaultBlockElement(AllBlocks.DEPLOYER.getDefaultState()
.with(DeployerBlock.FACING, Direction.DOWN) .setValue(DeployerBlock.FACING, Direction.DOWN)
.with(DeployerBlock.AXIS_ALONG_FIRST_COORDINATE, false)) .setValue(DeployerBlock.AXIS_ALONG_FIRST_COORDINATE, false))
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
float cycle = (AnimationTickHolder.getRenderTime() - offset * 8) % 30; float cycle = (AnimationTickHolder.getRenderTime() - offset * 8) % 30;
float offset = cycle < 10 ? cycle / 10f : cycle < 20 ? (20 - cycle) / 10f : 0; float offset = cycle < 10 ? cycle / 10f : cycle < 20 ? (20 - cycle) / 10f : 0;
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(0, offset * 17, 0); matrixStack.translate(0, offset * 17, 0);
defaultBlockElement(AllBlockPartials.DEPLOYER_POLE) defaultBlockElement(AllBlockPartials.DEPLOYER_POLE)
@ -46,14 +46,14 @@ public class AnimatedDeployer extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
defaultBlockElement(AllBlocks.DEPOT.getDefaultState()) defaultBlockElement(AllBlocks.DEPOT.getDefaultState())
.atLocal(0, 2, 0) .atLocal(0, 2, 0)
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
} }
} }

View file

@ -21,10 +21,10 @@ public class AnimatedItemDrain extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100); matrixStack.translate(xOffset, yOffset, 100);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f)); matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = 20; int scale = 20;
defaultBlockElement(AllBlocks.ITEM_DRAIN.getDefaultState()) defaultBlockElement(AllBlocks.ITEM_DRAIN.getDefaultState())
@ -32,14 +32,14 @@ public class AnimatedItemDrain extends AnimatedKinetics {
.render(matrixStack); .render(matrixStack);
Impl buffer = IRenderTypeBuffer.immediate(Tessellator.getInstance() Impl buffer = IRenderTypeBuffer.immediate(Tessellator.getInstance()
.getBuffer()); .getBuilder());
MatrixStack ms = new MatrixStack(); MatrixStack ms = new MatrixStack();
ms.scale(scale, -scale, scale); ms.scale(scale, -scale, scale);
float from = 2/16f; float from = 2/16f;
float to = 1f - from; float to = 1f - from;
FluidRenderer.renderTiledFluidBB(fluid, from, from, from, to, 3/4f, to, buffer, ms, 0xF000F0, false); FluidRenderer.renderTiledFluidBB(fluid, from, from, from, to, 3/4f, to, buffer, ms, 0xF000F0, false);
buffer.draw(); buffer.endBatch();
matrixStack.pop(); matrixStack.popPose();
} }
} }

View file

@ -27,7 +27,7 @@ public abstract class AnimatedKinetics implements IDrawable {
} }
protected BlockState shaft(Axis axis) { protected BlockState shaft(Axis axis) {
return AllBlocks.SHAFT.getDefaultState().with(BlockStateProperties.AXIS, axis); return AllBlocks.SHAFT.getDefaultState().setValue(BlockStateProperties.AXIS, axis);
} }
protected PartialModel cogwheel() { protected PartialModel cogwheel() {

View file

@ -9,7 +9,7 @@ public class AnimatedMillstone extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 0); matrixStack.translate(xOffset, yOffset, 0);
AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13); AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13);
matrixStack.translate(-2, 18, 0); matrixStack.translate(-2, 18, 0);
@ -25,7 +25,7 @@ public class AnimatedMillstone extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
} }
} }

View file

@ -12,10 +12,10 @@ public class AnimatedMixer extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 200); matrixStack.translate(xOffset, yOffset, 200);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f)); matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = 23; int scale = 23;
defaultBlockElement(cogwheel()) defaultBlockElement(cogwheel())
@ -47,7 +47,7 @@ public class AnimatedMixer extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
} }
} }

View file

@ -18,10 +18,10 @@ public class AnimatedPress extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100); matrixStack.translate(xOffset, yOffset, 100);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f)); matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = basin ? 20 : 24; int scale = basin ? 20 : 24;
defaultBlockElement(shaft(Axis.Z)) defaultBlockElement(shaft(Axis.Z))
@ -44,7 +44,7 @@ public class AnimatedPress extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
} }
private float getAnimatedHeadOffset() { private float getAnimatedHeadOffset() {

View file

@ -13,12 +13,12 @@ public class AnimatedSaw extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 0); matrixStack.translate(xOffset, yOffset, 0);
matrixStack.translate(0, 0, 200); matrixStack.translate(0, 0, 200);
matrixStack.translate(2, 22, 0); matrixStack.translate(2, 22, 0);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f + 90)); matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f + 90));
int scale = 25; int scale = 25;
defaultBlockElement(shaft(Axis.X)) defaultBlockElement(shaft(Axis.X))
@ -27,7 +27,7 @@ public class AnimatedSaw extends AnimatedKinetics {
.render(matrixStack); .render(matrixStack);
defaultBlockElement(AllBlocks.MECHANICAL_SAW.getDefaultState() defaultBlockElement(AllBlocks.MECHANICAL_SAW.getDefaultState()
.with(SawBlock.FACING, Direction.UP)) .setValue(SawBlock.FACING, Direction.UP))
.rotateBlock(0, 0, 0) .rotateBlock(0, 0, 0)
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
@ -37,7 +37,7 @@ public class AnimatedSaw extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.popPose();
} }
} }

View file

@ -26,10 +26,10 @@ public class AnimatedSpout extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
matrixStack.push(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100); matrixStack.translate(xOffset, yOffset, 100);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(22.5f)); matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
int scale = 20; int scale = 20;
defaultBlockElement(AllBlocks.SPOUT.getDefaultState()) defaultBlockElement(AllBlocks.SPOUT.getDefaultState())
@ -40,7 +40,7 @@ public class AnimatedSpout extends AnimatedKinetics {
float squeeze = cycle < 20 ? MathHelper.sin((float) (cycle / 20f * Math.PI)) : 0; float squeeze = cycle < 20 ? MathHelper.sin((float) (cycle / 20f * Math.PI)) : 0;
squeeze *= 20; squeeze *= 20;
matrixStack.push(); matrixStack.pushPose();
defaultBlockElement(AllBlockPartials.SPOUT_TOP) defaultBlockElement(AllBlockPartials.SPOUT_TOP)
.scale(scale) .scale(scale)
@ -55,7 +55,7 @@ public class AnimatedSpout extends AnimatedKinetics {
.render(matrixStack); .render(matrixStack);
matrixStack.translate(0, -3 * squeeze / 32f, 0); matrixStack.translate(0, -3 * squeeze / 32f, 0);
matrixStack.pop(); matrixStack.popPose();
defaultBlockElement(AllBlocks.DEPOT.getDefaultState()) defaultBlockElement(AllBlocks.DEPOT.getDefaultState())
.atLocal(0, 2, 0) .atLocal(0, 2, 0)
@ -63,13 +63,13 @@ public class AnimatedSpout extends AnimatedKinetics {
.render(matrixStack); .render(matrixStack);
Impl buffer = IRenderTypeBuffer.immediate(Tessellator.getInstance() Impl buffer = IRenderTypeBuffer.immediate(Tessellator.getInstance()
.getBuffer()); .getBuilder());
matrixStack.push(); matrixStack.pushPose();
matrixStack.scale(16, -16, 16); matrixStack.scale(16, -16, 16);
float from = 2/16f; float from = 2/16f;
float to = 1f - from; float to = 1f - from;
FluidRenderer.renderTiledFluidBB(fluids.get(0), from, from, from, to, to, to, buffer, matrixStack, 0xF000F0, false); FluidRenderer.renderTiledFluidBB(fluids.get(0), from, from, from, to, to, to, buffer, matrixStack, 0xF000F0, false);
matrixStack.pop(); matrixStack.popPose();
float width = 1 / 128f * squeeze; float width = 1 / 128f * squeeze;
matrixStack.translate(scale / 2f, scale * 1.5f, scale / 2f); matrixStack.translate(scale / 2f, scale * 1.5f, scale / 2f);
@ -77,9 +77,9 @@ public class AnimatedSpout extends AnimatedKinetics {
matrixStack.translate(-width / 2, 0, -width / 2); matrixStack.translate(-width / 2, 0, -width / 2);
FluidRenderer.renderTiledFluidBB(fluids.get(0), 0, -0.001f, 0, width, 2.001f, width, buffer, matrixStack, 0xF000F0, FluidRenderer.renderTiledFluidBB(fluids.get(0), 0, -0.001f, 0, width, 2.001f, width, buffer, matrixStack, 0xF000F0,
false); false);
buffer.draw(); buffer.endBatch();
matrixStack.pop(); matrixStack.popPose();
} }
} }

View file

@ -51,11 +51,11 @@ public abstract class SequencedAssemblySubCategory {
@Override @Override
public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) { public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) {
press.offset = index; press.offset = index;
ms.push(); ms.pushPose();
ms.translate(-5, 50, 0); ms.translate(-5, 50, 0);
ms.scale(.6f, .6f, .6f); ms.scale(.6f, .6f, .6f);
press.draw(ms, getWidth() / 2, 0); press.draw(ms, getWidth() / 2, 0);
ms.pop(); ms.popPose();
} }
} }
@ -86,7 +86,7 @@ public abstract class SequencedAssemblySubCategory {
public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) { public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) {
spout.offset = index; spout.offset = index;
AllGuiTextures.JEI_SLOT.draw(ms, 3, 14); AllGuiTextures.JEI_SLOT.draw(ms, 3, 14);
ms.push(); ms.pushPose();
ms.translate(-7, 50, 0); ms.translate(-7, 50, 0);
ms.scale(.75f, .75f, .75f); ms.scale(.75f, .75f, .75f);
spout.withFluids(recipe.getRecipe() spout.withFluids(recipe.getRecipe()
@ -94,7 +94,7 @@ public abstract class SequencedAssemblySubCategory {
.get(0) .get(0)
.getMatchingFluidStacks()) .getMatchingFluidStacks())
.draw(ms, getWidth() / 2, 0); .draw(ms, getWidth() / 2, 0);
ms.pop(); ms.popPose();
} }
} }
@ -114,18 +114,18 @@ public abstract class SequencedAssemblySubCategory {
itemStacks.set(index, Arrays.asList(recipe.getRecipe() itemStacks.set(index, Arrays.asList(recipe.getRecipe()
.getIngredients() .getIngredients()
.get(1) .get(1)
.getMatchingStacks())); .getItems()));
return 1; return 1;
} }
@Override @Override
public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) { public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) {
deployer.offset = index; deployer.offset = index;
ms.push(); ms.pushPose();
ms.translate(-7, 50, 0); ms.translate(-7, 50, 0);
ms.scale(.75f, .75f, .75f); ms.scale(.75f, .75f, .75f);
deployer.draw(ms, getWidth() / 2, 0); deployer.draw(ms, getWidth() / 2, 0);
ms.pop(); ms.popPose();
AllGuiTextures.JEI_SLOT.draw(ms, 3, 14); AllGuiTextures.JEI_SLOT.draw(ms, 3, 14);
} }
@ -142,11 +142,11 @@ public abstract class SequencedAssemblySubCategory {
@Override @Override
public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) { public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) {
ms.push(); ms.pushPose();
ms.translate(0, 51.5f, 0); ms.translate(0, 51.5f, 0);
ms.scale(.6f, .6f, .6f); ms.scale(.6f, .6f, .6f);
saw.draw(ms, getWidth() / 2, 30); saw.draw(ms, getWidth() / 2, 30);
ms.pop(); ms.popPose();
} }
} }

View file

@ -19,7 +19,7 @@ public class CreateItemGroup extends CreateItemGroupBase {
} }
@Override @Override
public ItemStack createIcon() { public ItemStack makeIcon() {
return AllBlocks.COGWHEEL.asStack(); return AllBlocks.COGWHEEL.asStack();
} }

View file

@ -37,23 +37,23 @@ public class KineticDebugger {
if (te == null) if (te == null)
return; return;
World world = Minecraft.getInstance().world; World world = Minecraft.getInstance().level;
BlockPos toOutline = te.hasSource() ? te.source : te.getPos(); BlockPos toOutline = te.hasSource() ? te.source : te.getBlockPos();
BlockState state = te.getBlockState(); BlockState state = te.getBlockState();
VoxelShape shape = world.getBlockState(toOutline) VoxelShape shape = world.getBlockState(toOutline)
.getRenderShape(world, toOutline); .getBlockSupportShape(world, toOutline);
if (te.getTheoreticalSpeed() != 0 && !shape.isEmpty()) if (te.getTheoreticalSpeed() != 0 && !shape.isEmpty())
CreateClient.OUTLINER.chaseAABB("kineticSource", shape.getBoundingBox() CreateClient.OUTLINER.chaseAABB("kineticSource", shape.bounds()
.offset(toOutline)) .move(toOutline))
.lineWidth(1 / 16f) .lineWidth(1 / 16f)
.colored(te.hasSource() ? ColorHelper.colorFromLong(te.network) : 0xffcc00); .colored(te.hasSource() ? ColorHelper.colorFromLong(te.network) : 0xffcc00);
if (state.getBlock() instanceof IRotate) { if (state.getBlock() instanceof IRotate) {
Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state); Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state);
Vector3d vec = Vector3d.of(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis) Vector3d vec = Vector3d.atLowerCornerOf(Direction.get(AxisDirection.POSITIVE, axis)
.getDirectionVec()); .getNormal());
Vector3d center = VecHelper.getCenterOf(te.getPos()); Vector3d center = VecHelper.getCenterOf(te.getBlockPos());
CreateClient.OUTLINER.showLine("rotationAxis", center.add(vec), center.subtract(vec)) CreateClient.OUTLINER.showLine("rotationAxis", center.add(vec), center.subtract(vec))
.lineWidth(1 / 16f); .lineWidth(1 / 16f);
} }
@ -61,12 +61,12 @@ public class KineticDebugger {
} }
public static boolean isActive() { public static boolean isActive() {
return Minecraft.getInstance().gameSettings.showDebugInfo && AllConfigs.CLIENT.rainbowDebug.get(); return Minecraft.getInstance().options.renderDebug && AllConfigs.CLIENT.rainbowDebug.get();
} }
public static KineticTileEntity getSelectedTE() { public static KineticTileEntity getSelectedTE() {
RayTraceResult obj = Minecraft.getInstance().objectMouseOver; RayTraceResult obj = Minecraft.getInstance().hitResult;
ClientWorld world = Minecraft.getInstance().world; ClientWorld world = Minecraft.getInstance().level;
if (obj == null) if (obj == null)
return null; return null;
if (world == null) if (world == null)
@ -75,7 +75,7 @@ public class KineticDebugger {
return null; return null;
BlockRayTraceResult ray = (BlockRayTraceResult) obj; BlockRayTraceResult ray = (BlockRayTraceResult) obj;
TileEntity te = world.getTileEntity(ray.getPos()); TileEntity te = world.getBlockEntity(ray.getBlockPos());
if (!(te instanceof KineticTileEntity)) if (!(te instanceof KineticTileEntity))
return null; return null;

View file

@ -89,7 +89,7 @@ public class KineticNetwork {
te.updateFromNetwork(0, 0, 0); te.updateFromNetwork(0, 0, 0);
if (members.isEmpty()) { if (members.isEmpty()) {
TorquePropagator.networks.get(te.getWorld()) TorquePropagator.networks.get(te.getLevel())
.remove(this.id); .remove(this.id);
return; return;
} }
@ -109,9 +109,9 @@ public class KineticNetwork {
boolean wasOverStressed = te.isOverStressed(); boolean wasOverStressed = te.isOverStressed();
te.updateFromNetwork(currentCapacity, currentStress, getSize()); te.updateFromNetwork(currentCapacity, currentStress, getSize());
if (!wasOverStressed && te.isOverStressed() && te.getTheoreticalSpeed() != 0) { if (!wasOverStressed && te.isOverStressed() && te.getTheoreticalSpeed() != 0) {
AllTriggers.triggerForNearbyPlayers(AllTriggers.OVERSTRESSED, te.getWorld(), te.getPos(), 4); AllTriggers.triggerForNearbyPlayers(AllTriggers.OVERSTRESSED, te.getLevel(), te.getBlockPos(), 4);
if (containsFlywheel) if (containsFlywheel)
AllTriggers.triggerForNearbyPlayers(AllTriggers.OVERSTRESS_FLYWHEEL, te.getWorld(), te.getPos(), 4); AllTriggers.triggerForNearbyPlayers(AllTriggers.OVERSTRESS_FLYWHEEL, te.getLevel(), te.getBlockPos(), 4);
} }
} }
@ -147,8 +147,8 @@ public class KineticNetwork {
for (Iterator<KineticTileEntity> iterator = sources.keySet() for (Iterator<KineticTileEntity> iterator = sources.keySet()
.iterator(); iterator.hasNext();) { .iterator(); iterator.hasNext();) {
KineticTileEntity te = iterator.next(); KineticTileEntity te = iterator.next();
if (te.getWorld() if (te.getLevel()
.getTileEntity(te.getPos()) != te) { .getBlockEntity(te.getBlockPos()) != te) {
iterator.remove(); iterator.remove();
continue; continue;
} }
@ -164,8 +164,8 @@ public class KineticNetwork {
for (Iterator<KineticTileEntity> iterator = members.keySet() for (Iterator<KineticTileEntity> iterator = members.keySet()
.iterator(); iterator.hasNext();) { .iterator(); iterator.hasNext();) {
KineticTileEntity te = iterator.next(); KineticTileEntity te = iterator.next();
if (te.getWorld() if (te.getLevel()
.getTileEntity(te.getPos()) != te) { .getBlockEntity(te.getBlockPos()) != te) {
iterator.remove(); iterator.remove();
continue; continue;
} }

View file

@ -51,20 +51,20 @@ public class RotationPropagator {
final IRotate definitionFrom = (IRotate) fromBlock; final IRotate definitionFrom = (IRotate) fromBlock;
final IRotate definitionTo = (IRotate) toBlock; final IRotate definitionTo = (IRotate) toBlock;
final BlockPos diff = to.getPos() final BlockPos diff = to.getBlockPos()
.subtract(from.getPos()); .subtract(from.getBlockPos());
final Direction direction = Direction.getFacingFromVector(diff.getX(), diff.getY(), diff.getZ()); final Direction direction = Direction.getNearest(diff.getX(), diff.getY(), diff.getZ());
final World world = from.getWorld(); final World world = from.getLevel();
boolean alignedAxes = true; boolean alignedAxes = true;
for (Axis axis : Axis.values()) for (Axis axis : Axis.values())
if (axis != direction.getAxis()) if (axis != direction.getAxis())
if (axis.getCoordinate(diff.getX(), diff.getY(), diff.getZ()) != 0) if (axis.choose(diff.getX(), diff.getY(), diff.getZ()) != 0)
alignedAxes = false; alignedAxes = false;
boolean connectedByAxis = boolean connectedByAxis =
alignedAxes && definitionFrom.hasShaftTowards(world, from.getPos(), stateFrom, direction) alignedAxes && definitionFrom.hasShaftTowards(world, from.getBlockPos(), stateFrom, direction)
&& definitionTo.hasShaftTowards(world, to.getPos(), stateTo, direction.getOpposite()); && definitionTo.hasShaftTowards(world, to.getBlockPos(), stateTo, direction.getOpposite());
boolean connectedByGears = ICogWheel.isSmallCog(stateFrom) boolean connectedByGears = ICogWheel.isSmallCog(stateFrom)
&& ICogWheel.isSmallCog(stateTo); && ICogWheel.isSmallCog(stateTo);
@ -89,10 +89,10 @@ public class RotationPropagator {
// Large Gear <-> Large Gear // Large Gear <-> Large Gear
if (isLargeToLargeGear(stateFrom, stateTo, diff)) { if (isLargeToLargeGear(stateFrom, stateTo, diff)) {
Axis sourceAxis = stateFrom.get(AXIS); Axis sourceAxis = stateFrom.getValue(AXIS);
Axis targetAxis = stateTo.get(AXIS); Axis targetAxis = stateTo.getValue(AXIS);
int sourceAxisDiff = sourceAxis.getCoordinate(diff.getX(), diff.getY(), diff.getZ()); int sourceAxisDiff = sourceAxis.choose(diff.getX(), diff.getY(), diff.getZ());
int targetAxisDiff = targetAxis.getCoordinate(diff.getX(), diff.getY(), diff.getZ()); int targetAxisDiff = targetAxis.choose(diff.getX(), diff.getY(), diff.getZ());
return sourceAxisDiff > 0 ^ targetAxisDiff > 0 ? -1 : 1; return sourceAxisDiff > 0 ^ targetAxisDiff > 0 ? -1 : 1;
} }
@ -107,7 +107,7 @@ public class RotationPropagator {
// Gear <-> Gear // Gear <-> Gear
if (connectedByGears) { if (connectedByGears) {
if (diff.manhattanDistance(BlockPos.ZERO) != 1) if (diff.distManhattan(BlockPos.ZERO) != 1)
return 0; return 0;
if (ICogWheel.isLargeCog(stateTo)) if (ICogWheel.isLargeCog(stateTo))
return 0; return 0;
@ -125,11 +125,11 @@ public class RotationPropagator {
final BlockState stateTo = to.getBlockState(); final BlockState stateTo = to.getBlockState();
// Rotation Speed Controller <-> Large Gear // Rotation Speed Controller <-> Large Gear
if (isLargeCogToSpeedController(stateFrom, stateTo, to.getPos() if (isLargeCogToSpeedController(stateFrom, stateTo, to.getBlockPos()
.subtract(from.getPos()))) .subtract(from.getBlockPos())))
return SpeedControllerTileEntity.getConveyedSpeed(from, to, true); return SpeedControllerTileEntity.getConveyedSpeed(from, to, true);
if (isLargeCogToSpeedController(stateTo, stateFrom, from.getPos() if (isLargeCogToSpeedController(stateTo, stateFrom, from.getBlockPos()
.subtract(to.getPos()))) .subtract(to.getBlockPos())))
return SpeedControllerTileEntity.getConveyedSpeed(to, from, false); return SpeedControllerTileEntity.getConveyedSpeed(to, from, false);
float rotationSpeedModifier = getRotationSpeedModifier(from, to); float rotationSpeedModifier = getRotationSpeedModifier(from, to);
@ -139,12 +139,12 @@ public class RotationPropagator {
private static boolean isLargeToLargeGear(BlockState from, BlockState to, BlockPos diff) { private static boolean isLargeToLargeGear(BlockState from, BlockState to, BlockPos diff) {
if (!ICogWheel.isLargeCog(from) || !ICogWheel.isLargeCog(to)) if (!ICogWheel.isLargeCog(from) || !ICogWheel.isLargeCog(to))
return false; return false;
Axis fromAxis = from.get(AXIS); Axis fromAxis = from.getValue(AXIS);
Axis toAxis = to.get(AXIS); Axis toAxis = to.getValue(AXIS);
if (fromAxis == toAxis) if (fromAxis == toAxis)
return false; return false;
for (Axis axis : Axis.values()) { for (Axis axis : Axis.values()) {
int axisDiff = axis.getCoordinate(diff.getX(), diff.getY(), diff.getZ()); int axisDiff = axis.choose(diff.getX(), diff.getY(), diff.getZ());
if (axis == fromAxis || axis == toAxis) { if (axis == fromAxis || axis == toAxis) {
if (axisDiff == 0) if (axisDiff == 0)
return false; return false;
@ -171,15 +171,15 @@ public class RotationPropagator {
} }
private static boolean isLargeToSmallCog(BlockState from, BlockState to, IRotate defTo, BlockPos diff) { private static boolean isLargeToSmallCog(BlockState from, BlockState to, IRotate defTo, BlockPos diff) {
Axis axisFrom = from.get(AXIS); Axis axisFrom = from.getValue(AXIS);
if (axisFrom != defTo.getRotationAxis(to)) if (axisFrom != defTo.getRotationAxis(to))
return false; return false;
if (axisFrom.getCoordinate(diff.getX(), diff.getY(), diff.getZ()) != 0) if (axisFrom.choose(diff.getX(), diff.getY(), diff.getZ()) != 0)
return false; return false;
for (Axis axis : Axis.values()) { for (Axis axis : Axis.values()) {
if (axis == axisFrom) if (axis == axisFrom)
continue; continue;
if (Math.abs(axis.getCoordinate(diff.getX(), diff.getY(), diff.getZ())) != 1) if (Math.abs(axis.choose(diff.getX(), diff.getY(), diff.getZ())) != 1)
return false; return false;
} }
return true; return true;
@ -188,12 +188,12 @@ public class RotationPropagator {
private static boolean isLargeCogToSpeedController(BlockState from, BlockState to, BlockPos diff) { private static boolean isLargeCogToSpeedController(BlockState from, BlockState to, BlockPos diff) {
if (!ICogWheel.isLargeCog(from) || !AllBlocks.ROTATION_SPEED_CONTROLLER.has(to)) if (!ICogWheel.isLargeCog(from) || !AllBlocks.ROTATION_SPEED_CONTROLLER.has(to))
return false; return false;
if (!diff.equals(BlockPos.ZERO.down())) if (!diff.equals(BlockPos.ZERO.below()))
return false; return false;
Axis axis = from.get(CogWheelBlock.AXIS); Axis axis = from.getValue(CogWheelBlock.AXIS);
if (axis.isVertical()) if (axis.isVertical())
return false; return false;
if (to.get(SpeedControllerBlock.HORIZONTAL_AXIS) == axis) if (to.getValue(SpeedControllerBlock.HORIZONTAL_AXIS) == axis)
return false; return false;
return true; return true;
} }
@ -205,9 +205,9 @@ public class RotationPropagator {
* @param pos * @param pos
*/ */
public static void handleAdded(World worldIn, BlockPos pos, KineticTileEntity addedTE) { public static void handleAdded(World worldIn, BlockPos pos, KineticTileEntity addedTE) {
if (worldIn.isRemote) if (worldIn.isClientSide)
return; return;
if (!worldIn.isBlockPresent(pos)) if (!worldIn.isLoaded(pos))
return; return;
propagateNewSource(addedTE); propagateNewSource(addedTE);
} }
@ -218,8 +218,8 @@ public class RotationPropagator {
* @param currentTE * @param currentTE
*/ */
private static void propagateNewSource(KineticTileEntity currentTE) { private static void propagateNewSource(KineticTileEntity currentTE) {
BlockPos pos = currentTE.getPos(); BlockPos pos = currentTE.getBlockPos();
World world = currentTE.getWorld(); World world = currentTE.getLevel();
for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) { for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) {
float speedOfCurrent = currentTE.getTheoreticalSpeed(); float speedOfCurrent = currentTE.getTheoreticalSpeed();
@ -251,7 +251,7 @@ public class RotationPropagator {
// Neighbour faster, overpower the incoming tree // Neighbour faster, overpower the incoming tree
if (Math.abs(oppositeSpeed) > Math.abs(speedOfCurrent)) { if (Math.abs(oppositeSpeed) > Math.abs(speedOfCurrent)) {
float prevSpeed = currentTE.getSpeed(); float prevSpeed = currentTE.getSpeed();
currentTE.setSource(neighbourTE.getPos()); currentTE.setSource(neighbourTE.getBlockPos());
currentTE.setSpeed(getConveyedSpeed(neighbourTE, currentTE)); currentTE.setSpeed(getConveyedSpeed(neighbourTE, currentTE));
currentTE.onSpeedChanged(prevSpeed); currentTE.onSpeedChanged(prevSpeed);
currentTE.sendData(); currentTE.sendData();
@ -271,11 +271,11 @@ public class RotationPropagator {
continue; continue;
} }
if (currentTE.hasSource() && currentTE.source.equals(neighbourTE.getPos())) if (currentTE.hasSource() && currentTE.source.equals(neighbourTE.getBlockPos()))
currentTE.removeSource(); currentTE.removeSource();
float prevSpeed = neighbourTE.getSpeed(); float prevSpeed = neighbourTE.getSpeed();
neighbourTE.setSource(currentTE.getPos()); neighbourTE.setSource(currentTE.getBlockPos());
neighbourTE.setSpeed(getConveyedSpeed(currentTE, neighbourTE)); neighbourTE.setSpeed(getConveyedSpeed(currentTE, neighbourTE));
neighbourTE.onSpeedChanged(prevSpeed); neighbourTE.onSpeedChanged(prevSpeed);
neighbourTE.sendData(); neighbourTE.sendData();
@ -289,7 +289,7 @@ public class RotationPropagator {
float prevSpeed = neighbourTE.getSpeed(); float prevSpeed = neighbourTE.getSpeed();
neighbourTE.setSpeed(newSpeed); neighbourTE.setSpeed(newSpeed);
neighbourTE.setSource(currentTE.getPos()); neighbourTE.setSource(currentTE.getBlockPos());
neighbourTE.onSpeedChanged(prevSpeed); neighbourTE.onSpeedChanged(prevSpeed);
neighbourTE.sendData(); neighbourTE.sendData();
propagateNewSource(neighbourTE); propagateNewSource(neighbourTE);
@ -305,7 +305,7 @@ public class RotationPropagator {
* @param removedTE * @param removedTE
*/ */
public static void handleRemoved(World worldIn, BlockPos pos, KineticTileEntity removedTE) { public static void handleRemoved(World worldIn, BlockPos pos, KineticTileEntity removedTE) {
if (worldIn.isRemote) if (worldIn.isClientSide)
return; return;
if (removedTE == null) if (removedTE == null)
return; return;
@ -316,7 +316,7 @@ public class RotationPropagator {
BlockState neighbourState = worldIn.getBlockState(neighbourPos); BlockState neighbourState = worldIn.getBlockState(neighbourPos);
if (!(neighbourState.getBlock() instanceof IRotate)) if (!(neighbourState.getBlock() instanceof IRotate))
continue; continue;
TileEntity tileEntity = worldIn.getTileEntity(neighbourPos); TileEntity tileEntity = worldIn.getBlockEntity(neighbourPos);
if (!(tileEntity instanceof KineticTileEntity)) if (!(tileEntity instanceof KineticTileEntity))
continue; continue;
@ -336,16 +336,16 @@ public class RotationPropagator {
* @param updateTE * @param updateTE
*/ */
private static void propagateMissingSource(KineticTileEntity updateTE) { private static void propagateMissingSource(KineticTileEntity updateTE) {
final World world = updateTE.getWorld(); final World world = updateTE.getLevel();
List<KineticTileEntity> potentialNewSources = new LinkedList<>(); List<KineticTileEntity> potentialNewSources = new LinkedList<>();
List<BlockPos> frontier = new LinkedList<>(); List<BlockPos> frontier = new LinkedList<>();
frontier.add(updateTE.getPos()); frontier.add(updateTE.getBlockPos());
BlockPos missingSource = updateTE.hasSource() ? updateTE.source : null; BlockPos missingSource = updateTE.hasSource() ? updateTE.source : null;
while (!frontier.isEmpty()) { while (!frontier.isEmpty()) {
final BlockPos pos = frontier.remove(0); final BlockPos pos = frontier.remove(0);
TileEntity tileEntity = world.getTileEntity(pos); TileEntity tileEntity = world.getBlockEntity(pos);
if (!(tileEntity instanceof KineticTileEntity)) if (!(tileEntity instanceof KineticTileEntity))
continue; continue;
final KineticTileEntity currentTE = (KineticTileEntity) tileEntity; final KineticTileEntity currentTE = (KineticTileEntity) tileEntity;
@ -354,7 +354,7 @@ public class RotationPropagator {
currentTE.sendData(); currentTE.sendData();
for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) { for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) {
if (neighbourTE.getPos() if (neighbourTE.getBlockPos()
.equals(missingSource)) .equals(missingSource))
continue; continue;
if (!neighbourTE.hasSource()) if (!neighbourTE.hasSource())
@ -368,7 +368,7 @@ public class RotationPropagator {
if (neighbourTE.isSource()) if (neighbourTE.isSource())
potentialNewSources.add(neighbourTE); potentialNewSources.add(neighbourTE);
frontier.add(neighbourTE.getPos()); frontier.add(neighbourTE.getBlockPos());
} }
} }
@ -381,14 +381,14 @@ public class RotationPropagator {
} }
private static KineticTileEntity findConnectedNeighbour(KineticTileEntity currentTE, BlockPos neighbourPos) { private static KineticTileEntity findConnectedNeighbour(KineticTileEntity currentTE, BlockPos neighbourPos) {
BlockState neighbourState = currentTE.getWorld() BlockState neighbourState = currentTE.getLevel()
.getBlockState(neighbourPos); .getBlockState(neighbourPos);
if (!(neighbourState.getBlock() instanceof IRotate)) if (!(neighbourState.getBlock() instanceof IRotate))
return null; return null;
if (!neighbourState.hasTileEntity()) if (!neighbourState.hasTileEntity())
return null; return null;
TileEntity neighbourTE = currentTE.getWorld() TileEntity neighbourTE = currentTE.getLevel()
.getTileEntity(neighbourPos); .getBlockEntity(neighbourPos);
if (!(neighbourTE instanceof KineticTileEntity)) if (!(neighbourTE instanceof KineticTileEntity))
return null; return null;
KineticTileEntity neighbourKTE = (KineticTileEntity) neighbourTE; KineticTileEntity neighbourKTE = (KineticTileEntity) neighbourTE;
@ -403,8 +403,8 @@ public class RotationPropagator {
public static boolean isConnected(KineticTileEntity from, KineticTileEntity to) { public static boolean isConnected(KineticTileEntity from, KineticTileEntity to) {
final BlockState stateFrom = from.getBlockState(); final BlockState stateFrom = from.getBlockState();
final BlockState stateTo = to.getBlockState(); final BlockState stateTo = to.getBlockState();
return isLargeCogToSpeedController(stateFrom, stateTo, to.getPos() return isLargeCogToSpeedController(stateFrom, stateTo, to.getBlockPos()
.subtract(from.getPos())) || getRotationSpeedModifier(from, to) != 0 .subtract(from.getBlockPos())) || getRotationSpeedModifier(from, to) != 0
|| from.isCustomConnection(to, stateFrom, stateTo); || from.isCustomConnection(to, stateFrom, stateTo);
} }
@ -423,13 +423,13 @@ public class RotationPropagator {
private static List<BlockPos> getPotentialNeighbourLocations(KineticTileEntity te) { private static List<BlockPos> getPotentialNeighbourLocations(KineticTileEntity te) {
List<BlockPos> neighbours = new LinkedList<>(); List<BlockPos> neighbours = new LinkedList<>();
if (!te.getWorld() if (!te.getLevel()
.isAreaLoaded(te.getPos(), 1)) .isAreaLoaded(te.getBlockPos(), 1))
return neighbours; return neighbours;
for (Direction facing : Iterate.directions) for (Direction facing : Iterate.directions)
neighbours.add(te.getPos() neighbours.add(te.getBlockPos()
.offset(facing)); .relative(facing));
BlockState blockState = te.getBlockState(); BlockState blockState = te.getBlockState();
if (!(blockState.getBlock() instanceof IRotate)) if (!(blockState.getBlock() instanceof IRotate))

View file

@ -26,7 +26,7 @@ public class TorquePropagator {
public KineticNetwork getOrCreateNetworkFor(KineticTileEntity te) { public KineticNetwork getOrCreateNetworkFor(KineticTileEntity te) {
Long id = te.network; Long id = te.network;
KineticNetwork network; KineticNetwork network;
Map<Long, KineticNetwork> map = networks.get(te.getWorld()); Map<Long, KineticNetwork> map = networks.get(te.getLevel());
if (id == null) if (id == null)
return null; return null;

View file

@ -12,6 +12,6 @@ public class BackHalfShaftInstance extends HalfShaftInstance {
@Override @Override
protected Direction getShaftDirection() { protected Direction getShaftDirection() {
return tile.getBlockState().get(BlockStateProperties.FACING).getOpposite(); return tile.getBlockState().getValue(BlockStateProperties.FACING).getOpposite();
} }
} }

View file

@ -11,6 +11,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraftforge.common.ToolType; import net.minecraftforge.common.ToolType;
import net.minecraft.block.AbstractBlock.Properties;
public class CasingBlock extends Block implements IWrenchable { public class CasingBlock extends Block implements IWrenchable {
public CasingBlock(Properties p_i48440_1_) { public CasingBlock(Properties p_i48440_1_) {
@ -29,7 +31,7 @@ public class CasingBlock extends Block implements IWrenchable {
@Override @Override
public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) { public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) {
for (ToolType toolType : player.getHeldItemMainhand().getToolTypes()) { for (ToolType toolType : player.getMainHandItem().getToolTypes()) {
if (isToolEffective(state, toolType)) if (isToolEffective(state, toolType))
return true; return true;
} }

View file

@ -15,6 +15,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.block.AbstractBlock.Properties;
public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBlock { public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBlock {
public static final BooleanProperty AXIS_ALONG_FIRST_COORDINATE = BooleanProperty.create("axis_along_first"); public static final BooleanProperty AXIS_ALONG_FIRST_COORDINATE = BooleanProperty.create("axis_along_first");
@ -24,30 +26,30 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
} }
@Override @Override
protected void fillStateContainer(Builder<Block, BlockState> builder) { protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
builder.add(AXIS_ALONG_FIRST_COORDINATE); builder.add(AXIS_ALONG_FIRST_COORDINATE);
super.fillStateContainer(builder); super.createBlockStateDefinition(builder);
} }
protected Direction getFacingForPlacement(BlockItemUseContext context) { protected Direction getFacingForPlacement(BlockItemUseContext context) {
Direction facing = context.getNearestLookingDirection() Direction facing = context.getNearestLookingDirection()
.getOpposite(); .getOpposite();
if (context.getPlayer() != null && context.getPlayer() if (context.getPlayer() != null && context.getPlayer()
.isSneaking()) .isShiftKeyDown())
facing = facing.getOpposite(); facing = facing.getOpposite();
return facing; return facing;
} }
protected boolean getAxisAlignmentForPlacement(BlockItemUseContext context) { protected boolean getAxisAlignmentForPlacement(BlockItemUseContext context) {
return context.getPlacementHorizontalFacing() return context.getHorizontalDirection()
.getAxis() == Axis.X; .getAxis() == Axis.X;
} }
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
Direction facing = getFacingForPlacement(context); Direction facing = getFacingForPlacement(context);
BlockPos pos = context.getPos(); BlockPos pos = context.getClickedPos();
World world = context.getWorld(); World world = context.getLevel();
boolean alongFirst = false; boolean alongFirst = false;
Axis faceAxis = facing.getAxis(); Axis faceAxis = facing.getAxis();
@ -70,7 +72,7 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
for (Direction side : Iterate.horizontalDirections) { for (Direction side : Iterate.horizontalDirections) {
if (!prefersConnectionTo(world, pos, side, true) if (!prefersConnectionTo(world, pos, side, true)
&& !prefersConnectionTo(world, pos, side.rotateY(), false)) && !prefersConnectionTo(world, pos, side.getClockWise(), false))
continue; continue;
if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) { if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) {
prefferedSide = null; prefferedSide = null;
@ -83,15 +85,15 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
alongFirst = prefferedSide.getAxis() == Axis.X; alongFirst = prefferedSide.getAxis() == Axis.X;
} }
return this.getDefaultState() return this.defaultBlockState()
.with(FACING, facing) .setValue(FACING, facing)
.with(AXIS_ALONG_FIRST_COORDINATE, alongFirst); .setValue(AXIS_ALONG_FIRST_COORDINATE, alongFirst);
} }
protected boolean prefersConnectionTo(IWorldReader reader, BlockPos pos, Direction facing, boolean shaftAxis) { protected boolean prefersConnectionTo(IWorldReader reader, BlockPos pos, Direction facing, boolean shaftAxis) {
if (!shaftAxis) if (!shaftAxis)
return false; return false;
BlockPos neighbourPos = pos.offset(facing); BlockPos neighbourPos = pos.relative(facing);
BlockState blockState = reader.getBlockState(neighbourPos); BlockState blockState = reader.getBlockState(neighbourPos);
Block block = blockState.getBlock(); Block block = blockState.getBlock();
return block instanceof IRotate return block instanceof IRotate
@ -100,9 +102,9 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
@Override @Override
public Axis getRotationAxis(BlockState state) { public Axis getRotationAxis(BlockState state) {
Axis pistonAxis = state.get(FACING) Axis pistonAxis = state.getValue(FACING)
.getAxis(); .getAxis();
boolean alongFirst = state.get(AXIS_ALONG_FIRST_COORDINATE); boolean alongFirst = state.getValue(AXIS_ALONG_FIRST_COORDINATE);
if (pistonAxis == Axis.X) if (pistonAxis == Axis.X)
return alongFirst ? Axis.Y : Axis.Z; return alongFirst ? Axis.Y : Axis.Z;

View file

@ -12,6 +12,8 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Mirror; import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation; import net.minecraft.util.Rotation;
import net.minecraft.block.AbstractBlock.Properties;
public abstract class DirectionalKineticBlock extends KineticBlock { public abstract class DirectionalKineticBlock extends KineticBlock {
public static final DirectionProperty FACING = BlockStateProperties.FACING; public static final DirectionProperty FACING = BlockStateProperties.FACING;
@ -21,20 +23,20 @@ public abstract class DirectionalKineticBlock extends KineticBlock {
} }
@Override @Override
protected void fillStateContainer(Builder<Block, BlockState> builder) { protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
builder.add(FACING); builder.add(FACING);
super.fillStateContainer(builder); super.createBlockStateDefinition(builder);
} }
public Direction getPreferredFacing(BlockItemUseContext context) { public Direction getPreferredFacing(BlockItemUseContext context) {
Direction prefferedSide = null; Direction prefferedSide = null;
for (Direction side : Iterate.directions) { for (Direction side : Iterate.directions) {
BlockState blockState = context.getWorld() BlockState blockState = context.getLevel()
.getBlockState(context.getPos() .getBlockState(context.getClickedPos()
.offset(side)); .relative(side));
if (blockState.getBlock() instanceof IRotate) { if (blockState.getBlock() instanceof IRotate) {
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getWorld(), context.getPos() if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getLevel(), context.getClickedPos()
.offset(side), blockState, side.getOpposite())) .relative(side), blockState, side.getOpposite()))
if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) { if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) {
prefferedSide = null; prefferedSide = null;
break; break;
@ -50,22 +52,22 @@ public abstract class DirectionalKineticBlock extends KineticBlock {
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
Direction preferred = getPreferredFacing(context); Direction preferred = getPreferredFacing(context);
if (preferred == null || (context.getPlayer() != null && context.getPlayer() if (preferred == null || (context.getPlayer() != null && context.getPlayer()
.isSneaking())) { .isShiftKeyDown())) {
Direction nearestLookingDirection = context.getNearestLookingDirection(); Direction nearestLookingDirection = context.getNearestLookingDirection();
return getDefaultState().with(FACING, context.getPlayer() != null && context.getPlayer() return defaultBlockState().setValue(FACING, context.getPlayer() != null && context.getPlayer()
.isSneaking() ? nearestLookingDirection : nearestLookingDirection.getOpposite()); .isShiftKeyDown() ? nearestLookingDirection : nearestLookingDirection.getOpposite());
} }
return getDefaultState().with(FACING, preferred.getOpposite()); return defaultBlockState().setValue(FACING, preferred.getOpposite());
} }
@Override @Override
public BlockState rotate(BlockState state, Rotation rot) { public BlockState rotate(BlockState state, Rotation rot) {
return state.with(FACING, rot.rotate(state.get(FACING))); return state.setValue(FACING, rot.rotate(state.getValue(FACING)));
} }
@Override @Override
public BlockState mirror(BlockState state, Mirror mirrorIn) { public BlockState mirror(BlockState state, Mirror mirrorIn) {
return state.rotate(mirrorIn.toRotation(state.get(FACING))); return state.rotate(mirrorIn.getRotation(state.getValue(FACING)));
} }
} }

View file

@ -36,7 +36,7 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
@Override @Override
public void setSource(BlockPos source) { public void setSource(BlockPos source) {
super.setSource(source); super.setSource(source);
TileEntity tileEntity = world.getTileEntity(source); TileEntity tileEntity = level.getBlockEntity(source);
if (!(tileEntity instanceof KineticTileEntity)) if (!(tileEntity instanceof KineticTileEntity))
return; return;
KineticTileEntity sourceTe = (KineticTileEntity) tileEntity; KineticTileEntity sourceTe = (KineticTileEntity) tileEntity;
@ -59,8 +59,8 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
float stressBase = calculateAddedStressCapacity(); float stressBase = calculateAddedStressCapacity();
if (stressBase != 0 && IRotate.StressImpact.isEnabled()) { if (stressBase != 0 && IRotate.StressImpact.isEnabled()) {
tooltip.add(componentSpacing.copy().append(Lang.translate("gui.goggles.generator_stats"))); tooltip.add(componentSpacing.plainCopy().append(Lang.translate("gui.goggles.generator_stats")));
tooltip.add(componentSpacing.copy().append(Lang.translate("tooltip.capacityProvided").formatted(TextFormatting.GRAY))); tooltip.add(componentSpacing.plainCopy().append(Lang.translate("tooltip.capacityProvided").withStyle(TextFormatting.GRAY)));
float speed = getTheoreticalSpeed(); float speed = getTheoreticalSpeed();
if (speed != getGeneratedSpeed() && speed != 0) if (speed != getGeneratedSpeed() && speed != 0)
@ -70,12 +70,12 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
float stressTotal = stressBase * speed; float stressTotal = stressBase * speed;
tooltip.add( tooltip.add(
componentSpacing.copy() componentSpacing.plainCopy()
.append(new StringTextComponent(" " + IHaveGoggleInformation.format(stressTotal)) .append(new StringTextComponent(" " + IHaveGoggleInformation.format(stressTotal))
.append(Lang.translate("generic.unit.stress")) .append(Lang.translate("generic.unit.stress"))
.formatted(TextFormatting.AQUA)) .withStyle(TextFormatting.AQUA))
.append(" ") .append(" ")
.append(Lang.translate("gui.goggles.at_current_speed").formatted(TextFormatting.DARK_GRAY))); .append(Lang.translate("gui.goggles.at_current_speed").withStyle(TextFormatting.DARK_GRAY)));
added = true; added = true;
} }
@ -87,7 +87,7 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
float speed = getGeneratedSpeed(); float speed = getGeneratedSpeed();
float prevSpeed = this.speed; float prevSpeed = this.speed;
if (world.isRemote) if (level.isClientSide)
return; return;
if (prevSpeed != speed) { if (prevSpeed != speed) {
@ -141,7 +141,7 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
// Staying below Overpowered speed // Staying below Overpowered speed
if (Math.abs(prevSpeed) >= Math.abs(speed)) { if (Math.abs(prevSpeed) >= Math.abs(speed)) {
if (Math.signum(prevSpeed) != Math.signum(speed)) if (Math.signum(prevSpeed) != Math.signum(speed))
world.destroyBlock(pos, true); level.destroyBlock(worldPosition, true);
return; return;
} }
@ -161,6 +161,6 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
} }
public Long createNetworkId() { public Long createNetworkId() {
return pos.toLong(); return worldPosition.asLong();
} }
} }

View file

@ -19,6 +19,6 @@ public class HalfShaftInstance extends SingleRotatingInstance {
} }
protected Direction getShaftDirection() { protected Direction getShaftDirection() {
return blockState.get(BlockStateProperties.FACING); return blockState.getValue(BlockStateProperties.FACING);
} }
} }

View file

@ -16,6 +16,8 @@ import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.block.AbstractBlock.Properties;
public abstract class HorizontalAxisKineticBlock extends KineticBlock { public abstract class HorizontalAxisKineticBlock extends KineticBlock {
public static final Property<Axis> HORIZONTAL_AXIS = BlockStateProperties.HORIZONTAL_AXIS; public static final Property<Axis> HORIZONTAL_AXIS = BlockStateProperties.HORIZONTAL_AXIS;
@ -25,25 +27,25 @@ public abstract class HorizontalAxisKineticBlock extends KineticBlock {
} }
@Override @Override
protected void fillStateContainer(Builder<Block, BlockState> builder) { protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
builder.add(HORIZONTAL_AXIS); builder.add(HORIZONTAL_AXIS);
super.fillStateContainer(builder); super.createBlockStateDefinition(builder);
} }
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
Axis preferredAxis = getPreferredHorizontalAxis(context); Axis preferredAxis = getPreferredHorizontalAxis(context);
if (preferredAxis != null) if (preferredAxis != null)
return this.getDefaultState().with(HORIZONTAL_AXIS, preferredAxis); return this.defaultBlockState().setValue(HORIZONTAL_AXIS, preferredAxis);
return this.getDefaultState().with(HORIZONTAL_AXIS, context.getPlacementHorizontalFacing().rotateY().getAxis()); return this.defaultBlockState().setValue(HORIZONTAL_AXIS, context.getHorizontalDirection().getClockWise().getAxis());
} }
public static Axis getPreferredHorizontalAxis(BlockItemUseContext context) { public static Axis getPreferredHorizontalAxis(BlockItemUseContext context) {
Direction prefferedSide = null; Direction prefferedSide = null;
for (Direction side : Iterate.horizontalDirections) { for (Direction side : Iterate.horizontalDirections) {
BlockState blockState = context.getWorld().getBlockState(context.getPos().offset(side)); BlockState blockState = context.getLevel().getBlockState(context.getClickedPos().relative(side));
if (blockState.getBlock() instanceof IRotate) { if (blockState.getBlock() instanceof IRotate) {
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getWorld(), context.getPos().offset(side), if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getLevel(), context.getClickedPos().relative(side),
blockState, side.getOpposite())) blockState, side.getOpposite()))
if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) { if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) {
prefferedSide = null; prefferedSide = null;
@ -58,19 +60,19 @@ public abstract class HorizontalAxisKineticBlock extends KineticBlock {
@Override @Override
public Axis getRotationAxis(BlockState state) { public Axis getRotationAxis(BlockState state) {
return state.get(HORIZONTAL_AXIS); return state.getValue(HORIZONTAL_AXIS);
} }
@Override @Override
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) { public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
return face.getAxis() == state.get(HORIZONTAL_AXIS); return face.getAxis() == state.getValue(HORIZONTAL_AXIS);
} }
@Override @Override
public BlockState rotate(BlockState state, Rotation rot) { public BlockState rotate(BlockState state, Rotation rot) {
Axis axis = state.get(HORIZONTAL_AXIS); Axis axis = state.getValue(HORIZONTAL_AXIS);
return state.with(HORIZONTAL_AXIS, return state.setValue(HORIZONTAL_AXIS,
rot.rotate(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis)).getAxis()); rot.rotate(Direction.get(AxisDirection.POSITIVE, axis)).getAxis());
} }
@Override @Override

View file

@ -13,6 +13,6 @@ public class HorizontalHalfShaftInstance extends HalfShaftInstance {
@Override @Override
protected Direction getShaftDirection() { protected Direction getShaftDirection() {
return blockState.get(BlockStateProperties.HORIZONTAL_FACING).getOpposite(); return blockState.getValue(BlockStateProperties.HORIZONTAL_FACING).getOpposite();
} }
} }

View file

@ -12,6 +12,8 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Mirror; import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation; import net.minecraft.util.Rotation;
import net.minecraft.block.AbstractBlock.Properties;
public abstract class HorizontalKineticBlock extends KineticBlock { public abstract class HorizontalKineticBlock extends KineticBlock {
public static final Property<Direction> HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; public static final Property<Direction> HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING;
@ -21,27 +23,27 @@ public abstract class HorizontalKineticBlock extends KineticBlock {
} }
@Override @Override
protected void fillStateContainer(Builder<Block, BlockState> builder) { protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
builder.add(HORIZONTAL_FACING); builder.add(HORIZONTAL_FACING);
super.fillStateContainer(builder); super.createBlockStateDefinition(builder);
} }
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
return this.getDefaultState() return this.defaultBlockState()
.with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing() .setValue(HORIZONTAL_FACING, context.getHorizontalDirection()
.getOpposite()); .getOpposite());
} }
public Direction getPreferredHorizontalFacing(BlockItemUseContext context) { public Direction getPreferredHorizontalFacing(BlockItemUseContext context) {
Direction prefferedSide = null; Direction prefferedSide = null;
for (Direction side : Iterate.horizontalDirections) { for (Direction side : Iterate.horizontalDirections) {
BlockState blockState = context.getWorld() BlockState blockState = context.getLevel()
.getBlockState(context.getPos() .getBlockState(context.getClickedPos()
.offset(side)); .relative(side));
if (blockState.getBlock() instanceof IRotate) { if (blockState.getBlock() instanceof IRotate) {
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getWorld(), context.getPos() if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getLevel(), context.getClickedPos()
.offset(side), blockState, side.getOpposite())) .relative(side), blockState, side.getOpposite()))
if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) { if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) {
prefferedSide = null; prefferedSide = null;
break; break;
@ -55,12 +57,12 @@ public abstract class HorizontalKineticBlock extends KineticBlock {
@Override @Override
public BlockState rotate(BlockState state, Rotation rot) { public BlockState rotate(BlockState state, Rotation rot) {
return state.with(HORIZONTAL_FACING, rot.rotate(state.get(HORIZONTAL_FACING))); return state.setValue(HORIZONTAL_FACING, rot.rotate(state.getValue(HORIZONTAL_FACING)));
} }
@Override @Override
public BlockState mirror(BlockState state, Mirror mirrorIn) { public BlockState mirror(BlockState state, Mirror mirrorIn) {
return state.rotate(mirrorIn.toRotation(state.get(HORIZONTAL_FACING))); return state.rotate(mirrorIn.getRotation(state.getValue(HORIZONTAL_FACING)));
} }
} }

View file

@ -72,9 +72,9 @@ public interface IRotate extends IWrenchable {
level.append(" (" + IHaveGoggleInformation.format(Math.abs(speed))).append(Lang.translate("generic.unit.rpm")).append(") "); level.append(" (" + IHaveGoggleInformation.format(Math.abs(speed))).append(Lang.translate("generic.unit.rpm")).append(") ");
if (overstressed) if (overstressed)
level.formatted(TextFormatting.DARK_GRAY, TextFormatting.STRIKETHROUGH); level.withStyle(TextFormatting.DARK_GRAY, TextFormatting.STRIKETHROUGH);
else else
level.formatted(speedLevel.getTextColor()); level.withStyle(speedLevel.getTextColor());
return level; return level;
} }
@ -115,7 +115,7 @@ public interface IRotate extends IWrenchable {
level.append(String.format(" (%s%%) ", (int) (stressPercent * 100))); level.append(String.format(" (%s%%) ", (int) (stressPercent * 100)));
return level.formatted(color); return level.withStyle(color);
} }
} }

View file

@ -16,6 +16,8 @@ import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ToolType; import net.minecraftforge.common.ToolType;
import net.minecraft.block.AbstractBlock.Properties;
public abstract class KineticBlock extends Block implements IRotate { public abstract class KineticBlock extends Block implements IRotate {
protected static final Palette color = Palette.Red; protected static final Palette color = Palette.Red;
@ -31,7 +33,7 @@ public abstract class KineticBlock extends Block implements IRotate {
@Override @Override
public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) { public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) {
for (ToolType toolType : player.getHeldItemMainhand() for (ToolType toolType : player.getMainHandItem()
.getToolTypes()) { .getToolTypes()) {
if (isToolEffective(state, toolType)) if (isToolEffective(state, toolType))
return true; return true;
@ -45,13 +47,13 @@ public abstract class KineticBlock extends Block implements IRotate {
} }
@Override @Override
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { public void onPlace(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
// onBlockAdded is useless for init, as sometimes the TE gets re-instantiated // onBlockAdded is useless for init, as sometimes the TE gets re-instantiated
// however, if a block change occurs that does not change kinetic connections, // however, if a block change occurs that does not change kinetic connections,
// we can prevent a major re-propagation here // we can prevent a major re-propagation here
TileEntity tileEntity = worldIn.getTileEntity(pos); TileEntity tileEntity = worldIn.getBlockEntity(pos);
if (tileEntity instanceof KineticTileEntity) { if (tileEntity instanceof KineticTileEntity) {
KineticTileEntity kineticTileEntity = (KineticTileEntity) tileEntity; KineticTileEntity kineticTileEntity = (KineticTileEntity) tileEntity;
kineticTileEntity.preventSpeedUpdate = 0; kineticTileEntity.preventSpeedUpdate = 0;
@ -87,11 +89,11 @@ public abstract class KineticBlock extends Block implements IRotate {
public abstract TileEntity createTileEntity(BlockState state, IBlockReader world); public abstract TileEntity createTileEntity(BlockState state, IBlockReader world);
@Override @Override
public void updateDiagonalNeighbors(BlockState stateIn, IWorld worldIn, BlockPos pos, int flags, int count) { public void updateIndirectNeighbourShapes(BlockState stateIn, IWorld worldIn, BlockPos pos, int flags, int count) {
if (worldIn.isRemote()) if (worldIn.isClientSide())
return; return;
TileEntity tileEntity = worldIn.getTileEntity(pos); TileEntity tileEntity = worldIn.getBlockEntity(pos);
if (!(tileEntity instanceof KineticTileEntity)) if (!(tileEntity instanceof KineticTileEntity))
return; return;
KineticTileEntity kte = (KineticTileEntity) tileEntity; KineticTileEntity kte = (KineticTileEntity) tileEntity;
@ -108,11 +110,11 @@ public abstract class KineticBlock extends Block implements IRotate {
} }
@Override @Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { public void setPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
if (worldIn.isRemote) if (worldIn.isClientSide)
return; return;
TileEntity tileEntity = worldIn.getTileEntity(pos); TileEntity tileEntity = worldIn.getBlockEntity(pos);
if (!(tileEntity instanceof KineticTileEntity)) if (!(tileEntity instanceof KineticTileEntity))
return; return;

View file

@ -24,7 +24,7 @@ public class KineticData extends BasicData {
} }
public KineticData setPosition(Vector3f pos) { public KineticData setPosition(Vector3f pos) {
return setPosition(pos.getX(), pos.getY(), pos.getZ()); return setPosition(pos.x(), pos.y(), pos.z());
} }
public KineticData setPosition(float x, float y, float z) { public KineticData setPosition(float x, float y, float z) {

View file

@ -29,9 +29,9 @@ public class KineticEffectHandler {
} }
public void tick() { public void tick() {
World world = kte.getWorld(); World world = kte.getLevel();
if (world.isRemote) { if (world.isClientSide) {
if (overStressedTime > 0) if (overStressedTime > 0)
if (--overStressedTime == 0) if (--overStressedTime == 0)
if (kte.isOverStressed()) { if (kte.isOverStressed()) {
@ -59,15 +59,15 @@ public class KineticEffectHandler {
} }
public void spawnEffect(IParticleData particle, float maxMotion, int amount) { public void spawnEffect(IParticleData particle, float maxMotion, int amount) {
World world = kte.getWorld(); World world = kte.getLevel();
if (world == null) if (world == null)
return; return;
if (!world.isRemote) if (!world.isClientSide)
return; return;
Random r = world.rand; Random r = world.random;
for (int i = 0; i < amount; i++) { for (int i = 0; i < amount; i++) {
Vector3d motion = VecHelper.offsetRandomly(Vector3d.ZERO, r, maxMotion); Vector3d motion = VecHelper.offsetRandomly(Vector3d.ZERO, r, maxMotion);
Vector3d position = VecHelper.getCenterOf(kte.getPos()); Vector3d position = VecHelper.getCenterOf(kte.getBlockPos());
world.addParticle(particle, position.x, position.y, position.z, motion.x, motion.y, motion.z); world.addParticle(particle, position.x, position.y, position.z, motion.x, motion.y, motion.z);
} }
} }
@ -87,8 +87,8 @@ public class KineticEffectHandler {
float radius2 = kb.getParticleTargetRadius(); float radius2 = kb.getParticleTargetRadius();
Axis axis = kb.getRotationAxis(state); Axis axis = kb.getRotationAxis(state);
BlockPos pos = kte.getPos(); BlockPos pos = kte.getBlockPos();
World world = kte.getWorld(); World world = kte.getLevel();
if (axis == null) if (axis == null)
return; return;
if (world == null) if (world == null)
@ -105,7 +105,7 @@ public class KineticEffectHandler {
AllTriggers.triggerForNearbyPlayers(AllTriggers.ROTATION, world, pos, 5); AllTriggers.triggerForNearbyPlayers(AllTriggers.ROTATION, world, pos, 5);
RotationIndicatorParticleData particleData = RotationIndicatorParticleData particleData =
new RotationIndicatorParticleData(color, particleSpeed, radius1, radius2, 10, axisChar); new RotationIndicatorParticleData(color, particleSpeed, radius1, radius2, 10, axisChar);
((ServerWorld) world).spawnParticle(particleData, vec.x, vec.y, vec.z, 20, 0, 0, 0, 1); ((ServerWorld) world).sendParticles(particleData, vec.x, vec.y, vec.z, 20, 0, 0, 0, 1);
} }
} }

View file

@ -78,7 +78,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
@Override @Override
public void initialize() { public void initialize() {
if (hasNetwork() && !world.isRemote) { if (hasNetwork() && !level.isClientSide) {
KineticNetwork network = getOrCreateNetwork(); KineticNetwork network = getOrCreateNetwork();
if (!network.initialized) if (!network.initialized)
network.initFromTE(capacity, stress, networkSize); network.initFromTE(capacity, stress, networkSize);
@ -90,13 +90,13 @@ public abstract class KineticTileEntity extends SmartTileEntity
@Override @Override
public void tick() { public void tick() {
if (!world.isRemote && needsSpeedUpdate()) if (!level.isClientSide && needsSpeedUpdate())
attachKinetics(); attachKinetics();
super.tick(); super.tick();
effects.tick(); effects.tick();
if (world.isRemote) { if (level.isClientSide) {
cachedBoundingBox = null; // cache the bounding box for every frame between ticks cachedBoundingBox = null; // cache the bounding box for every frame between ticks
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> this.tickAudio()); DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> this.tickAudio());
return; return;
@ -124,10 +124,10 @@ public abstract class KineticTileEntity extends SmartTileEntity
return; return;
} }
if (!world.isBlockPresent(source)) if (!level.isLoaded(source))
return; return;
TileEntity tileEntity = world.getTileEntity(source); TileEntity tileEntity = level.getBlockEntity(source);
KineticTileEntity sourceTe = KineticTileEntity sourceTe =
tileEntity instanceof KineticTileEntity ? (KineticTileEntity) tileEntity : null; tileEntity instanceof KineticTileEntity ? (KineticTileEntity) tileEntity : null;
if (sourceTe == null || sourceTe.speed == 0) { if (sourceTe == null || sourceTe.speed == 0) {
@ -184,13 +184,13 @@ public abstract class KineticTileEntity extends SmartTileEntity
} }
@Override @Override
public void remove() { public void setRemoved() {
if (!world.isRemote) { if (!level.isClientSide) {
if (hasNetwork()) if (hasNetwork())
getOrCreateNetwork().remove(this); getOrCreateNetwork().remove(this);
detachKinetics(); detachKinetics();
} }
super.remove(); super.setRemoved();
} }
@Override @Override
@ -289,10 +289,10 @@ public abstract class KineticTileEntity extends SmartTileEntity
public void setSource(BlockPos source) { public void setSource(BlockPos source) {
this.source = source; this.source = source;
if (world == null || world.isRemote) if (level == null || level.isClientSide)
return; return;
TileEntity tileEntity = world.getTileEntity(source); TileEntity tileEntity = level.getBlockEntity(source);
if (!(tileEntity instanceof KineticTileEntity)) { if (!(tileEntity instanceof KineticTileEntity)) {
removeSource(); removeSource();
return; return;
@ -339,11 +339,11 @@ public abstract class KineticTileEntity extends SmartTileEntity
public void attachKinetics() { public void attachKinetics() {
updateSpeed = false; updateSpeed = false;
RotationPropagator.handleAdded(world, pos, this); RotationPropagator.handleAdded(level, worldPosition, this);
} }
public void detachKinetics() { public void detachKinetics() {
RotationPropagator.handleRemoved(world, pos, this); RotationPropagator.handleRemoved(level, worldPosition, this);
} }
public boolean isSpeedRequirementFulfilled() { public boolean isSpeedRequirementFulfilled() {
@ -362,17 +362,17 @@ public abstract class KineticTileEntity extends SmartTileEntity
} }
public static void switchToBlockState(World world, BlockPos pos, BlockState state) { public static void switchToBlockState(World world, BlockPos pos, BlockState state) {
if (world.isRemote) if (world.isClientSide)
return; return;
TileEntity tileEntityIn = world.getTileEntity(pos); TileEntity tileEntityIn = world.getBlockEntity(pos);
BlockState currentState = world.getBlockState(pos); BlockState currentState = world.getBlockState(pos);
boolean isKinetic = tileEntityIn instanceof KineticTileEntity; boolean isKinetic = tileEntityIn instanceof KineticTileEntity;
if (currentState == state) if (currentState == state)
return; return;
if (tileEntityIn == null || !isKinetic) { if (tileEntityIn == null || !isKinetic) {
world.setBlockState(pos, state, 3); world.setBlock(pos, state, 3);
return; return;
} }
@ -386,7 +386,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
tileEntity.removeSource(); tileEntity.removeSource();
} }
world.setBlockState(pos, state, 3); world.setBlock(pos, state, 3);
} }
@Override @Override
@ -397,27 +397,27 @@ public abstract class KineticTileEntity extends SmartTileEntity
boolean notFastEnough = !isSpeedRequirementFulfilled() && getSpeed() != 0; boolean notFastEnough = !isSpeedRequirementFulfilled() && getSpeed() != 0;
if (overStressed && AllConfigs.CLIENT.enableOverstressedTooltip.get()) { if (overStressed && AllConfigs.CLIENT.enableOverstressedTooltip.get()) {
tooltip.add(componentSpacing.copy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.stressometer.overstressed") .append(Lang.translate("gui.stressometer.overstressed")
.formatted(GOLD))); .withStyle(GOLD)));
ITextComponent hint = Lang.translate("gui.contraptions.network_overstressed"); ITextComponent hint = Lang.translate("gui.contraptions.network_overstressed");
List<ITextComponent> cutString = TooltipHelper.cutTextComponent(hint, GRAY, TextFormatting.WHITE); List<ITextComponent> cutString = TooltipHelper.cutTextComponent(hint, GRAY, TextFormatting.WHITE);
for (int i = 0; i < cutString.size(); i++) for (int i = 0; i < cutString.size(); i++)
tooltip.add(componentSpacing.copy() tooltip.add(componentSpacing.plainCopy()
.append(cutString.get(i))); .append(cutString.get(i)));
return true; return true;
} }
if (notFastEnough) { if (notFastEnough) {
tooltip.add(componentSpacing.copy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.speedRequirement") .append(Lang.translate("tooltip.speedRequirement")
.formatted(GOLD))); .withStyle(GOLD)));
ITextComponent hint = ITextComponent hint =
Lang.translate("gui.contraptions.not_fast_enough", I18n.format(getBlockState().getBlock() Lang.translate("gui.contraptions.not_fast_enough", I18n.get(getBlockState().getBlock()
.getTranslationKey())); .getDescriptionId()));
List<ITextComponent> cutString = TooltipHelper.cutTextComponent(hint, GRAY, TextFormatting.WHITE); List<ITextComponent> cutString = TooltipHelper.cutTextComponent(hint, GRAY, TextFormatting.WHITE);
for (int i = 0; i < cutString.size(); i++) for (int i = 0; i < cutString.size(); i++)
tooltip.add(componentSpacing.copy() tooltip.add(componentSpacing.plainCopy()
.append(cutString.get(i))); .append(cutString.get(i)));
return true; return true;
} }
@ -431,21 +431,21 @@ public abstract class KineticTileEntity extends SmartTileEntity
float stressAtBase = calculateStressApplied(); float stressAtBase = calculateStressApplied();
if (calculateStressApplied() != 0 && StressImpact.isEnabled()) { if (calculateStressApplied() != 0 && StressImpact.isEnabled()) {
tooltip.add(componentSpacing.copy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.goggles.kinetic_stats"))); .append(Lang.translate("gui.goggles.kinetic_stats")));
tooltip.add(componentSpacing.copy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.stressImpact") .append(Lang.translate("tooltip.stressImpact")
.formatted(TextFormatting.GRAY))); .withStyle(TextFormatting.GRAY)));
float stressTotal = stressAtBase * Math.abs(getTheoreticalSpeed()); float stressTotal = stressAtBase * Math.abs(getTheoreticalSpeed());
tooltip.add(componentSpacing.copy() tooltip.add(componentSpacing.plainCopy()
.append(new StringTextComponent(" " + IHaveGoggleInformation.format(stressTotal)) .append(new StringTextComponent(" " + IHaveGoggleInformation.format(stressTotal))
.append(Lang.translate("generic.unit.stress")) .append(Lang.translate("generic.unit.stress"))
.append(" ") .append(" ")
.formatted(TextFormatting.AQUA)) .withStyle(TextFormatting.AQUA))
.append(Lang.translate("gui.goggles.at_current_speed") .append(Lang.translate("gui.goggles.at_current_speed")
.formatted(TextFormatting.DARK_GRAY))); .withStyle(TextFormatting.DARK_GRAY)));
added = true; added = true;
} }
@ -526,13 +526,13 @@ public abstract class KineticTileEntity extends SmartTileEntity
return neighbours; return neighbours;
Axis axis = block.getRotationAxis(state); Axis axis = block.getRotationAxis(state);
BlockPos.getAllInBox(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1)) BlockPos.betweenClosedStream(new BlockPos(-1, -1, -1), new BlockPos(1, 1, 1))
.forEach(offset -> { .forEach(offset -> {
if (axis.getCoordinate(offset.getX(), offset.getY(), offset.getZ()) != 0) if (axis.choose(offset.getX(), offset.getY(), offset.getZ()) != 0)
return; return;
if (offset.distanceSq(0, 0, 0, false) != BlockPos.ZERO.distanceSq(1, 1, 0, false)) if (offset.distSqr(0, 0, 0, false) != BlockPos.ZERO.distSqr(1, 1, 0, false))
return; return;
neighbours.add(pos.add(offset)); neighbours.add(worldPosition.offset(offset));
}); });
return neighbours; return neighbours;
} }
@ -560,7 +560,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
@Override @Override
public void requestModelDataUpdate() { public void requestModelDataUpdate() {
super.requestModelDataUpdate(); super.requestModelDataUpdate();
if (!this.removed) if (!this.remove)
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> InstancedRenderDispatcher.enqueueUpdate(this)); DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> InstancedRenderDispatcher.enqueueUpdate(this));
} }
@ -586,15 +586,16 @@ public abstract class KineticTileEntity extends SmartTileEntity
float pitch = MathHelper.clamp((componentSpeed / 256f) + .45f, .85f, 1f); float pitch = MathHelper.clamp((componentSpeed / 256f) + .45f, .85f, 1f);
if (isNoisy()) if (isNoisy())
SoundScapes.play(AmbienceGroup.KINETIC, pos, pitch); SoundScapes.play(AmbienceGroup.KINETIC, worldPosition, pitch);
Block block = getBlockState().getBlock(); Block block = getBlockState().getBlock();
if (ICogWheel.isSmallCog(block) || ICogWheel.isLargeCog(block) || block instanceof GearboxBlock) if (ICogWheel.isSmallCog(block) || ICogWheel.isLargeCog(block) || block instanceof GearboxBlock)
SoundScapes.play(AmbienceGroup.COG, pos, pitch); SoundScapes.play(AmbienceGroup.COG, worldPosition, pitch);
} }
protected boolean isNoisy() { protected boolean isNoisy() {
return true; return true;
} }
} }

View file

@ -39,9 +39,9 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
@Override @Override
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) { int light, int overlay) {
if (Backend.getInstance().canUseInstancing(te.getWorld())) return; if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
for (RenderType type : RenderType.getBlockLayers()) for (RenderType type : RenderType.chunkBufferLayers())
if (RenderTypeLookup.canRenderInLayer(te.getBlockState(), type)) if (RenderTypeLookup.canRenderInLayer(te.getBlockState(), type))
renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(type), light); renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(type), light);
} }
@ -58,7 +58,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
} }
public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) { public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) {
float time = AnimationTickHolder.getRenderTime(te.getWorld()); float time = AnimationTickHolder.getRenderTime(te.getLevel());
float offset = getRotationOffsetForPosition(te, pos, axis); float offset = getRotationOffsetForPosition(te, pos, axis);
float angle = ((time * te.getSpeed() * 3f / 10 + offset) % 360) / 180 * (float) Math.PI; float angle = ((time * te.getSpeed() * 3f / 10 + offset) % 360) / 180 * (float) Math.PI;
return angle; return angle;
@ -66,7 +66,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
public static SuperByteBuffer standardKineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te, public static SuperByteBuffer standardKineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te,
int light) { int light) {
final BlockPos pos = te.getPos(); final BlockPos pos = te.getBlockPos();
Axis axis = ((IRotate) te.getBlockState() Axis axis = ((IRotate) te.getBlockState()
.getBlock()).getRotationAxis(te.getBlockState()); .getBlock()).getRotationAxis(te.getBlockState());
return kineticRotationTransform(buffer, te, axis, getAngleForTe(te, pos, axis), light); return kineticRotationTransform(buffer, te, axis, getAngleForTe(te, pos, axis), light);
@ -75,7 +75,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
public static SuperByteBuffer kineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te, Axis axis, public static SuperByteBuffer kineticRotationTransform(SuperByteBuffer buffer, KineticTileEntity te, Axis axis,
float angle, int light) { float angle, int light) {
buffer.light(light); buffer.light(light);
buffer.rotateCentered(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis), angle); buffer.rotateCentered(Direction.get(AxisDirection.POSITIVE, axis), angle);
int white = 0xFFFFFF; int white = 0xFFFFFF;
if (KineticDebugger.isActive()) { if (KineticDebugger.isActive()) {
@ -107,7 +107,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
public static BlockState shaft(Axis axis) { public static BlockState shaft(Axis axis) {
return AllBlocks.SHAFT.getDefaultState() return AllBlocks.SHAFT.getDefaultState()
.with(BlockStateProperties.AXIS, axis); .setValue(BlockStateProperties.AXIS, axis);
} }
public static Axis getRotationAxisOf(KineticTileEntity te) { public static Axis getRotationAxisOf(KineticTileEntity te) {

View file

@ -90,6 +90,6 @@ public abstract class KineticTileInstance<T extends KineticTileEntity> extends T
public static BlockState shaft(Direction.Axis axis) { public static BlockState shaft(Direction.Axis axis) {
return AllBlocks.SHAFT.getDefaultState() return AllBlocks.SHAFT.getDefaultState()
.with(ShaftBlock.AXIS, axis); .setValue(ShaftBlock.AXIS, axis);
} }
} }

View file

@ -12,14 +12,16 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Rotation; import net.minecraft.util.Rotation;
import net.minecraft.block.AbstractBlock.Properties;
public abstract class RotatedPillarKineticBlock extends KineticBlock { public abstract class RotatedPillarKineticBlock extends KineticBlock {
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS; public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;
public RotatedPillarKineticBlock(Properties properties) { public RotatedPillarKineticBlock(Properties properties) {
super(properties); super(properties);
this.setDefaultState(this.getDefaultState() this.registerDefaultState(this.defaultBlockState()
.with(AXIS, Direction.Axis.Y)); .setValue(AXIS, Direction.Axis.Y));
} }
@Override @Override
@ -27,11 +29,11 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
switch (rot) { switch (rot) {
case COUNTERCLOCKWISE_90: case COUNTERCLOCKWISE_90:
case CLOCKWISE_90: case CLOCKWISE_90:
switch (state.get(AXIS)) { switch (state.getValue(AXIS)) {
case X: case X:
return state.with(AXIS, Direction.Axis.Z); return state.setValue(AXIS, Direction.Axis.Z);
case Z: case Z:
return state.with(AXIS, Direction.Axis.X); return state.setValue(AXIS, Direction.Axis.X);
default: default:
return state; return state;
} }
@ -43,12 +45,12 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
public static Axis getPreferredAxis(BlockItemUseContext context) { public static Axis getPreferredAxis(BlockItemUseContext context) {
Axis prefferedAxis = null; Axis prefferedAxis = null;
for (Direction side : Iterate.directions) { for (Direction side : Iterate.directions) {
BlockState blockState = context.getWorld() BlockState blockState = context.getLevel()
.getBlockState(context.getPos() .getBlockState(context.getClickedPos()
.offset(side)); .relative(side));
if (blockState.getBlock() instanceof IRotate) { if (blockState.getBlock() instanceof IRotate) {
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getWorld(), context.getPos() if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getLevel(), context.getClickedPos()
.offset(side), blockState, side.getOpposite())) .relative(side), blockState, side.getOpposite()))
if (prefferedAxis != null && prefferedAxis != side.getAxis()) { if (prefferedAxis != null && prefferedAxis != side.getAxis()) {
prefferedAxis = null; prefferedAxis = null;
break; break;
@ -61,7 +63,7 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> builder) {
builder.add(AXIS); builder.add(AXIS);
} }
@ -69,12 +71,12 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
Axis preferredAxis = getPreferredAxis(context); Axis preferredAxis = getPreferredAxis(context);
if (preferredAxis != null && (context.getPlayer() == null || !context.getPlayer() if (preferredAxis != null && (context.getPlayer() == null || !context.getPlayer()
.isSneaking())) .isShiftKeyDown()))
return this.getDefaultState() return this.defaultBlockState()
.with(AXIS, preferredAxis); .setValue(AXIS, preferredAxis);
return this.getDefaultState() return this.defaultBlockState()
.with(AXIS, preferredAxis != null && context.getPlayer() .setValue(AXIS, preferredAxis != null && context.getPlayer()
.isSneaking() ? context.getFace() .isShiftKeyDown() ? context.getClickedFace()
.getAxis() .getAxis()
: context.getNearestLookingDirection() : context.getNearestLookingDirection()
.getAxis()); .getAxis());

View file

@ -16,13 +16,13 @@ public class RotatingData extends KineticData {
} }
public RotatingData setRotationAxis(Direction.Axis axis) { public RotatingData setRotationAxis(Direction.Axis axis) {
Direction orientation = Direction.getFacingFromAxis(Direction.AxisDirection.POSITIVE, axis); Direction orientation = Direction.get(Direction.AxisDirection.POSITIVE, axis);
setRotationAxis(orientation.getUnitVector()); setRotationAxis(orientation.step());
return this; return this;
} }
public RotatingData setRotationAxis(Vector3f axis) { public RotatingData setRotationAxis(Vector3f axis) {
setRotationAxis(axis.getX(), axis.getY(), axis.getZ()); setRotationAxis(axis.x(), axis.y(), axis.z());
return this; return this;
} }

View file

@ -12,6 +12,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.item.Item.Properties;
public class AssemblyOperatorBlockItem extends BlockItem { public class AssemblyOperatorBlockItem extends BlockItem {
public AssemblyOperatorBlockItem(Block block, Properties builder) { public AssemblyOperatorBlockItem(Block block, Properties builder) {
@ -19,15 +21,15 @@ public class AssemblyOperatorBlockItem extends BlockItem {
} }
@Override @Override
public ActionResultType tryPlace(BlockItemUseContext context) { public ActionResultType place(BlockItemUseContext context) {
BlockPos placedOnPos = context.getPos() BlockPos placedOnPos = context.getClickedPos()
.offset(context.getFace() .relative(context.getClickedFace()
.getOpposite()); .getOpposite());
BlockState placedOnState = context.getWorld() BlockState placedOnState = context.getLevel()
.getBlockState(placedOnPos); .getBlockState(placedOnPos);
if (operatesOn(placedOnState)) { if (operatesOn(placedOnState)) {
if (context.getWorld() if (context.getLevel()
.getBlockState(placedOnPos.up(2)) .getBlockState(placedOnPos.above(2))
.getMaterial() .getMaterial()
.isReplaceable()) .isReplaceable())
context = adjustContext(context, placedOnPos); context = adjustContext(context, placedOnPos);
@ -35,12 +37,12 @@ public class AssemblyOperatorBlockItem extends BlockItem {
return ActionResultType.FAIL; return ActionResultType.FAIL;
} }
return super.tryPlace(context); return super.place(context);
} }
protected BlockItemUseContext adjustContext(BlockItemUseContext context, BlockPos placedOnPos) { protected BlockItemUseContext adjustContext(BlockItemUseContext context, BlockPos placedOnPos) {
BlockPos up = placedOnPos.up(2); BlockPos up = placedOnPos.above(2);
return new AssemblyOperatorUseContext(context.getWorld(), context.getPlayer(), context.getHand(), context.getItem(), new BlockRayTraceResult(new Vector3d((double)up.getX() + 0.5D + (double) Direction.UP.getXOffset() * 0.5D, (double)up.getY() + 0.5D + (double) Direction.UP.getYOffset() * 0.5D, (double)up.getZ() + 0.5D + (double) Direction.UP.getZOffset() * 0.5D), Direction.UP, up, false)); return new AssemblyOperatorUseContext(context.getLevel(), context.getPlayer(), context.getHand(), context.getItemInHand(), new BlockRayTraceResult(new Vector3d((double)up.getX() + 0.5D + (double) Direction.UP.getStepX() * 0.5D, (double)up.getY() + 0.5D + (double) Direction.UP.getStepY() * 0.5D, (double)up.getZ() + 0.5D + (double) Direction.UP.getStepZ() * 0.5D), Direction.UP, up, false));
} }
protected boolean operatesOn(BlockState placedOnState) { protected boolean operatesOn(BlockState placedOnState) {

View file

@ -66,7 +66,7 @@ public class ActorData extends InstanceData {
} }
public ActorData setRotationAxis(Vector3f axis) { public ActorData setRotationAxis(Vector3f axis) {
setRotationAxis(axis.getX(), axis.getY(), axis.getZ()); setRotationAxis(axis.x(), axis.y(), axis.z());
return this; return this;
} }
@ -79,7 +79,7 @@ public class ActorData extends InstanceData {
} }
public ActorData setRotationCenter(Vector3f axis) { public ActorData setRotationCenter(Vector3f axis) {
setRotationCenter(axis.getX(), axis.getY(), axis.getZ()); setRotationCenter(axis.x(), axis.y(), axis.z());
return this; return this;
} }
@ -92,10 +92,10 @@ public class ActorData extends InstanceData {
} }
public ActorData setLocalRotation(Quaternion q) { public ActorData setLocalRotation(Quaternion q) {
this.qX = q.getX(); this.qX = q.i();
this.qY = q.getY(); this.qY = q.j();
this.qZ = q.getZ(); this.qZ = q.k();
this.qW = q.getW(); this.qW = q.r();
markDirty(); markDirty();
return this; return this;
} }

View file

@ -22,6 +22,8 @@ import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.block.AbstractBlock.Properties;
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
public abstract class AttachedActorBlock extends HorizontalBlock implements IWrenchable { public abstract class AttachedActorBlock extends HorizontalBlock implements IWrenchable {
@ -37,41 +39,41 @@ public abstract class AttachedActorBlock extends HorizontalBlock implements IWre
@Override @Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
Direction direction = state.get(HORIZONTAL_FACING); Direction direction = state.getValue(FACING);
return AllShapes.HARVESTER_BASE.get(direction); return AllShapes.HARVESTER_BASE.get(direction);
} }
@Override @Override
protected void fillStateContainer(Builder<Block, BlockState> builder) { protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
builder.add(HORIZONTAL_FACING); builder.add(FACING);
super.fillStateContainer(builder); super.createBlockStateDefinition(builder);
} }
@Override @Override
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { public boolean canSurvive(BlockState state, IWorldReader worldIn, BlockPos pos) {
Direction direction = state.get(HORIZONTAL_FACING); Direction direction = state.getValue(FACING);
BlockPos offset = pos.offset(direction.getOpposite()); BlockPos offset = pos.relative(direction.getOpposite());
return BlockHelper.hasBlockSolidSide(worldIn.getBlockState(offset), worldIn, offset, direction); return BlockHelper.hasBlockSolidSide(worldIn.getBlockState(offset), worldIn, offset, direction);
} }
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
Direction facing; Direction facing;
if (context.getFace().getAxis().isVertical()) if (context.getClickedFace().getAxis().isVertical())
facing = context.getPlacementHorizontalFacing().getOpposite(); facing = context.getHorizontalDirection().getOpposite();
else { else {
BlockState blockState = BlockState blockState =
context.getWorld().getBlockState(context.getPos().offset(context.getFace().getOpposite())); context.getLevel().getBlockState(context.getClickedPos().relative(context.getClickedFace().getOpposite()));
if (blockState.getBlock() instanceof AttachedActorBlock) if (blockState.getBlock() instanceof AttachedActorBlock)
facing = blockState.get(HORIZONTAL_FACING); facing = blockState.getValue(FACING);
else else
facing = context.getFace(); facing = context.getClickedFace();
} }
return getDefaultState().with(HORIZONTAL_FACING, facing); return defaultBlockState().setValue(FACING, facing);
} }
@Override @Override
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) { public boolean isPathfindable(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
return false; return false;
} }

View file

@ -20,7 +20,7 @@ public class BellMovementBehaviour extends MovementBehaviour {
@Override @Override
public void onSpeedChanged(MovementContext context, Vector3d oldMotion, Vector3d motion) { public void onSpeedChanged(MovementContext context, Vector3d oldMotion, Vector3d motion) {
double dotProduct = oldMotion.dotProduct(motion); double dotProduct = oldMotion.dot(motion);
if (dotProduct <= 0 && (context.relativeMotion.length() != 0) || context.firstMovement) if (dotProduct <= 0 && (context.relativeMotion.length() != 0) || context.firstMovement)
playSound(context); playSound(context);
@ -41,7 +41,7 @@ public class BellMovementBehaviour extends MovementBehaviour {
((AbstractBellBlock<?>) block).playSound(world, pos); ((AbstractBellBlock<?>) block).playSound(world, pos);
} else { } else {
// Vanilla bell sound // Vanilla bell sound
world.playSound(null, pos, SoundEvents.BLOCK_BELL_USE, world.playSound(null, pos, SoundEvents.BELL_BLOCK,
SoundCategory.BLOCKS, 2f, 1f); SoundCategory.BLOCKS, 2f, 1f);
} }
} }

View file

@ -77,17 +77,17 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
} }
@Override @Override
public void remove() { public void setRemoved() {
if (!world.isRemote && destroyProgress != 0) if (!level.isClientSide && destroyProgress != 0)
world.sendBlockBreakProgress(breakerId, breakingPos, -1); level.destroyBlockProgress(breakerId, breakingPos, -1);
super.remove(); super.setRemoved();
} }
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
if (world.isRemote) if (level.isClientSide)
return; return;
if (!shouldRun()) if (!shouldRun())
return; return;
@ -101,31 +101,31 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
if (ticksUntilNextProgress-- > 0) if (ticksUntilNextProgress-- > 0)
return; return;
BlockState stateToBreak = world.getBlockState(breakingPos); BlockState stateToBreak = level.getBlockState(breakingPos);
float blockHardness = stateToBreak.getBlockHardness(world, breakingPos); float blockHardness = stateToBreak.getDestroySpeed(level, breakingPos);
if (!canBreak(stateToBreak, blockHardness)) { if (!canBreak(stateToBreak, blockHardness)) {
if (destroyProgress != 0) { if (destroyProgress != 0) {
destroyProgress = 0; destroyProgress = 0;
world.sendBlockBreakProgress(breakerId, breakingPos, -1); level.destroyBlockProgress(breakerId, breakingPos, -1);
} }
return; return;
} }
float breakSpeed = getBreakSpeed(); float breakSpeed = getBreakSpeed();
destroyProgress += MathHelper.clamp((int) (breakSpeed / blockHardness), 1, 10 - destroyProgress); destroyProgress += MathHelper.clamp((int) (breakSpeed / blockHardness), 1, 10 - destroyProgress);
world.playSound(null, pos, stateToBreak.getSoundType().getHitSound(), SoundCategory.NEUTRAL, .25f, 1); level.playSound(null, worldPosition, stateToBreak.getSoundType().getHitSound(), SoundCategory.NEUTRAL, .25f, 1);
if (destroyProgress >= 10) { if (destroyProgress >= 10) {
onBlockBroken(stateToBreak); onBlockBroken(stateToBreak);
destroyProgress = 0; destroyProgress = 0;
ticksUntilNextProgress = -1; ticksUntilNextProgress = -1;
world.sendBlockBreakProgress(breakerId, breakingPos, -1); level.destroyBlockProgress(breakerId, breakingPos, -1);
return; return;
} }
ticksUntilNextProgress = (int) (blockHardness / breakSpeed); ticksUntilNextProgress = (int) (blockHardness / breakSpeed);
world.sendBlockBreakProgress(breakerId, breakingPos, (int) destroyProgress); level.destroyBlockProgress(breakerId, breakingPos, (int) destroyProgress);
} }
public boolean canBreak(BlockState stateToBreak, float blockHardness) { public boolean canBreak(BlockState stateToBreak, float blockHardness) {
@ -138,23 +138,23 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
} }
public void onBlockBroken(BlockState stateToBreak) { public void onBlockBroken(BlockState stateToBreak) {
FluidState FluidState = world.getFluidState(breakingPos); FluidState FluidState = level.getFluidState(breakingPos);
world.playEvent(2001, breakingPos, Block.getStateId(stateToBreak)); level.levelEvent(2001, breakingPos, Block.getId(stateToBreak));
TileEntity tileentity = stateToBreak.hasTileEntity() ? world.getTileEntity(breakingPos) : null; TileEntity tileentity = stateToBreak.hasTileEntity() ? level.getBlockEntity(breakingPos) : null;
Vector3d vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), world.rand, .125f); Vector3d vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), level.random, .125f);
Block.getDrops(stateToBreak, (ServerWorld) world, breakingPos, tileentity).forEach((stack) -> { Block.getDrops(stateToBreak, (ServerWorld) level, breakingPos, tileentity).forEach((stack) -> {
if (!stack.isEmpty() && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS) if (!stack.isEmpty() && level.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)
&& !world.restoringBlockSnapshots) { && !level.restoringBlockSnapshots) {
ItemEntity itementity = new ItemEntity(world, vec.x, vec.y, vec.z, stack); ItemEntity itementity = new ItemEntity(level, vec.x, vec.y, vec.z, stack);
itementity.setDefaultPickupDelay(); itementity.setDefaultPickUpDelay();
itementity.setMotion(Vector3d.ZERO); itementity.setDeltaMovement(Vector3d.ZERO);
world.addEntity(itementity); level.addFreshEntity(itementity);
} }
}); });
if (world instanceof ServerWorld) if (level instanceof ServerWorld)
stateToBreak.spawnAdditionalDrops((ServerWorld) world, breakingPos, ItemStack.EMPTY); stateToBreak.spawnAfterBreak((ServerWorld) level, breakingPos, ItemStack.EMPTY);
world.setBlockState(breakingPos, FluidState.getBlockState(), 3); level.setBlock(breakingPos, FluidState.createLegacyBlock(), 3);
} }
protected float getBreakSpeed() { protected float getBreakSpeed() {

View file

@ -25,7 +25,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
@Override @Override
public void startMoving(MovementContext context) { public void startMoving(MovementContext context) {
if (context.world.isRemote) if (context.world.isClientSide)
return; return;
context.data.putInt("BreakerId", -BlockBreakingKineticTileEntity.NEXT_BREAKER_ID.incrementAndGet()); context.data.putInt("BreakerId", -BlockBreakingKineticTileEntity.NEXT_BREAKER_ID.incrementAndGet());
} }
@ -35,9 +35,9 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
World world = context.world; World world = context.world;
BlockState stateVisited = world.getBlockState(pos); BlockState stateVisited = world.getBlockState(pos);
if (!stateVisited.isNormalCube(world, pos)) if (!stateVisited.isRedstoneConductor(world, pos))
damageEntities(context, pos, world); damageEntities(context, pos, world);
if (world.isRemote) if (world.isClientSide)
return; return;
if (!canBreak(world, pos, stateVisited)) if (!canBreak(world, pos, stateVisited))
return; return;
@ -50,29 +50,29 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
DamageSource damageSource = getDamageSource(); DamageSource damageSource = getDamageSource();
if (damageSource == null && !throwsEntities()) if (damageSource == null && !throwsEntities())
return; return;
Entities: for (Entity entity : world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos))) { Entities: for (Entity entity : world.getEntitiesOfClass(Entity.class, new AxisAlignedBB(pos))) {
if (entity instanceof ItemEntity) if (entity instanceof ItemEntity)
continue; continue;
if (entity instanceof AbstractContraptionEntity) if (entity instanceof AbstractContraptionEntity)
continue; continue;
if (entity instanceof AbstractMinecartEntity) if (entity instanceof AbstractMinecartEntity)
for (Entity passenger : entity.getRecursivePassengers()) for (Entity passenger : entity.getIndirectPassengers())
if (passenger instanceof AbstractContraptionEntity if (passenger instanceof AbstractContraptionEntity
&& ((AbstractContraptionEntity) passenger).getContraption() == context.contraption) && ((AbstractContraptionEntity) passenger).getContraption() == context.contraption)
continue Entities; continue Entities;
if (damageSource != null && !world.isRemote) { if (damageSource != null && !world.isClientSide) {
float damage = (float) MathHelper.clamp(6 * Math.pow(context.relativeMotion.length(), 0.4) + 1, 2, 10); float damage = (float) MathHelper.clamp(6 * Math.pow(context.relativeMotion.length(), 0.4) + 1, 2, 10);
entity.attackEntityFrom(damageSource, damage); entity.hurt(damageSource, damage);
} }
if (throwsEntities() && (world.isRemote == (entity instanceof PlayerEntity))) { if (throwsEntities() && (world.isClientSide == (entity instanceof PlayerEntity))) {
Vector3d motionBoost = context.motion.add(0, context.motion.length() / 4f, 0); Vector3d motionBoost = context.motion.add(0, context.motion.length() / 4f, 0);
int maxBoost = 4; int maxBoost = 4;
if (motionBoost.length() > maxBoost) { if (motionBoost.length() > maxBoost) {
motionBoost = motionBoost.subtract(motionBoost.normalize().scale(motionBoost.length() - maxBoost)); motionBoost = motionBoost.subtract(motionBoost.normalize().scale(motionBoost.length() - maxBoost));
} }
entity.setMotion(entity.getMotion().add(motionBoost)); entity.setDeltaMovement(entity.getDeltaMovement().add(motionBoost));
entity.velocityChanged = true; entity.hurtMarked = true;
} }
} }
} }
@ -88,7 +88,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
@Override @Override
public void stopMoving(MovementContext context) { public void stopMoving(MovementContext context) {
CompoundNBT data = context.data; CompoundNBT data = context.data;
if (context.world.isRemote) if (context.world.isClientSide)
return; return;
if (!data.contains("BreakingPos")) if (!data.contains("BreakingPos"))
return; return;
@ -102,7 +102,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
data.remove("BreakingPos"); data.remove("BreakingPos");
context.stall = false; context.stall = false;
world.sendBlockBreakProgress(id, breakingPos, -1); world.destroyBlockProgress(id, breakingPos, -1);
} }
@Override @Override
@ -129,7 +129,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
public void tickBreaker(MovementContext context) { public void tickBreaker(MovementContext context) {
CompoundNBT data = context.data; CompoundNBT data = context.data;
if (context.world.isRemote) if (context.world.isClientSide)
return; return;
if (!data.contains("BreakingPos")) if (!data.contains("BreakingPos"))
return; return;
@ -149,7 +149,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
int destroyProgress = data.getInt("Progress"); int destroyProgress = data.getInt("Progress");
int id = data.getInt("BreakerId"); int id = data.getInt("BreakerId");
BlockState stateToBreak = world.getBlockState(breakingPos); BlockState stateToBreak = world.getBlockState(breakingPos);
float blockHardness = stateToBreak.getBlockHardness(world, breakingPos); float blockHardness = stateToBreak.getDestroySpeed(world, breakingPos);
if (!canBreak(world, breakingPos, stateToBreak)) { if (!canBreak(world, breakingPos, stateToBreak)) {
if (destroyProgress != 0) { if (destroyProgress != 0) {
@ -157,7 +157,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
data.remove("Progress"); data.remove("Progress");
data.remove("TicksUntilNextProgress"); data.remove("TicksUntilNextProgress");
data.remove("BreakingPos"); data.remove("BreakingPos");
world.sendBlockBreakProgress(id, breakingPos, -1); world.destroyBlockProgress(id, breakingPos, -1);
} }
context.stall = false; context.stall = false;
return; return;
@ -168,14 +168,14 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
world.playSound(null, breakingPos, stateToBreak.getSoundType().getHitSound(), SoundCategory.NEUTRAL, .25f, 1); world.playSound(null, breakingPos, stateToBreak.getSoundType().getHitSound(), SoundCategory.NEUTRAL, .25f, 1);
if (destroyProgress >= 10) { if (destroyProgress >= 10) {
world.sendBlockBreakProgress(id, breakingPos, -1); world.destroyBlockProgress(id, breakingPos, -1);
// break falling blocks from top to bottom // break falling blocks from top to bottom
BlockPos ogPos = breakingPos; BlockPos ogPos = breakingPos;
BlockState stateAbove = world.getBlockState(breakingPos.up()); BlockState stateAbove = world.getBlockState(breakingPos.above());
while (stateAbove.getBlock() instanceof FallingBlock) { while (stateAbove.getBlock() instanceof FallingBlock) {
breakingPos = breakingPos.up(); breakingPos = breakingPos.above();
stateAbove = world.getBlockState(breakingPos.up()); stateAbove = world.getBlockState(breakingPos.above());
} }
stateToBreak = world.getBlockState(breakingPos); stateToBreak = world.getBlockState(breakingPos);
@ -191,7 +191,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
} }
ticksUntilNextProgress = (int) (blockHardness / breakSpeed); ticksUntilNextProgress = (int) (blockHardness / breakSpeed);
world.sendBlockBreakProgress(id, breakingPos, (int) destroyProgress); world.destroyBlockProgress(id, breakingPos, (int) destroyProgress);
data.putInt("TicksUntilNextProgress", ticksUntilNextProgress); data.putInt("TicksUntilNextProgress", ticksUntilNextProgress);
data.putInt("Progress", destroyProgress); data.putInt("Progress", destroyProgress);
} }
@ -201,7 +201,7 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
} }
public boolean canBreak(World world, BlockPos breakingPos, BlockState state) { public boolean canBreak(World world, BlockPos breakingPos, BlockState state) {
float blockHardness = state.getBlockHardness(world, breakingPos); float blockHardness = state.getDestroySpeed(world, breakingPos);
return BlockBreakingKineticTileEntity.isBreakable(state, blockHardness); return BlockBreakingKineticTileEntity.isBreakable(state, blockHardness);
} }

View file

@ -16,20 +16,20 @@ public class CampfireMovementBehaviour extends MovementBehaviour {
@Override @Override
public void tick(MovementContext context) { public void tick(MovementContext context) {
if (context.world == null || !context.world.isRemote || context.position == null if (context.world == null || !context.world.isClientSide || context.position == null
|| !context.state.get(CampfireBlock.LIT)) || !context.state.getValue(CampfireBlock.LIT))
return; return;
// Mostly copied from CampfireBlock and CampfireTileEntity // Mostly copied from CampfireBlock and CampfireTileEntity
Random random = context.world.rand; Random random = context.world.random;
if (random.nextFloat() < 0.11F) { if (random.nextFloat() < 0.11F) {
for (int i = 0; i < random.nextInt(2) + 2; ++i) { for (int i = 0; i < random.nextInt(2) + 2; ++i) {
context.world.addOptionalParticle( context.world.addAlwaysVisibleParticle(
context.state.get(CampfireBlock.SIGNAL_FIRE) ? ParticleTypes.CAMPFIRE_SIGNAL_SMOKE context.state.getValue(CampfireBlock.SIGNAL_FIRE) ? ParticleTypes.CAMPFIRE_SIGNAL_SMOKE
: ParticleTypes.CAMPFIRE_COSY_SMOKE, : ParticleTypes.CAMPFIRE_COSY_SMOKE,
true, context.position.getX() + random.nextDouble() / (random.nextBoolean() ? 3D : -3D), true, context.position.x() + random.nextDouble() / (random.nextBoolean() ? 3D : -3D),
context.position.getY() + random.nextDouble() + random.nextDouble(), context.position.y() + random.nextDouble() + random.nextDouble(),
context.position.getZ() + random.nextDouble() / (random.nextBoolean() ? 3D : -3D), 0.0D, 0.07D, context.position.z() + random.nextDouble() / (random.nextBoolean() ? 3D : -3D), 0.0D, 0.07D,
0.0D); 0.0D);
} }
} }

View file

@ -26,7 +26,7 @@ public class DrillActorInstance extends ActorInstance {
BlockState state = context.state; BlockState state = context.state;
facing = state.get(DrillBlock.FACING); facing = state.getValue(DrillBlock.FACING);
Direction.Axis axis = facing.getAxis(); Direction.Axis axis = facing.getAxis();
float eulerX = AngleHelper.verticalAngle(facing); float eulerX = AngleHelper.verticalAngle(facing);
@ -35,7 +35,7 @@ public class DrillActorInstance extends ActorInstance {
if (axis == Direction.Axis.Y) if (axis == Direction.Axis.Y)
eulerY = 0; eulerY = 0;
else else
eulerY = facing.getHorizontalAngle() + ((axis == Direction.Axis.X) ? 180 : 0); eulerY = facing.toYRot() + ((axis == Direction.Axis.X) ? 180 : 0);
drillHead = instanceMaterial.getModel(AllBlockPartials.DRILL_HEAD, state).createInstance(); drillHead = instanceMaterial.getModel(AllBlockPartials.DRILL_HEAD, state).createInstance();

View file

@ -27,10 +27,12 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.block.AbstractBlock.Properties;
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
public class DrillBlock extends DirectionalKineticBlock implements ITE<DrillTileEntity> { public class DrillBlock extends DirectionalKineticBlock implements ITE<DrillTileEntity> {
public static DamageSource damageSourceDrill = new DamageSource("create.mechanical_drill").setDamageBypassesArmor(); public static DamageSource damageSourceDrill = new DamageSource("create.mechanical_drill").bypassArmor();
public DrillBlock(Properties properties) { public DrillBlock(Properties properties) {
super(properties); super(properties);
@ -42,15 +44,15 @@ public class DrillBlock extends DirectionalKineticBlock implements ITE<DrillTile
} }
@Override @Override
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) { public void entityInside(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
if (entityIn instanceof ItemEntity) if (entityIn instanceof ItemEntity)
return; return;
if (!new AxisAlignedBB(pos).shrink(.1f).intersects(entityIn.getBoundingBox())) if (!new AxisAlignedBB(pos).deflate(.1f).intersects(entityIn.getBoundingBox()))
return; return;
withTileEntityDo(worldIn, pos, te -> { withTileEntityDo(worldIn, pos, te -> {
if (te.getSpeed() == 0) if (te.getSpeed() == 0)
return; return;
entityIn.attackEntityFrom(damageSourceDrill, (float) getDamage(te.getSpeed())); entityIn.hurt(damageSourceDrill, (float) getDamage(te.getSpeed()));
}); });
} }
@ -61,7 +63,7 @@ public class DrillBlock extends DirectionalKineticBlock implements ITE<DrillTile
@Override @Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return AllShapes.CASING_12PX.get(state.get(FACING)); return AllShapes.CASING_12PX.get(state.getValue(FACING));
} }
@Override @Override
@ -72,16 +74,16 @@ public class DrillBlock extends DirectionalKineticBlock implements ITE<DrillTile
@Override @Override
public Axis getRotationAxis(BlockState state) { public Axis getRotationAxis(BlockState state) {
return state.get(FACING).getAxis(); return state.getValue(FACING).getAxis();
} }
@Override @Override
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) { public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
return face == state.get(FACING).getOpposite(); return face == state.getValue(FACING).getOpposite();
} }
@Override @Override
public PushReaction getPushReaction(BlockState state) { public PushReaction getPistonPushReaction(BlockState state) {
return PushReaction.NORMAL; return PushReaction.NORMAL;
} }
@ -91,7 +93,7 @@ public class DrillBlock extends DirectionalKineticBlock implements ITE<DrillTile
} }
@Override @Override
public boolean allowsMovement(BlockState state, IBlockReader reader, BlockPos pos, PathType type) { public boolean isPathfindable(BlockState state, IBlockReader reader, BlockPos pos, PathType type) {
return false; return false;
} }

View file

@ -21,7 +21,7 @@ public class DrillInstance extends SingleRotatingInstance {
@Override @Override
protected Instancer<RotatingData> getModel() { protected Instancer<RotatingData> getModel() {
BlockState referenceState = tile.getBlockState(); BlockState referenceState = tile.getBlockState();
Direction facing = referenceState.get(FACING); Direction facing = referenceState.getValue(FACING);
return getRotatingMaterial().getModel(AllBlockPartials.DRILL_HEAD, referenceState, facing); return getRotatingMaterial().getModel(AllBlockPartials.DRILL_HEAD, referenceState, facing);
} }
} }

View file

@ -23,14 +23,14 @@ public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
@Override @Override
public boolean isActive(MovementContext context) { public boolean isActive(MovementContext context) {
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.get(DrillBlock.FACING) return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.getValue(DrillBlock.FACING)
.getOpposite()); .getOpposite());
} }
@Override @Override
public Vector3d getActiveAreaOffset(MovementContext context) { public Vector3d getActiveAreaOffset(MovementContext context) {
return Vector3d.of(context.state.get(DrillBlock.FACING) return Vector3d.atLowerCornerOf(context.state.getValue(DrillBlock.FACING)
.getDirectionVec()).scale(.65f); .getNormal()).scale(.65f);
} }
@Override @Override

View file

@ -36,7 +36,7 @@ public class DrillRenderer extends KineticTileEntityRenderer {
ContraptionMatrices matrices, IRenderTypeBuffer buffer) { ContraptionMatrices matrices, IRenderTypeBuffer buffer) {
BlockState state = context.state; BlockState state = context.state;
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.DRILL_HEAD, state); SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.DRILL_HEAD, state);
Direction facing = state.get(DrillBlock.FACING); Direction facing = state.getValue(DrillBlock.FACING);
float speed = (float) (context.contraption.stalled float speed = (float) (context.contraption.stalled
|| !VecHelper.isVecPointingTowards(context.relativeMotion, facing || !VecHelper.isVecPointingTowards(context.relativeMotion, facing
@ -45,7 +45,7 @@ public class DrillRenderer extends KineticTileEntityRenderer {
float angle = (float) (((time * speed) % 360)); float angle = (float) (((time * speed) % 360));
MatrixStack m = matrices.contraptionStack; MatrixStack m = matrices.contraptionStack;
m.push(); m.pushPose();
MatrixStacker.of(m) MatrixStacker.of(m)
.centre() .centre()
.rotateY(AngleHelper.horizontalAngle(facing)) .rotateY(AngleHelper.horizontalAngle(facing))
@ -57,9 +57,9 @@ public class DrillRenderer extends KineticTileEntityRenderer {
.transform(m) .transform(m)
.light(matrices.entityMatrix, .light(matrices.entityMatrix,
ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld)) ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld))
.renderInto(matrices.entityStack, buffer.getBuffer(RenderType.getSolid())); .renderInto(matrices.entityStack, buffer.getBuffer(RenderType.solid()));
m.pop(); m.popPose();
} }
} }

View file

@ -11,7 +11,7 @@ public class DrillTileEntity extends BlockBreakingKineticTileEntity {
@Override @Override
protected BlockPos getBreakingPos() { protected BlockPos getBreakingPos() {
return getPos().offset(getBlockState().get(DrillBlock.FACING)); return getBlockPos().relative(getBlockState().getValue(DrillBlock.FACING));
} }
} }

View file

@ -40,11 +40,11 @@ public class HarvesterActorInstance extends ActorInstance {
BlockState state = context.state; BlockState state = context.state;
facing = state.get(HORIZONTAL_FACING); facing = state.getValue(HORIZONTAL_FACING);
harvester = instanceMaterial.getModel(AllBlockPartials.HARVESTER_BLADE, state).createInstance(); harvester = instanceMaterial.getModel(AllBlockPartials.HARVESTER_BLADE, state).createInstance();
horizontalAngle = facing.getHorizontalAngle() + ((facing.getAxis() == Direction.Axis.X) ? 180 : 0); horizontalAngle = facing.toYRot() + ((facing.getAxis() == Direction.Axis.X) ? 180 : 0);
harvester.setBlockLight(localBlockLight()); harvester.setBlockLight(localBlockLight());
} }

View file

@ -6,6 +6,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.block.AbstractBlock.Properties;
public class HarvesterBlock extends AttachedActorBlock { public class HarvesterBlock extends AttachedActorBlock {
public HarvesterBlock(Properties p_i48377_1_) { public HarvesterBlock(Properties p_i48377_1_) {

View file

@ -1,6 +1,6 @@
package com.simibubi.create.content.contraptions.components.actors; package com.simibubi.create.content.contraptions.components.actors;
import static net.minecraft.block.HorizontalBlock.HORIZONTAL_FACING; import static net.minecraft.block.HorizontalBlock.FACING;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -38,7 +38,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
@Override @Override
public boolean isActive(MovementContext context) { public boolean isActive(MovementContext context) {
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.get(HORIZONTAL_FACING) return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.getValue(FACING)
.getOpposite()); .getOpposite());
} }
@ -62,8 +62,8 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
@Override @Override
public Vector3d getActiveAreaOffset(MovementContext context) { public Vector3d getActiveAreaOffset(MovementContext context) {
return Vector3d.of(context.state.get(HORIZONTAL_FACING) return Vector3d.atLowerCornerOf(context.state.getValue(FACING)
.getDirectionVec()) .getNormal())
.scale(.45); .scale(.45);
} }
@ -73,7 +73,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
BlockState stateVisited = world.getBlockState(pos); BlockState stateVisited = world.getBlockState(pos);
boolean notCropButCuttable = false; boolean notCropButCuttable = false;
if (world.isRemote) if (world.isClientSide)
return; return;
if (!isValidCrop(world, pos, stateVisited)) { if (!isValidCrop(world, pos, stateVisited)) {
@ -86,14 +86,14 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
MutableBoolean seedSubtracted = new MutableBoolean(notCropButCuttable); MutableBoolean seedSubtracted = new MutableBoolean(notCropButCuttable);
BlockState state = stateVisited; BlockState state = stateVisited;
BlockHelper.destroyBlock(world, pos, 1, stack -> { BlockHelper.destroyBlock(world, pos, 1, stack -> {
if (!seedSubtracted.getValue() && stack.isItemEqual(new ItemStack(state.getBlock()))) { if (!seedSubtracted.getValue() && stack.sameItem(new ItemStack(state.getBlock()))) {
stack.shrink(1); stack.shrink(1);
seedSubtracted.setTrue(); seedSubtracted.setTrue();
} }
dropItem(context, stack); dropItem(context, stack);
}); });
world.setBlockState(pos, cutCrop(world, pos, stateVisited)); world.setBlockAndUpdate(pos, cutCrop(world, pos, stateVisited));
} }
private boolean isValidCrop(World world, BlockPos pos, BlockState state) { private boolean isValidCrop(World world, BlockPos pos, BlockState state) {
@ -109,10 +109,10 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
if (!(property instanceof IntegerProperty)) if (!(property instanceof IntegerProperty))
continue; continue;
if (!property.getName() if (!property.getName()
.equals(BlockStateProperties.AGE_0_1.getName())) .equals(BlockStateProperties.AGE_1.getName()))
continue; continue;
if (((IntegerProperty) property).getAllowedValues() if (((IntegerProperty) property).getPossibleValues()
.size() - 1 != state.get((IntegerProperty) property) .size() - 1 != state.getValue((IntegerProperty) property)
.intValue()) .intValue())
continue; continue;
return true; return true;
@ -139,7 +139,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
if (!(property instanceof IntegerProperty)) if (!(property instanceof IntegerProperty))
continue; continue;
if (!property.getName() if (!property.getName()
.equals(BlockStateProperties.AGE_0_1.getName())) .equals(BlockStateProperties.AGE_1.getName()))
continue; continue;
return false; return false;
} }
@ -155,17 +155,17 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
Block block = state.getBlock(); Block block = state.getBlock();
if (block instanceof CropsBlock) { if (block instanceof CropsBlock) {
CropsBlock crop = (CropsBlock) block; CropsBlock crop = (CropsBlock) block;
return crop.withAge(0); return crop.getStateForAge(0);
} }
if (block == Blocks.SWEET_BERRY_BUSH) { if (block == Blocks.SWEET_BERRY_BUSH) {
return state.with(BlockStateProperties.AGE_0_3, Integer.valueOf(1)); return state.setValue(BlockStateProperties.AGE_3, Integer.valueOf(1));
} }
if (block == Blocks.SUGAR_CANE || block == Blocks.KELP) { if (block == Blocks.SUGAR_CANE || block == Blocks.KELP) {
if (state.getFluidState() if (state.getFluidState()
.isEmpty()) .isEmpty())
return Blocks.AIR.getDefaultState(); return Blocks.AIR.defaultBlockState();
return state.getFluidState() return state.getFluidState()
.getBlockState(); .createLegacyBlock();
} }
if (state.getCollisionShape(world, pos) if (state.getCollisionShape(world, pos)
.isEmpty() || block instanceof CocoaBlock) { .isEmpty() || block instanceof CocoaBlock) {
@ -173,17 +173,17 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
if (!(property instanceof IntegerProperty)) if (!(property instanceof IntegerProperty))
continue; continue;
if (!property.getName() if (!property.getName()
.equals(BlockStateProperties.AGE_0_1.getName())) .equals(BlockStateProperties.AGE_1.getName()))
continue; continue;
return state.with((IntegerProperty) property, Integer.valueOf(0)); return state.setValue((IntegerProperty) property, Integer.valueOf(0));
} }
} }
if (state.getFluidState() if (state.getFluidState()
.isEmpty()) .isEmpty())
return Blocks.AIR.getDefaultState(); return Blocks.AIR.defaultBlockState();
return state.getFluidState() return state.getFluidState()
.getBlockState(); .createLegacyBlock();
} }
} }

View file

@ -35,16 +35,16 @@ public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntit
int light, int overlay) { int light, int overlay) {
BlockState blockState = te.getBlockState(); BlockState blockState = te.getBlockState();
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.HARVESTER_BLADE, blockState); SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.HARVESTER_BLADE, blockState);
transform(te.getWorld(), blockState.get(HarvesterBlock.HORIZONTAL_FACING), superBuffer, transform(te.getLevel(), blockState.getValue(HarvesterBlock.FACING), superBuffer,
te.getAnimatedSpeed()); te.getAnimatedSpeed());
superBuffer.light(light) superBuffer.light(light)
.renderInto(ms, buffer.getBuffer(RenderType.getCutoutMipped())); .renderInto(ms, buffer.getBuffer(RenderType.cutoutMipped()));
} }
public static void renderInContraption(MovementContext context, PlacementSimulationWorld renderWorld, public static void renderInContraption(MovementContext context, PlacementSimulationWorld renderWorld,
ContraptionMatrices matrices, IRenderTypeBuffer buffers) { ContraptionMatrices matrices, IRenderTypeBuffer buffers) {
BlockState blockState = context.state; BlockState blockState = context.state;
Direction facing = blockState.get(HORIZONTAL_FACING); Direction facing = blockState.getValue(HORIZONTAL_FACING);
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.HARVESTER_BLADE, blockState); SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.HARVESTER_BLADE, blockState);
float speed = (float) (!VecHelper.isVecPointingTowards(context.relativeMotion, facing.getOpposite()) float speed = (float) (!VecHelper.isVecPointingTowards(context.relativeMotion, facing.getOpposite())
? context.getAnimationSpeed() ? context.getAnimationSpeed()
@ -58,7 +58,7 @@ public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntit
superBuffer superBuffer
.light(matrices.entityMatrix, .light(matrices.entityMatrix,
ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld)) ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld))
.renderInto(matrices.entityStack, buffers.getBuffer(RenderType.getCutoutMipped())); .renderInto(matrices.entityStack, buffers.getBuffer(RenderType.cutoutMipped()));
} }
public static void transform(World world, Direction facing, SuperByteBuffer superBuffer, float speed) { public static void transform(World world, Direction facing, SuperByteBuffer superBuffer, float speed) {

View file

@ -21,7 +21,7 @@ public class HarvesterTileEntity extends SyncedTileEntity {
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public AxisAlignedBB getRenderBoundingBox() { public AxisAlignedBB getRenderBoundingBox() {
return RENDER_BOX.offset(pos); return RENDER_BOX.move(worldPosition);
} }
public float getAnimatedSpeed() { public float getAnimatedSpeed() {

View file

@ -7,6 +7,8 @@ import com.mojang.authlib.GameProfile;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayer;
import net.minecraft.block.AbstractBlock.Properties;
public class PloughBlock extends AttachedActorBlock { public class PloughBlock extends AttachedActorBlock {
public PloughBlock(Properties p_i48377_1_) { public PloughBlock(Properties p_i48377_1_) {

View file

@ -1,6 +1,6 @@
package com.simibubi.create.content.contraptions.components.actors; package com.simibubi.create.content.contraptions.components.actors;
import static net.minecraft.block.HorizontalBlock.HORIZONTAL_FACING; import static net.minecraft.block.HorizontalBlock.FACING;
import com.simibubi.create.content.contraptions.components.actors.PloughBlock.PloughFakePlayer; import com.simibubi.create.content.contraptions.components.actors.PloughBlock.PloughFakePlayer;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
@ -31,7 +31,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
@Override @Override
public boolean isActive(MovementContext context) { public boolean isActive(MovementContext context) {
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.get(HORIZONTAL_FACING) return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.getValue(FACING)
.getOpposite()); .getOpposite());
} }
@ -39,10 +39,10 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
public void visitNewPosition(MovementContext context, BlockPos pos) { public void visitNewPosition(MovementContext context, BlockPos pos) {
super.visitNewPosition(context, pos); super.visitNewPosition(context, pos);
World world = context.world; World world = context.world;
if (world.isRemote) if (world.isClientSide)
return; return;
BlockPos below = pos.down(); BlockPos below = pos.below();
if (!world.isBlockPresent(below)) if (!world.isLoaded(below))
return; return;
Vector3d vec = VecHelper.getCenterOf(pos); Vector3d vec = VecHelper.getCenterOf(pos);
@ -52,18 +52,18 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
return; return;
BlockRayTraceResult ray = world BlockRayTraceResult ray = world
.rayTraceBlocks(new RayTraceContext(vec, vec.add(0, -1, 0), BlockMode.OUTLINE, FluidMode.NONE, player)); .clip(new RayTraceContext(vec, vec.add(0, -1, 0), BlockMode.OUTLINE, FluidMode.NONE, player));
if (ray.getType() != Type.BLOCK) if (ray.getType() != Type.BLOCK)
return; return;
ItemUseContext ctx = new ItemUseContext(player, Hand.MAIN_HAND, ray); ItemUseContext ctx = new ItemUseContext(player, Hand.MAIN_HAND, ray);
new ItemStack(Items.DIAMOND_HOE).onItemUse(ctx); new ItemStack(Items.DIAMOND_HOE).useOn(ctx);
} }
@Override @Override
public Vector3d getActiveAreaOffset(MovementContext context) { public Vector3d getActiveAreaOffset(MovementContext context) {
return Vector3d.of(context.state.get(HORIZONTAL_FACING) return Vector3d.atLowerCornerOf(context.state.getValue(FACING)
.getDirectionVec()).scale(.45); .getNormal()).scale(.45);
} }
@Override @Override
@ -73,7 +73,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
@Override @Override
public boolean canBreak(World world, BlockPos breakingPos, BlockState state) { public boolean canBreak(World world, BlockPos breakingPos, BlockState state) {
if (world.getBlockState(breakingPos.down()) if (world.getBlockState(breakingPos.below())
.getBlock() instanceof FarmlandBlock) .getBlock() instanceof FarmlandBlock)
return false; return false;
if (state.getBlock() instanceof FlowingFluidBlock) if (state.getBlock() instanceof FlowingFluidBlock)
@ -91,7 +91,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
if (brokenState.getBlock() == Blocks.SNOW && context.world instanceof ServerWorld) { if (brokenState.getBlock() == Blocks.SNOW && context.world instanceof ServerWorld) {
ServerWorld world = (ServerWorld) context.world; ServerWorld world = (ServerWorld) context.world;
brokenState.getDrops(new LootContext.Builder(world).withParameter(LootParameters.BLOCK_STATE, brokenState) brokenState.getDrops(new LootContext.Builder(world).withParameter(LootParameters.BLOCK_STATE, brokenState)
.withParameter(LootParameters.ORIGIN, Vector3d.ofCenter(pos)) .withParameter(LootParameters.ORIGIN, Vector3d.atCenterOf(pos))
.withParameter(LootParameters.THIS_ENTITY, getPlayer(context)) .withParameter(LootParameters.THIS_ENTITY, getPlayer(context))
.withParameter(LootParameters.TOOL, new ItemStack(Items.IRON_SHOVEL))) .withParameter(LootParameters.TOOL, new ItemStack(Items.IRON_SHOVEL)))
.forEach(s -> dropItem(context, s)); .forEach(s -> dropItem(context, s));
@ -108,7 +108,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
private PloughFakePlayer getPlayer(MovementContext context) { private PloughFakePlayer getPlayer(MovementContext context) {
if (!(context.temporaryData instanceof PloughFakePlayer) && context.world != null) { if (!(context.temporaryData instanceof PloughFakePlayer) && context.world != null) {
PloughFakePlayer player = new PloughFakePlayer((ServerWorld) context.world); PloughFakePlayer player = new PloughFakePlayer((ServerWorld) context.world);
player.setHeldItem(Hand.MAIN_HAND, new ItemStack(Items.DIAMOND_HOE)); player.setItemInHand(Hand.MAIN_HAND, new ItemStack(Items.DIAMOND_HOE));
context.temporaryData = player; context.temporaryData = player;
} }
return (PloughFakePlayer) context.temporaryData; return (PloughFakePlayer) context.temporaryData;

Some files were not shown because too many files have changed in this diff Show more