diff --git a/src/main/java/com/hbm/blocks/generic/BarbedWire.java b/src/main/java/com/hbm/blocks/generic/BarbedWire.java index 5be89ec51..b52d5ff46 100644 --- a/src/main/java/com/hbm/blocks/generic/BarbedWire.java +++ b/src/main/java/com/hbm/blocks/generic/BarbedWire.java @@ -21,93 +21,93 @@ import net.minecraft.world.World; public class BarbedWire extends Block { - public BarbedWire(Material mat) { - super(mat); - } - - public void onEntityCollidedWithBlock(World p_149670_1_, int x, int y, int z, Entity ent) { - - ent.setInWeb(); + public BarbedWire(Material mat) { + super(mat); + } - if(this == ModBlocks.barbed_wire) { - ent.attackEntityFrom(DamageSource.cactus, 2.0F); - } + public void onEntityCollidedWithBlock(World p_149670_1_, int x, int y, int z, Entity ent) { - if(this == ModBlocks.barbed_wire_fire) { - ent.attackEntityFrom(DamageSource.cactus, 2.0F); - ent.setFire(1); - } + //ent.setInWeb(); - if(this == ModBlocks.barbed_wire_poison) { - ent.attackEntityFrom(DamageSource.cactus, 2.0F); - - if(ent instanceof EntityLivingBase) - ((EntityLivingBase)ent).addPotionEffect(new PotionEffect(Potion.poison.id, 5 * 20, 2)); - - } + ent.motionX *= 0.25D; + ent.motionY *= 0.1D; + ent.motionZ *= 0.25D; - if(this == ModBlocks.barbed_wire_acid) { - ent.attackEntityFrom(DamageSource.cactus, 2.0F); + if(this == ModBlocks.barbed_wire) { + ent.attackEntityFrom(DamageSource.cactus, 2.0F); + } - if(ent instanceof EntityPlayer) { - ArmorUtil.damageSuit((EntityPlayer)ent, 0, 1); - ArmorUtil.damageSuit((EntityPlayer)ent, 1, 1); - ArmorUtil.damageSuit((EntityPlayer)ent, 2, 1); - ArmorUtil.damageSuit((EntityPlayer)ent, 3, 1); - } - } + if(this == ModBlocks.barbed_wire_fire) { + ent.attackEntityFrom(DamageSource.cactus, 2.0F); + ent.setFire(1); + } - if(this == ModBlocks.barbed_wire_wither) { - ent.attackEntityFrom(DamageSource.cactus, 2.0F); - - if(ent instanceof EntityLivingBase) - ((EntityLivingBase)ent).addPotionEffect(new PotionEffect(Potion.wither.id, 5 * 20, 4)); - } + if(this == ModBlocks.barbed_wire_poison) { + ent.attackEntityFrom(DamageSource.cactus, 2.0F); - if(this == ModBlocks.barbed_wire_ultradeath) { + if(ent instanceof EntityLivingBase) + ((EntityLivingBase) ent).addPotionEffect(new PotionEffect(Potion.poison.id, 5 * 20, 2)); + + } + + if(this == ModBlocks.barbed_wire_acid) { + ent.attackEntityFrom(DamageSource.cactus, 2.0F); + + if(ent instanceof EntityPlayer) { + ArmorUtil.damageSuit((EntityPlayer) ent, 0, 1); + ArmorUtil.damageSuit((EntityPlayer) ent, 1, 1); + ArmorUtil.damageSuit((EntityPlayer) ent, 2, 1); + ArmorUtil.damageSuit((EntityPlayer) ent, 3, 1); + } + } + + if(this == ModBlocks.barbed_wire_wither) { + ent.attackEntityFrom(DamageSource.cactus, 2.0F); + + if(ent instanceof EntityLivingBase) + ((EntityLivingBase) ent).addPotionEffect(new PotionEffect(Potion.wither.id, 5 * 20, 4)); + } + + if(this == ModBlocks.barbed_wire_ultradeath) { ent.attackEntityFrom(ModDamageSource.pc, 5.0F); - - if(ent instanceof EntityLivingBase) - ((EntityLivingBase)ent).addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 5 * 20, 9)); - } - } - public boolean isOpaqueCube() - { - return false; - } + if(ent instanceof EntityLivingBase) + ((EntityLivingBase) ent).addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 5 * 20, 9)); + } + } - public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) - { - return null; - } - - public static int renderID = RenderingRegistry.getNextAvailableRenderId(); + public boolean isOpaqueCube() { + return false; + } - public int getRenderType() - { - return renderID; - } + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { + return null; + } - public boolean renderAsNormalBlock() - { - return false; + public static int renderID = RenderingRegistry.getNextAvailableRenderId(); + + public int getRenderType() { + return renderID; + } + + public boolean renderAsNormalBlock() { + return false; } @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - if (i == 0) { + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } - if (i == 1) { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if (i == 2) { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - if (i == 3) { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } } diff --git a/src/main/java/com/hbm/handler/HbmKeybinds.java b/src/main/java/com/hbm/handler/HbmKeybinds.java index ee6a995dd..19ae602f3 100644 --- a/src/main/java/com/hbm/handler/HbmKeybinds.java +++ b/src/main/java/com/hbm/handler/HbmKeybinds.java @@ -59,7 +59,6 @@ public class HbmKeybinds { if(last != current) { PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, current)); props.setKeyPressed(key, current); - System.out.println(key); } } } diff --git a/src/main/java/com/hbm/inventory/FluidTank.java b/src/main/java/com/hbm/inventory/FluidTank.java index f2fac384b..32271f1f1 100644 --- a/src/main/java/com/hbm/inventory/FluidTank.java +++ b/src/main/java/com/hbm/inventory/FluidTank.java @@ -78,11 +78,16 @@ public class FluidTank { //Called on TE update public void updateTank(TileEntity te) { - updateTank(te.xCoord, te.yCoord, te.zCoord, te.getWorldObj().provider.dimensionId); + updateTank(te, 100); + } + public void updateTank(TileEntity te, int range) { + updateTank(te.xCoord, te.yCoord, te.zCoord, te.getWorldObj().provider.dimensionId, range); } - public void updateTank(int x, int y, int z, int dim) { - PacketDispatcher.wrapper.sendToAllAround(new TEFluidPacket(x, y, z, fluid, index, type), new TargetPoint(dim, x, y, z, 100)); + updateTank(x, y, z, dim, 100); + } + public void updateTank(int x, int y, int z, int dim, int range) { + PacketDispatcher.wrapper.sendToAllAround(new TEFluidPacket(x, y, z, fluid, index, type), new TargetPoint(dim, x, y, z, range)); } //Fills tank from canisters diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumExtractor.java b/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumExtractor.java index 4c3d339f7..87600125e 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumExtractor.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumExtractor.java @@ -45,7 +45,8 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen this.updateConnections(); - this.tanks[0].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId); + this.tanks[0].updateTank(this, 25); + this.tanks[1].updateTank(this, 25); age++; if(age >= 10) { diff --git a/src/main/java/com/hbm/world/feature/Dud.java b/src/main/java/com/hbm/world/feature/Dud.java index edda9403b..1622cfae4 100644 --- a/src/main/java/com/hbm/world/feature/Dud.java +++ b/src/main/java/com/hbm/world/feature/Dud.java @@ -4,7 +4,6 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; import com.hbm.config.GeneralConfig; -import com.hbm.main.MainRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -12,18 +11,16 @@ import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -public class Dud extends WorldGenerator -{ +public class Dud extends WorldGenerator { + Block Block1 = ModBlocks.steel_scaffold; Block Block2 = ModBlocks.machine_difurnace_off; Block Block3 = ModBlocks.factory_titanium_core; Block Block4 = ModBlocks.steel_wall; Block Block5 = ModBlocks.reinforced_light; - protected Block[] GetValidSpawnBlocks() - { - return new Block[] - { + protected Block[] GetValidSpawnBlocks() { + return new Block[] { Blocks.grass, Blocks.dirt, Blocks.stone, @@ -32,29 +29,21 @@ public class Dud extends WorldGenerator }; } - public boolean LocationIsValidSpawn(World world, int x, int y, int z) - { + public boolean LocationIsValidSpawn(World world, int x, int y, int z) { Block checkBlock = world.getBlock(x, y - 1, z); - Block blockAbove = world.getBlock(x, y , z); + Block blockAbove = world.getBlock(x, y, z); Block blockBelow = world.getBlock(x, y - 2, z); - for (Block i : GetValidSpawnBlocks()) - { - if (blockAbove != Blocks.air) - { + for(Block i : GetValidSpawnBlocks()) { + if(blockAbove != Blocks.air) { return false; } - if (checkBlock == i) - { + if(checkBlock == i) { return true; - } - else if (checkBlock == Blocks.snow_layer && blockBelow == i) - { + } else if(checkBlock == Blocks.snow_layer && blockBelow == i) { return true; - } - else if (checkBlock.getMaterial() == Material.plants && blockBelow == i) - { + } else if(checkBlock.getMaterial() == Material.plants && blockBelow == i) { return true; } } @@ -62,28 +51,25 @@ public class Dud extends WorldGenerator } @Override - public boolean generate(World world, Random rand, int x, int y, int z) - { + public boolean generate(World world, Random rand, int x, int y, int z) { int i = rand.nextInt(1); - if(i == 0) - { - generate_r0(world, rand, x, y, z); + if(i == 0) { + generate_r0(world, rand, x, y, z); } - return true; + return true; } - public boolean generate_r0(World world, Random rand, int x, int y, int z) - { + public boolean generate_r0(World world, Random rand, int x, int y, int z) { if(!LocationIsValidSpawn(world, x, y, z)) return false; - + world.setBlock(x, y, z, ModBlocks.crashed_balefire, rand.nextInt(4) + 2, 3); - + if(GeneralConfig.enableDebugMode) - System.out.print("[Debug] Successfully spawned dud at " + x + " " + y +" " + z + "\n"); + System.out.print("[Debug] Successfully spawned dud at " + x + " " + y + " " + z + "\n"); return true; } diff --git a/src/main/java/com/hbm/world/feature/Meteorite.java b/src/main/java/com/hbm/world/feature/Meteorite.java index 3bbd1612a..5fd973253 100644 --- a/src/main/java/com/hbm/world/feature/Meteorite.java +++ b/src/main/java/com/hbm/world/feature/Meteorite.java @@ -5,26 +5,17 @@ import java.util.List; import java.util.Random; import com.hbm.blocks.ModBlocks; -import com.hbm.config.GeneralConfig; import com.hbm.config.WorldConfig; import com.hbm.explosion.ExplosionLarge; -import com.hbm.explosion.ExplosionNT; -import com.hbm.explosion.ExplosionNukeGeneric; import com.hbm.explosion.ExplosionNukeSmall; -import com.hbm.explosion.ExplosionNT.ExAttrib; import com.hbm.items.ModItems; import com.hbm.lib.ModDamageSource; -import com.hbm.main.MainRegistry; -import com.hbm.packet.AuxParticlePacketNT; -import com.hbm.packet.PacketDispatcher; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; @@ -117,7 +108,7 @@ public class Meteorite { List list10 = new ArrayList(); list10.add(new ItemStack(ModBlocks.block_meteor_broken)); generateSphere5x5(world, rand, x, y, z, list10); - world.setBlock(x, y, z, ModBlocks.taint, 9, 2); + setBlock(world, x, y, z, ModBlocks.taint, 9, 2); return; case 11: // Atomic meteorite @@ -433,7 +424,7 @@ public class Meteorite { generateBox(world, rand, x, y, z, hullL); ItemStack stack = sCore.get(rand.nextInt(sCore.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void genL1(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { @@ -441,7 +432,7 @@ public class Meteorite { generateStar5x5(world, rand, x, y, z, op); generateStar3x3(world, rand, x, y, z, ip); ItemStack stack = core.get(rand.nextInt(core.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void genL2(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { @@ -449,7 +440,7 @@ public class Meteorite { generateSphere5x5(world, rand, x, y, z, op); generateStar3x3(world, rand, x, y, z, ip); ItemStack stack = core.get(rand.nextInt(core.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void genL3(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { @@ -457,7 +448,7 @@ public class Meteorite { generateSphere5x5(world, rand, x, y, z, op); generateBox(world, rand, x, y, z, ip); ItemStack stack = core.get(rand.nextInt(core.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void genL4(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { @@ -466,7 +457,7 @@ public class Meteorite { generateBox(world, rand, x, y, z, ip); generateStar3x3(world, rand, x, y, z, this.getRandomOre(rand)); ItemStack stack = core.get(rand.nextInt(core.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void genL5(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { @@ -475,27 +466,27 @@ public class Meteorite { generateStar5x5(world, rand, x, y, z, ip); generateStar3x3(world, rand, x, y, z, this.getRandomOre(rand)); ItemStack stack = core.get(rand.nextInt(core.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void genM1(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { generateSphere5x5(world, rand, x, y, z, hull); ItemStack stack = core.get(rand.nextInt(core.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void genM2(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { generateSphere5x5(world, rand, x, y, z, hull); generateStar3x3(world, rand, x, y, z, op); ItemStack stack = core.get(rand.nextInt(core.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void genM3(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { generateSphere5x5(world, rand, x, y, z, hull); generateBox(world, rand, x, y, z, op); ItemStack stack = core.get(rand.nextInt(core.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void genM4(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { @@ -503,14 +494,14 @@ public class Meteorite { generateBox(world, rand, x, y, z, op); generateStar3x3(world, rand, x, y, z, ip); ItemStack stack = core.get(rand.nextInt(core.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void genM5(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { generateSphere5x5(world, rand, x, y, z, hull); generateBox(world, rand, x, y, z, ip); ItemStack stack = core.get(rand.nextInt(core.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void genM6(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { @@ -518,7 +509,7 @@ public class Meteorite { generateBox(world, rand, x, y, z, ip); generateStar3x3(world, rand, x, y, z, this.getRandomOre(rand)); ItemStack stack = core.get(rand.nextInt(core.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void generateSphere7x7(World world, Random rand, int x, int y, int z, List set) { @@ -526,38 +517,38 @@ public class Meteorite { for(int b = -1; b < 2; b++) for(int c = -1; c < 2; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -1; a < 2; a++) for(int b = -3; b < 4; b++) for(int c = -1; c < 2; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -1; a < 2; a++) for(int b = -1; b < 2; b++) for(int c = -3; c < 4; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -2; a < 3; a++) for(int b = -2; b < 3; b++) for(int c = -1; c < 2; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -1; a < 2; a++) for(int b = -2; b < 3; b++) for(int c = -2; c < 3; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -2; a < 3; a++) for(int b = -1; b < 2; b++) for(int c = -2; c < 3; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } } @@ -566,19 +557,19 @@ public class Meteorite { for(int b = -1; b < 2; b++) for(int c = -1; c < 2; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -1; a < 2; a++) for(int b = -2; b < 3; b++) for(int c = -1; c < 2; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -1; a < 2; a++) for(int b = -1; b < 2; b++) for(int c = -2; c < 3; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } } @@ -587,57 +578,57 @@ public class Meteorite { for(int b = -1; b < 2; b++) for(int c = -1; c < 2; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -1; a < 2; a++) for(int b = -4; b < 5; b++) for(int c = -1; c < 2; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -1; a < 2; a++) for(int b = -1; b < 2; b++) for(int c = -4; c < 5; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -1; a < 2; a++) for(int b = -3; b < 4; b++) for(int c = -3; c < 4; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -3; a < 4; a++) for(int b = -1; b < 2; b++) for(int c = -3; c < 4; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -3; a < 4; a++) for(int b = -3; b < 4; b++) for(int c = -1; c < 2; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -3; a < 4; a++) for(int b = -2; b < 3; b++) for(int c = -2; c < 3; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -2; a < 3; a++) for(int b = -3; b < 4; b++) for(int c = -2; c < 3; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } for(int a = -2; a < 3; a++) for(int b = -2; b < 3; b++) for(int c = -3; c < 4; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } } @@ -646,7 +637,7 @@ public class Meteorite { for(int b = -1; b < 2; b++) for(int c = -1; c < 2; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } } @@ -655,39 +646,39 @@ public class Meteorite { for(int b = -1; b < 2; b++) for(int c = -1; c < 2; c++) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + 2, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + 2, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); stack = set.get(rand.nextInt(set.size())); - world.setBlock(x - 2, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x - 2, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); stack = set.get(rand.nextInt(set.size())); - world.setBlock(x, y + 2, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y + 2, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); stack = set.get(rand.nextInt(set.size())); - world.setBlock(x, y - 2, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y - 2, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); stack = set.get(rand.nextInt(set.size())); - world.setBlock(x, y, z + 2, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z + 2, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); stack = set.get(rand.nextInt(set.size())); - world.setBlock(x, y, z - 2, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z - 2, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public void generateStar3x3(World world, Random rand, int x, int y, int z, List set) { ItemStack stack = set.get(rand.nextInt(set.size())); - world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); stack = set.get(rand.nextInt(set.size())); - world.setBlock(x + 1, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x + 1, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); stack = set.get(rand.nextInt(set.size())); - world.setBlock(x - 1, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x - 1, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); stack = set.get(rand.nextInt(set.size())); - world.setBlock(x, y + 1, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y + 1, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); stack = set.get(rand.nextInt(set.size())); - world.setBlock(x, y - 1, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y - 1, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); stack = set.get(rand.nextInt(set.size())); - world.setBlock(x, y, z + 1, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z + 1, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); stack = set.get(rand.nextInt(set.size())); - world.setBlock(x, y, z - 1, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + setBlock(world, x, y, z - 1, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); } public List getRandomOre(Random rand) { @@ -717,5 +708,11 @@ public class Meteorite { return ores; } - + + private void setBlock(World world, int x, int y, int z, Block b, int meta, int flag) { + Block target = world.getBlock(x, y, z); + float hardness = target.getBlockHardness(world, x, y, z); + if(hardness != -1 && hardness < 10_000) + world.setBlock(x, y, z, b, meta, flag); + } }