mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-12 16:37:38 +00:00
Fixed smoke particles on redstone torches (bugged in vanilla) Added functions for world and coordinates on parts to clean code Added more placement and world interaction events Properly distinguished converted tiles Fixed tick scheduler to remain in better sync with vanilla
45 lines
1.1 KiB
Java
45 lines
1.1 KiB
Java
package codechicken.multipart.minecraft;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraftforge.common.ForgeDirection;
|
|
import codechicken.core.vec.BlockCoord;
|
|
import codechicken.core.vec.Vector3;
|
|
import codechicken.multipart.TileMultipartObj;
|
|
|
|
public abstract class McSidedMetaPart extends McMetaPart
|
|
{
|
|
public McSidedMetaPart()
|
|
{
|
|
}
|
|
|
|
public McSidedMetaPart(int meta)
|
|
{
|
|
super(meta);
|
|
}
|
|
|
|
public abstract int sideForMeta(int meta);
|
|
|
|
public void onNeighbourChanged()
|
|
{
|
|
if(!world().isRemote)
|
|
dropIfCantStay();
|
|
}
|
|
|
|
public boolean dropIfCantStay()
|
|
{
|
|
BlockCoord pos = new BlockCoord(getTile()).offset(sideForMeta(meta));
|
|
if(!world().isBlockSolidOnSide(pos.x, pos.y, pos.z, ForgeDirection.getOrientation(sideForMeta(meta)^1)))
|
|
{
|
|
drop();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void drop()
|
|
{
|
|
tile().remPart(this);
|
|
TileMultipartObj.dropItem(new ItemStack(getBlock()), world(), Vector3.fromTileEntityCenter(getTile()));
|
|
}
|
|
}
|