Glow panels now break off of non-solid surfaces

This commit is contained in:
Aidan C. Brady 2014-06-12 23:36:29 +02:00
parent 81477966ee
commit ef7f6e91eb
2 changed files with 22 additions and 1 deletions

View file

@ -37,7 +37,14 @@ public class ItemGlowPanel extends JItemMultiPart
EnumColor col = EnumColor.DYES[item.getItemDamage()];
ForgeDirection orientation = getSideFromVector3(vHit.subtract(Vector3.center));
return new PartGlowPanel(col, orientation);
BlockCoord pos1 = pos.copy().inset(orientation.getOpposite().ordinal());
if(world.isSideSolid(pos1.x, pos1.y, pos1.z, orientation.getOpposite()))
{
return new PartGlowPanel(col, orientation);
}
return null;
}
public ForgeDirection getSideFromVector3(Vector3 vector)

View file

@ -2,6 +2,7 @@ package mekanism.common.multipart;
import java.util.Collections;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.client.render.RenderGlowPanel;
import mekanism.common.Mekanism;
@ -23,6 +24,7 @@ import codechicken.multipart.JIconHitEffects;
import codechicken.multipart.JNormalOcclusion;
import codechicken.multipart.NormalOcclusionTest;
import codechicken.multipart.TMultiPart;
import codechicken.multipart.TileMultipart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -78,6 +80,18 @@ public class PartGlowPanel extends JCuboidPart implements JNormalOcclusion, JIco
{
side = newSide;
}
@Override
public void onNeighborChanged()
{
Coord4D adj = Coord4D.get(tile()).getFromSide(side);
if(!world().isRemote && !world().isSideSolid(adj.xCoord, adj.yCoord, adj.zCoord, side.getOpposite()))
{
TileMultipart.dropItem(new ItemStack(Mekanism.GlowPanel, 1, colour.getMetaValue()), world(), Vector3.fromTileEntityCenter(tile()));
tile().remPart(this);
}
}
@Override
public void writeDesc(MCDataOutput data)