From f7a2a6b408a02fe5d03ebe96e56b95f47841cc89 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 1 Aug 2015 18:26:13 +0200 Subject: [PATCH] More stuff on the Magnet & The Water Removal Ring --- .../config/values/ConfigIntValues.java | 5 ++- .../items/ItemWaterRemovalRing.java | 5 +-- .../tile/TileEntityOreMagnet.java | 34 ++++++++++--------- .../actuallyadditions/util/KeyUtil.java | 4 --- 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java index 6f75b3e8a..891cb24f8 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java @@ -142,7 +142,10 @@ public enum ConfigIntValues{ GROWTH_RING_GROWTH_PER_CYCLE("Growth Ring: Growth Ticks per Cycle", ConfigCategories.MACHINE_VALUES, 45, 1, 200, "The Amount of plants that get ticked per cycle"), MAGNET_RING_RANGE("Magnet Ring: Range", ConfigCategories.MACHINE_VALUES, 5, 3, 30, "The Range of the Magnet Ring"), - MAGNET_RING_ENERGY_USE("Magnet Ring: Energy Used", ConfigCategories.MACHINE_VALUES, 30, 0, 500, "The Amount of Energy the Magnet Ring uses per tick"); + MAGNET_RING_ENERGY_USE("Magnet Ring: Energy Used", ConfigCategories.MACHINE_VALUES, 30, 0, 500, "The Amount of Energy the Magnet Ring uses per tick"), + + WATER_RING_RANGE("Water Ring: Range", ConfigCategories.MACHINE_VALUES, 3, 1, 10, "The Range of the Water Ring"), + WATER_RING_ENERGY_USE("Magnet Ring: Energy Used", ConfigCategories.MACHINE_VALUES, 30, 0, 500, "The Amount of Energy the Water Ring uses per Block"); public final String name; public final String category; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java b/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java index 95805dcf5..82eb5a33e 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java @@ -2,6 +2,7 @@ package ellpeck.actuallyadditions.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.client.renderer.texture.IIconRegister; @@ -15,8 +16,8 @@ import net.minecraft.world.World; public class ItemWaterRemovalRing extends ItemEnergy implements INameableItem{ - private static final int RANGE = 3; - private static final int ENERGY_USED_PER_BLOCK = 30; + private static final int RANGE = ConfigIntValues.WATER_RING_RANGE.getValue(); + private static final int ENERGY_USED_PER_BLOCK = ConfigIntValues.WATER_RING_ENERGY_USE.getValue(); public ItemWaterRemovalRing(){ super(1000000, 5000, 2); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java index 27d8fb655..3eaff50bf 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java @@ -35,7 +35,7 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne private int currentWorkTimer; - private int maxWorkTimer = 15; + private int maxWorkTimer = 10; private int range = 10; public static int oilUsePerTick = 50; public static int energyUsePerTick = 400; @@ -86,22 +86,24 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne for(int y = this.yCoord-1; y > 0; y--){ Block block = worldObj.getBlock(xCoord+x, y, zCoord+z); int meta = worldObj.getBlockMetadata(xCoord+x, y, zCoord+z); - int[] oreIDs = OreDictionary.getOreIDs(new ItemStack(block, 1, meta)); - for(int ID : oreIDs){ - String oreName = OreDictionary.getOreName(ID); - //Is the block an ore according to the OreDictionary? - if(oreName.substring(0, 3).equals("ore")){ - //Remove the Block - worldObj.setBlockToAir(xCoord+x, y, zCoord+z); - worldObj.playAuxSFX(2001, xCoord+x, y, zCoord+z, Block.getIdFromBlock(block)+(meta << 12)); + if(!block.hasTileEntity(meta) && block.getBlockHardness(worldObj, xCoord+x, y, zCoord+z) >= 0.0F && (block.getMaterial().isToolNotRequired() || (block.getHarvestTool(meta).equals("pickaxe") && block.getHarvestLevel(meta) <= 3))){ + int[] oreIDs = OreDictionary.getOreIDs(new ItemStack(block, 1, meta)); + for(int ID : oreIDs){ + String oreName = OreDictionary.getOreName(ID); + //Is the block an ore according to the OreDictionary? + if(oreName.substring(0, 3).equals("ore")){ + //Remove the Block + worldObj.setBlockToAir(xCoord+x, y, zCoord+z); + worldObj.playAuxSFX(2001, xCoord+x, y, zCoord+z, Block.getIdFromBlock(block)+(meta << 12)); - //Set the Block at the Top again - worldObj.setBlock(xCoord+x, yCoord+toPlaceY, zCoord+z, block, meta, 2); - worldObj.playSoundEffect((double)xCoord+x+0.5D, (double)yCoord+toPlaceY+0.5D, (double)zCoord+z+0.5D, block.stepSound.func_150496_b(), (block.stepSound.getVolume()+1.0F)/2.0F, block.stepSound.getPitch()*0.8F); + //Set the Block at the Top again + worldObj.setBlock(xCoord+x, yCoord+toPlaceY, zCoord+z, block, meta, 2); + worldObj.playSoundEffect((double)xCoord+x+0.5D, (double)yCoord+toPlaceY+0.5D, (double)zCoord+z+0.5D, block.stepSound.func_150496_b(), (block.stepSound.getVolume()+1.0F)/2.0F, block.stepSound.getPitch()*0.8F); - //Extract oil - this.tank.drain(oilUsePerTick, true); - return; + //Extract oil + this.tank.drain(oilUsePerTick, true); + return; + } } } } @@ -189,7 +191,7 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill){ - if(resource.getFluid() == InitBlocks.fluidOil) return this.tank.fill(resource, doFill); + if(this.canFill(from, resource.getFluid())) return this.tank.fill(resource, doFill); return 0; } diff --git a/src/main/java/ellpeck/actuallyadditions/util/KeyUtil.java b/src/main/java/ellpeck/actuallyadditions/util/KeyUtil.java index a455ca1fa..7db820f5f 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/KeyUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/KeyUtil.java @@ -12,8 +12,4 @@ public class KeyUtil{ return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); } - public static boolean isAltPressed(){ - return Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU); - } - }