Fixed placing parts inside other parts

This commit is contained in:
modmuss50 2015-04-26 16:05:44 +01:00
parent 98427bbe8a
commit d70038b77f
4 changed files with 17 additions and 8 deletions

View file

@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import techreborn.partSystem.parts.CablePart;
import uk.co.qmunity.lib.ref.Names;
@ -25,6 +26,16 @@ public class ModPartItem extends Item {
@Override
public boolean onItemUse(ItemStack item, EntityPlayer player, World world,
int x, int y, int z, int face, float x_, float y_, float z_) {
System.out.println(ModPartUtils.hasPart(world, x, y, z, modPart.getName()));
ForgeDirection dir = ForgeDirection.getOrientation(face);
if(ModPartUtils.hasPart(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, modPart.getName())){
x = x + dir.offsetX;
y = y + dir.offsetY;
z = z + dir.offsetZ;
}
if(ModPartUtils.hasPart(world, x, y, z, modPart.getName())){
return false;
}
if (ModPartRegistry.masterProvider != null) {
try {
if(modPart instanceof CablePart){