diff --git a/src/main/java/com/hbm/blocks/BlockEnums.java b/src/main/java/com/hbm/blocks/BlockEnums.java index 99d7edadf..5a8e89122 100644 --- a/src/main/java/com/hbm/blocks/BlockEnums.java +++ b/src/main/java/com/hbm/blocks/BlockEnums.java @@ -10,6 +10,11 @@ public class BlockEnums { LIMESTONE } + public static enum EnumBiomeType { + DESERT, + WOODLAND + } + public static enum EnumStalagmiteType { SULFUR, ASBESTOS diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index fe53bd84c..0a0df5800 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -138,6 +138,7 @@ public class ModBlocks { public static Block stone_resource; public static Block stalagmite; public static Block stalactite; + public static Block stone_biome; public static Block stone_deep_cobble; public static Block depth_brick; @@ -1318,6 +1319,7 @@ public class ModBlocks { stone_resource = new BlockResourceStone().setBlockName("stone_resource").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F); stalagmite = new BlockStalagmite().setBlockName("stalagmite").setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.0F); stalactite = new BlockStalagmite().setBlockName("stalactite").setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setResistance(2.0F); + stone_biome = new BlockBiomeStone().setBlockName("stone_biome").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F); stone_deep_cobble = new BlockDeepCobble().setBlockName("stone_deep_cobble").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(30.0F); basalt = new BlockGeneric(Material.rock).setBlockName("basalt").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":basalt"); @@ -1443,7 +1445,7 @@ public class ModBlocks { block_semtex = new BlockPlasticExplosive(Material.tnt).setBlockName("block_semtex").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(2.0F).setBlockTextureName(RefStrings.MODID + ":block_semtex"); block_c4 = new BlockPlasticExplosive(Material.tnt).setBlockName("block_c4").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(2.0F).setBlockTextureName(RefStrings.MODID + ":block_c4"); block_smore = new BlockPillar(Material.rock, RefStrings.MODID + ":block_smore_top").setBlockName("block_smore").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":block_smore_side"); - block_slag = new BlockBeaconable(Material.iron).setBlockName("block_slag").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_slag"); + block_slag = new BlockSlag(Material.rock).setBlockName("block_slag").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeStone).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_slag"); block_australium = new BlockBeaconable(Material.iron).setBlockName("block_australium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_australium"); block_weidanium = new BlockBeaconable(Material.iron).setBlockName("block_weidanium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_weidanium"); @@ -2461,9 +2463,10 @@ public class ModBlocks { GameRegistry.registerBlock(crystal_trixite, crystal_trixite.getUnlocalizedName()); //Resource-bearing Stones - GameRegistry.registerBlock(stone_resource, ItemBlockBase.class, stone_resource.getUnlocalizedName()); - GameRegistry.registerBlock(stalagmite, ItemBlockBase.class, stalagmite.getUnlocalizedName()); - GameRegistry.registerBlock(stalactite, ItemBlockBase.class, stalactite.getUnlocalizedName()); + register(stone_resource); + register(stalagmite); + register(stalactite); + register(stone_biome); //Stone Variants GameRegistry.registerBlock(stone_porous, stone_porous.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/generic/BlockBiomeStone.java b/src/main/java/com/hbm/blocks/generic/BlockBiomeStone.java new file mode 100644 index 000000000..a53cce92d --- /dev/null +++ b/src/main/java/com/hbm/blocks/generic/BlockBiomeStone.java @@ -0,0 +1,53 @@ +package com.hbm.blocks.generic; + +import com.hbm.blocks.BlockEnumMulti; +import com.hbm.blocks.BlockEnums.EnumBiomeType; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +public class BlockBiomeStone extends BlockEnumMulti { + + public BlockBiomeStone() { + super(Material.rock, EnumBiomeType.class, true, true); + } + + protected IIcon[] iconsTop; + protected IIcon[] iconsLayer; + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + + Enum[] enums = theEnum.getEnumConstants(); + this.icons = new IIcon[enums.length]; + this.iconsTop = new IIcon[enums.length]; + this.iconsLayer = new IIcon[enums.length]; + + for(int i = 0; i < icons.length; i++) { + Enum num = enums[i]; + this.icons[i] = reg.registerIcon(this.getTextureName() + "." + num.name().toLowerCase()); + this.iconsTop[i] = reg.registerIcon(this.getTextureName() + "_top." + num.name().toLowerCase()); + this.iconsLayer[i] = reg.registerIcon(this.getTextureName() + "_layer." + num.name().toLowerCase()); + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + + int meta = world.getBlockMetadata(x, y, z); + if(side == 0) return this.iconsTop[meta % this.icons.length]; + if(side == 1) return this.iconsTop[meta % this.icons.length]; + + if(world.getBlock(x, y + 1, z) == this && world.getBlockMetadata(x, y + 1, z) == meta) { + return this.getIcon(side, meta); + } else { + return this.iconsLayer[meta % this.icons.length]; + } + } +} diff --git a/src/main/java/com/hbm/blocks/generic/BlockSlag.java b/src/main/java/com/hbm/blocks/generic/BlockSlag.java new file mode 100644 index 000000000..b18db55b1 --- /dev/null +++ b/src/main/java/com/hbm/blocks/generic/BlockSlag.java @@ -0,0 +1,32 @@ +package com.hbm.blocks.generic; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; + +public class BlockSlag extends BlockBeaconable { + + @SideOnly(Side.CLIENT) + private IIcon iconAlt; + + public BlockSlag(Material mat) { + super(mat); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + super.registerBlockIcons(iconRegister); + this.iconAlt = iconRegister.registerIcon(this.getTextureName() + "_broken"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int metadata) { + if(metadata == 1) return this.iconAlt; + + return this.blockIcon; + } +} diff --git a/src/main/java/com/hbm/entity/EntityMappings.java b/src/main/java/com/hbm/entity/EntityMappings.java index 844c470e9..23a8e70fd 100644 --- a/src/main/java/com/hbm/entity/EntityMappings.java +++ b/src/main/java/com/hbm/entity/EntityMappings.java @@ -20,6 +20,10 @@ import com.hbm.util.Tuple.Quartet; import cpw.mods.fml.common.registry.EntityRegistry; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry; public class EntityMappings { @@ -211,6 +215,8 @@ public class EntityMappings { addMob(EntityCreeperNuclear.class, "entity_mob_nuclear_creeper", 0x204131, 0x75CE00); addMob(EntityCreeperTainted.class, "entity_mob_tainted_creeper", 0x813b9b, 0xd71fdd); addMob(EntityCreeperPhosgene.class, "entity_mob_phosgene_creeper", 0xE3D398, 0xB8A06B); + addMob(EntityCreeperVolatile.class, "entity_mob_volatile_creeper", 0xC28153, 0x4D382C); + addMob(EntityCreeperGold.class, "entity_mob_gold_creeper", 0xECC136, 0x9E8B3E); addMob(EntityHunterChopper.class, "entity_mob_hunter_chopper", 0x000020, 0x2D2D72); addMob(EntityCyberCrab.class, "entity_cyber_crab", 0xAAAAAA, 0x444444); addMob(EntityTeslaCrab.class, "entity_tesla_crab", 0xAAAAAA, 0x440000); @@ -224,6 +230,10 @@ public class EntityMappings { addMob(EntitySiegeSkeleton.class, "entity_meme_skeleton", 0x303030, 0x000080); addMob(EntitySiegeUFO.class, "entity_meme_ufo", 0x303030, 0x800000); addMob(EntitySiegeCraft.class, "entity_meme_craft", 0x303030, 0x808000); + + addSpawn(EntityCreeperPhosgene.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray()); + addSpawn(EntityCreeperVolatile.class, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray()); + addSpawn(EntityCreeperGold.class, 1, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray()); int id = 0; for(Quartet, String, Integer, Boolean> entry : entityMappings) { @@ -246,4 +256,26 @@ public class EntityMappings { private static void addMob(Class clazz, String name, int color1, int color2) { mobMappings.add(new Quartet(clazz, name, color1, color2)); } + + public static void addSpawn(Class entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes) { + + for(BiomeGenBase biome : biomes) { + + if(biome == null) continue; + + List spawns = biome.getSpawnableList(typeOfCreature); + + for(SpawnListEntry entry : spawns) { + // Adjusting an existing spawn entry + if(entry.entityClass == entityClass) { + entry.itemWeight = weightedProb; + entry.minGroupCount = min; + entry.maxGroupCount = max; + break; + } + } + + spawns.add(new SpawnListEntry(entityClass, weightedProb, min, max)); + } + } } diff --git a/src/main/java/com/hbm/entity/mob/EntityCreeperGold.java b/src/main/java/com/hbm/entity/mob/EntityCreeperGold.java new file mode 100644 index 000000000..d9ab7d3b6 --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/EntityCreeperGold.java @@ -0,0 +1,36 @@ +package com.hbm.entity.mob; + +import com.hbm.explosion.vanillant.ExplosionVNT; +import com.hbm.explosion.vanillant.standard.*; + +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; + +public class EntityCreeperGold extends EntityCreeper { + + public EntityCreeperGold(World world) { + super(world); + } + + @Override + public void func_146077_cc() { + + if(!this.worldObj.isRemote) { + this.setDead(); + + ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, 7); + vnt.setBlockAllocator(new BlockAllocatorBulkie(60)); + vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorBulkie(Blocks.gold_ore))); + vnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(0.5F)); + vnt.setPlayerProcessor(new PlayerProcessorStandard()); + vnt.setSFX(new ExplosionEffectStandard()); + vnt.explode(); + } + } + + @Override + public boolean getCanSpawnHere() { + return super.getCanSpawnHere() && this.posY <= 40; + } +} diff --git a/src/main/java/com/hbm/entity/mob/EntityCreeperVolatile.java b/src/main/java/com/hbm/entity/mob/EntityCreeperVolatile.java new file mode 100644 index 000000000..d957c7aca --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/EntityCreeperVolatile.java @@ -0,0 +1,36 @@ +package com.hbm.entity.mob; + +import com.hbm.blocks.ModBlocks; +import com.hbm.explosion.vanillant.ExplosionVNT; +import com.hbm.explosion.vanillant.standard.*; + +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.world.World; + +public class EntityCreeperVolatile extends EntityCreeper { + + public EntityCreeperVolatile(World world) { + super(world); + } + + @Override + public void func_146077_cc() { + + if(!this.worldObj.isRemote) { + this.setDead(); + + ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, 7); + vnt.setBlockAllocator(new BlockAllocatorBulkie(60)); + vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorBulkie(ModBlocks.block_slag, 1))); + vnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(0.5F)); + vnt.setPlayerProcessor(new PlayerProcessorStandard()); + vnt.setSFX(new ExplosionEffectStandard()); + vnt.explode(); + } + } + + @Override + public boolean getCanSpawnHere() { + return super.getCanSpawnHere() && this.posY <= 40; + } +} diff --git a/src/main/java/com/hbm/explosion/vanillant/ExplosionVNT.java b/src/main/java/com/hbm/explosion/vanillant/ExplosionVNT.java index 891c10213..e1c217617 100644 --- a/src/main/java/com/hbm/explosion/vanillant/ExplosionVNT.java +++ b/src/main/java/com/hbm/explosion/vanillant/ExplosionVNT.java @@ -39,10 +39,10 @@ public class ExplosionVNT { //since we want to reduce each effect to the bare minimum (sound, particles, etc. being separate) we definitely need multiple most of the time private IExplosionSFX[] sfx; - protected World world; - protected double posX; - protected double posY; - protected double posZ; + public World world; + public double posX; + public double posY; + public double posZ; public float size; public Entity exploder; diff --git a/src/main/java/com/hbm/explosion/vanillant/interfaces/IBlockMutator.java b/src/main/java/com/hbm/explosion/vanillant/interfaces/IBlockMutator.java index d1e29ecbc..904f01c69 100644 --- a/src/main/java/com/hbm/explosion/vanillant/interfaces/IBlockMutator.java +++ b/src/main/java/com/hbm/explosion/vanillant/interfaces/IBlockMutator.java @@ -2,7 +2,10 @@ package com.hbm.explosion.vanillant.interfaces; import com.hbm.explosion.vanillant.ExplosionVNT; +import net.minecraft.block.Block; + public interface IBlockMutator { - public int mutateAtPosition(ExplosionVNT explosion, int x, int y, int z); + public void mutatePre(ExplosionVNT explosion, Block block, int meta, int x, int y, int z); + public void mutatePost(ExplosionVNT explosion, int x, int y, int z); } diff --git a/src/main/java/com/hbm/explosion/vanillant/standard/BlockAllocatorBulkie.java b/src/main/java/com/hbm/explosion/vanillant/standard/BlockAllocatorBulkie.java new file mode 100644 index 000000000..863916f19 --- /dev/null +++ b/src/main/java/com/hbm/explosion/vanillant/standard/BlockAllocatorBulkie.java @@ -0,0 +1,89 @@ +package com.hbm.explosion.vanillant.standard; + +import java.util.HashSet; + +import com.hbm.explosion.vanillant.ExplosionVNT; +import com.hbm.explosion.vanillant.interfaces.IBlockAllocator; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.World; + +public class BlockAllocatorBulkie implements IBlockAllocator { + + protected double maximum; + protected int resolution; + + public BlockAllocatorBulkie(double maximum) { + this(maximum, 16); + } + + public BlockAllocatorBulkie(double maximum, int resolution) { + this.resolution = resolution; + this.maximum = maximum; + } + + @Override + public HashSet allocate(ExplosionVNT explosion, World world, double x, double y, double z, float size) { + + HashSet affectedBlocks = new HashSet(); + + for(int i = 0; i < this.resolution; ++i) { + for(int j = 0; j < this.resolution; ++j) { + for(int k = 0; k < this.resolution; ++k) { + + if(i == 0 || i == this.resolution - 1 || j == 0 || j == this.resolution - 1 || k == 0 || k == this.resolution - 1) { + + double d0 = (double) ((float) i / ((float) this.resolution - 1.0F) * 2.0F - 1.0F); + double d1 = (double) ((float) j / ((float) this.resolution - 1.0F) * 2.0F - 1.0F); + double d2 = (double) ((float) k / ((float) this.resolution - 1.0F) * 2.0F - 1.0F); + double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); + + d0 /= d3; + d1 /= d3; + d2 /= d3; + + double currentX = x; + double currentY = y; + double currentZ = z; + + double dist = 0; + + for(float stepSize = 0.3F; dist <= explosion.size;) { + + double deltaX = currentX - x; + double deltaY = currentY - y; + double deltaZ = currentZ - z; + dist = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ); + + int blockX = MathHelper.floor_double(currentX); + int blockY = MathHelper.floor_double(currentY); + int blockZ = MathHelper.floor_double(currentZ); + + Block block = world.getBlock(blockX, blockY, blockZ); + + if(block.getMaterial() != Material.air) { + float blockResistance = explosion.exploder != null ? explosion.exploder.func_145772_a(explosion.compat, world, blockX, blockY, blockZ, block) : block.getExplosionResistance(explosion.exploder, world, blockX, blockY, blockZ, x, y, z); + if(this.maximum < blockResistance) { + break; + } + } + + if(explosion.exploder == null || explosion.exploder.func_145774_a(explosion.compat, world, blockX, blockY, blockZ, block, explosion.size)) { + affectedBlocks.add(new ChunkPosition(blockX, blockY, blockZ)); + } + + currentX += d0 * (double) stepSize; + currentY += d1 * (double) stepSize; + currentZ += d2 * (double) stepSize; + } + } + } + } + } + + return affectedBlocks; + } +} diff --git a/src/main/java/com/hbm/explosion/vanillant/standard/BlockMutatorBulkie.java b/src/main/java/com/hbm/explosion/vanillant/standard/BlockMutatorBulkie.java new file mode 100644 index 000000000..5b89ee88e --- /dev/null +++ b/src/main/java/com/hbm/explosion/vanillant/standard/BlockMutatorBulkie.java @@ -0,0 +1,32 @@ +package com.hbm.explosion.vanillant.standard; + +import com.hbm.explosion.vanillant.ExplosionVNT; +import com.hbm.explosion.vanillant.interfaces.IBlockMutator; +import com.hbm.inventory.RecipesCommon.MetaBlock; + +import net.minecraft.block.Block; +import net.minecraft.util.Vec3; + +public class BlockMutatorBulkie implements IBlockMutator { + + protected MetaBlock metaBlock; + + public BlockMutatorBulkie(Block block) { + this(block, 0); + } + + public BlockMutatorBulkie(Block block, int meta) { + this.metaBlock = new MetaBlock(block, meta); + } + + @Override + public void mutatePre(ExplosionVNT explosion, Block block, int meta, int x, int y, int z) { + if(!block.isBlockNormalCube()) return; + Vec3 vec = Vec3.createVectorHelper(x + 0.5 - explosion.posX, y + 0.5 - explosion.posY, z + 0.5 - explosion.posZ); + if(vec.lengthVector() >= explosion.size - 0.5) { + explosion.world.setBlock(x, y, z, metaBlock.block, metaBlock.meta, 3); + } + } + + @Override public void mutatePost(ExplosionVNT explosion, int x, int y, int z) { } +} diff --git a/src/main/java/com/hbm/explosion/vanillant/standard/BlockProcessorStandard.java b/src/main/java/com/hbm/explosion/vanillant/standard/BlockProcessorStandard.java index ac1fcd7be..a6da1e153 100644 --- a/src/main/java/com/hbm/explosion/vanillant/standard/BlockProcessorStandard.java +++ b/src/main/java/com/hbm/explosion/vanillant/standard/BlockProcessorStandard.java @@ -63,6 +63,7 @@ public class BlockProcessorStandard implements IBlockProcessor { } block.onBlockExploded(world, blockX, blockY, blockZ, explosion.compat); + if(this.convert != null) this.convert.mutatePre(explosion, block, world.getBlockMetadata(blockX, blockY, blockZ), blockX, blockY, blockZ); } } @@ -78,7 +79,7 @@ public class BlockProcessorStandard implements IBlockProcessor { Block block = world.getBlock(blockX, blockY, blockZ); if(block.getMaterial() == Material.air) { - this.convert.mutateAtPosition(explosion, blockX, blockY, blockZ); + this.convert.mutatePost(explosion, blockX, blockY, blockZ); } } } diff --git a/src/main/java/com/hbm/items/tool/ItemWandD.java b/src/main/java/com/hbm/items/tool/ItemWandD.java index 2d22a2182..7ea8ad8b7 100644 --- a/src/main/java/com/hbm/items/tool/ItemWandD.java +++ b/src/main/java/com/hbm/items/tool/ItemWandD.java @@ -2,8 +2,16 @@ package com.hbm.items.tool; import java.util.List; +import com.hbm.blocks.ModBlocks; import com.hbm.blocks.rail.IRailNTM; import com.hbm.blocks.rail.IRailNTM.RailContext; +import com.hbm.explosion.vanillant.ExplosionVNT; +import com.hbm.explosion.vanillant.standard.BlockAllocatorBulkie; +import com.hbm.explosion.vanillant.standard.BlockMutatorBulkie; +import com.hbm.explosion.vanillant.standard.BlockProcessorStandard; +import com.hbm.explosion.vanillant.standard.EntityProcessorStandard; +import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard; +import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; import com.hbm.lib.Library; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.PlayerInformPacket; @@ -14,6 +22,7 @@ import com.hbm.world.feature.OilSpot; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ChatComponentText; @@ -34,6 +43,14 @@ public class ItemWandD extends Item { if(pos != null) { + ExplosionVNT vnt = new ExplosionVNT(world, pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 7); + vnt.setBlockAllocator(new BlockAllocatorBulkie(60)); + vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorBulkie(ModBlocks.block_slag)).setNoDrop()); + vnt.setEntityProcessor(new EntityProcessorStandard()); + vnt.setPlayerProcessor(new PlayerProcessorStandard()); + vnt.setSFX(new ExplosionEffectStandard()); + vnt.explode(); + /*TimeAnalyzer.startCount("setBlock"); world.setBlock(pos.blockX, pos.blockY, pos.blockZ, Blocks.dirt); TimeAnalyzer.startEndCount("getBlock"); diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index 04a912a51..e69446d89 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -691,6 +691,8 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.registerEntityRenderingHandler(EntityCreeperNuclear.class, new RenderCreeperUniversal(RefStrings.MODID + ":" + "textures/entity/creeper.png", RefStrings.MODID + ":" + "textures/entity/creeper_armor.png").setSwellMod(5F)); RenderingRegistry.registerEntityRenderingHandler(EntityCreeperTainted.class, new RenderCreeperUniversal(RefStrings.MODID + ":" + "textures/entity/creeper_tainted.png", RefStrings.MODID + ":" + "textures/entity/creeper_armor_taint.png")); RenderingRegistry.registerEntityRenderingHandler(EntityCreeperPhosgene.class, new RenderCreeperUniversal(RefStrings.MODID + ":" + "textures/entity/creeper_phosgene.png", "textures/entity/creeper/creeper_armor.png")); + RenderingRegistry.registerEntityRenderingHandler(EntityCreeperVolatile.class, new RenderCreeperUniversal(RefStrings.MODID + ":" + "textures/entity/creeper_volatile.png", "textures/entity/creeper/creeper_armor.png")); + RenderingRegistry.registerEntityRenderingHandler(EntityCreeperGold.class, new RenderCreeperUniversal(RefStrings.MODID + ":" + "textures/entity/creeper_gold.png", "textures/entity/creeper/creeper_armor.png")); RenderingRegistry.registerEntityRenderingHandler(EntityHunterChopper.class, new RenderHunterChopper()); RenderingRegistry.registerEntityRenderingHandler(EntityCyberCrab.class, new RenderCyberCrab()); RenderingRegistry.registerEntityRenderingHandler(EntityTeslaCrab.class, new RenderTeslaCrab()); diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index 6e1e381e5..da251825c 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -848,6 +848,7 @@ public class MainRegistry { new OreCave(ModBlocks.stone_resource, 0).setThreshold(1.5D).setRangeMult(20).setYLevel(30).setMaxRange(20).withFluid(ModBlocks.sulfuric_acid_block); //sulfur new OreCave(ModBlocks.stone_resource, 1).setThreshold(1.75D).setRangeMult(20).setYLevel(25).setMaxRange(20); //asbestos new OreLayer3D(ModBlocks.stone_resource, EnumStoneType.HEMATITE.ordinal()); + new BiomeCave().setThreshold(1.5D).setRangeMult(20).setYLevel(40).setMaxRange(20); //new OreLayer(Blocks.coal_ore, 0.2F).setThreshold(4).setRangeMult(3).setYLevel(70); Compat.handleRailcraftNonsense(); diff --git a/src/main/java/com/hbm/world/feature/BiomeCave.java b/src/main/java/com/hbm/world/feature/BiomeCave.java new file mode 100644 index 000000000..9d297778e --- /dev/null +++ b/src/main/java/com/hbm/world/feature/BiomeCave.java @@ -0,0 +1,126 @@ +package com.hbm.world.feature; + +import java.util.Random; + +import com.hbm.blocks.BlockEnums.EnumBiomeType; +import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.generic.BlockStalagmite; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.BiomeGenBase.TempCategory; +import net.minecraft.world.gen.NoiseGeneratorPerlin; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.event.terraingen.DecorateBiomeEvent; + +public class BiomeCave { + + private NoiseGeneratorPerlin noise; + /** The number that is being deducted flat from the result of the perlin noise before all other processing. Increase this to make strata rarer. */ + private double threshold = 2D; + /** The mulitplier for the remaining bit after the threshold has been deducted. Increase to make strata wavier. */ + private int rangeMult = 3; + /** The maximum range after multiplying - anything above this will be subtracted from (maxRange * 2) to yield the proper range. Increase this to make strata thicker. */ + private int maxRange = 4; + /** The y-level around which the stratum is centered. */ + private int yLevel = 30; + + public BiomeCave() { + MinecraftForge.EVENT_BUS.register(this); + } + + public BiomeCave setThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + public BiomeCave setRangeMult(int rangeMult) { + this.rangeMult = rangeMult; + return this; + } + + public BiomeCave setMaxRange(int maxRange) { + this.maxRange = maxRange; + return this; + } + + public BiomeCave setYLevel(int yLevel) { + this.yLevel = yLevel; + return this; + } + + @SubscribeEvent + public void onDecorate(DecorateBiomeEvent.Pre event) { + + World world = event.world; + + if(world.provider == null || world.provider.dimensionId != 0) return; + + if(this.noise == null) { + this.noise = new NoiseGeneratorPerlin(new Random(event.world.getSeed() - 1916169 + yLevel), 2); + } + + int cX = event.chunkX; + int cZ = event.chunkZ; + + double scale = 0.01D; + + for(int x = cX + 8; x < cX + 24; x++) { + for(int z = cZ + 8; z < cZ + 24; z++) { + + BiomeGenBase biome = world.getBiomeGenForCoords(x, z); + EnumBiomeType type = getTypeFromBiome(biome); + + double n = noise.func_151601_a(x * scale, z * scale); + + if(type != null && n > threshold) { + int range = (int)((n - threshold) * rangeMult); + + if(range > maxRange) + range = (maxRange * 2) - range; + + if(range < 0) + continue; + + for(int y = yLevel - range; y <= yLevel + range; y++) { + handleBiome(world, x, y, z, type); + } + } + } + } + } + + private static void handleBiome(World world, int x, int y, int z, EnumBiomeType type) { + Block target = world.getBlock(x, y, z); + + if(target.isNormalCube()) { + + boolean shouldGen = false; + + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).isAir(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) { + shouldGen = true; break; + } + if(world.getBlock(x + dir.offsetX * 2, y + dir.offsetY * 2, z + dir.offsetZ * 2).isAir(world, x + dir.offsetX * 2, y + dir.offsetY * 2, z + dir.offsetZ * 2)) { + shouldGen = true; break; + } + } + + if(shouldGen) { + world.setBlock(x, y, z, ModBlocks.stone_biome, type.ordinal(), 2); + } + } + } + + private static EnumBiomeType getTypeFromBiome(BiomeGenBase biome) { + + if(biome.temperature >= 1 && biome.rainfall < 0.25) return EnumBiomeType.DESERT; + if(biome.temperature >= 0.5 && biome.rainfall > 0.25 && biome.getTempCategory() != TempCategory.OCEAN) return EnumBiomeType.WOODLAND; + + return null; + } +} diff --git a/src/main/resources/assets/hbm/textures/blocks/block_slag_broken.png b/src/main/resources/assets/hbm/textures/blocks/block_slag_broken.png new file mode 100644 index 000000000..97f12ce5d Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/block_slag_broken.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/stone_biome.woodland.png b/src/main/resources/assets/hbm/textures/blocks/stone_biome.woodland.png new file mode 100644 index 000000000..d0e122c48 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/stone_biome.woodland.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/stone_biome_layer.woodland.png b/src/main/resources/assets/hbm/textures/blocks/stone_biome_layer.woodland.png new file mode 100644 index 000000000..1ff0e0593 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/stone_biome_layer.woodland.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/stone_biome_top.woodland.png b/src/main/resources/assets/hbm/textures/blocks/stone_biome_top.woodland.png new file mode 100644 index 000000000..e758050f4 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/stone_biome_top.woodland.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/stone_deep_base.png b/src/main/resources/assets/hbm/textures/blocks/stone_deep_base.png new file mode 100644 index 000000000..0800acb0c Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/stone_deep_base.png differ diff --git a/src/main/resources/assets/hbm/textures/entity/creeper_gold.png b/src/main/resources/assets/hbm/textures/entity/creeper_gold.png new file mode 100644 index 000000000..8f20dd3f4 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/entity/creeper_gold.png differ diff --git a/src/main/resources/assets/hbm/textures/entity/creeper_volatile.png b/src/main/resources/assets/hbm/textures/entity/creeper_volatile.png new file mode 100644 index 000000000..b26401539 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/entity/creeper_volatile.png differ