use of riskyken.armourersWorkshop.common.tileentities.TileEntityMannequin in project Armourers-Workshop by RiskyKen.
the class ItemPaintbrush method onItemUse.
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
Block block = world.getBlock(x, y, z);
if (player.isSneaking() & block == ModBlocks.colourMixer) {
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof IPantable) {
if (!world.isRemote) {
int colour = ((IPantable) te).getColour(0);
PaintType paintType = ((IPantable) te).getPaintType(0);
setToolColour(stack, colour);
setToolPaintType(stack, paintType);
}
}
return true;
}
if (block instanceof IPantableBlock) {
int newColour = getToolColour(stack);
if (!world.isRemote) {
UndoManager.begin(player);
if ((Boolean) ToolOptions.FULL_BLOCK_MODE.readFromNBT(stack.getTagCompound())) {
for (int i = 0; i < 6; i++) {
usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, i);
}
} else {
usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, side);
}
UndoManager.end(player);
if ((Boolean) ToolOptions.FULL_BLOCK_MODE.readFromNBT(stack.getTagCompound())) {
world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.PAINT, 1.0F, world.rand.nextFloat() * 0.1F + 0.9F);
} else {
world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.PAINT, 1.0F, world.rand.nextFloat() * 0.1F + 1.5F);
}
} else {
spawnPaintParticles(world, x, y, z, side, newColour);
}
return true;
}
if (block == ModBlocks.armourerBrain & player.isSneaking()) {
if (!world.isRemote) {
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TileEntityArmourer) {
((TileEntityArmourer) te).toolUsedOnArmourer(this, world, stack, player);
}
}
ModLogger.log("armourer");
return true;
}
if (block == ModBlocks.mannequin) {
if (!world.isRemote) {
TileEntity te = ((BlockMannequin) block).getMannequinTileEntity(world, x, y, z);
if (te != null && te instanceof TileEntityMannequin) {
int newColour = getToolColour(stack);
if (player.isSneaking()) {
((TileEntityMannequin) te).setHairColour(newColour);
} else {
((TileEntityMannequin) te).setSkinColour(newColour);
}
}
}
return true;
}
return false;
}
use of riskyken.armourersWorkshop.common.tileentities.TileEntityMannequin in project Armourers-Workshop by RiskyKen.
the class MessageClientGuiMannequinData method onMessage.
@Override
public IMessage onMessage(MessageClientGuiMannequinData message, MessageContext ctx) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
if (player == null) {
return null;
}
Container container = player.openContainer;
if (container != null && container instanceof ContainerMannequin) {
TileEntityMannequin tileEntity = ((ContainerMannequin) container).getTileEntity();
tileEntity.gotUpdateFromClient(message.xOffset, message.yOffset, message.zOffset, message.skinColour, message.hairColour, message.username, message.renderExtras, message.flying, message.visible, message.textureType);
}
return null;
}
use of riskyken.armourersWorkshop.common.tileentities.TileEntityMannequin in project Armourers-Workshop by RiskyKen.
the class BlockDoll method randomDisplayTick.
@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
if (isValentins) {
if (random.nextFloat() * 100 > 80) {
world.spawnParticle("heart", x + 0.2D + random.nextFloat() * 0.6F, y + 1D, z + 0.2D + random.nextFloat() * 0.6F, 0, 0, 0);
}
}
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity != null && tileEntity instanceof TileEntityMannequin) {
TileEntityMannequin te = (TileEntityMannequin) tileEntity;
if (te.isRenderExtras() & te.isVisible()) {
Contributor contributor = Contributors.INSTANCE.getContributor(te.getGameProfile());
if (contributor != null) {
EntityFX entityfx = new EntitySpellParticleFX(world, x + random.nextFloat() * 1F, y, z + random.nextFloat() * 1F, 0, 0, 0);
((EntitySpellParticleFX) entityfx).setBaseSpellTextureIndex(144);
entityfx.setRBGColorF((float) (contributor.r & 0xFF) / 255F, (float) (contributor.g & 0xFF) / 255F, (float) (contributor.b & 0xFF) / 255F);
Minecraft.getMinecraft().effectRenderer.addEffect(entityfx);
}
}
}
}
use of riskyken.armourersWorkshop.common.tileentities.TileEntityMannequin in project Armourers-Workshop by RiskyKen.
the class BlockDoll method breakBlock.
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int metadata) {
if (!world.isRemote) {
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TileEntityMannequin) {
ItemStack dropStack = ((TileEntityMannequin) te).getDropStack();
UtilItems.spawnItemInWorld(world, x, y, z, dropStack);
}
BlockUtils.dropInventoryBlocks(world, x, y, z);
}
super.breakBlock(world, x, y, z, block, metadata);
}
use of riskyken.armourersWorkshop.common.tileentities.TileEntityMannequin in project Armourers-Workshop by RiskyKen.
the class BlockDoll method onBlockPlacedBy.
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof TileEntityMannequin) {
int l = MathHelper.floor_double((double) (player.rotationYaw * 16.0F / 360.0F) + 0.5D) & 15;
((TileEntityMannequin) te).setRotation(l);
if (stack.hasTagCompound()) {
NBTTagCompound compound = stack.getTagCompound();
GameProfile gameProfile = null;
if (compound.hasKey(TAG_OWNER, 10)) {
gameProfile = NBTUtil.func_152459_a(compound.getCompoundTag(TAG_OWNER));
((TileEntityMannequin) te).setGameProfile(gameProfile);
}
}
}
}
Aggregations