From c06522fd6f5e81d1d1879b0463de6350ce0e9502 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 1 Aug 2015 19:04:45 +0200 Subject: [PATCH] floor_double > typecasting --- .../ellpeck/actuallyadditions/crafting/BlockCrafting.java | 2 +- .../ellpeck/actuallyadditions/items/ItemGrowthRing.java | 7 ++++--- .../ellpeck/actuallyadditions/items/ItemLeafBlower.java | 3 ++- .../actuallyadditions/items/ItemWaterRemovalRing.java | 7 ++++--- .../actuallyadditions/tile/TileEntityOreMagnet.java | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java index f55abc6fb..d7dd646f0 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java @@ -100,7 +100,7 @@ public class BlockCrafting{ //Casing if(ConfigCrafting.CASING.isEnabled()) - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 16, TheMiscBlocks.LAVA_FACTORY_CASE.ordinal()), + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 8, TheMiscBlocks.LAVA_FACTORY_CASE.ordinal()), "ICI", 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), 'I', "blockIron")); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemGrowthRing.java b/src/main/java/ellpeck/actuallyadditions/items/ItemGrowthRing.java index dea850473..addfbeddb 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemGrowthRing.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemGrowthRing.java @@ -16,6 +16,7 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.IPlantable; @@ -53,9 +54,9 @@ public class ItemGrowthRing extends ItemEnergy implements INameableItem{ for(int x = -RANGE; x < RANGE+1; x++){ for(int z = -RANGE; z < RANGE+1; z++){ for(int y = -RANGE; y < RANGE+1; y++){ - int theX = (int)player.posX+x; - int theY = (int)player.posY+y; - int theZ = (int)player.posZ+z; + int theX = MathHelper.floor_double(player.posX+x); + int theY = MathHelper.floor_double(player.posY+y); + int theZ = MathHelper.floor_double(player.posZ+z); Block theBlock = world.getBlock(theX, theY, theZ); if((theBlock instanceof IGrowable || theBlock instanceof IPlantable) && !(theBlock instanceof BlockGrass)){ blocks.add(new WorldPos(world, theX, theY, theZ)); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java b/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java index 8f14b7761..3d3d13b41 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemLeafBlower.java @@ -16,6 +16,7 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; import java.util.ArrayList; @@ -39,7 +40,7 @@ public class ItemLeafBlower extends Item implements INameableItem{ if(!player.worldObj.isRemote){ if(time <= getMaxItemUseDuration(stack) && time % 2 == 0){ //Breaks the Blocks - this.breakStuff(player.worldObj, (int)player.posX, (int)player.posY, (int)player.posZ); + this.breakStuff(player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ)); //Plays a Minecart sounds (It really sounds like a Leaf Blower!) if(this.hasSound) player.worldObj.playSoundAtEntity(player, "minecart.base", 0.3F, 0.001F); } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java b/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java index 82eb5a33e..413356f0b 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemWaterRemovalRing.java @@ -12,6 +12,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class ItemWaterRemovalRing extends ItemEnergy implements INameableItem{ @@ -36,9 +37,9 @@ public class ItemWaterRemovalRing extends ItemEnergy implements INameableItem{ for(int x = -RANGE; x < RANGE+1; x++){ for(int z = -RANGE; z < RANGE+1; z++){ for(int y = -RANGE; y < RANGE+1; y++){ - int theX = (int)player.posX+x; - int theY = (int)player.posY+y; - int theZ = (int)player.posZ+z; + int theX = MathHelper.floor_double(player.posX+x); + int theY = MathHelper.floor_double(player.posY+y); + int theZ = MathHelper.floor_double(player.posZ+z); if(this.getEnergyStored(stack) >= ENERGY_USED_PER_BLOCK){ //Remove Water if(world.getBlock(theX, theY, theZ) == Blocks.water || world.getBlock(theX, theY, theZ) == Blocks.flowing_water){ diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java index 3eaff50bf..c5cf0aad3 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java @@ -57,8 +57,8 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne //The possible positions where ores can be mined up in RELATIVE COORDINATES!! ArrayList possiblePlacingPositions = new ArrayList(); - for(int x = -range; x <= range; x++){ - for(int z = -range; z <= range; z++){ + for(int x = -range/2; x <= range/2; x++){ + for(int z = -range/2; z <= range/2; z++){ //Check if there is a casing below the Block to mine if(WorldUtil.hasBlocksInPlacesGiven(new int[][]{{x, -1, z}}, InitBlocks.blockMisc, TheMiscBlocks.LAVA_FACTORY_CASE.ordinal(), worldObj, xCoord, yCoord, zCoord)){ //Can the block at the top be replaced?