use of com.github.technus.tectech.thing.metaTileEntity.IConstructable in project TecTech by Technus.
the class ConstructableTriggerItem method onItemUseFirst.
@Override
public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (tTileEntity == null || aPlayer instanceof FakePlayer) {
return aPlayer instanceof EntityPlayerMP;
}
if (aPlayer instanceof EntityPlayerMP) {
// struct gen
if (aPlayer.isSneaking() && aPlayer.capabilities.isCreativeMode) {
if (tTileEntity instanceof IGregTechTileEntity) {
IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
if (metaTE instanceof IConstructable) {
((IConstructable) metaTE).construct(aStack.stackSize, false);
} else if (multiblockMap.containsKey(metaTE.getClass().getCanonicalName())) {
multiblockMap.get(metaTE.getClass().getCanonicalName()).construct(aStack.stackSize, false, tTileEntity, ((IGregTechTileEntity) tTileEntity).getFrontFacing());
}
} else if (tTileEntity instanceof IConstructable) {
((IConstructable) tTileEntity).construct(aStack.stackSize, false);
} else if (multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())) {
multiblockMap.get(tTileEntity.getClass().getCanonicalName()).construct(aStack.stackSize, false, tTileEntity, aSide);
}
}
return true;
} else if (aPlayer instanceof EntityClientPlayerMP) {
// if ((!aPlayer.isSneaking() || !aPlayer.capabilities.isCreativeMode)) {
if (tTileEntity instanceof IGregTechTileEntity) {
IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
if (metaTE instanceof IConstructable) {
((IConstructable) metaTE).construct(aStack.stackSize, true);
TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize));
return false;
} else if (multiblockMap.containsKey(metaTE.getClass().getCanonicalName())) {
multiblockMap.get(metaTE.getClass().getCanonicalName()).construct(aStack.stackSize, true, tTileEntity, ((IGregTechTileEntity) tTileEntity).getFrontFacing());
TecTech.proxy.printInchat(multiblockMap.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize));
return false;
}
} else if (tTileEntity instanceof IConstructable) {
((IConstructable) tTileEntity).construct(aStack.stackSize, true);
TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize));
return false;
} else if (multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())) {
multiblockMap.get(tTileEntity.getClass().getCanonicalName()).construct(aStack.stackSize, true, tTileEntity, aSide);
TecTech.proxy.printInchat(multiblockMap.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize));
return false;
}
// } else {
// if(tTileEntity instanceof IGregTechTileEntity) {
// IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
// if (metaTE instanceof IConstructable) {
// TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize));
// return false;
// } else if(multiblockMap.containsKey(metaTE.getClass().getCanonicalName())){
// TecTech.proxy.printInchat(multiblockMap.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize));
// return false;
// }
// } else if(tTileEntity instanceof IConstructable){
// TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize));
// return false;
// } else if(multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())){
// TecTech.proxy.printInchat(multiblockMap.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize));
// return false;
// }
// }
}
return false;
}
Aggregations