mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFillingWand.java
This commit is contained in:
commit
9d7d7bd3fc
1 changed files with 46 additions and 46 deletions
|
@ -37,52 +37,6 @@ public class ItemFillingWand extends ItemEnergy{
|
||||||
super(800000, 2000, name);
|
super(800000, 2000, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean removeFittingItem(IBlockState state, EntityPlayer player){
|
|
||||||
Block block = state.getBlock();
|
|
||||||
ItemStack stack = new ItemStack(block, 1, block.getMetaFromState(state));
|
|
||||||
|
|
||||||
if(stack != null && stack.getItem() != null){
|
|
||||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
|
|
||||||
ItemStack slot = player.inventory.getStackInSlot(i);
|
|
||||||
if(slot != null && slot.isItemEqual(stack) && slot.stackSize > 0){
|
|
||||||
slot.stackSize--;
|
|
||||||
if(slot.stackSize <= 0){
|
|
||||||
player.inventory.setInventorySlotContents(i, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void saveBlock(IBlockState state, ItemStack stack){
|
|
||||||
if(!stack.hasTagCompound()){
|
|
||||||
stack.setTagCompound(new NBTTagCompound());
|
|
||||||
}
|
|
||||||
NBTTagCompound compound = stack.getTagCompound();
|
|
||||||
|
|
||||||
Block block = state.getBlock();
|
|
||||||
compound.setString("Block", block.getRegistryName().toString());
|
|
||||||
compound.setInteger("Meta", block.getMetaFromState(state));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IBlockState loadBlock(ItemStack stack){
|
|
||||||
if(stack.hasTagCompound()){
|
|
||||||
NBTTagCompound compound = stack.getTagCompound();
|
|
||||||
String blockName = compound.getString("Block");
|
|
||||||
int meta = compound.getInteger("Meta");
|
|
||||||
|
|
||||||
Block block = Block.getBlockFromName(blockName);
|
|
||||||
if(block != null){
|
|
||||||
return block.getStateFromMeta(meta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){
|
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){
|
||||||
if(!world.isRemote && player.getItemInUseCount() <= 0){
|
if(!world.isRemote && player.getItemInUseCount() <= 0){
|
||||||
|
@ -245,6 +199,52 @@ public class ItemFillingWand extends ItemEnergy{
|
||||||
list.add("Selected Block: "+display);
|
list.add("Selected Block: "+display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean removeFittingItem(IBlockState state, EntityPlayer player){
|
||||||
|
Block block = state.getBlock();
|
||||||
|
ItemStack stack = new ItemStack(block, 1, block.damageDropped(state));
|
||||||
|
|
||||||
|
if(stack != null && stack.getItem() != null){
|
||||||
|
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
|
||||||
|
ItemStack slot = player.inventory.getStackInSlot(i);
|
||||||
|
if(slot != null && slot.isItemEqual(stack) && slot.stackSize > 0){
|
||||||
|
slot.stackSize--;
|
||||||
|
if(slot.stackSize <= 0){
|
||||||
|
player.inventory.setInventorySlotContents(i, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void saveBlock(IBlockState state, ItemStack stack){
|
||||||
|
if(!stack.hasTagCompound()){
|
||||||
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
|
}
|
||||||
|
NBTTagCompound compound = stack.getTagCompound();
|
||||||
|
|
||||||
|
Block block = state.getBlock();
|
||||||
|
compound.setString("Block", block.getRegistryName().toString());
|
||||||
|
compound.setInteger("Meta", block.getMetaFromState(state));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IBlockState loadBlock(ItemStack stack){
|
||||||
|
if(stack.hasTagCompound()){
|
||||||
|
NBTTagCompound compound = stack.getTagCompound();
|
||||||
|
String blockName = compound.getString("Block");
|
||||||
|
int meta = compound.getInteger("Meta");
|
||||||
|
|
||||||
|
Block block = Block.getBlockFromName(blockName);
|
||||||
|
if(block != null){
|
||||||
|
return block.getStateFromMeta(meta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxItemUseDuration(ItemStack stack){
|
public int getMaxItemUseDuration(ItemStack stack){
|
||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
|
|
Loading…
Reference in a new issue