more accurate source coordinates for break/place events - #3323
This commit is contained in:
parent
5bcb99193d
commit
2bdabf6a1c
|
@ -279,7 +279,7 @@ public abstract class BptBuilderBase implements IAreaProvider {
|
||||||
if (!world.isAirBlock(x, y, z)) {
|
if (!world.isAirBlock(x, y, z)) {
|
||||||
BlockEvent.BreakEvent breakEvent = new BlockEvent.BreakEvent(x, y, z, world, world.getBlock(x, y, z),
|
BlockEvent.BreakEvent breakEvent = new BlockEvent.BreakEvent(x, y, z, world, world.getBlock(x, y, z),
|
||||||
world.getBlockMetadata(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);
|
MinecraftForge.EVENT_BUS.post(breakEvent);
|
||||||
return breakEvent.isCanceled();
|
return breakEvent.isCanceled();
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ public abstract class BptBuilderBase implements IAreaProvider {
|
||||||
BlockEvent.PlaceEvent placeEvent = new BlockEvent.PlaceEvent(
|
BlockEvent.PlaceEvent placeEvent = new BlockEvent.PlaceEvent(
|
||||||
new BlockSnapshot(world, x, y, z, block, meta),
|
new BlockSnapshot(world, x, y, z, block, meta),
|
||||||
Blocks.air,
|
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);
|
MinecraftForge.EVENT_BUS.post(placeEvent);
|
||||||
|
|
|
@ -4,12 +4,14 @@ import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
|
||||||
|
@ -93,7 +95,7 @@ public class BlockMiner {
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
BlockEvent.BreakEvent breakEvent = new BlockEvent.BreakEvent(x, y, z, world, block, meta,
|
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);
|
MinecraftForge.EVENT_BUS.post(breakEvent);
|
||||||
|
|
||||||
if (!breakEvent.isCanceled()) {
|
if (!breakEvent.isCanceled()) {
|
||||||
|
|
Loading…
Reference in a new issue