Allow Glow panels to be placed and stay in hollow covers again.
This commit is contained in:
parent
366a51e770
commit
2663be0f5a
2 changed files with 26 additions and 3 deletions
|
@ -13,8 +13,11 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.microblock.HollowMicroblock;
|
||||
import codechicken.multipart.JItemMultiPart;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -44,6 +47,11 @@ public class ItemGlowPanel extends JItemMultiPart
|
|||
return new PartGlowPanel(col, orientation);
|
||||
}
|
||||
|
||||
if(world.getTileEntity(pos.x, pos.y, pos.z) instanceof TileMultipart && ((TileMultipart) world.getTileEntity(pos.x, pos.y, pos.z)).partMap(orientation.ordinal()) instanceof HollowMicroblock)
|
||||
{
|
||||
return new PartGlowPanel(col, orientation);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import codechicken.lib.vec.Cuboid6;
|
|||
import codechicken.lib.vec.Rotation;
|
||||
import codechicken.lib.vec.Translation;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.microblock.HollowMicroblock;
|
||||
import codechicken.multipart.IconHitEffects;
|
||||
import codechicken.multipart.JCuboidPart;
|
||||
import codechicken.multipart.JIconHitEffects;
|
||||
|
@ -84,9 +85,17 @@ public class PartGlowPanel extends JCuboidPart implements JNormalOcclusion, JIco
|
|||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
Coord4D adj = Coord4D.get(tile()).getFromSide(side);
|
||||
|
||||
if(!world().isRemote && !world().isSideSolid(adj.xCoord, adj.yCoord, adj.zCoord, side.getOpposite()))
|
||||
if(!world().isRemote && !canStay())
|
||||
{
|
||||
TileMultipart.dropItem(new ItemStack(Mekanism.GlowPanel, 1, colour.getMetaValue()), world(), Vector3.fromTileEntityCenter(tile()));
|
||||
tile().remPart(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPartChanged(TMultiPart other)
|
||||
{
|
||||
if(!world().isRemote && !canStay())
|
||||
{
|
||||
TileMultipart.dropItem(new ItemStack(Mekanism.GlowPanel, 1, colour.getMetaValue()), world(), Vector3.fromTileEntityCenter(tile()));
|
||||
tile().remPart(this);
|
||||
|
@ -193,4 +202,10 @@ public class PartGlowPanel extends JCuboidPart implements JNormalOcclusion, JIco
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canStay()
|
||||
{
|
||||
Coord4D adj = Coord4D.get(tile()).getFromSide(side);
|
||||
return world().isSideSolid(adj.xCoord, adj.yCoord, adj.zCoord, side.getOpposite()) || tile().partMap(side.ordinal()) instanceof HollowMicroblock;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue