From b4d18b552e3f8468c8dbadd0fa566d0cd31cc1c0 Mon Sep 17 00:00:00 2001 From: Phylogeny Date: Sat, 24 Dec 2016 03:27:36 -0800 Subject: [PATCH] Standardized the naming of ItemStacks, both as variable and in method descriptions, in the API. --- .../api/EventBlockBitModification.java | 8 +-- .../mod/chiselsandbits/api/IBitAccess.java | 10 ++-- .../mod/chiselsandbits/api/IBitBrush.java | 2 +- .../chiselsandbits/api/IChiselAndBitsAPI.java | 24 ++++---- .../chiselsandbits/core/api/BitAccess.java | 18 +++--- .../core/api/ChiselAndBitsAPI.java | 56 +++++++++---------- 6 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/main/java/mod/chiselsandbits/api/EventBlockBitModification.java b/src/main/java/mod/chiselsandbits/api/EventBlockBitModification.java index eedb83d6..d7164b9c 100644 --- a/src/main/java/mod/chiselsandbits/api/EventBlockBitModification.java +++ b/src/main/java/mod/chiselsandbits/api/EventBlockBitModification.java @@ -16,7 +16,7 @@ public class EventBlockBitModification extends Event private final BlockPos pos; private final EntityPlayer player; private final EnumHand hand; - private final ItemStack itemUsed; + private final ItemStack stackUsed; private final boolean placement; public EventBlockBitModification( @@ -24,7 +24,7 @@ public EventBlockBitModification( final BlockPos pos, final EntityPlayer player, final EnumHand hand, - final ItemStack itemUsed, + final ItemStack stackUsed, final boolean placement ) { @@ -32,7 +32,7 @@ public EventBlockBitModification( this.pos = pos; this.player = player; this.hand = hand; - this.itemUsed = itemUsed; + this.stackUsed = stackUsed; this.placement = placement; } @@ -58,7 +58,7 @@ public EnumHand getHand() public ItemStack getItemUsed() { - return itemUsed; + return stackUsed; } public boolean isPlacing() diff --git a/src/main/java/mod/chiselsandbits/api/IBitAccess.java b/src/main/java/mod/chiselsandbits/api/IBitAccess.java index 672de3c4..4b5fb3b5 100644 --- a/src/main/java/mod/chiselsandbits/api/IBitAccess.java +++ b/src/main/java/mod/chiselsandbits/api/IBitAccess.java @@ -85,7 +85,7 @@ void commitChanges( void commitChanges(); /** - * Returns an item for the {@link IBitAccess} + * Returns an ItemStack for the {@link IBitAccess} * * Usable for any {@link IBitAccess} * @@ -94,11 +94,11 @@ void commitChanges( * @param type * what type of item to give. * @param crossWorld - * determines if the NBT for the item is specific to this world + * determines if the NBT for the ItemStack is specific to this world * or if it is portable, cross world NBT is larger and slower, * you should only request cross world NBT if you specifically * need it. - * @return an Item for bits, which is empty if there are no bits. + * @return an ItemStack for bits, which is empty if there are no bits. */ ItemStack getBitsAsItem( EnumFacing side, @@ -106,7 +106,7 @@ ItemStack getBitsAsItem( boolean crossWorld ); /** - * Returns an item for the {@link IBitAccess}, this method all ways returns + * Returns an ItemStack for the {@link IBitAccess}, this method all ways returns * non-cross world NBT, please move to the above method and specify false to * prepare for future removal. * @@ -116,7 +116,7 @@ ItemStack getBitsAsItem( * angle the player is looking at, can be null. * @param type * what type of item to give. - * @return an Item for bits, which is empty if there are no bits. + * @return an ItemStack for bits, which is empty if there are no bits. */ @Deprecated ItemStack getBitsAsItem( diff --git a/src/main/java/mod/chiselsandbits/api/IBitBrush.java b/src/main/java/mod/chiselsandbits/api/IBitBrush.java index 99d01a26..300534b8 100644 --- a/src/main/java/mod/chiselsandbits/api/IBitBrush.java +++ b/src/main/java/mod/chiselsandbits/api/IBitBrush.java @@ -28,7 +28,7 @@ public interface IBitBrush * Get the ItemStack for a bit, which is empty for air. * * VERY IMPORTANT: C&B lets you disable bits, if this happens the Item in - * this ItemStack WILL BE NULL, if you put this item in an inventory, drop + * this ItemStack WILL BE NULL, if you put this ItemStack in an inventory, drop * it on the ground, or anything else.. CHECK THIS!!!!! * * @param count diff --git a/src/main/java/mod/chiselsandbits/api/IChiselAndBitsAPI.java b/src/main/java/mod/chiselsandbits/api/IChiselAndBitsAPI.java index e761df98..ef1427dd 100644 --- a/src/main/java/mod/chiselsandbits/api/IChiselAndBitsAPI.java +++ b/src/main/java/mod/chiselsandbits/api/IChiselAndBitsAPI.java @@ -19,13 +19,13 @@ public interface IChiselAndBitsAPI { /** - * Determine the Item Type and return it. + * Determine the Item Type of the item in an ItemStack and return it. * - * @param item + * @param stack * @return ItemType of the item, or null if it is not any of them. */ ItemType getItemType( - ItemStack item ); + ItemStack stack ); /** * Check if a block can support {@link IBitAccess} @@ -65,24 +65,24 @@ IBitAccess getBitAccess( BlockPos pos ) throws CannotBeChiseled; /** - * Create a bit access from an item, passing an empty ItemStack creates an empty bit access, + * Create a bit access from an ItemStack, passing an empty ItemStack creates an empty bit access, * passing an invalid item returns null. * - * @return a {@link IBitAccess} for an item. + * @return a {@link IBitAccess} for an ItemStack. */ IBitAccess createBitItem( - ItemStack BitItemStack ); + ItemStack stack ); /** - * Create a brush from an item, once created you can use it many times. + * Create a brush from an ItemStack, once created you can use it many times. * * @param bitItem - * @return A brush for the specified item, if passed an empty ItemStack an + * @return A brush for the specified ItemStack, if passed an empty ItemStack an * air brush is created. * @throws InvalidBitItem */ IBitBrush createBrush( - ItemStack bitItem ) throws InvalidBitItem; + ItemStack stack ) throws InvalidBitItem; /** * Create a brush from a state, once created you can use it many times. @@ -135,7 +135,7 @@ ItemStack getBitItem( * * CLIENT: destroys the item. * - * SERVER: adds item to inv/bag/spawns entity. + * SERVER: adds ItemStack to inv/bag/spawns entity. * * @param player * player to give bits to. @@ -148,7 +148,7 @@ ItemStack getBitItem( */ void giveBitToPlayer( EntityPlayer player, - ItemStack itemstack, + ItemStack stack, Vec3d spawnPos ); /** @@ -158,7 +158,7 @@ void giveBitToPlayer( * @return internal object to manipulate bag. */ IBitBag getBitbag( - ItemStack itemstack ); + ItemStack stack ); /** * Begins an undo operation, starting two operations without ending the diff --git a/src/main/java/mod/chiselsandbits/core/api/BitAccess.java b/src/main/java/mod/chiselsandbits/core/api/BitAccess.java index db2481bb..e59272ad 100644 --- a/src/main/java/mod/chiselsandbits/core/api/BitAccess.java +++ b/src/main/java/mod/chiselsandbits/core/api/BitAccess.java @@ -155,7 +155,7 @@ public ItemStack getBitsAsItem( final NBTTagCompound nbttagcompound = new NBTTagCompound(); c.writeChisleData( nbttagcompound, crossWorld ); - final ItemStack itemstack; + final ItemStack stack; if ( type == ItemType.CHISLED_BLOCK ) { @@ -167,35 +167,35 @@ public ItemStack getBitsAsItem( return ModUtil.getEmptyStack(); } - itemstack = new ItemStack( blk, 1 ); - itemstack.setTagInfo( ModUtil.NBT_BLOCKENTITYTAG, nbttagcompound ); + stack = new ItemStack( blk, 1 ); + stack.setTagInfo( ModUtil.NBT_BLOCKENTITYTAG, nbttagcompound ); } else { switch ( type ) { case MIRROR_DESIGN: - itemstack = new ItemStack( ChiselsAndBits.getItems().itemMirrorprint ); + stack = new ItemStack( ChiselsAndBits.getItems().itemMirrorprint ); break; case NEGATIVE_DESIGN: - itemstack = new ItemStack( ChiselsAndBits.getItems().itemNegativeprint ); + stack = new ItemStack( ChiselsAndBits.getItems().itemNegativeprint ); break; case POSITIVE_DESIGN: - itemstack = new ItemStack( ChiselsAndBits.getItems().itemPositiveprint ); + stack = new ItemStack( ChiselsAndBits.getItems().itemPositiveprint ); break; default: return ModUtil.getEmptyStack(); } - itemstack.setTagCompound( nbttagcompound ); + stack.setTagCompound( nbttagcompound ); } if ( side != null ) { - ModUtil.setSide( itemstack, side ); + ModUtil.setSide( stack, side ); } - return itemstack; + return stack; } @Override diff --git a/src/main/java/mod/chiselsandbits/core/api/ChiselAndBitsAPI.java b/src/main/java/mod/chiselsandbits/core/api/ChiselAndBitsAPI.java index fbf769db..35a54c70 100644 --- a/src/main/java/mod/chiselsandbits/core/api/ChiselAndBitsAPI.java +++ b/src/main/java/mod/chiselsandbits/core/api/ChiselAndBitsAPI.java @@ -116,16 +116,16 @@ public IBitAccess getBitAccess( @Override public IBitBrush createBrush( - final ItemStack bitItem ) throws InvalidBitItem + final ItemStack stack ) throws InvalidBitItem { - if ( ModUtil.isEmpty(bitItem) ) + if ( ModUtil.isEmpty(stack) ) { return new BitBrush( 0 ); } - if ( bitItem.getItem() == null || getItemType( bitItem ) == ItemType.CHISLED_BIT ) + if ( stack.getItem() == null || getItemType( stack ) == ItemType.CHISLED_BIT ) { - final int stateID = ItemChiseledBit.getStackState( bitItem ); + final int stateID = ItemChiseledBit.getStackState( stack ); final IBlockState state = ModUtil.getStateById( stateID ); if ( state != null && BlockBitInfo.supportsBlock( state ) ) @@ -157,44 +157,44 @@ public IBitLocation getBitPos( @Override public ItemType getItemType( - final ItemStack item ) + final ItemStack stack ) { - if ( item.getItem() instanceof ItemChiseledBit ) + if ( stack.getItem() instanceof ItemChiseledBit ) { return ItemType.CHISLED_BIT; } - if ( item.getItem() instanceof ItemBitBag ) + if ( stack.getItem() instanceof ItemBitBag ) { return ItemType.BIT_BAG; } - if ( item.getItem() instanceof ItemChisel ) + if ( stack.getItem() instanceof ItemChisel ) { return ItemType.CHISEL; } - if ( item.getItem() instanceof ItemBlockChiseled ) + if ( stack.getItem() instanceof ItemBlockChiseled ) { return ItemType.CHISLED_BLOCK; } - if ( item.getItem() instanceof ItemMirrorPrint ) + if ( stack.getItem() instanceof ItemMirrorPrint ) { return ItemType.MIRROR_DESIGN; } - if ( item.getItem() instanceof ItemPositivePrint ) + if ( stack.getItem() instanceof ItemPositivePrint ) { return ItemType.POSITIVE_DESIGN; } - if ( item.getItem() instanceof ItemNegativePrint ) + if ( stack.getItem() instanceof ItemNegativePrint ) { return ItemType.NEGATIVE_DESIGN; } - if ( item.getItem() instanceof ItemWrench ) + if ( stack.getItem() instanceof ItemWrench ) { return ItemType.WRENCH; } @@ -204,23 +204,23 @@ public ItemType getItemType( @Override public IBitAccess createBitItem( - final ItemStack bitItemStack ) + final ItemStack stack ) { - if ( ModUtil.isEmpty(bitItemStack) ) + if ( ModUtil.isEmpty(stack) ) { return new BitAccess( null, null, new VoxelBlob(), VoxelBlob.NULL_BLOB ); } - final ItemType type = getItemType( bitItemStack ); + final ItemType type = getItemType( stack ); if ( type != null && type.isBitAccess ) { - final VoxelBlob blob = ModUtil.getBlobFromStack( bitItemStack, null ); + final VoxelBlob blob = ModUtil.getBlobFromStack( stack, null ); return new BitAccess( null, null, blob, VoxelBlob.NULL_BLOB ); } - if ( bitItemStack != null && bitItemStack.getItem() instanceof ItemBlock ) + if ( stack.getItem() instanceof ItemBlock ) { - final IBlockState state = DeprecationHelper.getStateFromItem( bitItemStack ); + final IBlockState state = DeprecationHelper.getStateFromItem( stack ); if ( BlockBitInfo.supportsBlock( state ) ) { @@ -265,10 +265,10 @@ public ItemStack getBitItem( @Override public void giveBitToPlayer( final EntityPlayer player, - final ItemStack is, + final ItemStack stack, Vec3d spawnPos ) { - if ( ModUtil.isEmpty(is) ) + if ( ModUtil.isEmpty(stack) ) { return; } @@ -278,9 +278,9 @@ public void giveBitToPlayer( spawnPos = new Vec3d( player.posX, player.posY, player.posZ ); } - final EntityItem ei = new EntityItem( player.getEntityWorld(), spawnPos.xCoord, spawnPos.yCoord, spawnPos.zCoord, is ); + final EntityItem ei = new EntityItem( player.getEntityWorld(), spawnPos.xCoord, spawnPos.yCoord, spawnPos.zCoord, stack ); - if ( is.getItem() == ChiselsAndBits.getItems().itemBlockBit ) + if ( stack.getItem() == ChiselsAndBits.getItems().itemBlockBit ) { if ( player.getEntityWorld().isRemote ) { @@ -290,20 +290,20 @@ public void giveBitToPlayer( ModUtil.feedPlayer( player.getEntityWorld(), player, ei ); return; } - else if ( !player.inventory.addItemStackToInventory( is ) ) + else if ( !player.inventory.addItemStackToInventory( stack ) ) { - ei.setEntityItemStack( is ); + ei.setEntityItemStack( stack ); player.getEntityWorld().spawnEntityInWorld( ei ); } } @Override public IBitBag getBitbag( - final ItemStack itemstack ) + final ItemStack stack ) { - if ( !ModUtil.isEmpty(itemstack) ) + if ( !ModUtil.isEmpty(stack) ) { - final Object o = itemstack.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP ); + final Object o = stack.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP ); if ( o instanceof IBitBag ) { return (IBitBag) o;