diff --git a/assets/hbm/sounds.json b/assets/hbm/sounds.json index 91ae07828..38ebb50a2 100644 --- a/assets/hbm/sounds.json +++ b/assets/hbm/sounds.json @@ -60,5 +60,6 @@ "entity.chopperCharge": {"category": "hostile", "sounds": [{"name": "entity/chopperCharge", "stream": false}]}, "entity.chopperDamage": {"category": "hostile", "sounds": [{"name": "entity/chopperDamage", "stream": true}]}, "entity.chopperMineLoop": {"category": "hostile", "sounds": [{"name": "entity/chopperMineLoop", "stream": false}]}, - "entity.chopperCrashingLoop": {"category": "hostile", "sounds": [{"name": "entity/chopperCrashingLoop", "stream": true}]} + "entity.chopperCrashingLoop": {"category": "hostile", "sounds": [{"name": "entity/chopperCrashingLoop", "stream": true}]}, + "entity.oldExplosion": {"category": "ambient", "sounds": [{"name": "entity/oldExplosion", "stream": false}]} } diff --git a/assets/hbm/sounds/entity/oldExplosion.ogg b/assets/hbm/sounds/entity/oldExplosion.ogg new file mode 100644 index 000000000..a414ea046 Binary files /dev/null and b/assets/hbm/sounds/entity/oldExplosion.ogg differ diff --git a/com/hbm/blocks/ModBlocks.java b/com/hbm/blocks/ModBlocks.java index 57058a799..8b57f409e 100644 --- a/com/hbm/blocks/ModBlocks.java +++ b/com/hbm/blocks/ModBlocks.java @@ -533,7 +533,7 @@ public class ModBlocks { block_meteor = new BlockOre(Material.rock).setBlockName("block_meteor").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor"); block_meteor_cobble = new BlockOre(Material.rock).setBlockName("block_meteor_cobble").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_cobble"); block_meteor_broken = new BlockOre(Material.rock).setBlockName("block_meteor_broken").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_broken"); - block_meteor_molten = new BlockOre(Material.rock).setBlockName("block_meteor_molten").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_molten"); + block_meteor_molten = new BlockOre(Material.rock).setBlockName("block_meteor_molten").setLightLevel(0.75F).setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_molten"); block_meteor_treasure = new BlockOre(Material.rock).setBlockName("block_meteor_treasure").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_treasure"); tape_recorder = new DecoTapeRecorder(Material.rock).setBlockName("tape_recorder").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder"); diff --git a/com/hbm/blocks/test/TestEventTester.java b/com/hbm/blocks/test/TestEventTester.java index 42c3745e4..b98fbf3ca 100644 --- a/com/hbm/blocks/test/TestEventTester.java +++ b/com/hbm/blocks/test/TestEventTester.java @@ -9,7 +9,9 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; import com.hbm.entity.effect.EntityBlackHole; +import com.hbm.entity.projectile.EntityMeteor; import com.hbm.main.MainRegistry; +import com.hbm.main.ModEventHandler; import com.hbm.world.Meteorite; import net.minecraft.block.Block; @@ -131,7 +133,7 @@ public class TestEventTester extends Block { }*/ - if(!worldObj.isRemote) { + /*if(!worldObj.isRemote) { switch(itemRand.nextInt(3)) { case 0: (new Meteorite()).generateLarge(worldObj, itemRand, x1, y1, z1); @@ -143,6 +145,11 @@ public class TestEventTester extends Block { (new Meteorite()).generateSmall(worldObj, itemRand, x1, y1, z1); break; } + }*/ + + + if(!worldObj.isRemote) { + ModEventHandler.meteorShower = 6000; } diff --git a/com/hbm/entity/projectile/EntityMeteor.java b/com/hbm/entity/projectile/EntityMeteor.java new file mode 100644 index 000000000..06e300fa7 --- /dev/null +++ b/com/hbm/entity/projectile/EntityMeteor.java @@ -0,0 +1,87 @@ +package com.hbm.entity.projectile; + +import com.hbm.entity.effect.EntityNukeCloudSmall; +import com.hbm.entity.logic.EntityNukeExplosionAdvanced; +import com.hbm.entity.logic.EntityNukeExplosionMK3; +import com.hbm.entity.particle.EntityGasFlameFX; +import com.hbm.entity.particle.EntitySmokeFX; +import com.hbm.explosion.ExplosionLarge; +import com.hbm.main.MainRegistry; +import com.hbm.world.Meteorite; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.projectile.EntityThrowable; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class EntityMeteor extends EntityThrowable { + + public EntityMeteor(World p_i1582_1_) { + super(p_i1582_1_); + this.ignoreFrustumCheck = true; + this.isImmuneToFire = true; + } + + @Override + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + + this.motionY -= 0.03; + if(motionY < -2.5) + motionY = -2.5; + + if(this.worldObj.getBlock((int)this.posX, (int)this.posY, (int)this.posZ) != Blocks.air) + { + if(!this.worldObj.isRemote) + { + worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 5 + rand.nextFloat(), true); + if(MainRegistry.enableMeteorTails) + ExplosionLarge.spawnParticles(worldObj, posX, posY, posZ, ExplosionLarge.cloudFunction(20)); + (new Meteorite()).generate(worldObj, rand, (int)Math.round(this.posX - 0.5D), (int)Math.round(this.posY - 0.5D), (int)Math.round(this.posZ - 0.5D)); + } + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "hbm:entity.oldExplosion", 10000.0F, 0.5F + this.rand.nextFloat() * 0.1F); + this.setDead(); + } + + if(MainRegistry.enableMeteorTails) { + this.worldObj.spawnEntityInWorld(new EntitySmokeFX(this.worldObj, this.posX, this.posY + 1.5D, this.posZ, 0.0, 0.0, 0.0)); + for(int i = 0; i < 10; i++) + this.worldObj.spawnEntityInWorld(new EntityGasFlameFX(this.worldObj, this.posX + rand.nextDouble() * 3 - 1.5, this.posY + 1.5D + rand.nextDouble() * 3 - 1.5, this.posZ + rand.nextDouble() * 3 - 1.5, 0.0, 0.1, 0.0)); + } + } + + @Override + protected void onImpact(MovingObjectPosition p_70184_1_) { + + } + + @Override + @SideOnly(Side.CLIENT) + public boolean isInRangeToRenderDist(double distance) + { + return distance < 25000; + } + + @Override + @SideOnly(Side.CLIENT) + public int getBrightnessForRender(float p_70070_1_) + { + return 15728880; + } + + @Override + public float getBrightness(float p_70013_1_) + { + return 1.0F; + } + +} diff --git a/com/hbm/inventory/MachineRecipes.java b/com/hbm/inventory/MachineRecipes.java index 27c173450..adb8578a7 100644 --- a/com/hbm/inventory/MachineRecipes.java +++ b/com/hbm/inventory/MachineRecipes.java @@ -600,7 +600,7 @@ public class MachineRecipes { recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.powder_cobalt) }, getFurnaceOutput(ModItems.ingot_steel, ModItems.powder_cobalt).copy()); } catch (Exception x) { - System.out.println("Unable to register alloy recipes for NEI!"); + MainRegistry.logger.error("Unable to register alloy recipes for NEI!"); } return recipes; } @@ -1140,7 +1140,7 @@ public class MachineRecipes { theWholeThing.add(new DictCouple(stacks.get(i), oreNames)); } - System.out.println("Added " + theWholeThing.size() + " elements from the Ore Dict!"); + MainRegistry.logger.info("Added " + theWholeThing.size() + " elements from the Ore Dict!"); } public boolean doesExist(ItemStack stack) { @@ -1214,8 +1214,8 @@ public class MachineRecipes { setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap)); } - System.out.println("Added " + recipesShredder.size() + " in total."); - System.out.println("Added " + dustCount + " ore dust recipes."); + MainRegistry.logger.info("Added " + recipesShredder.size() + " in total."); + MainRegistry.logger.info("Added " + dustCount + " ore dust recipes."); } public ItemStack canFindDustByName(String s) { @@ -1320,7 +1320,7 @@ public class MachineRecipes { System.out.println(recipes.get(j)); }*/ - System.out.println("TWT: " + theWholeThing.size() + ", REC: " + recipesShredder.size()); + MainRegistry.logger.debug("TWT: " + theWholeThing.size() + ", REC: " + recipesShredder.size()); } } diff --git a/com/hbm/main/ClientProxy.java b/com/hbm/main/ClientProxy.java index 15e6b0075..672ee5af1 100644 --- a/com/hbm/main/ClientProxy.java +++ b/com/hbm/main/ClientProxy.java @@ -78,6 +78,7 @@ import com.hbm.entity.projectile.EntityDischarge; import com.hbm.entity.projectile.EntityFire; import com.hbm.entity.projectile.EntityLN2; import com.hbm.entity.projectile.EntityLaserBeam; +import com.hbm.entity.projectile.EntityMeteor; import com.hbm.entity.projectile.EntityMinerBeam; import com.hbm.entity.projectile.EntityMiniMIRV; import com.hbm.entity.projectile.EntityMiniNuke; @@ -116,6 +117,7 @@ import com.hbm.render.entity.RenderFireball; import com.hbm.render.entity.RenderFlare; import com.hbm.render.entity.RenderHunterChopper; import com.hbm.render.entity.RenderLN2; +import com.hbm.render.entity.RenderMeteor; import com.hbm.render.entity.RenderMinecartTest; import com.hbm.render.entity.RenderMiniMIRV; import com.hbm.render.entity.RenderMiniNuke; @@ -483,6 +485,7 @@ public class ClientProxy extends ServerProxy RenderingRegistry.registerEntityRenderingHandler(EntityMissileDoomsday.class, new RenderMissileDoomsday()); RenderingRegistry.registerEntityRenderingHandler(EntityBombletTheta.class, new RenderBombletTheta()); RenderingRegistry.registerEntityRenderingHandler(EntityBombletSelena.class, new RenderBombletSelena()); + RenderingRegistry.registerEntityRenderingHandler(EntityMeteor.class, new RenderMeteor()); RenderingRegistry.registerEntityRenderingHandler(EntityMissileEndo.class, new RenderMissileThermo()); RenderingRegistry.registerEntityRenderingHandler(EntityMissileExo.class, new RenderMissileThermo()); diff --git a/com/hbm/main/MainRegistry.java b/com/hbm/main/MainRegistry.java index d90bbc2d5..b0d713f2d 100644 --- a/com/hbm/main/MainRegistry.java +++ b/com/hbm/main/MainRegistry.java @@ -1,6 +1,7 @@ package com.hbm.main; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -8,6 +9,7 @@ import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager.LoadingCallback; import net.minecraftforge.common.ForgeChunkManager.Ticket; @@ -27,6 +29,8 @@ import java.util.Arrays; import java.util.List; import java.util.Random; +import org.apache.logging.log4j.Logger; + import com.hbm.blocks.ModBlocks; import com.hbm.creativetabs.BlockTab; import com.hbm.creativetabs.MachineTab; @@ -107,6 +111,7 @@ import com.hbm.entity.projectile.EntityDischarge; import com.hbm.entity.projectile.EntityFire; import com.hbm.entity.projectile.EntityLN2; import com.hbm.entity.projectile.EntityLaserBeam; +import com.hbm.entity.projectile.EntityMeteor; import com.hbm.entity.projectile.EntityMinerBeam; import com.hbm.entity.projectile.EntityMiniMIRV; import com.hbm.entity.projectile.EntityMiniNuke; @@ -235,6 +240,8 @@ public class MainRegistry @Metadata public static ModMetadata meta; + public static Logger logger; + //Tool Materials public static ToolMaterial enumToolMaterialSchrabidium = EnumHelper.addToolMaterial("SCHRABIDIUM", 3, 10000, 50.0F, 100.0F, 200); public static ToolMaterial enumToolMaterialHammer = EnumHelper.addToolMaterial("SCHRABIDIUMHAMMER", 3, 0, 50.0F, 999999996F, 200); @@ -329,6 +336,9 @@ public class MainRegistry public static boolean enableNITAN = true; public static boolean enableNukeClouds = true; public static boolean enableAutoCleanup = false; + public static boolean enableMeteorStrikes = true; + public static boolean enableMeteorShowers = true; + public static boolean enableMeteorTails = true; public static int uraniumSpawn = 7; public static int titaniumSpawn = 8; public static int sulfurSpawn = 5; @@ -363,6 +373,9 @@ public class MainRegistry public static int factoryStructure = 1000; public static int dudStructure = 500; public static int spaceshipStructure = 1000; + public static int meteorStrikeChance = 50000; + public static int meteorShowerChance = 500; + public static int meteorShowerDuration = 6000; public static int polaroidID = 1; @@ -375,6 +388,8 @@ public class MainRegistry @EventHandler public void PreLoad(FMLPreInitializationEvent PreEvent) { + logger = PreEvent.getModLog(); + //Reroll Polaroid polaroidID = rand.nextInt(16) + 1; while(polaroidID == 4 || polaroidID == 9) @@ -585,6 +600,7 @@ public class MainRegistry EntityRegistry.registerModEntity(EntityTSmokeFX.class, "entity_t_smoke_fx", 81, this, 1000, 1, true); EntityRegistry.registerModEntity(EntityNukeExplosionMK3.class, "entity_nuke_mk3", 82, this, 1000, 1, true); EntityRegistry.registerModEntity(EntityVortex.class, "entity_vortex", 83, this, 250, 1, true); + EntityRegistry.registerModEntity(EntityMeteor.class, "entity_meteor", 84, this, 1000, 1, true); EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00); EntityRegistry.registerGlobalEntityID(EntityHunterChopper.class, "entity_mob_hunter_chopper", EntityRegistry.findGlobalUniqueEntityId(), 0x000020, 0x2D2D72); @@ -757,6 +773,7 @@ public class MainRegistry OreDictionary.registerOre("oreUnobtainium", ModBlocks.ore_unobtainium); OreDictionary.registerOre("oreDaffergon", ModBlocks.ore_daffergon); OreDictionary.registerOre("oreVerticium", ModBlocks.ore_verticium); + OreDictionary.registerOre("oreRareEarth", ModBlocks.ore_rare); OreDictionary.registerOre("oreUranium", ModBlocks.ore_nether_uranium); OreDictionary.registerOre("orePlutonium", ModBlocks.ore_nether_plutonium); @@ -926,120 +943,133 @@ public class MainRegistry Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); - enableDebugMode = config.get(Configuration.CATEGORY_GENERAL, "1.0_enableDebugMode", false).getBoolean(false); - enableMycelium = config.get(Configuration.CATEGORY_GENERAL, "1.1_enableMyceliumSpread", false).getBoolean(false); - enablePlutoniumOre = config.get(Configuration.CATEGORY_GENERAL, "1.2_enablePlutoniumNetherOre", false).getBoolean(false); - enableDungeons = config.get(Configuration.CATEGORY_GENERAL, "1.3_enableDungeonSpawn", true).getBoolean(true); - enableMDOres = config.get(Configuration.CATEGORY_GENERAL, "1.4_enableOresInModdedDimensions", true).getBoolean(true); - enableBarrels = config.get(Configuration.CATEGORY_GENERAL, "1.5_enableNuclearBarrelSpawn", false).getBoolean(false); - enableNITAN = config.get(Configuration.CATEGORY_GENERAL, "1.6_enableNITANChestSpawn", true).getBoolean(true); - enableNukeClouds = config.get(Configuration.CATEGORY_GENERAL, "1.7_enableMushroomClouds", true).getBoolean(true); - enableAutoCleanup = config.get(Configuration.CATEGORY_GENERAL, "1.8_enableAutomaticRadCleanup", false).getBoolean(false); + enableDebugMode = config.get(Configuration.CATEGORY_GENERAL, "1.00_enableDebugMode", false).getBoolean(false); + enableMycelium = config.get(Configuration.CATEGORY_GENERAL, "1.01_enableMyceliumSpread", false).getBoolean(false); + enablePlutoniumOre = config.get(Configuration.CATEGORY_GENERAL, "1.02_enablePlutoniumNetherOre", false).getBoolean(false); + enableDungeons = config.get(Configuration.CATEGORY_GENERAL, "1.03_enableDungeonSpawn", true).getBoolean(true); + enableMDOres = config.get(Configuration.CATEGORY_GENERAL, "1.04_enableOresInModdedDimensions", true).getBoolean(true); + enableBarrels = config.get(Configuration.CATEGORY_GENERAL, "1.05_enableNuclearBarrelSpawn", false).getBoolean(false); + enableNITAN = config.get(Configuration.CATEGORY_GENERAL, "1.06_enableNITANChestSpawn", true).getBoolean(true); + enableNukeClouds = config.get(Configuration.CATEGORY_GENERAL, "1.07_enableMushroomClouds", true).getBoolean(true); + enableAutoCleanup = config.get(Configuration.CATEGORY_GENERAL, "1.08_enableAutomaticRadCleanup", false).getBoolean(false); + enableMeteorStrikes = config.get(Configuration.CATEGORY_GENERAL, "1.09_enableMeteorStrikes", true).getBoolean(true); + enableMeteorShowers = config.get(Configuration.CATEGORY_GENERAL, "1.10_enableMeteorShowers", true).getBoolean(true); + enableMeteorTails = config.get(Configuration.CATEGORY_GENERAL, "1.11_enableMeteorTails", true).getBoolean(true); - Property PuraniumSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.0_uraniumSpawnrate", 7); + Property PuraniumSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.00_uraniumSpawnrate", 7); PuraniumSpawn.comment = "Ammount of uranium ore veins per chunk"; uraniumSpawn = PuraniumSpawn.getInt(); - Property PtitaniumSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.1_titaniumSpawnrate", 8); + Property PtitaniumSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.01_titaniumSpawnrate", 8); PtitaniumSpawn.comment = "Ammount of titanium ore veins per chunk"; titaniumSpawn = PtitaniumSpawn.getInt(); - Property PsulfurSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.2_sulfurSpawnrate", 5); + Property PsulfurSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.02_sulfurSpawnrate", 5); PsulfurSpawn.comment = "Ammount of sulfur ore veins per chunk"; sulfurSpawn = PsulfurSpawn.getInt(); - Property PaluminiumSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.3_aluminiumSpawnrate", 7); + Property PaluminiumSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.03_aluminiumSpawnrate", 7); PaluminiumSpawn.comment = "Ammount of aluminium ore veins per chunk"; aluminiumSpawn = PaluminiumSpawn.getInt(); - Property PcopperSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.4_copperSpawnrate", 12); + Property PcopperSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.04_copperSpawnrate", 12); PcopperSpawn.comment = "Ammount of copper ore veins per chunk"; copperSpawn = PcopperSpawn.getInt(); - Property PFluoriteSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.5_fluoriteSpawnrate", 6); + Property PFluoriteSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.05_fluoriteSpawnrate", 6); PFluoriteSpawn.comment = "Ammount of fluorite ore veins per chunk"; fluoriteSpawn = PFluoriteSpawn.getInt(); - Property PNiterSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.6_niterSpawnrate", 6); + Property PNiterSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.06_niterSpawnrate", 6); PNiterSpawn.comment = "Ammount of niter ore veins per chunk"; niterSpawn = PNiterSpawn.getInt(); - Property PtungstenSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.7_tungstenSpawnrate", 10); + Property PtungstenSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.07_tungstenSpawnrate", 10); PtungstenSpawn.comment = "Ammount of tungsten ore veins per chunk"; tungstenSpawn = PtungstenSpawn.getInt(); - Property PleadSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.8_leadSpawnrate", 6); + Property PleadSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.08_leadSpawnrate", 6); PleadSpawn.comment = "Ammount of lead ore veins per chunk"; leadSpawn = PleadSpawn.getInt(); - Property PberylliumSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.9_berylliumSpawnrate", 6); + Property PberylliumSpawn = config.get(Configuration.CATEGORY_GENERAL, "2.09_berylliumSpawnrate", 6); PberylliumSpawn.comment = "Ammount of beryllium ore veins per chunk"; berylliumSpawn = PberylliumSpawn.getInt(); - Property propGadget = config.get(Configuration.CATEGORY_GENERAL, "3.0_gadgetRadius", 150); + Property propGadget = config.get(Configuration.CATEGORY_GENERAL, "3.00_gadgetRadius", 150); propGadget.comment = "Radius of the Gadget"; gadgetRadius = propGadget.getInt(); - Property propBoy = config.get(Configuration.CATEGORY_GENERAL, "3.1_boyRadius", 120); + Property propBoy = config.get(Configuration.CATEGORY_GENERAL, "3.01_boyRadius", 120); propBoy.comment = "Radius of Little Boy"; boyRadius = propBoy.getInt(); - Property propMan = config.get(Configuration.CATEGORY_GENERAL, "3.2_manRadius", 175); + Property propMan = config.get(Configuration.CATEGORY_GENERAL, "3.02_manRadius", 175); propMan.comment = "Radius of Fat Man"; manRadius = propMan.getInt(); - Property propMike = config.get(Configuration.CATEGORY_GENERAL, "3.3_mikeRadius", 250); + Property propMike = config.get(Configuration.CATEGORY_GENERAL, "3.03_mikeRadius", 250); propMike.comment = "Radius of Ivy Mike"; mikeRadius = propMike.getInt(); - Property propTsar = config.get(Configuration.CATEGORY_GENERAL, "3.4_tsarRadius", 500); + Property propTsar = config.get(Configuration.CATEGORY_GENERAL, "3.04_tsarRadius", 500); propTsar.comment = "Radius of the Tsar Bomba"; tsarRadius = propTsar.getInt(); - Property propPrototype = config.get(Configuration.CATEGORY_GENERAL, "3.5_prototypeRadius", 150); + Property propPrototype = config.get(Configuration.CATEGORY_GENERAL, "3.05_prototypeRadius", 150); propPrototype.comment = "Radius of the Prototype"; prototypeRadius = propPrototype.getInt(); - Property propFleija = config.get(Configuration.CATEGORY_GENERAL, "3.6_fleijaRadius", 50); + Property propFleija = config.get(Configuration.CATEGORY_GENERAL, "3.06_fleijaRadius", 50); propFleija.comment = "Radius of F.L.E.I.J.A."; fleijaRadius = propFleija.getInt(); - Property propMissile = config.get(Configuration.CATEGORY_GENERAL, "3.7_missileRadius", 100); + Property propMissile = config.get(Configuration.CATEGORY_GENERAL, "3.07_missileRadius", 100); propMissile.comment = "Radius of the nuclear missile"; missileRadius = propMissile.getInt(); - Property propMirv = config.get(Configuration.CATEGORY_GENERAL, "3.8_mirvRadius", 100); + Property propMirv = config.get(Configuration.CATEGORY_GENERAL, "3.08_mirvRadius", 100); propMirv.comment = "Radius of a MIRV"; mirvRadius = propMirv.getInt(); - Property propFatman = config.get(Configuration.CATEGORY_GENERAL, "3.9_fatmanRadius", 35); + Property propFatman = config.get(Configuration.CATEGORY_GENERAL, "3.09_fatmanRadius", 35); propFatman.comment = "Radius of the Fatman Launcher"; fatmanRadius = propFatman.getInt(); - Property propNuka = config.get(Configuration.CATEGORY_GENERAL, "3.91_nukaRadius", 25); + Property propNuka = config.get(Configuration.CATEGORY_GENERAL, "3.10_nukaRadius", 25); propNuka.comment = "Radius of the nuka grenade"; nukaRadius = propNuka.getInt(); - Property propASchrab = config.get(Configuration.CATEGORY_GENERAL, "3.92_aSchrabRadius", 20); + Property propASchrab = config.get(Configuration.CATEGORY_GENERAL, "3.11_aSchrabRadius", 20); propASchrab.comment = "Radius of dropped anti schrabidium"; aSchrabRadius = propASchrab.getInt(); - Property propRadio = config.get(Configuration.CATEGORY_GENERAL, "4.0_radioSpawn", 500); + Property propRadio = config.get(Configuration.CATEGORY_GENERAL, "4.00_radioSpawn", 500); propRadio.comment = "Spawn radio station on every nTH chunk"; radioStructure = propRadio.getInt(); - Property propAntenna = config.get(Configuration.CATEGORY_GENERAL, "4.1_antennaSpawn", 250); + Property propAntenna = config.get(Configuration.CATEGORY_GENERAL, "4.01_antennaSpawn", 250); propAntenna.comment = "Spawn antenna on every nTH chunk"; antennaStructure = propAntenna.getInt(); - Property propAtom = config.get(Configuration.CATEGORY_GENERAL, "4.2_atomSpawn", 500); + Property propAtom = config.get(Configuration.CATEGORY_GENERAL, "4.02_atomSpawn", 500); propAtom.comment = "Spawn power plant on every nTH chunk"; atomStructure = propAtom.getInt(); - Property propVertibird = config.get(Configuration.CATEGORY_GENERAL, "4.3_vertibirdSpawn", 500); + Property propVertibird = config.get(Configuration.CATEGORY_GENERAL, "4.03_vertibirdSpawn", 500); propVertibird.comment = "Spawn vertibird on every nTH chunk"; vertibirdStructure = propVertibird.getInt(); - Property propDungeon = config.get(Configuration.CATEGORY_GENERAL, "4.4_dungeonSpawn", 64); + Property propDungeon = config.get(Configuration.CATEGORY_GENERAL, "4.04_dungeonSpawn", 64); propDungeon.comment = "Spawn library dungeon on every nTH chunk"; dungeonStructure = propDungeon.getInt(); - Property propRelay = config.get(Configuration.CATEGORY_GENERAL, "4.5_relaySpawn", 500); + Property propRelay = config.get(Configuration.CATEGORY_GENERAL, "4.05_relaySpawn", 500); propRelay.comment = "Spawn relay on every nTH chunk"; relayStructure = propRelay.getInt(); - Property propSatellite = config.get(Configuration.CATEGORY_GENERAL, "4.6_satelliteSpawn", 500); + Property propSatellite = config.get(Configuration.CATEGORY_GENERAL, "4.06_satelliteSpawn", 500); propSatellite.comment = "Spawn satellite dish on every nTH chunk"; satelliteStructure = propSatellite.getInt(); - Property propBunker = config.get(Configuration.CATEGORY_GENERAL, "4.7_bunkerSpawn", 1000); + Property propBunker = config.get(Configuration.CATEGORY_GENERAL, "4.07_bunkerSpawn", 1000); propBunker.comment = "Spawn bunker on every nTH chunk"; bunkerStructure = propBunker.getInt(); - Property propSilo = config.get(Configuration.CATEGORY_GENERAL, "4.8_siloSpawn", 1000); + Property propSilo = config.get(Configuration.CATEGORY_GENERAL, "4.08_siloSpawn", 1000); propSilo.comment = "Spawn missile silo on every nTH chunk"; siloStructure = propSilo.getInt(); - Property propFactory = config.get(Configuration.CATEGORY_GENERAL, "4.9_factorySpawn", 1000); + Property propFactory = config.get(Configuration.CATEGORY_GENERAL, "4.09_factorySpawn", 1000); propFactory.comment = "Spawn factory on every nTH chunk"; factoryStructure = propFactory.getInt(); - Property propDud = config.get(Configuration.CATEGORY_GENERAL, "4.91_dudSpawn", 500); + Property propDud = config.get(Configuration.CATEGORY_GENERAL, "4.10_dudSpawn", 500); propDud.comment = "Spawn dud on every nTH chunk"; dudStructure = propDud.getInt(); - Property propSpaceship = config.get(Configuration.CATEGORY_GENERAL, "4.92_spaceshipSpawn", 1000); + Property propSpaceship = config.get(Configuration.CATEGORY_GENERAL, "4.11_spaceshipSpawn", 1000); propSpaceship.comment = "Spawn spaceship on every nTH chunk"; spaceshipStructure = propSpaceship.getInt(); + + Property propMeteorStrikeChance = config.get(Configuration.CATEGORY_GENERAL, "5.00_meteorStrikeChance", 50000); + propMeteorStrikeChance.comment = "The probability of a meteor spawning (an average of once every nTH ticks)"; + meteorStrikeChance = propMeteorStrikeChance.getInt(); + Property propMeteorShowerChance = config.get(Configuration.CATEGORY_GENERAL, "5.01_meteorShowerChance", 500); + propMeteorShowerChance.comment = "The probability of a meteor spawning during meteor shower (an average of once every nTH ticks)"; + meteorShowerChance = propMeteorShowerChance.getInt(); + Property propMeteorShowerDuration = config.get(Configuration.CATEGORY_GENERAL, "5.02_meteorShowerDuration", 6000); + propMeteorShowerDuration.comment = "Max duration of meteor shower in ticks"; + meteorShowerDuration = propMeteorShowerDuration.getInt(); config.save(); } diff --git a/com/hbm/main/ModEventHandler.java b/com/hbm/main/ModEventHandler.java index 519b9bb01..96d3ce583 100644 --- a/com/hbm/main/ModEventHandler.java +++ b/com/hbm/main/ModEventHandler.java @@ -1,14 +1,18 @@ package com.hbm.main; +import com.hbm.entity.projectile.EntityMeteor; import com.hbm.lib.RefStrings; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; +import cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; public class ModEventHandler { public static boolean showMessage = true; + public static int meteorShower = 0; @SubscribeEvent public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { @@ -20,6 +24,38 @@ public class ModEventHandler showMessage = !showMessage; } + @SubscribeEvent + public void worldTick(WorldTickEvent event) { + if(event.world != null && !event.world.isRemote && event.world.provider.isSurfaceWorld() && MainRegistry.enableMeteorStrikes) { + if(event.world.rand.nextInt(meteorShower > 0 ? MainRegistry.meteorShowerChance : MainRegistry.meteorStrikeChance) == 0) { + if(!event.world.playerEntities.isEmpty()) { + EntityPlayer p = (EntityPlayer)event.world.playerEntities.get(event.world.rand.nextInt(event.world.playerEntities.size())); + EntityMeteor meteor = new EntityMeteor(event.world); + meteor.posX = p.posX + event.world.rand.nextInt(201) - 100; + meteor.posY = 384; + meteor.posZ = p.posZ + event.world.rand.nextInt(201) - 100; + meteor.motionX = event.world.rand.nextDouble() - 0.5; + meteor.motionY = -2.5; + meteor.motionZ = event.world.rand.nextDouble() - 0.5; + event.world.spawnEntityInWorld(meteor); + } + } + + if(meteorShower > 0) { + meteorShower--; + if(meteorShower == 0) + MainRegistry.logger.info("Ended meteor shower."); + } + + if(event.world.rand.nextInt(MainRegistry.meteorStrikeChance * 100) == 0 && MainRegistry.enableMeteorShowers) { + meteorShower = + (int)(MainRegistry.meteorShowerDuration * 0.75 + + MainRegistry.meteorShowerDuration * 0.25 * event.world.rand.nextFloat()); + MainRegistry.logger.info("Started meteor shower! Duration: " + meteorShower); + } + } + } + /*@SubscribeEvent public void itemSmelted(PlayerEvent.ItemSmeltedEvent e) { if(e.smelting.getItem().equals(ModItems.ingot_titanium)) { diff --git a/com/hbm/render/entity/RenderMeteor.java b/com/hbm/render/entity/RenderMeteor.java new file mode 100644 index 000000000..b1ae12549 --- /dev/null +++ b/com/hbm/render/entity/RenderMeteor.java @@ -0,0 +1,95 @@ +package com.hbm.render.entity; + +import org.lwjgl.opengl.GL11; + +import com.hbm.lib.RefStrings; +import com.hbm.render.model.ModelRubble; + +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class RenderMeteor extends Render { + + public RenderMeteor() { } + + @Override + public void doRender(Entity rocket, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, + float p_76986_9_) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_, (float) p_76986_6_); + GL11.glScalef(1.0F, 1.0F, 1.0F); + GL11.glRotatef(180, 1, 0, 0); + GL11.glRotatef((rocket.ticksExisted % 360) * 10, 1, 1, 1); + + + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glScalef(5.0F, 5.0F, 5.0F); + renderBlock(getEntityTexture(rocket), 0, 0, 0); + GL11.glEnable(GL11.GL_CULL_FACE); + + GL11.glPopMatrix(); + } + + public void renderBlock(ResourceLocation loc1, double x, double y, double z) { + GL11.glPushMatrix(); + GL11.glTranslated(x, y, z); + GL11.glRotatef(180, 0F, 0F, 1F); + Tessellator tesseract = Tessellator.instance; + tesseract.startDrawingQuads(); + tesseract.addVertexWithUV(-0.5, -0.5, -0.5, 1, 0); + tesseract.addVertexWithUV(+0.5, -0.5, -0.5, 0, 0); + tesseract.addVertexWithUV(+0.5, +0.5, -0.5, 0, 1); + tesseract.addVertexWithUV(-0.5, +0.5, -0.5, 1, 1); + this.bindTexture(loc1); + tesseract.draw(); + + tesseract.startDrawingQuads(); + tesseract.addVertexWithUV(-0.5, -0.5, +0.5, 1, 0); + tesseract.addVertexWithUV(-0.5, -0.5, -0.5, 0, 0); + tesseract.addVertexWithUV(-0.5, +0.5, -0.5, 0, 1); + tesseract.addVertexWithUV(-0.5, +0.5, +0.5, 1, 1); + this.bindTexture(loc1); + tesseract.draw(); + + tesseract.startDrawingQuads(); + tesseract.addVertexWithUV(+0.5, -0.5, +0.5, 1, 0); + tesseract.addVertexWithUV(-0.5, -0.5, +0.5, 0, 0); + tesseract.addVertexWithUV(-0.5, +0.5, +0.5, 0, 1); + tesseract.addVertexWithUV(+0.5, +0.5, +0.5, 1, 1); + this.bindTexture(loc1); + tesseract.draw(); + + tesseract.startDrawingQuads(); + tesseract.addVertexWithUV(+0.5, -0.5, -0.5, 1, 0); + tesseract.addVertexWithUV(+0.5, -0.5, +0.5, 0, 0); + tesseract.addVertexWithUV(+0.5, +0.5, +0.5, 0, 1); + tesseract.addVertexWithUV(+0.5, +0.5, -0.5, 1, 1); + this.bindTexture(loc1); + tesseract.draw(); + + tesseract.startDrawingQuads(); + tesseract.addVertexWithUV(-0.5, -0.5, +0.5, 1, 0); + tesseract.addVertexWithUV(+0.5, -0.5, +0.5, 0, 0); + tesseract.addVertexWithUV(+0.5, -0.5, -0.5, 0, 1); + tesseract.addVertexWithUV(-0.5, -0.5, -0.5, 1, 1); + this.bindTexture(loc1); + tesseract.draw(); + + tesseract.startDrawingQuads(); + tesseract.addVertexWithUV(+0.5, +0.5, +0.5, 1, 0); + tesseract.addVertexWithUV(-0.5, +0.5, +0.5, 0, 0); + tesseract.addVertexWithUV(-0.5, +0.5, -0.5, 0, 1); + tesseract.addVertexWithUV(+0.5, +0.5, -0.5, 1, 1); + this.bindTexture(loc1); + tesseract.draw(); + GL11.glPopMatrix(); + + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return new ResourceLocation(RefStrings.MODID + ":textures/blocks/block_meteor_molten.png"); + } +} diff --git a/com/hbm/world/Meteorite.java b/com/hbm/world/Meteorite.java index 0ccca147b..a59de0260 100644 --- a/com/hbm/world/Meteorite.java +++ b/com/hbm/world/Meteorite.java @@ -54,7 +54,9 @@ public class Meteorite { //0 - Meteor //1 - Treasure //2 - Ore - int core = rand.nextInt(3); + int core = rand.nextInt(2); + if(innerPadding > 0) + core = 2; List hullL = new ArrayList(); switch(hull) { @@ -65,7 +67,9 @@ public class Meteorite { hullL.add(new ItemStack(ModBlocks.block_meteor_cobble)); break; case 2: - hullL.add(new ItemStack(ModBlocks.block_meteor_broken)); + for(int i = 0; i < 99; i++) + hullL.add(new ItemStack(ModBlocks.block_meteor_broken)); + hullL.add(new ItemStack(ModBlocks.block_meteor_treasure)); break; case 3: hullL.add(new ItemStack(ModBlocks.block_meteor_molten)); @@ -79,7 +83,9 @@ public class Meteorite { opL.add(new ItemStack(ModBlocks.block_meteor_cobble)); break; case 1: - opL.add(new ItemStack(ModBlocks.block_meteor_broken)); + for(int i = 0; i < 99; i++) + opL.add(new ItemStack(ModBlocks.block_meteor_broken)); + opL.add(new ItemStack(ModBlocks.block_meteor_treasure)); break; case 2: opL.add(new ItemStack(ModBlocks.block_meteor_cobble)); @@ -90,7 +96,9 @@ public class Meteorite { List ipL = new ArrayList(); switch(innerPadding) { case 0: - ipL.add(new ItemStack(ModBlocks.block_meteor_broken)); + for(int i = 0; i < 99; i++) + ipL.add(new ItemStack(ModBlocks.block_meteor_broken)); + ipL.add(new ItemStack(ModBlocks.block_meteor_treasure)); break; case 1: ipL.add(new ItemStack(Blocks.stone)); @@ -157,7 +165,9 @@ public class Meteorite { //0 - Meteor //1 - Treasure //2 - Ore - int core = rand.nextInt(3); + int core = rand.nextInt(2); + if(innerPadding > 0) + core = 2; List hullL = new ArrayList(); switch(hull) { @@ -168,7 +178,9 @@ public class Meteorite { hullL.add(new ItemStack(ModBlocks.block_meteor_cobble)); break; case 2: - hullL.add(new ItemStack(ModBlocks.block_meteor_broken)); + for(int i = 0; i < 99; i++) + hullL.add(new ItemStack(ModBlocks.block_meteor_broken)); + hullL.add(new ItemStack(ModBlocks.block_meteor_treasure)); break; case 3: hullL.add(new ItemStack(ModBlocks.block_meteor_molten)); @@ -182,7 +194,9 @@ public class Meteorite { opL.add(new ItemStack(ModBlocks.block_meteor_cobble)); break; case 1: - opL.add(new ItemStack(ModBlocks.block_meteor_broken)); + for(int i = 0; i < 99; i++) + opL.add(new ItemStack(ModBlocks.block_meteor_broken)); + opL.add(new ItemStack(ModBlocks.block_meteor_treasure)); break; case 2: opL.add(new ItemStack(ModBlocks.block_meteor_cobble)); @@ -193,7 +207,9 @@ public class Meteorite { List ipL = new ArrayList(); switch(innerPadding) { case 0: - ipL.add(new ItemStack(ModBlocks.block_meteor_broken)); + for(int i = 0; i < 99; i++) + ipL.add(new ItemStack(ModBlocks.block_meteor_broken)); + ipL.add(new ItemStack(ModBlocks.block_meteor_treasure)); break; case 1: ipL.add(new ItemStack(Blocks.stone)); @@ -273,7 +289,9 @@ public class Meteorite { hullL.add(new ItemStack(ModBlocks.block_meteor_cobble)); break; case 2: - hullL.add(new ItemStack(ModBlocks.block_meteor_broken)); + for(int i = 0; i < 99; i++) + hullL.add(new ItemStack(ModBlocks.block_meteor_broken)); + hullL.add(new ItemStack(ModBlocks.block_meteor_treasure)); break; case 3: hullL.add(new ItemStack(ModBlocks.block_meteor_molten)); @@ -512,6 +530,12 @@ public class Meteorite { } } + if(rand.nextInt(5) == 3) { + List list = new ArrayList(); + list.add(new ItemStack(ModBlocks.ore_rare, 1).copy()); + return list; + } + if(ores.isEmpty()) { List list = new ArrayList(); list.add(new ItemStack(Blocks.iron_ore, 1).copy());