diff --git a/changelog b/changelog index 1e3e818a7..bb000ef7e 100644 --- a/changelog +++ b/changelog @@ -14,6 +14,9 @@ * This means that a chemical factory can make hydrogen peroxide, sulfuric acid and nitric acid, and the only fluid input needed is water * Paintable exhaust pipe * Full block exhaust pipe that behaves like paintable cables and ducts +* Rangefinder + * A simple tool for checking the distance to a block + * Is now used as the base ingredient for long range target designatory, artillery remotes and airstrike designators ## Changed * Updated chinese and ukrainian localizations @@ -44,6 +47,8 @@ * Open doors can now be interacted through * Area abilities on tools now drop all mined blocks in the center * Tools with AoE now come with the new "flat AoE" ability, which is the same but the area is only 1 block tall +* Atomic airstrike now requires a control unit +* Parallelized explosions have been temporarily disabled, regardless of config option, explosions will use the previous system ## Fixed * Chemical plant ports. For real this time. @@ -62,3 +67,4 @@ * Replaced paintabble cables in the lighthouse with regular ones, fixing an issue where the paint would ID shift * Fixed light blocks being considered solid for NPC pathfinding * Fixed issue regarding locked slots when using crates +* Fixed MK3 explosions crashing when spawned with invalid size or when not being deserialized correctly diff --git a/gradle.properties b/gradle.properties index 17c61bd4b..da72d22ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ mod_version=1.0.27 # Empty build number makes a release type -mod_build_number=5357 +mod_build_number=5377 credits=HbMinecraft,\ \ rodolphito (explosion algorithms),\ diff --git a/src/main/java/com/hbm/crafting/ConsumableRecipes.java b/src/main/java/com/hbm/crafting/ConsumableRecipes.java index a64f9759c..8d867f56e 100644 --- a/src/main/java/com/hbm/crafting/ConsumableRecipes.java +++ b/src/main/java/com/hbm/crafting/ConsumableRecipes.java @@ -27,11 +27,11 @@ public class ConsumableRecipes { public static void register() { //Airstikes - CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 0), new Object[] { "TTT", "TRT", "TTT", 'T', Blocks.tnt, 'R', ModItems.detonator_laser }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 1), new Object[] { "TTT", "TRT", "TTT", 'T', ModItems.grenade_gascan, 'R', ModItems.detonator_laser }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 2), new Object[] { "TTT", "TRT", "TTT", 'T', ModItems.pellet_gas, 'R', ModItems.detonator_laser }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 3), new Object[] { "TRT", 'T', ModItems.grenade_cloud, 'R', ModItems.detonator_laser }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 4), new Object[] { "TR", 'T', DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.NUKE_HIGH), 'R', ModItems.detonator_laser }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 0), new Object[] { "TTT", "TRT", "TTT", 'T', Blocks.tnt, 'R', ModItems.rangefinder }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 1), new Object[] { "TTT", "TRT", "TTT", 'T', ModItems.grenade_gascan, 'R', ModItems.rangefinder }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 2), new Object[] { "TTT", "TRT", "TTT", 'T', ModItems.pellet_gas, 'R', ModItems.rangefinder }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 3), new Object[] { "TRT", 'T', ModItems.grenade_cloud, 'R', ModItems.rangefinder }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_caller, 1, 4), new Object[] { "TRC", 'T', DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.NUKE_HIGH), 'R', ModItems.rangefinder, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CONTROLLER) }); //Food CraftingManager.addRecipeAuto(new ItemStack(ModItems.bomb_waffle, 1), new Object[] { "WEW", "MPM", "WEW", 'W', Items.wheat, 'E', Items.egg, 'M', Items.milk_bucket, 'P', ModItems.man_core }); diff --git a/src/main/java/com/hbm/crafting/ToolRecipes.java b/src/main/java/com/hbm/crafting/ToolRecipes.java index 26a04b5fe..39c00cde5 100644 --- a/src/main/java/com/hbm/crafting/ToolRecipes.java +++ b/src/main/java/com/hbm/crafting/ToolRecipes.java @@ -112,10 +112,11 @@ public class ToolRecipes { CraftingManager.addRecipeAuto(new ItemStack(ModItems.ullapool_caber, 1), new Object[] { "ITI", " S ", " S ", 'I', IRON.plate(), 'T', Blocks.tnt, 'S', KEY_STICK }); //Utility + CraftingManager.addRecipeAuto(new ItemStack(ModItems.rangefinder, 1), new Object[] { "GRC", " S", 'G', KEY_ANYPANE, 'R', REDSTONE.dust(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC), 'S' ,STEEL.plate() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator, 1), new Object[] { " A", "#B#", "#B#", '#', IRON.plate(), 'A', STEEL.plate(), 'B', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC) }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator_range, 1), new Object[] { "RRD", "PIC", " P", 'P', STEEL.plate(), 'R', Items.redstone, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'D', ModItems.designator, 'I', STEEL.ingot() }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.designator_range, 1), new Object[] { ModItems.rangefinder, ModItems.designator, ANY_PLASTIC.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator_manual, 1), new Object[] { " A", "#C#", "#B#", '#', ANY_PLASTIC.ingot(), 'A', PB.plate(), 'B', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'C', ModItems.designator }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.designator_arty_range, 1), new Object[] { "M", "C", "P", 'M', ModItems.magnetron, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'P', ANY_PLASTIC.ingot() }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.designator_arty_range, 1), new Object[] { ModItems.rangefinder, DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), ANY_PLASTIC.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.linker, 1), new Object[] { "I I", "ICI", "GGG", 'I', IRON.plate(), 'G', GOLD.plate(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED) }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.oil_detector, 1), new Object[] { "W I", "WCI", "PPP", 'W', GOLD.wireFine(), 'I', CU.ingot(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ANALOG), 'P', STEEL.plate528() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.turret_chip, 1), new Object[] { "WWW", "CPC", "WWW", 'W', GOLD.wireFine(), 'P', ANY_PLASTIC.ingot(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), }); diff --git a/src/main/java/com/hbm/entity/logic/EntityNukeExplosionMK5.java b/src/main/java/com/hbm/entity/logic/EntityNukeExplosionMK5.java index dac30b1db..06480aa21 100644 --- a/src/main/java/com/hbm/entity/logic/EntityNukeExplosionMK5.java +++ b/src/main/java/com/hbm/entity/logic/EntityNukeExplosionMK5.java @@ -10,7 +10,6 @@ import com.hbm.config.GeneralConfig; import com.hbm.entity.effect.EntityFalloutRain; import com.hbm.explosion.ExplosionNukeGeneric; import com.hbm.explosion.ExplosionNukeRayBatched; -import com.hbm.explosion.ExplosionNukeRayParallelized; import com.hbm.main.MainRegistry; import com.hbm.util.ContaminationUtil; import com.hbm.util.ContaminationUtil.ContaminationType; @@ -70,13 +69,11 @@ public class EntityNukeExplosionMK5 extends EntityExplosionChunkloading { if(explosion == null) { explosionStart = System.currentTimeMillis(); - if (BombConfig.explosionAlgorithm == 1 || BombConfig.explosionAlgorithm == 2) { - explosion = new ExplosionNukeRayParallelized(worldObj, posX, posY, posZ, - strength, speed, length); - } else { - explosion = new ExplosionNukeRayBatched(worldObj, (int) posX, (int) posY, (int) posZ, - strength, speed, length); - } + //if(BombConfig.explosionAlgorithm == 1 || BombConfig.explosionAlgorithm == 2) { + // explosion = new ExplosionNukeRayParallelized(worldObj, posX, posY, posZ, strength, speed, length); + //} else { + explosion = new ExplosionNukeRayBatched(worldObj, (int) posX, (int) posY, (int) posZ, strength, speed, length); + //} } if(!explosion.isComplete()) { diff --git a/src/main/java/com/hbm/explosion/ExplosionFleija.java b/src/main/java/com/hbm/explosion/ExplosionFleija.java index 5a478fe14..8c06d708a 100644 --- a/src/main/java/com/hbm/explosion/ExplosionFleija.java +++ b/src/main/java/com/hbm/explosion/ExplosionFleija.java @@ -6,8 +6,8 @@ import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -public class ExplosionFleija -{ +public class ExplosionFleija { + public int posX; public int posY; public int posZ; @@ -23,7 +23,7 @@ public class ExplosionFleija private int element; public float explosionCoefficient = 1.0F; public float explosionCoefficient2 = 1.0F; - + public void saveToNbt(NBTTagCompound nbt, String name) { nbt.setInteger(name + "posX", posX); nbt.setInteger(name + "posY", posY); @@ -40,7 +40,7 @@ public class ExplosionFleija nbt.setFloat(name + "explosionCoefficient", explosionCoefficient); nbt.setFloat(name + "explosionCoefficient2", explosionCoefficient2); } - + public void readFromNbt(NBTTagCompound nbt, String name) { posX = nbt.getInteger(name + "posX"); posY = nbt.getInteger(name + "posY"); @@ -57,29 +57,28 @@ public class ExplosionFleija explosionCoefficient = nbt.getFloat(name + "explosionCoefficient"); explosionCoefficient2 = nbt.getFloat(name + "explosionCoefficient2"); } - - public ExplosionFleija(int x, int y, int z, World world, int rad, float coefficient, float coefficient2) - { + + public ExplosionFleija(int x, int y, int z, World world, int rad, float coefficient, float coefficient2) { this.posX = x; this.posY = y; this.posZ = z; - + this.worldObj = world; - + this.radius = rad; this.radius2 = this.radius * this.radius; this.explosionCoefficient = coefficient; this.explosionCoefficient2 = coefficient2; - + this.nlimit = this.radius2 * 4; } - - public boolean update() - { + + public boolean update() { breakColumn(this.lastposX, this.lastposZ); this.shell = (int) Math.floor((Math.sqrt(n) + 1) / 2); int shell2 = this.shell * 2; + if(shell2 == 0) return true; // end explosion if the shell size is 0 to prevent division by zero crash this.leg = (int) Math.floor((this.n - (shell2 - 1) * (shell2 - 1)) / shell2); this.element = (this.n - (shell2 - 1) * (shell2 - 1)) - shell2 * this.leg - this.shell + 1; this.lastposX = this.leg == 0 ? this.shell : this.leg == 1 ? -this.element : this.leg == 2 ? -this.shell : this.element; @@ -88,15 +87,13 @@ public class ExplosionFleija return this.n > this.nlimit; } - private void breakColumn(int x, int z) - { + private void breakColumn(int x, int z) { int dist = this.radius2 - (x * x + z * z); - if (dist > 0) - { + if(dist > 0) { dist = (int) Math.sqrt(dist); - for (int y = (int)(dist / this.explosionCoefficient2); y > -dist / this.explosionCoefficient; y--) - { - if(this.posY + y > 0 && !(this.worldObj.getBlock(this.posX+x, this.posY+y, this.posZ+z) instanceof DecoBlockAlt))this.worldObj.setBlock(this.posX+x, this.posY+y, this.posZ+z, Blocks.air); + for(int y = (int) (dist / this.explosionCoefficient2); y > -dist / this.explosionCoefficient; y--) { + if(this.posY + y > 0 && !(this.worldObj.getBlock(this.posX + x, this.posY + y, this.posZ + z) instanceof DecoBlockAlt)) + this.worldObj.setBlock(this.posX + x, this.posY + y, this.posZ + z, Blocks.air); } } } diff --git a/src/main/java/com/hbm/handler/HTTPHandler.java b/src/main/java/com/hbm/handler/HTTPHandler.java index 4efc054f4..3af10a74b 100644 --- a/src/main/java/com/hbm/handler/HTTPHandler.java +++ b/src/main/java/com/hbm/handler/HTTPHandler.java @@ -13,6 +13,7 @@ import com.hbm.main.MainRegistry; public class HTTPHandler { public static List capsule = new ArrayList(); + public static List tipOfTheDay = new ArrayList(); public static boolean newVersion = false; public static String versionNumber = ""; @@ -25,6 +26,7 @@ public class HTTPHandler { try { loadVersion(); loadSoyuz(); + loadTips(); } catch(IOException e) { MainRegistry.logger.warn("Version checker failed!"); } @@ -69,12 +71,17 @@ public class HTTPHandler { BufferedReader in = new BufferedReader(new InputStreamReader(github.openStream())); String line; - - while((line = in.readLine()) != null) { - capsule.add(line); - } - + while((line = in.readLine()) != null) capsule.add(line); in.close(); } + private static void loadTips() throws IOException { + + URL github = new URL("https://gist.githubusercontent.com/HbmMods/a03c66ba160184e12f43de826b30c096/raw/tip_of_the_day"); + BufferedReader in = new BufferedReader(new InputStreamReader(github.openStream())); + + String line; + while((line = in.readLine()) != null) tipOfTheDay.add(line); + in.close(); + } } diff --git a/src/main/java/com/hbm/inventory/gui/LoadingScreenRendererNT.java b/src/main/java/com/hbm/inventory/gui/LoadingScreenRendererNT.java new file mode 100644 index 000000000..d9dc5e676 --- /dev/null +++ b/src/main/java/com/hbm/inventory/gui/LoadingScreenRendererNT.java @@ -0,0 +1,189 @@ +package com.hbm.inventory.gui; + +import java.util.Random; + +import org.lwjgl.opengl.GL11; + +import com.hbm.handler.HTTPHandler; + +import cpw.mods.fml.client.FMLClientHandler; +import net.minecraft.client.LoadingScreenRenderer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MinecraftError; + +public class LoadingScreenRendererNT extends LoadingScreenRenderer { + + private String message = ""; + private Minecraft mc; + private String currentlyDisplayedText = ""; + private long time = Minecraft.getSystemTime(); + private boolean doesProgress; + private ScaledResolution resolution; + private Framebuffer frameBuffer; + public String tipOfTheDay = "Tip of the day: " + chooseTip(); + + public LoadingScreenRendererNT(Minecraft mc) { + super(mc); + this.mc = mc; + this.resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); + this.frameBuffer = new Framebuffer(mc.displayWidth, mc.displayHeight, false); + this.frameBuffer.setFramebufferFilter(9728); + } + + private String chooseTip() { + if(HTTPHandler.tipOfTheDay.isEmpty()) return "null"; + return HTTPHandler.tipOfTheDay.get(new Random().nextInt(HTTPHandler.tipOfTheDay.size())); + } + + @Override + public void resetProgressAndMessage(String message) { + this.doesProgress = false; + this.func_73722_d(message); + } + + @Override + public void displayProgressMessage(String message) { + this.doesProgress = true; + this.func_73722_d(message); + } + + @Override + public void func_73722_d(String message) { + this.currentlyDisplayedText = message; + + if(!this.mc.running) { + if(!this.doesProgress) { + throw new MinecraftError(); + } + } else { + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + + if(OpenGlHelper.isFramebufferEnabled()) { + int scale = this.resolution.getScaleFactor(); + GL11.glOrtho(0.0D, (this.resolution.getScaledWidth() * scale), (this.resolution.getScaledHeight() * scale), 0.0D, 100.0D, 300.0D); + } else { + ScaledResolution scaledresolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); + GL11.glOrtho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); + } + + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -200.0F); + } + } + + @Override + public void resetProgresAndWorkingMessage(String message) { + if(!this.mc.running) { + if(!this.doesProgress) { + throw new MinecraftError(); + } + } else { + this.time = 0L; + this.message = message; + this.setLoadingProgress(-1); + this.time = 0L; + } + } + + @Override + public void setLoadingProgress(int p_73718_1_) { + if(!this.mc.running) { + if(!this.doesProgress) { + throw new MinecraftError(); + } + } else { + long time = Minecraft.getSystemTime(); + + if(time - this.time >= 100L) { + this.time = time; + ScaledResolution scaledresolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); + int scaleFactor = scaledresolution.getScaleFactor(); + int width = scaledresolution.getScaledWidth(); + int height = scaledresolution.getScaledHeight(); + + if(OpenGlHelper.isFramebufferEnabled()) { + this.frameBuffer.framebufferClear(); + } else { + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + } + + this.frameBuffer.bindFramebuffer(false); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -200.0F); + + if(!OpenGlHelper.isFramebufferEnabled()) { + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); + } + + if(!FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) { + Tessellator tessellator = Tessellator.instance; + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + float f = 32.0F; + tessellator.startDrawingQuads(); + tessellator.setColorOpaque_I(4210752); + tessellator.addVertexWithUV(0.0D, height, 0.0D, 0.0D, height / f); + tessellator.addVertexWithUV(width, height, 0.0D, width / f, height / f); + tessellator.addVertexWithUV(width, 0.0D, 0.0D, width / f, 0.0D); + tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + tessellator.draw(); + + if(p_73718_1_ >= 0) { + byte b0 = 100; + byte b1 = 2; + int j1 = width / 2 - b0 / 2; + int k1 = height / 2 + 16; + GL11.glDisable(GL11.GL_TEXTURE_2D); + tessellator.startDrawingQuads(); + tessellator.setColorOpaque_I(8421504); + tessellator.addVertex(j1, k1, 0.0D); + tessellator.addVertex(j1, k1 + b1, 0.0D); + tessellator.addVertex(j1 + b0, k1 + b1, 0.0D); + tessellator.addVertex(j1 + b0, k1, 0.0D); + tessellator.setColorOpaque_I(8454016); + tessellator.addVertex(j1, k1, 0.0D); + tessellator.addVertex(j1, (k1 + b1), 0.0D); + tessellator.addVertex(j1 + p_73718_1_, k1 + b1, 0.0D); + tessellator.addVertex(j1 + p_73718_1_, k1, 0.0D); + tessellator.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + this.mc.fontRenderer.drawStringWithShadow(this.currentlyDisplayedText, (width - this.mc.fontRenderer.getStringWidth(this.currentlyDisplayedText)) / 2, height / 2 - 4 - 16, 16777215); + this.mc.fontRenderer.drawStringWithShadow(this.message, (width - this.mc.fontRenderer.getStringWidth(this.message)) / 2, height / 2 - 4 + 8, 16777215); + + String[] frags = this.tipOfTheDay.split("$"); + for(int i = 0; i < frags.length; i++) { + String frag = frags[i]; + this.mc.fontRenderer.drawStringWithShadow(EnumChatFormatting.YELLOW + frag, (width - this.mc.fontRenderer.getStringWidth(frag)) / 2, height / 2 - 4 - 60 + i * 10, 16777215); + } + } + this.frameBuffer.unbindFramebuffer(); + + if(OpenGlHelper.isFramebufferEnabled()) { + this.frameBuffer.framebufferRender(width * scaleFactor, height * scaleFactor); + } + + this.mc.func_147120_f(); + + try { Thread.yield(); } catch(Exception exception) { } + } + } + } + + @Override public void func_146586_a() { } +} diff --git a/src/main/java/com/hbm/inventory/recipes/PedestalRecipes.java b/src/main/java/com/hbm/inventory/recipes/PedestalRecipes.java index 8554afafc..76d22d7c8 100644 --- a/src/main/java/com/hbm/inventory/recipes/PedestalRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/PedestalRecipes.java @@ -62,9 +62,9 @@ public class PedestalRecipes extends SerializableRecipe { .extra(PedestalExtraCondition.SUN)); register(new PedestalRecipe(new ItemStack(ModItems.gun_autoshotgun_sexy), - new ComparableStack(ModItems.bolt_spike, 16), new OreDictStack(STAR.ingot(), 4), new ComparableStack(ModItems.bolt_spike, 16), + new ComparableStack(ModItems.bolt_spike, 16), new ComparableStack(ModItems.wild_p), new ComparableStack(ModItems.bolt_spike, 16), new ComparableStack(ModItems.card_qos), new ComparableStack(ModItems.gun_autoshotgun), new ComparableStack(ModItems.card_aos), - new ComparableStack(ModItems.bolt_spike, 16), new OreDictStack(STAR.ingot(), 4), new ComparableStack(ModItems.bolt_spike, 16))); + new ComparableStack(ModItems.bolt_spike, 16), new OreDictStack(STAR.ingot(), 16), new ComparableStack(ModItems.bolt_spike, 16))); register(new PedestalRecipe(new ItemStack(ModItems.gun_minigun_lacunae), null, new ComparableStack(ModItems.powder_magic, 4), null, diff --git a/src/main/java/com/hbm/items/ItemEnums.java b/src/main/java/com/hbm/items/ItemEnums.java index 18878469c..d92c7840b 100644 --- a/src/main/java/com/hbm/items/ItemEnums.java +++ b/src/main/java/com/hbm/items/ItemEnums.java @@ -87,6 +87,6 @@ public class ItemEnums { } public static enum EnumIngotMetal { - INGOT, COUNTER, KEY, BEACON, CASING, CLOCKWORK, BAR, DETECTOR + SCRAP, INGOT, COUNTER, KEY, BEACON, CASING, CLOCKWORK, BAR, DETECTOR } } diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index d7b7fb410..7387de265 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -1169,6 +1169,7 @@ public class ModItems { public static Item pellet_buckshot; public static Item pellet_charged; + public static Item rangefinder; public static Item designator; public static Item designator_range; public static Item designator_manual; @@ -3553,6 +3554,7 @@ public class ModItems { pellet_buckshot = new Item().setUnlocalizedName("pellet_buckshot").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":pellets_lead"); pellet_charged = new Item().setUnlocalizedName("pellet_charged").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":pellets_charged"); + rangefinder = new ItemRangefinder().setUnlocalizedName("rangefinder").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":rangefinder"); designator = new ItemDesingator().setUnlocalizedName("designator").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":designator"); designator_range = new ItemDesingatorRange().setUnlocalizedName("designator_range").setFull3D().setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":designator_range_alt"); designator_manual = new ItemDesingatorManual().setUnlocalizedName("designator_manual").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":designator_manual"); @@ -6136,6 +6138,7 @@ public class ModItems { GameRegistry.registerItem(spawn_duck, spawn_duck.getUnlocalizedName()); //Computer Tools + GameRegistry.registerItem(rangefinder, rangefinder.getUnlocalizedName()); GameRegistry.registerItem(designator, designator.getUnlocalizedName()); GameRegistry.registerItem(designator_range, designator_range.getUnlocalizedName()); GameRegistry.registerItem(designator_manual, designator_manual.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/tool/ItemRangefinder.java b/src/main/java/com/hbm/items/tool/ItemRangefinder.java new file mode 100644 index 000000000..9c1d5179f --- /dev/null +++ b/src/main/java/com/hbm/items/tool/ItemRangefinder.java @@ -0,0 +1,47 @@ +package com.hbm.items.tool; + +import com.hbm.main.MainRegistry; +import com.hbm.packet.PacketDispatcher; +import com.hbm.packet.toclient.PlayerInformPacket; +import com.hbm.util.ChatBuilder; +import com.hbm.util.Vec3NT; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class ItemRangefinder extends Item { + + public static final int META_POLARIZED = 1; + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + if(world.isRemote) return stack; + + Vec3NT start = new Vec3NT(player.posX, player.posY + player.eyeHeight, player.posZ); + Vec3NT startOriginal = new Vec3NT(start); // why the fuck + Vec3NT end = new Vec3NT(start).add(new Vec3NT(player.getLookVec()).multiply(300)); + + MovingObjectPosition mop = world.func_147447_a(start, end, false, true, false); + + if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) { + double dist = startOriginal.distanceTo(mop.hitVec); + String msg = ((int)(dist * 10D)) / 10D + "m"; + if(stack.getItemDamage() == META_POLARIZED) msg = EnumChatFormatting.LIGHT_PURPLE + msg + EnumChatFormatting.RESET; + PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start(msg).flush(), MainRegistry.proxy.ID_DETONATOR, 5000), (EntityPlayerMP) player); + } + + return stack; + } + + @Override + public String getItemStackDisplayName(ItemStack stack) { + String name = super.getItemStackDisplayName(stack); + if(stack.getItemDamage() == META_POLARIZED) name = EnumChatFormatting.LIGHT_PURPLE + name + EnumChatFormatting.RESET; + return name; + } +} diff --git a/src/main/java/com/hbm/lib/RefStrings.java b/src/main/java/com/hbm/lib/RefStrings.java index 27fe4f45d..f56883283 100644 --- a/src/main/java/com/hbm/lib/RefStrings.java +++ b/src/main/java/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.27 BETA (5357)"; + public static final String VERSION = "1.0.27 BETA (5377)"; //HBM's Beta Naming Convention: //V T (X) //V -> next release version diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 86a280f16..846699693 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -313,8 +313,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModItems.detonator, 1), new Object[] { "C", "S", 'S', STEEL.plate(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC), }); addShapelessAuto(new ItemStack(ModItems.detonator_multi, 1), new Object[] { ModItems.detonator, DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED) }); - addRecipeAuto(new ItemStack(ModItems.detonator_laser, 1), new Object[] { "RRD", "PIC", " P", 'P', STEEL.plate(), 'R', REDSTONE.dust(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'D', DIAMOND.gem(), 'I', STEEL.ingot() }); - addRecipeAuto(new ItemStack(ModItems.detonator_laser, 1), new Object[] { "RRD", "PIC", " P", 'P', STEEL.plate(), 'R', REDSTONE.dust(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'D', EMERALD.gem(), 'I', STEEL.ingot() }); + addShapelessAuto(new ItemStack(ModItems.detonator_laser, 1), new Object[] { ModItems.rangefinder, DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), RUBBER.ingot(), GOLD.wireDense() }); addShapelessAuto(new ItemStack(ModItems.detonator_deadman, 1), new Object[] { ModItems.detonator, ModItems.defuser, ModItems.ducttape }); addRecipeAuto(new ItemStack(ModItems.detonator_de, 1), new Object[] { "T", "D", "T", 'T', Blocks.tnt, 'D', ModItems.detonator_deadman }); diff --git a/src/main/java/com/hbm/main/ModEventHandlerClient.java b/src/main/java/com/hbm/main/ModEventHandlerClient.java index e9e40dfe0..aea94c19b 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerClient.java +++ b/src/main/java/com/hbm/main/ModEventHandlerClient.java @@ -22,6 +22,7 @@ import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.gui.GUIArmorTable; import com.hbm.inventory.gui.GUIScreenPreview; import com.hbm.inventory.gui.GUIScreenWikiRender; +import com.hbm.inventory.gui.LoadingScreenRendererNT; import com.hbm.items.ItemCustomLore; import com.hbm.items.ModItems; import com.hbm.items.armor.*; @@ -1032,10 +1033,15 @@ public class ModEventHandlerClient { @SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.LOWEST) public void onClientTickLast(ClientTickEvent event) { + + Minecraft mc = Minecraft.getMinecraft(); + if(!(mc.loadingScreen instanceof LoadingScreenRendererNT)) { + mc.loadingScreen = new LoadingScreenRendererNT(mc); + } if(event.phase == Phase.START && GeneralConfig.enableSkyboxes) { - World world = Minecraft.getMinecraft().theWorld; + World world = mc.theWorld; if(world == null) return; IRenderHandler sky = world.provider.getSkyRenderer(); @@ -1059,7 +1065,7 @@ public class ModEventHandlerClient { } } - EntityPlayer player = Minecraft.getMinecraft().thePlayer; + EntityPlayer player = mc.thePlayer; long millis = Clock.get_ms(); if(lastStarCheck + 200 < millis) { diff --git a/src/main/java/com/hbm/main/ServerProxy.java b/src/main/java/com/hbm/main/ServerProxy.java index 7ec6eaa23..271a21759 100644 --- a/src/main/java/com/hbm/main/ServerProxy.java +++ b/src/main/java/com/hbm/main/ServerProxy.java @@ -32,8 +32,7 @@ public class ServerProxy { public static final int ID_FLUID_ID = 9; public static final int ID_FAN_MODE = 10; public static final int ID_TOOLABILITY = 11; - public static final int ID_GUN_MODE = 12; - public static final int ID_GAS_HAZARD = 13; + public static final int ID_GAS_HAZARD = 12; public ITranslate getI18n() { return I18N; } diff --git a/src/main/java/com/hbm/util/Vec3NT.java b/src/main/java/com/hbm/util/Vec3NT.java index 0cb8121a7..1e6cb1294 100644 --- a/src/main/java/com/hbm/util/Vec3NT.java +++ b/src/main/java/com/hbm/util/Vec3NT.java @@ -29,6 +29,13 @@ public class Vec3NT extends Vec3 { return this; } + public Vec3NT add(Vec3 vec) { + this.xCoord += vec.xCoord; + this.yCoord += vec.yCoord; + this.zCoord += vec.zCoord; + return this; + } + public Vec3NT multiply(double m) { this.xCoord *= m; this.yCoord *= m; @@ -43,6 +50,13 @@ public class Vec3NT extends Vec3 { return this; } + public double distanceTo(double x, double y, double z) { + double dX = x - this.xCoord; + double dY = y - this.yCoord; + double dZ = z - this.zCoord; + return Math.sqrt(dX * dX + dY * dY + dZ * dZ); + } + @Override public Vec3NT setComponents(double x, double y, double z) { this.xCoord = x; diff --git a/src/main/resources/META-INF/HBM_at.cfg b/src/main/resources/META-INF/HBM_at.cfg index 81514dff3..859de4618 100644 --- a/src/main/resources/META-INF/HBM_at.cfg +++ b/src/main/resources/META-INF/HBM_at.cfg @@ -55,3 +55,5 @@ public net.minecraft.client.gui.GuiIngame field_92016_l # hi # Block public net.minecraft.block.Block func_149642_a(Lnet/minecraft/world/World;IIILnet/minecraft/item/ItemStack;)V # dropBlockAsItem +# Minecraft +public net.minecraft.client.Minecraft field_71425_J # running diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 33050befc..c76f24002 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -3039,6 +3039,7 @@ item.radx.name=Rad-X item.rag.name=Stoff item.rag_damp.name=Nasser Stoff item.rag_piss.name=Pisslappen +item.rangefinder.name=Entfernungsmessgerät item.rbmk_fuel_balefire.name=Balefire-RBMK-Kernbrennstoff item.rbmk_fuel_balefire_gold.name=Flammgold-RBMK-Kernbrennstoff item.rbmk_fuel_drx.name=§cDigamma-RBMK-Kernbrennstoff diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 72c0ee93b..d432682b1 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -3992,6 +3992,7 @@ item.radx.desc=Increases radiation resistance by 0.2 (37%%) for 3 minutes item.rag.name=Cloth item.rag_damp.name=Damp Cloth item.rag_piss.name=Piss-Soaked Rag +item.rangefinder.name=Rangefinder item.rbmk_fuel_balefire.name=Balefire RBMK Fuel Rod item.rbmk_fuel_balefire_gold.name=Flashgold RBMK Fuel Rod item.rbmk_fuel_drx.name=§cDigamma RBMK Fuel Rod§r diff --git a/src/main/resources/assets/hbm/textures/items/ingot_metal.scrap.png b/src/main/resources/assets/hbm/textures/items/ingot_metal.scrap.png new file mode 100644 index 000000000..a0074ffc8 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/ingot_metal.scrap.png differ diff --git a/src/main/resources/assets/hbm/textures/items/ingot_metal_sheet.png b/src/main/resources/assets/hbm/textures/items/ingot_metal_sheet.png index 3697db98c..d45fd4404 100644 Binary files a/src/main/resources/assets/hbm/textures/items/ingot_metal_sheet.png and b/src/main/resources/assets/hbm/textures/items/ingot_metal_sheet.png differ diff --git a/src/main/resources/assets/hbm/textures/items/rangefinder.png b/src/main/resources/assets/hbm/textures/items/rangefinder.png new file mode 100644 index 000000000..d7539ee67 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/rangefinder.png differ