From 7e4ca127933dc591b0d54542287f816e9794150e Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 22 Jun 2015 18:09:00 +0200 Subject: [PATCH] -Update 0.0.6.0 --- README.md | 4 +-- .../ellpeck/actuallyadditions/PLANNED.txt | 4 +++ .../actuallyadditions/blocks/BlockPlant.java | 2 +- .../actuallyadditions/blocks/InitBlocks.java | 2 +- .../crafting/ItemCrafting.java | 4 +-- .../inventory/ContainerEnergizer.java | 4 +-- .../actuallyadditions/items/ItemDrill.java | 24 ++++++------- .../tile/TileEntityEnergizer.java | 20 ++++++----- .../tile/TileEntityEnervator.java | 36 ++++++++++--------- 9 files changed, 52 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 36056bc70..4d7b16a71 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ What that means? I can decide what I want to do with the License myself. ### YOU MAY - Fork and modify the Code - Submit Pull Requests -- Copy Parts of the Code for other Projects +- Copy (SMALL!) Parts of the Code for other Projects - Make a Review/Spotlight of the Mod or use it in a Modpack - Make Let's Play (and similar) Videos containing my Mod @@ -20,7 +20,7 @@ What that means? I can decide what I want to do with the License myself. ### YOU CAN NOT - Copy the entire Code or claim it is yours. - Reupload the Code or Mod to another website or claim you made it. - +- Copy entire Classes, Methods or other big Parts of Code. ### YOU HAVE TO - Always credit me. Don't be a jerk and copy entire portions of the code and claim they're yours. diff --git a/src/main/java/ellpeck/actuallyadditions/PLANNED.txt b/src/main/java/ellpeck/actuallyadditions/PLANNED.txt index b3e7fb03f..2e145b832 100644 --- a/src/main/java/ellpeck/actuallyadditions/PLANNED.txt +++ b/src/main/java/ellpeck/actuallyadditions/PLANNED.txt @@ -109,3 +109,7 @@ -Dog Bones -Breed Dogs faster -Makes them have Babies too + +-Testificate Bucks + -Village House that has a Coffee Machine + -Villager who sells Coffee and Cookies diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java index a0acb372e..e04e805df 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java @@ -49,7 +49,7 @@ public class BlockPlant extends BlockCrops implements INameableItem, IFactoryHar @Override public int quantityDropped(int meta, int fortune, Random random){ - return random.nextInt(addDropAmount)+minDropAmount; + return meta >= 7 ? super.quantityDropped(meta, fortune, random) : random.nextInt(addDropAmount)+minDropAmount; } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java index 713d56dc8..821a6a463 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -219,7 +219,7 @@ public class InitBlocks{ } else{ errorAlreadyRegistered("Oil Fluid"); - } + } fluidOil = FluidRegistry.getFluid(oil); if(fluidOil.getBlock() == null || ConfigBoolValues.PREVENT_OIL_BLOCK_OVERRIDE.isEnabled()){ diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index b09a62682..076feb3d5 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -242,10 +242,10 @@ public class ItemCrafting{ //Crafter on a Stick if(ConfigCrafting.STICK_CRAFTER.isEnabled()) - GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemCrafterOnAStick), + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemCrafterOnAStick), new ItemStack(Blocks.crafting_table), new ItemStack(Items.sign), - new ItemStack(Items.slime_ball)); + "slimeball")); //Tiny Coal GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.TINY_COAL.ordinal()), diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java index c050deaea..fd54376ef 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerEnergizer.java @@ -88,13 +88,11 @@ public class ContainerEnergizer extends Container{ if(slot <= hotbarEnd && slot >= hotbarStart){ this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false); } - else if(slot <= inventoryEnd && slot >= inventoryStart){ this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false); } - else if(slot < inventoryStart){ - this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false); + this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false); } if(newStack.stackSize == 0) theSlot.putStack(null); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java index e12140994..1298809c3 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemDrill.java @@ -70,24 +70,22 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ ItemStack upgrade = this.getHasUpgradeAsStack(stack, ItemDrillUpgrade.UpgradeType.PLACER); if(upgrade != null){ int slot = ItemDrillUpgrade.getSlotToPlaceFrom(upgrade); - if(slot >= 0 && slot < InventoryPlayer.getHotbarSize() && slot != player.inventory.currentItem){ - ItemStack equip = player.inventory.getStackInSlot(slot); - if(equip != null){ + if(slot >= 0 && slot < InventoryPlayer.getHotbarSize()){ + ItemStack anEquip =player.inventory.getStackInSlot(slot); + if(anEquip != null && anEquip != stack){ + ItemStack equip = anEquip.copy(); if(!world.isRemote){ - boolean placed = false; try{ - placed = equip.tryPlaceItemIntoWorld(player, world, x, y, z, hitSide, hitX, hitY, hitZ); + if(equip.tryPlaceItemIntoWorld(player, world, x, y, z, hitSide, hitX, hitY, hitZ)){ + if(!player.capabilities.isCreativeMode) player.inventory.setInventorySlotContents(slot, equip.stackSize <= 0 ? null : equip.copy()); + player.inventoryContainer.detectAndSendChanges(); + return true; + } } catch(Exception e){ player.addChatComponentMessage(new ChatComponentText("Ouch! That really hurt! You must have done something wrong, don't do that again please!")); ModUtil.LOGGER.log(Level.ERROR, "Player "+player.getDisplayName()+" who should place a Block using a Drill at "+player.posX+", "+player.posY+", "+player.posZ+" in World "+world.provider.dimensionId+" threw an Exception! Don't let that happen again!"); } - - if(placed){ - player.inventory.setInventorySlotContents(slot, equip.stackSize <= 0 ? null : equip.copy()); - player.inventoryContainer.detectAndSendChanges(); - return true; - } } else return true; } @@ -320,7 +318,7 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ if(!world.isRemote){ if(!living.isSneaking() && this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)){ - this.breakBlocks(stack, 2, world, x, y, z, player); + this.breakBlocks(stack, 30, world, x, y, z, player); } else this.breakBlocks(stack, 1, world, x, y, z, player); } @@ -354,7 +352,7 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{ @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ - if(!world.isRemote && player.isSneaking()){ + if(!world.isRemote && player.isSneaking() && stack == player.getCurrentEquippedItem()){ player.openGui(ActuallyAdditions.instance, GuiHandler.DRILL_ID, world, (int)player.posX, (int)player.posY, (int)player.posZ); } return stack; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java index 4103c6008..62f7d0f1d 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java @@ -19,16 +19,18 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne @Override public void updateEntity(){ - if(this.slots[0] != null && this.slots[0].getItem() instanceof IEnergyContainerItem && this.slots[1] == null){ - if(this.storage.getEnergyStored() > 0){ - int received = ((IEnergyContainerItem)this.slots[0].getItem()).receiveEnergy(this.slots[0], this.storage.getEnergyStored(), false); - this.storage.extractEnergy(received, false); - } + if(!worldObj.isRemote){ + if(this.slots[0] != null && this.slots[0].getItem() instanceof IEnergyContainerItem && this.slots[1] == null){ + if(this.storage.getEnergyStored() > 0){ + int received = ((IEnergyContainerItem)this.slots[0].getItem()).receiveEnergy(this.slots[0], this.storage.getEnergyStored(), false); + this.storage.extractEnergy(received, false); + } - if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) >= ((IEnergyContainerItem)this.slots[0].getItem()).getMaxEnergyStored(this.slots[0])){ - this.slots[1] = this.slots[0].copy(); - this.slots[0].stackSize--; - if(this.slots[0].stackSize <= 0) this.slots[0] = null; + if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) >= ((IEnergyContainerItem)this.slots[0].getItem()).getMaxEnergyStored(this.slots[0])){ + this.slots[1] = this.slots[0].copy(); + this.slots[0].stackSize--; + if(this.slots[0].stackSize <= 0) this.slots[0] = null; + } } } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java index 936635337..a26b71c78 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java @@ -20,27 +20,29 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne @Override public void updateEntity(){ - if(this.slots[0] != null && this.slots[0].getItem() instanceof IEnergyContainerItem && this.slots[1] == null){ - if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) > 0){ - int toReceive = ((IEnergyContainerItem)this.slots[0].getItem()).extractEnergy(this.slots[0], this.storage.getMaxEnergyStored()-this.storage.getEnergyStored(), false); - this.storage.receiveEnergy(toReceive, false); + if(!worldObj.isRemote){ + if(this.slots[0] != null && this.slots[0].getItem() instanceof IEnergyContainerItem && this.slots[1] == null){ + if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) > 0){ + int toReceive = ((IEnergyContainerItem)this.slots[0].getItem()).extractEnergy(this.slots[0], this.storage.getMaxEnergyStored()-this.storage.getEnergyStored(), false); + this.storage.receiveEnergy(toReceive, false); + } + + if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) <= 0){ + this.slots[1] = this.slots[0].copy(); + this.slots[0].stackSize--; + if(this.slots[0].stackSize <= 0) this.slots[0] = null; + } } - if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) <= 0){ - this.slots[1] = this.slots[0].copy(); - this.slots[0].stackSize--; - if(this.slots[0].stackSize <= 0) this.slots[0] = null; + if(this.getEnergyStored(ForgeDirection.UNKNOWN) > 0){ + WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UP, storage); + WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, storage); + WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, storage); + WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.EAST, storage); + WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, storage); + WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage); } } - - if(this.getEnergyStored(ForgeDirection.UNKNOWN) > 0){ - WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UP, storage); - WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, storage); - WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, storage); - WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.EAST, storage); - WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, storage); - WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage); - } } @Override