Fixed torch part placement on fences

This commit is contained in:
Chicken Bones committed 2013-08-01 23:54:25 +10:00
1 parent 0836b3d0ee
commit c5168ff047
3 files changed
+43 -4

No files matched your search

@@ -6,6 +6,7 @@ import codechicken.lib.vec.BlockCoord;
import codechicken.lib.vec.Vector3;
import codechicken.multipart.TileMultipart;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.Packet15Place;
@@ -62,7 +63,7 @@ public class EventHandler
{
Vector3 f = new Vector3(hit.hitVec).add(-hit.blockX, -hit.blockY, -hit.blockZ);
Block block = Block.blocksList[world.getBlockId(hit.blockX, hit.blockY, hit.blockZ)];
if(block != null && block.onBlockActivated(world, hit.blockX, hit.blockY, hit.blockZ, player, hit.sideHit, (float)f.x, (float)f.y, (float)f.z))
if(block != null && !ignoreActivate(block) && block.onBlockActivated(world, hit.blockX, hit.blockY, hit.blockZ, player, hit.sideHit, (float)f.x, (float)f.y, (float)f.z))
{
player.swingItem();
PacketCustom.sendToServer(new Packet15Place(
@@ -101,4 +102,14 @@ public class EventHandler
}
return true;
}
/**
* Because vanilla is weird.
*/
private static boolean ignoreActivate(Block block)
{
if(block instanceof BlockFence)
return true;
return false;
}
}