mirror of
https://github.com/GTNewHorizons/Hardcore-Ender-Expansion.git
synced 2026-10-26 14:24:03 +00:00
Speed up BlockEnderGoo event registration
This commit is contained in:
1 parent
cf8a59ae71
commit
c8f6af0847
2 files changed
+14
-10
No files matched your search
@@ -36,6 +36,7 @@ public class BlockEnderGoo extends BlockFluidClassic {
|
||||
private final byte[] xOff = new byte[] { -1, 1, 0, 0, 0, 0 }, yOff = new byte[] { 0, 0, -1, 1, 0, 0 },
|
||||
zOff = new byte[] { 0, 0, 0, 0, -1, 1 };
|
||||
|
||||
public EventHandler handler;
|
||||
public BlockEnderGoo() {
|
||||
super(fluid, enderGoo);
|
||||
disableStats();
|
||||
@@ -43,6 +44,7 @@ public class BlockEnderGoo extends BlockFluidClassic {
|
||||
setQuantaPerBlock(5);
|
||||
setTickRate(18);
|
||||
setTickRandomly(true);
|
||||
handler = new EventHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,19 +124,21 @@ public class BlockEnderGoo extends BlockFluidClassic {
|
||||
HardcoreEnderExpansion.fx.enderGoo(world, x, y, z);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBucketFill(FillBucketEvent e) {
|
||||
if (BlockPosM.tmp(e.target.blockX, e.target.blockY, e.target.blockZ).getBlock(e.world) == this) {
|
||||
BlockPosM.tmp(e.target.blockX, e.target.blockY, e.target.blockZ).setAir(e.world);
|
||||
e.result = new ItemStack(ItemList.bucket_ender_goo);
|
||||
e.setResult(Result.ALLOW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
super.registerBlockIcons(iconRegister);
|
||||
fluid.setIcons(blockIcon);
|
||||
}
|
||||
|
||||
public class EventHandler{
|
||||
@SubscribeEvent
|
||||
public void onBucketFill(FillBucketEvent e) {
|
||||
if (BlockPosM.tmp(e.target.blockX, e.target.blockY, e.target.blockZ).getBlock(e.world) == BlockEnderGoo.this) {
|
||||
BlockPosM.tmp(e.target.blockX, e.target.blockY, e.target.blockZ).setAir(e.world);
|
||||
e.result = new ItemStack(ItemList.bucket_ender_goo);
|
||||
e.setResult(Result.ALLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -497,7 +497,7 @@ public final class BlockList {
|
||||
OreDictionary.registerOre("oreHeeIgneousRock", BlockList.igneous_rock_ore);
|
||||
OreDictionary.registerOre("oreHeeInstabilityOrb", BlockList.instability_orb_ore);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(BlockList.ender_goo);
|
||||
MinecraftForge.EVENT_BUS.register(((BlockEnderGoo)BlockList.ender_goo).handler);
|
||||
}
|
||||
|
||||
public static void registerTileEntities() {
|
||||
|
||||
Reference in new issue
Block a user