mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 12:42:26 +00:00
Convert Forge to use Official mappings. Mojang released their obfuscation mappings but we have not used them up until now due to wanting to get their license to be more explicitly permissive. It is clear that their intent is to allow us to use their names for developing mods like this. See the full wording, and our interpretation here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
173 lines
7.8 KiB
Diff
173 lines
7.8 KiB
Diff
--- a/net/minecraft/block/AbstractBlock.java
|
|
+++ b/net/minecraft/block/AbstractBlock.java
|
|
@@ -60,7 +_,8 @@
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
|
|
-public abstract class AbstractBlock {
|
|
+//TODO, Delegates are weird here now, because Block extends this.
|
|
+public abstract class AbstractBlock extends net.minecraftforge.registries.ForgeRegistryEntry<Block> {
|
|
protected static final Direction[] field_212556_a = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP};
|
|
protected final Material field_149764_J;
|
|
protected final boolean field_235688_at_;
|
|
@@ -87,6 +_,8 @@
|
|
this.field_226887_g_ = p_i241196_1_.field_226894_k_;
|
|
this.field_208621_p = p_i241196_1_.field_208772_j;
|
|
this.field_235684_aB_ = p_i241196_1_;
|
|
+ final ResourceLocation lootTableCache = p_i241196_1_.field_222381_j;
|
|
+ this.lootTableSupplier = lootTableCache != null ? () -> lootTableCache : p_i241196_1_.lootTableSupplier != null ? p_i241196_1_.lootTableSupplier : () -> new ResourceLocation(this.getRegistryName().func_110624_b(), "blocks/" + this.getRegistryName().func_110623_a());
|
|
}
|
|
|
|
@Deprecated
|
|
@@ -129,7 +_,7 @@
|
|
|
|
@Deprecated
|
|
public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
|
|
- if (this.func_235695_q_() && !p_196243_1_.func_203425_a(p_196243_4_.func_177230_c())) {
|
|
+ if (p_196243_1_.hasTileEntity() && (!p_196243_1_.func_203425_a(p_196243_4_.func_177230_c()) || !p_196243_4_.hasTileEntity())) {
|
|
p_196243_2_.func_175713_t(p_196243_3_);
|
|
}
|
|
|
|
@@ -191,7 +_,7 @@
|
|
|
|
@Deprecated
|
|
public boolean func_196253_a(BlockState p_196253_1_, BlockItemUseContext p_196253_2_) {
|
|
- return this.field_149764_J.func_76222_j() && (p_196253_2_.func_195996_i().func_190926_b() || p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j());
|
|
+ return p_196253_1_.func_185904_a().func_76222_j() && (p_196253_2_.func_195996_i().func_190926_b() || p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j());
|
|
}
|
|
|
|
@Deprecated
|
|
@@ -294,8 +_,8 @@
|
|
if (f == -1.0F) {
|
|
return 0.0F;
|
|
} else {
|
|
- int i = p_180647_2_.func_234569_d_(p_180647_1_) ? 30 : 100;
|
|
- return p_180647_2_.func_184813_a(p_180647_1_) / f / (float)i;
|
|
+ int i = net.minecraftforge.common.ForgeHooks.canHarvestBlock(p_180647_1_, p_180647_2_, p_180647_3_, p_180647_4_) ? 30 : 100;
|
|
+ return p_180647_2_.getDigSpeed(p_180647_1_, p_180647_4_) / f / (float)i;
|
|
}
|
|
}
|
|
|
|
@@ -321,14 +_,14 @@
|
|
return 0;
|
|
}
|
|
|
|
+ @Deprecated //Forge: Use state.hasTileEntity()
|
|
public final boolean func_235695_q_() {
|
|
return this instanceof ITileEntityProvider;
|
|
}
|
|
|
|
public final ResourceLocation func_220068_i() {
|
|
if (this.field_220085_g == null) {
|
|
- ResourceLocation resourcelocation = Registry.field_212618_g.func_177774_c(this.func_230328_p_());
|
|
- this.field_220085_g = new ResourceLocation(resourcelocation.func_110624_b(), "blocks/" + resourcelocation.func_110623_a());
|
|
+ this.field_220085_g = this.lootTableSupplier.get();
|
|
}
|
|
|
|
return this.field_220085_g;
|
|
@@ -346,6 +_,14 @@
|
|
return this.field_235684_aB_.field_235800_b_.apply(this.func_230328_p_().func_176223_P());
|
|
}
|
|
|
|
+ protected boolean isAir(BlockState state) {
|
|
+ return ((AbstractBlockState)state).field_235702_f_;
|
|
+ }
|
|
+
|
|
+ /* ======================================== FORGE START ===================================== */
|
|
+ private final java.util.function.Supplier<ResourceLocation> lootTableSupplier;
|
|
+ /* ========================================= FORGE END ====================================== */
|
|
+
|
|
public abstract static class AbstractBlockState extends StateHolder<Block, BlockState> {
|
|
private final int field_215708_d;
|
|
private final boolean field_215709_e;
|
|
@@ -424,18 +_,24 @@
|
|
return this.field_215709_e;
|
|
}
|
|
|
|
+ /** @deprecated use {@link BlockState#getLightValue(IBlockReader, BlockPos)} */
|
|
+ @Deprecated
|
|
public int func_185906_d() {
|
|
return this.field_215708_d;
|
|
}
|
|
|
|
+ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos)} until 1.17, at which point this method will be undreprecated. See https://github.com/MinecraftForge/MinecraftForge/issues/7409 for more details */
|
|
+ @Deprecated
|
|
public boolean func_196958_f() {
|
|
- return this.field_235702_f_;
|
|
+ return this.func_177230_c().isAir((BlockState)this);
|
|
}
|
|
|
|
public MaterialColor func_185909_g(IBlockReader p_185909_1_, BlockPos p_185909_2_) {
|
|
return this.field_235704_h_;
|
|
}
|
|
|
|
+ /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation)} */
|
|
+ @Deprecated
|
|
public BlockState func_185907_a(Rotation p_185907_1_) {
|
|
return this.func_177230_c().func_185499_a(this.func_230340_p_(), p_185907_1_);
|
|
}
|
|
@@ -802,8 +_,11 @@
|
|
private ResourceLocation field_222381_j;
|
|
private boolean field_226895_m_ = true;
|
|
private boolean field_235813_o_;
|
|
+ private int harvestLevel = -1;
|
|
+ private net.minecraftforge.common.ToolType harvestTool;
|
|
+ private java.util.function.Supplier<ResourceLocation> lootTableSupplier;
|
|
private AbstractBlock.IExtendedPositionPredicate<EntityType<?>> field_235814_p_ = (p_235832_0_, p_235832_1_, p_235832_2_, p_235832_3_) -> {
|
|
- return p_235832_0_.func_224755_d(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.func_185906_d() < 14;
|
|
+ return p_235832_0_.func_224755_d(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.getLightValue(p_235832_1_, p_235832_2_) < 14;
|
|
};
|
|
private AbstractBlock.IPositionPredicate field_235815_q_ = (p_235853_0_, p_235853_1_, p_235853_2_) -> {
|
|
return p_235853_0_.func_185904_a().func_76218_k() && p_235853_0_.func_235785_r_(p_235853_1_, p_235853_2_);
|
|
@@ -863,6 +_,8 @@
|
|
abstractblock$properties.field_226895_m_ = p_200950_0_.field_235684_aB_.field_226895_m_;
|
|
abstractblock$properties.field_235813_o_ = p_200950_0_.field_235684_aB_.field_235813_o_;
|
|
abstractblock$properties.field_235806_h_ = p_200950_0_.field_235684_aB_.field_235806_h_;
|
|
+ abstractblock$properties.harvestLevel = p_200950_0_.field_235684_aB_.harvestLevel;
|
|
+ abstractblock$properties.harvestTool = p_200950_0_.field_235684_aB_.harvestTool;
|
|
return abstractblock$properties;
|
|
}
|
|
|
|
@@ -877,6 +_,24 @@
|
|
return this;
|
|
}
|
|
|
|
+ public AbstractBlock.Properties harvestLevel(int harvestLevel) {
|
|
+ this.harvestLevel = harvestLevel;
|
|
+ return this;
|
|
+ }
|
|
+
|
|
+ public AbstractBlock.Properties harvestTool(net.minecraftforge.common.ToolType harvestTool) {
|
|
+ this.harvestTool = harvestTool;
|
|
+ return this;
|
|
+ }
|
|
+
|
|
+ public int getHarvestLevel() {
|
|
+ return this.harvestLevel;
|
|
+ }
|
|
+
|
|
+ public net.minecraftforge.common.ToolType getHarvestTool() {
|
|
+ return this.harvestTool;
|
|
+ }
|
|
+
|
|
public AbstractBlock.Properties func_200941_a(float p_200941_1_) {
|
|
this.field_200961_i = p_200941_1_;
|
|
return this;
|
|
@@ -932,9 +_,15 @@
|
|
return this;
|
|
}
|
|
|
|
+ @Deprecated // FORGE: Use the variant that takes a Supplier below
|
|
public AbstractBlock.Properties func_222379_b(Block p_222379_1_) {
|
|
- this.field_222381_j = p_222379_1_.func_220068_i();
|
|
+ this.lootTableSupplier = () -> p_222379_1_.delegate.get().func_220068_i();
|
|
return this;
|
|
+ }
|
|
+
|
|
+ public AbstractBlock.Properties lootFrom(java.util.function.Supplier<? extends Block> blockIn) {
|
|
+ this.lootTableSupplier = () -> blockIn.get().func_220068_i();
|
|
+ return this;
|
|
}
|
|
|
|
public AbstractBlock.Properties func_235859_g_() {
|