Files
MinecraftForge/patches/minecraft/net/minecraft/block/Block.java.patch
T

75 lines
2.6 KiB
Diff

--- a/net/minecraft/block/Block.java
+++ b/net/minecraft/block/Block.java
@@ -74,7 +74,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public class Block implements IItemProvider {
+public class Block extends net.minecraftforge.registries.ForgeRegistryEntry<Block> implements IItemProvider, net.minecraftforge.common.extensions.IForgeBlock {
protected static final Logger field_196273_d = LogManager.getLogger();
private static final ResourceLocation AIR_ID = new ResourceLocation("air");
public static final RegistryNamespacedDefaultedByKey<ResourceLocation, Block> REGISTRY = new RegistryNamespacedDefaultedByKey<ResourceLocation, Block>(AIR_ID);
@@ -1604,4 +1604,62 @@
return Objects.hash(this.field_212164_a, this.field_212165_b, this.field_212166_c);
}
}
+ /* ======================================== FORGE START =====================================*/
+
+ private ThreadLocal<IBlockState> silkCheck = new ThreadLocal<>();
+ private String[] harvestTool = new String[16];
+ private int[] harvestLevel = new int[]{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
+ protected static ThreadLocal<Boolean> captureDrops = ThreadLocal.withInitial(() -> false);
+ protected static ThreadLocal<NonNullList<ItemStack>> capturedDrops = ThreadLocal.withInitial(NonNullList::create);
+ protected NonNullList<ItemStack> captureDrops(boolean start)
+ {
+ if (start)
+ {
+ captureDrops.set(true);
+ capturedDrops.get().clear();
+ return NonNullList.create();
+ }
+ else
+ {
+ captureDrops.set(false);
+ return capturedDrops.get();
+ }
+ }
+
+ @Override
+ public float getSlipperiness(IBlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity)
+ {
+ return this.slipperiness;
+ }
+
+ @Override
+ public boolean canSilkHarvest(IWorldReader world, BlockPos pos, IBlockState state, EntityPlayer player)
+ {
+ silkCheck.set(state);
+ boolean ret = this.canSilkHarvest();
+ return ret;
+ }
+
+ @Override
+ public void onBlockExploded(World world, BlockPos pos, Explosion explosion)
+ {
+ world.setBlockToAir(pos);
+ onExplosionDestroy(world, pos, explosion);
+ }
+
+ @Nullable
+ @Override
+ public String getHarvestTool(IBlockState state)
+ {
+ return harvestTool[0]; //TODO: RE-Evaluate
+ }
+
+ @Override
+ public int getHarvestLevel(IBlockState state)
+ {
+
+ return harvestLevel[0]; //TODO: RE-Evaluate
+ }
+
+ /* ========================================= FORGE END ======================================*/
}