Hookup BlockEvent.FluidPlaceBlockEvent (#6103)

This commit is contained in:
David Quintana 2019-08-31 14:15:08 +02:00 committed by GitHub
parent 0d448a5e4f
commit 68ff1afac1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 2 deletions

View file

@ -0,0 +1,18 @@
--- a/net/minecraft/block/FlowingFluidBlock.java
+++ b/net/minecraft/block/FlowingFluidBlock.java
@@ -121,13 +121,13 @@
if (flag) {
IFluidState ifluidstate = p_204515_1_.func_204610_c(p_204515_2_);
if (ifluidstate.func_206889_d()) {
- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_150343_Z.func_176223_P());
+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_150343_Z.func_176223_P()));
this.func_180688_d(p_204515_1_, p_204515_2_);
return false;
}
if (ifluidstate.func_215679_a(p_204515_1_, p_204515_2_) >= 0.44444445F) {
- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_150347_e.func_176223_P());
+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_150347_e.func_176223_P()));
this.func_180688_d(p_204515_1_, p_204515_2_);
return false;
}

View file

@ -0,0 +1,29 @@
--- a/net/minecraft/fluid/LavaFluid.java
+++ b/net/minecraft/fluid/LavaFluid.java
@@ -76,7 +76,7 @@
BlockState blockstate = p_207186_1_.func_180495_p(blockpos);
if (blockstate.func_196958_f()) {
if (this.func_176369_e(p_207186_1_, blockpos)) {
- p_207186_1_.func_175656_a(blockpos, Blocks.field_150480_ab.func_176223_P());
+ p_207186_1_.func_175656_a(blockpos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_207186_1_, blockpos, p_207186_2_, Blocks.field_150480_ab.func_176223_P()));
return;
}
} else if (blockstate.func_185904_a().func_76230_c()) {
@@ -91,7 +91,7 @@
}
if (p_207186_1_.func_175623_d(blockpos1.func_177984_a()) && this.func_176368_m(p_207186_1_, blockpos1)) {
- p_207186_1_.func_175656_a(blockpos1.func_177984_a(), Blocks.field_150480_ab.func_176223_P());
+ p_207186_1_.func_175656_a(blockpos1.func_177984_a(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_207186_1_, blockpos1.func_177984_a(), p_207186_2_, Blocks.field_150480_ab.func_176223_P()));
}
}
}
@@ -169,7 +169,7 @@
IFluidState ifluidstate = p_205574_1_.func_204610_c(p_205574_2_);
if (this.func_207185_a(FluidTags.field_206960_b) && ifluidstate.func_206884_a(FluidTags.field_206959_a)) {
if (p_205574_3_.func_177230_c() instanceof FlowingFluidBlock) {
- p_205574_1_.func_180501_a(p_205574_2_, Blocks.field_150348_b.func_176223_P(), 3);
+ p_205574_1_.func_180501_a(p_205574_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_205574_1_, p_205574_2_, p_205574_2_, Blocks.field_150348_b.func_176223_P()), 3);
}
this.func_205581_a(p_205574_1_, p_205574_2_);

View file

@ -252,7 +252,7 @@ public class ForgeEventFactory
return event.getDropChance();
}
public static BlockState fireFluidPlaceBlockEvent(World world, BlockPos pos, BlockPos liquidPos, BlockState state)
public static BlockState fireFluidPlaceBlockEvent(IWorld world, BlockPos pos, BlockPos liquidPos, BlockState state)
{
BlockEvent.FluidPlaceBlockEvent event = new BlockEvent.FluidPlaceBlockEvent(world, pos, liquidPos, state);
MinecraftForge.EVENT_BUS.post(event);

View file

@ -301,7 +301,7 @@ public class BlockEvent extends Event
private BlockState newState;
private BlockState origState;
public FluidPlaceBlockEvent(World world, BlockPos pos, BlockPos liquidPos, BlockState state)
public FluidPlaceBlockEvent(IWorld world, BlockPos pos, BlockPos liquidPos, BlockState state)
{
super(world, pos, state);
this.liquidPos = liquidPos;