some fixes

This commit is contained in:
Boblet 2022-04-12 16:00:19 +02:00
parent 4d2bda7820
commit db259a9fdc
6 changed files with 145 additions and 157 deletions

View File

@ -21,93 +21,93 @@ import net.minecraft.world.World;
public class BarbedWire extends Block { public class BarbedWire extends Block {
public BarbedWire(Material mat) { public BarbedWire(Material mat) {
super(mat); super(mat);
} }
public void onEntityCollidedWithBlock(World p_149670_1_, int x, int y, int z, Entity ent) {
ent.setInWeb();
if(this == ModBlocks.barbed_wire) { public void onEntityCollidedWithBlock(World p_149670_1_, int x, int y, int z, Entity ent) {
ent.attackEntityFrom(DamageSource.cactus, 2.0F);
}
if(this == ModBlocks.barbed_wire_fire) { //ent.setInWeb();
ent.attackEntityFrom(DamageSource.cactus, 2.0F);
ent.setFire(1);
}
if(this == ModBlocks.barbed_wire_poison) { ent.motionX *= 0.25D;
ent.attackEntityFrom(DamageSource.cactus, 2.0F); ent.motionY *= 0.1D;
ent.motionZ *= 0.25D;
if(ent instanceof EntityLivingBase)
((EntityLivingBase)ent).addPotionEffect(new PotionEffect(Potion.poison.id, 5 * 20, 2));
}
if(this == ModBlocks.barbed_wire_acid) { if(this == ModBlocks.barbed_wire) {
ent.attackEntityFrom(DamageSource.cactus, 2.0F); ent.attackEntityFrom(DamageSource.cactus, 2.0F);
}
if(ent instanceof EntityPlayer) { if(this == ModBlocks.barbed_wire_fire) {
ArmorUtil.damageSuit((EntityPlayer)ent, 0, 1); ent.attackEntityFrom(DamageSource.cactus, 2.0F);
ArmorUtil.damageSuit((EntityPlayer)ent, 1, 1); ent.setFire(1);
ArmorUtil.damageSuit((EntityPlayer)ent, 2, 1); }
ArmorUtil.damageSuit((EntityPlayer)ent, 3, 1);
}
}
if(this == ModBlocks.barbed_wire_wither) { if(this == ModBlocks.barbed_wire_poison) {
ent.attackEntityFrom(DamageSource.cactus, 2.0F); 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) { 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); ent.attackEntityFrom(ModDamageSource.pc, 5.0F);
if(ent instanceof EntityLivingBase)
((EntityLivingBase)ent).addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 5 * 20, 9));
}
}
public boolean isOpaqueCube() if(ent instanceof EntityLivingBase)
{ ((EntityLivingBase) ent).addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 5 * 20, 9));
return false; }
} }
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) public boolean isOpaqueCube() {
{ return false;
return null; }
}
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
public int getRenderType() public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
{ return null;
return renderID; }
}
public boolean renderAsNormalBlock() public static int renderID = RenderingRegistry.getNextAvailableRenderId();
{
return false; public int getRenderType() {
return renderID;
}
public boolean renderAsNormalBlock() {
return false;
} }
@Override @Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { 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; 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); world.setBlockMetadataWithNotify(x, y, z, 5, 2);
} }
if (i == 1) { if(i == 1) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2); world.setBlockMetadataWithNotify(x, y, z, 3, 2);
} }
if (i == 2) { if(i == 2) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2); world.setBlockMetadataWithNotify(x, y, z, 4, 2);
} }
if (i == 3) { if(i == 3) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2); world.setBlockMetadataWithNotify(x, y, z, 2, 2);
} }
} }

View File

@ -59,7 +59,6 @@ public class HbmKeybinds {
if(last != current) { if(last != current) {
PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, current)); PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, current));
props.setKeyPressed(key, current); props.setKeyPressed(key, current);
System.out.println(key);
} }
} }
} }

View File

@ -78,11 +78,16 @@ public class FluidTank {
//Called on TE update //Called on TE update
public void updateTank(TileEntity te) { 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) { 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 //Fills tank from canisters

View File

@ -45,7 +45,8 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen
this.updateConnections(); 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++; age++;
if(age >= 10) { if(age >= 10) {

View File

@ -4,7 +4,6 @@ import java.util.Random;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.config.GeneralConfig; import com.hbm.config.GeneralConfig;
import com.hbm.main.MainRegistry;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -12,18 +11,16 @@ import net.minecraft.init.Blocks;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
public class Dud extends WorldGenerator public class Dud extends WorldGenerator {
{
Block Block1 = ModBlocks.steel_scaffold; Block Block1 = ModBlocks.steel_scaffold;
Block Block2 = ModBlocks.machine_difurnace_off; Block Block2 = ModBlocks.machine_difurnace_off;
Block Block3 = ModBlocks.factory_titanium_core; Block Block3 = ModBlocks.factory_titanium_core;
Block Block4 = ModBlocks.steel_wall; Block Block4 = ModBlocks.steel_wall;
Block Block5 = ModBlocks.reinforced_light; Block Block5 = ModBlocks.reinforced_light;
protected Block[] GetValidSpawnBlocks() protected Block[] GetValidSpawnBlocks() {
{ return new Block[] {
return new Block[]
{
Blocks.grass, Blocks.grass,
Blocks.dirt, Blocks.dirt,
Blocks.stone, 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 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); Block blockBelow = world.getBlock(x, y - 2, z);
for (Block i : GetValidSpawnBlocks()) for(Block i : GetValidSpawnBlocks()) {
{ if(blockAbove != Blocks.air) {
if (blockAbove != Blocks.air)
{
return false; return false;
} }
if (checkBlock == i) if(checkBlock == i) {
{
return true; return true;
} } else if(checkBlock == Blocks.snow_layer && blockBelow == i) {
else if (checkBlock == Blocks.snow_layer && blockBelow == i)
{
return true; return true;
} } else if(checkBlock.getMaterial() == Material.plants && blockBelow == i) {
else if (checkBlock.getMaterial() == Material.plants && blockBelow == i)
{
return true; return true;
} }
} }
@ -62,28 +51,25 @@ public class Dud extends WorldGenerator
} }
@Override @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); int i = rand.nextInt(1);
if(i == 0) if(i == 0) {
{ generate_r0(world, rand, x, y, z);
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)) if(!LocationIsValidSpawn(world, x, y, z))
return false; return false;
world.setBlock(x, y, z, ModBlocks.crashed_balefire, rand.nextInt(4) + 2, 3); world.setBlock(x, y, z, ModBlocks.crashed_balefire, rand.nextInt(4) + 2, 3);
if(GeneralConfig.enableDebugMode) 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; return true;
} }

View File

@ -5,26 +5,17 @@ import java.util.List;
import java.util.Random; import java.util.Random;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.config.GeneralConfig;
import com.hbm.config.WorldConfig; import com.hbm.config.WorldConfig;
import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionNT;
import com.hbm.explosion.ExplosionNukeGeneric;
import com.hbm.explosion.ExplosionNukeSmall; import com.hbm.explosion.ExplosionNukeSmall;
import com.hbm.explosion.ExplosionNT.ExAttrib;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.lib.ModDamageSource; 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.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -117,7 +108,7 @@ public class Meteorite {
List<ItemStack> list10 = new ArrayList<ItemStack>(); List<ItemStack> list10 = new ArrayList<ItemStack>();
list10.add(new ItemStack(ModBlocks.block_meteor_broken)); list10.add(new ItemStack(ModBlocks.block_meteor_broken));
generateSphere5x5(world, rand, x, y, z, list10); 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; return;
case 11: case 11:
// Atomic meteorite // Atomic meteorite
@ -433,7 +424,7 @@ public class Meteorite {
generateBox(world, rand, x, y, z, hullL); generateBox(world, rand, x, y, z, hullL);
ItemStack stack = sCore.get(rand.nextInt(sCore.size())); 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<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) { public void genL1(World world, Random rand, int x, int y, int z, List<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) {
@ -441,7 +432,7 @@ public class Meteorite {
generateStar5x5(world, rand, x, y, z, op); generateStar5x5(world, rand, x, y, z, op);
generateStar3x3(world, rand, x, y, z, ip); generateStar3x3(world, rand, x, y, z, ip);
ItemStack stack = core.get(rand.nextInt(core.size())); 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<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) { public void genL2(World world, Random rand, int x, int y, int z, List<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) {
@ -449,7 +440,7 @@ public class Meteorite {
generateSphere5x5(world, rand, x, y, z, op); generateSphere5x5(world, rand, x, y, z, op);
generateStar3x3(world, rand, x, y, z, ip); generateStar3x3(world, rand, x, y, z, ip);
ItemStack stack = core.get(rand.nextInt(core.size())); 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<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) { public void genL3(World world, Random rand, int x, int y, int z, List<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) {
@ -457,7 +448,7 @@ public class Meteorite {
generateSphere5x5(world, rand, x, y, z, op); generateSphere5x5(world, rand, x, y, z, op);
generateBox(world, rand, x, y, z, ip); generateBox(world, rand, x, y, z, ip);
ItemStack stack = core.get(rand.nextInt(core.size())); 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<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) { public void genL4(World world, Random rand, int x, int y, int z, List<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) {
@ -466,7 +457,7 @@ public class Meteorite {
generateBox(world, rand, x, y, z, ip); generateBox(world, rand, x, y, z, ip);
generateStar3x3(world, rand, x, y, z, this.getRandomOre(rand)); generateStar3x3(world, rand, x, y, z, this.getRandomOre(rand));
ItemStack stack = core.get(rand.nextInt(core.size())); 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<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) { public void genL5(World world, Random rand, int x, int y, int z, List<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) {
@ -475,27 +466,27 @@ public class Meteorite {
generateStar5x5(world, rand, x, y, z, ip); generateStar5x5(world, rand, x, y, z, ip);
generateStar3x3(world, rand, x, y, z, this.getRandomOre(rand)); generateStar3x3(world, rand, x, y, z, this.getRandomOre(rand));
ItemStack stack = core.get(rand.nextInt(core.size())); 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<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) { public void genM1(World world, Random rand, int x, int y, int z, List<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) {
generateSphere5x5(world, rand, x, y, z, hull); generateSphere5x5(world, rand, x, y, z, hull);
ItemStack stack = core.get(rand.nextInt(core.size())); 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<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) { public void genM2(World world, Random rand, int x, int y, int z, List<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) {
generateSphere5x5(world, rand, x, y, z, hull); generateSphere5x5(world, rand, x, y, z, hull);
generateStar3x3(world, rand, x, y, z, op); generateStar3x3(world, rand, x, y, z, op);
ItemStack stack = core.get(rand.nextInt(core.size())); 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<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) { public void genM3(World world, Random rand, int x, int y, int z, List<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) {
generateSphere5x5(world, rand, x, y, z, hull); generateSphere5x5(world, rand, x, y, z, hull);
generateBox(world, rand, x, y, z, op); generateBox(world, rand, x, y, z, op);
ItemStack stack = core.get(rand.nextInt(core.size())); 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<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) { public void genM4(World world, Random rand, int x, int y, int z, List<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) {
@ -503,14 +494,14 @@ public class Meteorite {
generateBox(world, rand, x, y, z, op); generateBox(world, rand, x, y, z, op);
generateStar3x3(world, rand, x, y, z, ip); generateStar3x3(world, rand, x, y, z, ip);
ItemStack stack = core.get(rand.nextInt(core.size())); 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<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) { public void genM5(World world, Random rand, int x, int y, int z, List<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) {
generateSphere5x5(world, rand, x, y, z, hull); generateSphere5x5(world, rand, x, y, z, hull);
generateBox(world, rand, x, y, z, ip); generateBox(world, rand, x, y, z, ip);
ItemStack stack = core.get(rand.nextInt(core.size())); 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<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) { public void genM6(World world, Random rand, int x, int y, int z, List<ItemStack> hull, List<ItemStack> op, List<ItemStack> ip, List<ItemStack> core) {
@ -518,7 +509,7 @@ public class Meteorite {
generateBox(world, rand, x, y, z, ip); generateBox(world, rand, x, y, z, ip);
generateStar3x3(world, rand, x, y, z, this.getRandomOre(rand)); generateStar3x3(world, rand, x, y, z, this.getRandomOre(rand));
ItemStack stack = core.get(rand.nextInt(core.size())); 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<ItemStack> set) { public void generateSphere7x7(World world, Random rand, int x, int y, int z, List<ItemStack> set) {
@ -526,38 +517,38 @@ public class Meteorite {
for(int b = -1; b < 2; b++) for(int b = -1; b < 2; b++)
for(int c = -1; c < 2; c++) { for(int c = -1; c < 2; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -1; a < 2; a++)
for(int b = -3; b < 4; b++) for(int b = -3; b < 4; b++)
for(int c = -1; c < 2; c++) { for(int c = -1; c < 2; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -1; a < 2; a++)
for(int b = -1; b < 2; b++) for(int b = -1; b < 2; b++)
for(int c = -3; c < 4; c++) { for(int c = -3; c < 4; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -2; a < 3; a++)
for(int b = -2; b < 3; b++) for(int b = -2; b < 3; b++)
for(int c = -1; c < 2; c++) { for(int c = -1; c < 2; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -1; a < 2; a++)
for(int b = -2; b < 3; b++) for(int b = -2; b < 3; b++)
for(int c = -2; c < 3; c++) { for(int c = -2; c < 3; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -2; a < 3; a++)
for(int b = -1; b < 2; b++) for(int b = -1; b < 2; b++)
for(int c = -2; c < 3; c++) { for(int c = -2; c < 3; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 b = -1; b < 2; b++)
for(int c = -1; c < 2; c++) { for(int c = -1; c < 2; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -1; a < 2; a++)
for(int b = -2; b < 3; b++) for(int b = -2; b < 3; b++)
for(int c = -1; c < 2; c++) { for(int c = -1; c < 2; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -1; a < 2; a++)
for(int b = -1; b < 2; b++) for(int b = -1; b < 2; b++)
for(int c = -2; c < 3; c++) { for(int c = -2; c < 3; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 b = -1; b < 2; b++)
for(int c = -1; c < 2; c++) { for(int c = -1; c < 2; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -1; a < 2; a++)
for(int b = -4; b < 5; b++) for(int b = -4; b < 5; b++)
for(int c = -1; c < 2; c++) { for(int c = -1; c < 2; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -1; a < 2; a++)
for(int b = -1; b < 2; b++) for(int b = -1; b < 2; b++)
for(int c = -4; c < 5; c++) { for(int c = -4; c < 5; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -1; a < 2; a++)
for(int b = -3; b < 4; b++) for(int b = -3; b < 4; b++)
for(int c = -3; c < 4; c++) { for(int c = -3; c < 4; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -3; a < 4; a++)
for(int b = -1; b < 2; b++) for(int b = -1; b < 2; b++)
for(int c = -3; c < 4; c++) { for(int c = -3; c < 4; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -3; a < 4; a++)
for(int b = -3; b < 4; b++) for(int b = -3; b < 4; b++)
for(int c = -1; c < 2; c++) { for(int c = -1; c < 2; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -3; a < 4; a++)
for(int b = -2; b < 3; b++) for(int b = -2; b < 3; b++)
for(int c = -2; c < 3; c++) { for(int c = -2; c < 3; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -2; a < 3; a++)
for(int b = -3; b < 4; b++) for(int b = -3; b < 4; b++)
for(int c = -2; c < 3; c++) { for(int c = -2; c < 3; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 a = -2; a < 3; a++)
for(int b = -2; b < 3; b++) for(int b = -2; b < 3; b++)
for(int c = -3; c < 4; c++) { for(int c = -3; c < 4; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 b = -1; b < 2; b++)
for(int c = -1; c < 2; c++) { for(int c = -1; c < 2; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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 b = -1; b < 2; b++)
for(int c = -1; c < 2; c++) { for(int c = -1; c < 2; c++) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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())); 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())); 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())); 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())); 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())); 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())); 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<ItemStack> set) { public void generateStar3x3(World world, Random rand, int x, int y, int z, List<ItemStack> set) {
ItemStack stack = set.get(rand.nextInt(set.size())); 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())); 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())); 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())); 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())); 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())); 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())); 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<ItemStack> getRandomOre(Random rand) { public List<ItemStack> getRandomOre(Random rand) {
@ -717,5 +708,11 @@ public class Meteorite {
return ores; 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);
}
} }