Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* 1: */ package com.riciJak.Ztones.network;
- /* 2: */
- /* 3: */ import io.netty.buffer.ByteBuf;
- /* 4: */ import io.netty.buffer.ByteBufInputStream;
- /* 5: */ import java.io.IOException;
- import com.riciJak.Ztones.item.block.ItemDecoBlocks2;
- /* 6: */ import net.minecraft.entity.player.EntityPlayer;
- /* 7: */ import net.minecraft.item.ItemStack;
- /* 8: */
- /* 9: */ public class ToggleMetaData
- /* 10: */ implements IZTPacket
- /* 11: */ {
- /* 12:18 */ private boolean incDamage = false;
- /* 13: */
- /* 14: */ public ToggleMetaData() {}
- /* 15: */
- /* 16: */ public ToggleMetaData(boolean incDamage)
- /* 17: */ {
- /* 18:24 */ this.incDamage = incDamage;
- /* 19: */ }
- /* 20: */
- /* 21: */ public void processData(EntityPlayer entityPlayer, ByteBufInputStream bbis)
- /* 22: */ throws IOException
- /* 23: */ {
- /* 24:33 */ ItemStack itemStack = entityPlayer.getHeldItem();
- /* 25:34 */ if (itemStack != null && ((itemStack.getItem() instanceof ItemDecoBlocks2)))
- /* 26: */ {
- /* 27:36 */ boolean incDmg = bbis.readBoolean();
- /* 28:37 */ int maxDmg = 15;
- /* 29: */
- /* 30:39 */ int itemDmg = itemStack.getItemDamage();
- /* 31:40 */ itemDmg += (incDmg ? 1 : -1);
- /* 32:41 */ if (itemDmg > maxDmg) {
- /* 33:43 */ itemDmg = 0;
- /* 34:45 */ } else if (itemDmg < 0) {
- /* 35:47 */ itemDmg = maxDmg;
- /* 36: */ }
- /* 37:49 */ itemStack.setItemDamage(itemDmg);
- /* 38: */ }
- /* 39: */ }
- /* 40: */
- /* 41: */ public void appendData(ByteBuf buffer)
- /* 42: */ throws IOException
- /* 43: */ {
- /* 44:57 */ buffer.writeBoolean(this.incDamage);
- /* 45: */ }
- /* 46: */ }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement