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"), 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_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 name;
public final String category; 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.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.INameableItem; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -15,8 +16,8 @@ import net.minecraft.world.World;
public class ItemWaterRemovalRing extends ItemEnergy implements INameableItem{ public class ItemWaterRemovalRing extends ItemEnergy implements INameableItem{
private static final int RANGE = 3; private static final int RANGE = ConfigIntValues.WATER_RING_RANGE.getValue();
private static final int ENERGY_USED_PER_BLOCK = 30; private static final int ENERGY_USED_PER_BLOCK = ConfigIntValues.WATER_RING_ENERGY_USE.getValue();
public ItemWaterRemovalRing(){ public ItemWaterRemovalRing(){
super(1000000, 5000, 2); super(1000000, 5000, 2);

View file

@ -35,7 +35,7 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
private int currentWorkTimer; private int currentWorkTimer;
private int maxWorkTimer = 15; private int maxWorkTimer = 10;
private int range = 10; private int range = 10;
public static int oilUsePerTick = 50; public static int oilUsePerTick = 50;
public static int energyUsePerTick = 400; 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--){ for(int y = this.yCoord-1; y > 0; y--){
Block block = worldObj.getBlock(xCoord+x, y, zCoord+z); Block block = worldObj.getBlock(xCoord+x, y, zCoord+z);
int meta = worldObj.getBlockMetadata(xCoord+x, y, zCoord+z); int meta = worldObj.getBlockMetadata(xCoord+x, y, zCoord+z);
int[] oreIDs = OreDictionary.getOreIDs(new ItemStack(block, 1, meta)); 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))){
for(int ID : oreIDs){ int[] oreIDs = OreDictionary.getOreIDs(new ItemStack(block, 1, meta));
String oreName = OreDictionary.getOreName(ID); for(int ID : oreIDs){
//Is the block an ore according to the OreDictionary? String oreName = OreDictionary.getOreName(ID);
if(oreName.substring(0, 3).equals("ore")){ //Is the block an ore according to the OreDictionary?
//Remove the Block if(oreName.substring(0, 3).equals("ore")){
worldObj.setBlockToAir(xCoord+x, y, zCoord+z); //Remove the Block
worldObj.playAuxSFX(2001, xCoord+x, y, zCoord+z, Block.getIdFromBlock(block)+(meta << 12)); 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 //Set the Block at the Top again
worldObj.setBlock(xCoord+x, yCoord+toPlaceY, zCoord+z, block, meta, 2); 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); 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 //Extract oil
this.tank.drain(oilUsePerTick, true); this.tank.drain(oilUsePerTick, true);
return; return;
}
} }
} }
} }
@ -189,7 +191,7 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
@Override @Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){ 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; return 0;
} }

View file

@ -12,8 +12,4 @@ public class KeyUtil{
return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); 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);
}
} }