From 89c7a3c0f73b4ee0202a45c4b884d6af7f69230d Mon Sep 17 00:00:00 2001 From: HbmMods Date: Sun, 27 May 2018 11:14:57 +0200 Subject: [PATCH] Mk4 improvements, faster blast --- .../entity/logic/EntityNukeExplosionMK4.java | 2 +- com/hbm/explosion/ExplosionNukeRay.java | 38 +++++++++++++------ com/hbm/items/ModItems.java | 2 +- com/hbm/items/special/ItemUnstable.java | 12 ++++++ com/hbm/lib/HbmWorldGen.java | 4 +- com/hbm/render/entity/RenderSmallNukeMK3.java | 6 +-- 6 files changed, 45 insertions(+), 19 deletions(-) diff --git a/com/hbm/entity/logic/EntityNukeExplosionMK4.java b/com/hbm/entity/logic/EntityNukeExplosionMK4.java index 919ba35e2..d4b4ec132 100644 --- a/com/hbm/entity/logic/EntityNukeExplosionMK4.java +++ b/com/hbm/entity/logic/EntityNukeExplosionMK4.java @@ -66,7 +66,7 @@ public class EntityNukeExplosionMK4 extends Entity { } else if(explosion.getStoredSize() > 0) { //if(!worldObj.isRemote) //MainRegistry.logger.info(explosion.getProgress() + " / " + count / length); - explosion.processTip(speed); + explosion.processTip(1024); } else if(fallout) { EntityFalloutRain fallout = new EntityFalloutRain(this.worldObj, (int)(this.length * 1.8) * 10); diff --git a/com/hbm/explosion/ExplosionNukeRay.java b/com/hbm/explosion/ExplosionNukeRay.java index c0b2b27e4..843b7f148 100644 --- a/com/hbm/explosion/ExplosionNukeRay.java +++ b/com/hbm/explosion/ExplosionNukeRay.java @@ -101,7 +101,13 @@ public class ExplosionNukeRay { }*/ public void processTip(int count) { - for(int l = 0; l < count; l++) { + + int processedBlocks = 0; + + for(int l = 0; l < Integer.MAX_VALUE; l++) { + + if(processedBlocks >= count) + return; if(l > affectedBlocks.size() - 1) break; @@ -109,9 +115,11 @@ public class ExplosionNukeRay { if(affectedBlocks.isEmpty()) return; - float x = affectedBlocks.get(0).xCoord; - float y = affectedBlocks.get(0).yCoord; - float z = affectedBlocks.get(0).zCoord; + int in = affectedBlocks.size() - 1; + + float x = affectedBlocks.get(in).xCoord; + float y = affectedBlocks.get(in).yCoord; + float z = affectedBlocks.get(in).zCoord; world.setBlock((int)x, (int)y, (int)z, Blocks.air); @@ -125,11 +133,13 @@ public class ExplosionNukeRay { int y0 = (int)(posY + pY * i); int z0 = (int)(posZ + pZ * i); - //if(world.getBlock(x0, y0, z0) != Blocks.air) + if(!world.isAirBlock(x0, y0, z0)) { world.setBlock(x0, y0, z0, Blocks.air); + processedBlocks++; + } } - affectedBlocks.remove(0); + affectedBlocks.remove(in); } processed += count; @@ -310,16 +320,20 @@ public class ExplosionNukeRay { //StartY starts at this.length for(int v = startY; v <= bowCount; v++) { - Vec3 heightVec = Vec3.createVectorHelper(0, strength, 0); - heightVec.rotateAroundZ((float)(Math.PI/bow * -(float)v)); + float part = (float) (Math.PI/bow); + float rot = part * -v; + + Vec3 heightVec = Vec3.createVectorHelper(0, -strength, 0); + heightVec.rotateAroundZ(rot); double y = heightVec.yCoord; - System.out.println(v + " " + y); - double sectionRad = Math.sqrt(Math.pow(strength, 2) - Math.pow(y, 2)); double circumference = 2 * Math.PI * sectionRad; + //if(y < 2 && y > -2) + // circumference *= 1.25D; + //circumference = Math.ceil(circumference); //Radial @@ -330,8 +344,8 @@ public class ExplosionNukeRay { vec = vec.normalize(); /*if(y > 0) vec.rotateAroundZ((float) (y / sectionRad) * 0.15F);*/ - if(y < 0) - vec.rotateAroundZ((float) (y / sectionRad) * 0.15F); + /*if(y < 0) + vec.rotateAroundZ((float) (y / sectionRad) * 0.15F);*/ vec.rotateAroundY((float) (360 / circumference * r)); int length = (int)Math.ceil(strength); diff --git a/com/hbm/items/ModItems.java b/com/hbm/items/ModItems.java index 4cd4bff95..0428af94a 100644 --- a/com/hbm/items/ModItems.java +++ b/com/hbm/items/ModItems.java @@ -2416,7 +2416,7 @@ public class ModItems { nothing = new Item().setUnlocalizedName("nothing").setTextureName(RefStrings.MODID + ":nothing"); void_anim = new Item().setUnlocalizedName("void_anim").setTextureName(RefStrings.MODID + ":void_anim"); - mysteryshovel = new ItemMS().setUnlocalizedName("mysteryshovel").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":cursed_shovel"); + mysteryshovel = new ItemMS().setUnlocalizedName("mysteryshovel").setFull3D().setMaxStackSize(1).setTextureName(RefStrings.MODID + ":cursed_shovel"); memory = new ItemBattery(Long.MAX_VALUE / 100L, 100000, 100000).setUnlocalizedName("memory").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":mo8_anim"); FluidContainerRegistry.registerFluidContainer(new FluidStack(ModBlocks.mud_fluid, 1000), new ItemStack(ModItems.bucket_mud)); diff --git a/com/hbm/items/special/ItemUnstable.java b/com/hbm/items/special/ItemUnstable.java index 4d9655d49..731af0cbd 100644 --- a/com/hbm/items/special/ItemUnstable.java +++ b/com/hbm/items/special/ItemUnstable.java @@ -2,6 +2,7 @@ package com.hbm.items.special; import com.hbm.entity.logic.EntityNukeExplosionMK4; import com.hbm.lib.ModDamageSource; +import com.hbm.main.MainRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -11,6 +12,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; public class ItemUnstable extends Item { @@ -86,4 +88,14 @@ public class ItemUnstable extends Item { } } + public String getItemStackDisplayName(ItemStack stack) + { + switch(stack.getItemDamage()) { + case 1: return "ELEMENTS"; + case 2: return "ARSENIC"; + case 3: return "VAULT"; + default: return ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); + } + } + } diff --git a/com/hbm/lib/HbmWorldGen.java b/com/hbm/lib/HbmWorldGen.java index dc45c1a16..658e19b8d 100644 --- a/com/hbm/lib/HbmWorldGen.java +++ b/com/hbm/lib/HbmWorldGen.java @@ -349,8 +349,8 @@ public class HbmWorldGen implements IWorldGenerator { int z = j + rand.nextInt(16); int y = world.getHeightValue(x, z); - if(world.getBlock(x, y - 1, z).canPlaceTorchOnTop(world, x, y - 1, z)) - world.setBlock(x, y, z, ModBlocks.broadcaster_pc, rand.nextInt(4) + 2, 2); + if(world.getBlock(x, y, z).canPlaceTorchOnTop(world, x, y - 1, z)) + world.setBlock(x, y + 1, z, ModBlocks.broadcaster_pc, rand.nextInt(4) + 2, 2); if(MainRegistry.enableDebugMode) MainRegistry.logger.info("[Debug] Successfully spawned corrupted broadcaster at " + x + " " + y +" " + z); diff --git a/com/hbm/render/entity/RenderSmallNukeMK3.java b/com/hbm/render/entity/RenderSmallNukeMK3.java index 4850ee469..4cc52b1de 100644 --- a/com/hbm/render/entity/RenderSmallNukeMK3.java +++ b/com/hbm/render/entity/RenderSmallNukeMK3.java @@ -176,13 +176,13 @@ public class RenderSmallNukeMK3 extends Render { GL11.glColor4f(0.4F, 0.4F, 0.4F, 1F); float f = (float)Math.min((age - 50) * 0.5, 20); GL11.glScalef(f, 15, f); - ringBigModel.renderAll(); + //ringBigModel.renderAll(); GL11.glScalef(1.5F, 1, 1.5F); GL11.glTranslatef(0, -0.15F, 0); - ringBigModel.renderAll(); + //ringBigModel.renderAll(); GL11.glScalef(1.5F, 1, 1.5F); GL11.glTranslatef(0, -0.15F, 0); - ringBigModel.renderAll(); + //ringBigModel.renderAll(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix();