From 268a4f15616264167e79a652aa2becbec92446bb Mon Sep 17 00:00:00 2001 From: Shnupbups Date: Sun, 8 Oct 2023 23:47:22 +1100 Subject: [PATCH] Fix FabricBlockSettings copyOf missing settings Fixes FabricBlockSettings' copyOf method missing several new settings introduced as a result of the removal of Materials. Specifically, burnable, liquid, forceNotSolid, forceSolid, pistonBehavior, instrument, and replaceable. These are all copied by the vanilla `BlockSettings.copy` as well. The emissiveLightingPredicate is also now copied in vanilla, so I moved the copy of that to reflect that change. --- .../builder/v1/block/FabricBlockSettings.java | 9 ++++- .../AbstractBlockSettingsAccessor.java | 38 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java index 588846c563..5d90b75844 100644 --- a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java +++ b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java @@ -69,10 +69,18 @@ protected FabricBlockSettings(AbstractBlock.Settings settings) { thisAccessor.setDynamicBounds(otherAccessor.getDynamicBounds()); thisAccessor.setOpaque(otherAccessor.getOpaque()); thisAccessor.setIsAir(otherAccessor.getIsAir()); + thisAccessor.setBurnable(otherAccessor.getBurnable()); + thisAccessor.setLiquid(otherAccessor.getLiquid()); + thisAccessor.setForceNotSolid(otherAccessor.getForceNotSolid()); + thisAccessor.setForceSolid(otherAccessor.getForceSolid()); + this.pistonBehavior(otherAccessor.getPistonBehavior()); thisAccessor.setToolRequired(otherAccessor.isToolRequired()); thisAccessor.setOffsetter(otherAccessor.getOffsetter()); thisAccessor.setBlockBreakParticles(otherAccessor.getBlockBreakParticles()); thisAccessor.setRequiredFeatures(otherAccessor.getRequiredFeatures()); + this.emissiveLighting(otherAccessor.getEmissiveLightingPredicate()); + this.instrument(otherAccessor.getInstrument()); + thisAccessor.setReplaceable(otherAccessor.getReplaceable()); // Not copied in vanilla: field definition order this.jumpVelocityMultiplier(otherAccessor.getJumpVelocityMultiplier()); @@ -82,7 +90,6 @@ protected FabricBlockSettings(AbstractBlock.Settings settings) { this.suffocates(otherAccessor.getSuffocationPredicate()); this.blockVision(otherAccessor.getBlockVisionPredicate()); this.postProcess(otherAccessor.getPostProcessPredicate()); - this.emissiveLighting(otherAccessor.getEmissiveLightingPredicate()); } public static FabricBlockSettings create() { diff --git a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/AbstractBlockSettingsAccessor.java b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/AbstractBlockSettingsAccessor.java index 31a9afb1d1..1c4cef0eaf 100644 --- a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/AbstractBlockSettingsAccessor.java +++ b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/AbstractBlockSettingsAccessor.java @@ -26,6 +26,8 @@ import net.minecraft.block.AbstractBlock; import net.minecraft.block.BlockState; import net.minecraft.block.MapColor; +import net.minecraft.block.enums.Instrument; +import net.minecraft.block.piston.PistonBehavior; import net.minecraft.entity.EntityType; import net.minecraft.resource.featuretoggle.FeatureSet; import net.minecraft.sound.BlockSoundGroup; @@ -106,6 +108,27 @@ public interface AbstractBlockSettingsAccessor { @Accessor FeatureSet getRequiredFeatures(); + @Accessor + boolean getBurnable(); + + @Accessor + boolean getLiquid(); + + @Accessor + boolean getForceNotSolid(); + + @Accessor + boolean getForceSolid(); + + @Accessor + PistonBehavior getPistonBehavior(); + + @Accessor + Instrument getInstrument(); + + @Accessor + boolean getReplaceable(); + /* SETTERS */ @Accessor void setCollidable(boolean collidable); @@ -139,4 +162,19 @@ public interface AbstractBlockSettingsAccessor { @Accessor void setOffsetter(Optional offsetter); + + @Accessor + void setBurnable(boolean burnable); + + @Accessor + void setLiquid(boolean liquid); + + @Accessor + void setForceNotSolid(boolean forceNotSolid); + + @Accessor + void setForceSolid(boolean forceSolid); + + @Accessor + void setReplaceable(boolean replaceable); }