mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-20 04:09:45 +00:00
Fix duplicate block activated events when holding multipart vanilla blocks (torches)
Fix torch placement logic
This commit is contained in:
1 parent
e098bdd608
commit
2a9541ecb9
2 files changed
+5
-3
No files matched your search
@@ -5,6 +5,7 @@ import codechicken.lib.raytracer.RayTracer;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFence;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -23,7 +24,7 @@ public class EventHandler
|
||||
{
|
||||
private ThreadLocal<Object> placing = new ThreadLocal<Object>();
|
||||
|
||||
@SubscribeEvent
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void playerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if(event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote)
|
||||
@@ -78,7 +79,7 @@ public class EventHandler
|
||||
hit.blockX, hit.blockY, hit.blockZ, hit.sideHit,
|
||||
player.inventory.getCurrentItem(),
|
||||
(float)f.x, (float)f.y, (float)f.z));
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.world.World;
|
||||
import codechicken.multipart.IRandomDisplayTick;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TorchPart extends McSidedMetaPart implements IRandomDisplayTick
|
||||
{
|
||||
@@ -77,7 +78,7 @@ public class TorchPart extends McSidedMetaPart implements IRandomDisplayTick
|
||||
return null;
|
||||
pos = pos.copy().offset(side^1);
|
||||
Block block = world.getBlock(pos.x, pos.y, pos.z);
|
||||
if(!block.isBlockSolid(world, pos.x, pos.y, pos.z, side) && (side != 1 || block.canPlaceTorchOnTop(world, pos.x, pos.y, pos.z)))
|
||||
if(!block.isSideSolid(world, pos.x, pos.y, pos.z, ForgeDirection.getOrientation(side)) && (side != 1 || block.canPlaceTorchOnTop(world, pos.x, pos.y, pos.z)))
|
||||
return null;
|
||||
|
||||
return new TorchPart(sideMetaMap[side^1]);
|
||||
|
||||
Reference in new issue
Block a user