More stuff on the Magnet & The Water Removal Ring

This commit is contained in:
Ellpeck 2015-08-01 18:26:13 +02:00
parent 24812ab53f
commit f7a2a6b408
4 changed files with 25 additions and 23 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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;
}

View file

@ -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);
}
}