more accurate source coordinates for break/place events - #3323

This commit is contained in:
asiekierka 2016-04-30 15:34:02 +02:00
parent 5bcb99193d
commit 2bdabf6a1c
2 changed files with 5 additions and 3 deletions

View file

@ -279,7 +279,7 @@ public abstract class BptBuilderBase implements IAreaProvider {
if (!world.isAirBlock(x, y, z)) {
BlockEvent.BreakEvent breakEvent = new BlockEvent.BreakEvent(x, y, z, world, world.getBlock(x, y, z),
world.getBlockMetadata(x, y, z),
CoreProxy.proxy.getBuildCraftPlayer((WorldServer) world).get());
CoreProxy.proxy.getBuildCraftPlayer((WorldServer) world, this.x, this.y, this.z).get());
MinecraftForge.EVENT_BUS.post(breakEvent);
return breakEvent.isCanceled();
}
@ -293,7 +293,7 @@ public abstract class BptBuilderBase implements IAreaProvider {
BlockEvent.PlaceEvent placeEvent = new BlockEvent.PlaceEvent(
new BlockSnapshot(world, x, y, z, block, meta),
Blocks.air,
CoreProxy.proxy.getBuildCraftPlayer((WorldServer) world, x, y, z).get()
CoreProxy.proxy.getBuildCraftPlayer((WorldServer) world, this.x, this.y, this.z).get()
);
MinecraftForge.EVENT_BUS.post(placeEvent);

View file

@ -4,12 +4,14 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.world.BlockEvent;
@ -93,7 +95,7 @@ public class BlockMiner {
int meta = world.getBlockMetadata(x, y, z);
BlockEvent.BreakEvent breakEvent = new BlockEvent.BreakEvent(x, y, z, world, block, meta,
CoreProxy.proxy.getBuildCraftPlayer((WorldServer) world).get());
CoreProxy.proxy.getBuildCraftPlayer((WorldServer) owner.getWorldObj(), owner.xCoord, owner.yCoord, owner.zCoord).get());
MinecraftForge.EVENT_BUS.post(breakEvent);
if (!breakEvent.isCanceled()) {