23w45a porting fixes ()

This commit is contained in:
apple502j 2023-11-17 01:11:10 +09:00 committed by GitHub
parent 23e8616e74
commit a2e8758a92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 3 deletions
fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block

View file

@ -82,7 +82,12 @@ public class FabricBlockSettings extends AbstractBlock.Settings {
this.instrument(otherAccessor.getInstrument());
thisAccessor.setReplaceable(otherAccessor.getReplaceable());
// Not copied in vanilla: field definition order
// Vanilla did not copy those fields until 23w45a, which introduced
// copyShallow method (maintaining the behavior previously used by the copy method)
// and the copy method that copies those fields as well. copyShallow is now
// deprecated. To maintain compatibility and since this behavior seems to be the
// more proper way, this copies all the fields, not just the shallow ones.
// Fields are added by field definition order.
this.jumpVelocityMultiplier(otherAccessor.getJumpVelocityMultiplier());
this.drops(otherAccessor.getLootTableId());
this.allowsSpawning(otherAccessor.getAllowsSpawningPredicate());

View file

@ -210,6 +210,7 @@ public final class BlockSetTypeBuilder {
public static BlockSetTypeBuilder copyOf(BlockSetTypeBuilder builder) {
BlockSetTypeBuilder copy = new BlockSetTypeBuilder();
copy.openableByHand(builder.openableByHand);
copy.openableByWindCharge(builder.openableByWindCharge);
copy.buttonActivatedByArrows(builder.buttonActivatedByArrows);
copy.pressurePlateActivationRule(builder.pressurePlateActivationRule);
copy.soundGroup(builder.soundGroup);
@ -234,6 +235,7 @@ public final class BlockSetTypeBuilder {
public static BlockSetTypeBuilder copyOf(BlockSetType setType) {
BlockSetTypeBuilder copy = new BlockSetTypeBuilder();
copy.openableByHand(setType.canOpenByHand());
copy.openableByWindCharge(setType.canOpenByWindCharge());
copy.buttonActivatedByArrows(setType.canButtonBeActivatedByArrows());
copy.pressurePlateActivationRule(setType.pressurePlateSensitivity());
copy.soundGroup(setType.soundType());