{
IInvConfiguration config = (IInvConfiguration)tile;
if(!player.isSneaking())
{
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.configurator.viewColor") + ": " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName()));
return true;
}
else {
if(getEnergy(stack) >= ENERGY_PER_CONFIGURE)
{
setEnergy(stack, getEnergy(stack) - ENERGY_PER_CONFIGURE);
MekanismUtils.incrementOutput(config, MekanismUtils.getBaseOrientation(side, config.getOrientation()));
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + MekanismUtils.localize("tooltip.configurator.toggleColor") + ": " + config.getSideData().get(config.getConfiguration()[MekanismUtils.getBaseOrientation(side, config.getOrientation())]).color.getName()));
if(config instanceof TileEntityBasicBlock)
{
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)config;
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(tileEntity), tileEntity.getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(tileEntity)));
}
return true;
}
}
}
else if(tile instanceof IConfigurable)
{
IConfigurable config = (IConfigurable)tile;
if(player.isSneaking())
{
return config.onSneakRightClick(player, side);
}
else {
return config.onRightClick(player, side);
}
}
}
else if(getState(stack) == 1) //Empty
{
if(tile instanceof IInventory)
{
IInventory inv = (IInventory)tile;
if(!(inv instanceof TileEntityElectricChest) || (((TileEntityElectricChest)inv).canAccess()))
{
for(int i = 0; i < inv.getSizeInventory(); i++)
{
ItemStack slotStack = inv.getStackInSlot(i);
if(slotStack != null)
{
if(getEnergy(stack) < ENERGY_PER_ITEM_DUMP)
{
break;
}
float xRandom = random.nextFloat() * 0.8F + 0.1F;
float yRandom = random.nextFloat() * 0.8F + 0.1F;
float zRandom = random.nextFloat() * 0.8F + 0.1F;
while(slotStack.stackSize > 0)
{
int j = random.nextInt(21) + 10;
if(j > slotStack.stackSize)
{
j = slotStack.stackSize;
}
slotStack.stackSize -= j;
EntityItem item = new EntityItem(world, x + xRandom, y + yRandom, z + zRandom, new ItemStack(slotStack.getItem(), j, slotStack.getItemDamage()));
if(slotStack.hasTagCompound())
{
item.getEntityItem().setTagCompound((NBTTagCompound)slotStack.getTagCompound().copy());
}
float k = 0.05F;
item.motionX = random.nextGaussian() * k;
item.motionY = random.nextGaussian() * k + 0.2F;
item.motionZ = random.nextGaussian() * k;
world.spawnEntityInWorld(item);
inv.setInventorySlotContents(i, null);
setEnergy(stack, getEnergy(stack) - ENERGY_PER_ITEM_DUMP);
}
}
}
return true;
}
else {
player.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + MekanismUtils.localize("tooltip.configurator.unauth")));
return true;
}
}
}
else if(getState(stack) == 2) //Rotate