use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.
the class MessageClientGuiButton method onMessage.
@Override
public IMessage onMessage(MessageClientGuiButton message, MessageContext ctx) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
if (player == null) {
return null;
}
Container container = player.openContainer;
if (container != null && container instanceof ContainerArmourer) {
TileEntityArmourer armourerBrain = ((ContainerArmourer) container).getTileEntity();
if (message.buttonId == 14) {
armourerBrain.loadArmourItem(player);
}
if (message.buttonId == 7) {
armourerBrain.toggleGuides();
}
if (message.buttonId == 9) {
armourerBrain.toggleOverlay();
}
if (message.buttonId == 6) {
armourerBrain.toggleHelper();
}
if (message.buttonId == 11) {
// armourerBrain.cloneToSide(ForgeDirection.WEST);
}
if (message.buttonId == 12) {
// armourerBrain.cloneToSide(ForgeDirection.EAST);
}
}
if (container != null && container instanceof ContainerColourMixer) {
TileEntityColourMixer colourMixer = ((ContainerColourMixer) container).getTileEntity();
colourMixer.setColourFamily(ColourFamily.values()[message.buttonId]);
}
if (container instanceof IButtonPress) {
((IButtonPress) container).buttonPressed(message.buttonId);
}
return null;
}
use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.
the class MessageClientGuiSetArmourerSkinProps method onMessage.
@Override
public IMessage onMessage(MessageClientGuiSetArmourerSkinProps message, MessageContext ctx) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
if (player == null) {
return null;
}
Container container = player.openContainer;
if (container != null && container instanceof ContainerArmourer) {
TileEntityArmourer te = ((ContainerArmourer) container).getTileEntity();
te.setSkinProps(message.skinProps);
}
return null;
}
use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.
the class BlockBoundingBox method isRemoteOnly.
@Override
public boolean isRemoteOnly(IBlockAccess world, int x, int y, int z, int side) {
ForgeDirection sideBlock = ForgeDirection.getOrientation(side);
if (world.getBlock(x + sideBlock.offsetX, y + sideBlock.offsetY, z + sideBlock.offsetZ) == this) {
return false;
}
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TileEntityBoundingBox) {
TileEntityArmourer parent = ((TileEntityBoundingBox) te).getParent();
if (parent != null) {
if (((TileEntityBoundingBox) te).getSkinPart() instanceof ISkinPartTypeTextured) {
Point texturePoint = SkinTextureHelper.getTextureLocationFromWorldBlock((TileEntityBoundingBox) te, side);
int colour = parent.getPaintData(texturePoint.x, texturePoint.y);
int paintType = BitwiseUtils.getUByteFromInt(colour, 0);
return paintType == 0;
}
}
}
return false;
}
use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.
the class BlockBoundingBox method setPaintType.
@Override
public void setPaintType(IBlockAccess world, int x, int y, int z, PaintType paintType, int side) {
ForgeDirection sideBlock = ForgeDirection.getOrientation(side);
if (world.getBlock(x + sideBlock.offsetX, y + sideBlock.offsetY, z + sideBlock.offsetZ) == this) {
return;
}
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TileEntityBoundingBox) {
TileEntityArmourer parent = ((TileEntityBoundingBox) te).getParent();
if (((TileEntityBoundingBox) te).getSkinPart() instanceof ISkinPartTypeTextured) {
if (parent != null) {
ISkinType skinType = parent.getSkinType();
Point texturePoint = SkinTextureHelper.getTextureLocationFromWorldBlock((TileEntityBoundingBox) te, side);
int oldColour = parent.getPaintData(texturePoint.x, texturePoint.y);
int newColour = PaintType.setPaintTypeOnColour(paintType, oldColour);
parent.updatePaintData(texturePoint.x, texturePoint.y, newColour);
}
}
}
}
use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.
the class BlockArmourer method onBlockPlacedBy.
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TileEntityArmourer) {
ForgeDirection direction = BlockUtils.determineDirectionSide(entity).getOpposite();
((TileEntityArmourer) te).setDirection(ForgeDirection.NORTH);
if (!world.isRemote) {
((TileEntityArmourer) te).setTexture(new PlayerTexture(player.getCommandSenderName(), TextureType.USER));
((TileEntityArmourer) te).onPlaced();
}
}
}
}
Aggregations