Add constructor to StairsBlock that accepts a state supplier
This commit is contained in:
parent
583ff81dba
commit
d510978446
2 changed files with 54 additions and 0 deletions
40
patches/minecraft/net/minecraft/block/StairsBlock.java.patch
Normal file
40
patches/minecraft/net/minecraft/block/StairsBlock.java.patch
Normal file
|
@ -0,0 +1,40 @@
|
|||
--- a/net/minecraft/block/StairsBlock.java
|
||||
+++ b/net/minecraft/block/StairsBlock.java
|
||||
@@ -83,13 +83,24 @@
|
||||
return voxelshape;
|
||||
}
|
||||
|
||||
+ // Forge: Use the other constructor that takes a Supplier
|
||||
+ @Deprecated
|
||||
protected StairsBlock(BlockState p_i48321_1_, Block.Properties p_i48321_2_) {
|
||||
super(p_i48321_2_);
|
||||
this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176309_a, Direction.NORTH).func_206870_a(field_176308_b, Half.BOTTOM).func_206870_a(field_176310_M, StairsShape.STRAIGHT).func_206870_a(field_204513_t, Boolean.valueOf(false)));
|
||||
this.field_150149_b = p_i48321_1_.func_177230_c();
|
||||
this.field_150151_M = p_i48321_1_;
|
||||
+ this.stateSupplier = () -> p_i48321_1_;
|
||||
}
|
||||
|
||||
+ protected StairsBlock(java.util.function.Supplier<BlockState> state, Block.Properties properties) {
|
||||
+ super(properties);
|
||||
+ this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176309_a, Direction.NORTH).func_206870_a(field_176308_b, Half.BOTTOM).func_206870_a(field_176310_M, StairsShape.STRAIGHT).func_206870_a(field_204513_t, Boolean.valueOf(false)));
|
||||
+ this.field_150149_b = Blocks.field_150350_a; // These are unused, fields are redirected
|
||||
+ this.field_150151_M = Blocks.field_150350_a.func_176223_P();
|
||||
+ this.stateSupplier = state;
|
||||
+ }
|
||||
+
|
||||
public boolean func_220074_n(BlockState p_220074_1_) {
|
||||
return true;
|
||||
}
|
||||
@@ -265,4 +276,12 @@
|
||||
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ private final java.util.function.Supplier<BlockState> stateSupplier;
|
||||
+ private Block getModelBlock() {
|
||||
+ return getModelState().func_177230_c();
|
||||
+ }
|
||||
+ private BlockState getModelState() {
|
||||
+ return stateSupplier.get();
|
||||
+ }
|
||||
}
|
|
@ -35,6 +35,20 @@ function initializeCoreMod() {
|
|||
asmapi.redirectFieldToMethod(classNode, fn, 'getFluid') // forge added method, doesn't need mapping
|
||||
return classNode;
|
||||
}
|
||||
},
|
||||
'stairsblock': {
|
||||
'target': {
|
||||
'type': 'CLASS',
|
||||
'name': 'net.minecraft.block.StairsBlock'
|
||||
},
|
||||
'transformer': function(classNode) {
|
||||
var asmapi=Java.type('net.minecraftforge.coremod.api.ASMAPI')
|
||||
var blockField = asmapi.mapField('field_150149_b') // modelBlock - remap to mcp if necessary
|
||||
asmapi.redirectFieldToMethod(classNode, blockField, 'getModelBlock') // forge added method, doesn't need mapping
|
||||
var stateField = asmapi.mapField('field_150151_M') // modelState - remap to mcp if necessary
|
||||
asmapi.redirectFieldToMethod(classNode, stateField, 'getModelState') // forge added method, doesn't need mapping
|
||||
return classNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue