floor_double > typecasting

This commit is contained in:
Ellpeck 2015-08-01 19:04:45 +02:00
parent 22ff8b0f9b
commit c06522fd6f
5 changed files with 13 additions and 10 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -57,8 +57,8 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
//The possible positions where ores can be mined up in RELATIVE COORDINATES!!
ArrayList<WorldPos> possiblePlacingPositions = new ArrayList<WorldPos>();
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?