Skip to content

Commit

Permalink
Fix FabricBlockSettings copyOf missing settings (#3373)
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 2ff98d3)
  • Loading branch information
Shnupbups authored and modmuss50 committed Oct 22, 2023
1 parent 16a9bc7 commit 4ee0bc6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -139,4 +162,19 @@ public interface AbstractBlockSettingsAccessor {

@Accessor
void setOffsetter(Optional<AbstractBlock.Offsetter> 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);
}

0 comments on commit 4ee0bc6

Please sign in to comment.