From edb78440cafc7c45087bfba4b4baaafd4051b6b2 Mon Sep 17 00:00:00 2001 From: Boblet Date: Tue, 8 Feb 2022 11:05:33 +0100 Subject: [PATCH] makes use of the pistol bullet model, transparency for water in GUIs --- .../com/hbm/blocks/generic/BlockBobble.java | 13 +++++++++ .../handler/guncfg/BulletConfigFactory.java | 6 ++++ .../hbm/handler/guncfg/Gun22LRFactory.java | 4 +-- .../handler/guncfg/Gun357MagnumFactory.java | 16 +++++------ .../handler/guncfg/Gun44MagnumFactory.java | 16 +++++------ .../hbm/handler/guncfg/Gun50AEFactory.java | 8 +++--- .../com/hbm/handler/guncfg/Gun9mmFactory.java | 6 ++-- .../java/com/hbm/inventory/FluidTank.java | 26 ++++++------------ .../assets/hbm/textures/gui/fluids/water.png | Bin 452 -> 2042 bytes 9 files changed, 52 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/hbm/blocks/generic/BlockBobble.java b/src/main/java/com/hbm/blocks/generic/BlockBobble.java index e11fa1e57..c154fc950 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockBobble.java +++ b/src/main/java/com/hbm/blocks/generic/BlockBobble.java @@ -26,6 +26,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -54,6 +55,18 @@ public class BlockBobble extends BlockContainer { public Item getItemDropped(int i, Random rand, int j) { return null; } + + @Override + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { + + TileEntityBobble entity = (TileEntityBobble) world.getTileEntity(x, y, z); + + if(entity != null) { + return new ItemStack(this, 1, entity.type.ordinal()); + } + + return super.getPickBlock(target, world, x, y, z, player); + } @Override public void breakBlock(World world, int x, int y, int z, Block block, int meta) { diff --git a/src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java b/src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java index 018821428..4bd0647ce 100644 --- a/src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/BulletConfigFactory.java @@ -89,6 +89,12 @@ public class BulletConfigFactory { return bullet; } + public static BulletConfiguration standardPistolConfig() { + BulletConfiguration bullet = standardBulletConfig(); + bullet.style = BulletConfiguration.STYLE_PISTOL; + bullet.plink = BulletConfiguration.PLINK_BULLET; + return bullet; + } public static BulletConfiguration standardBuckshotConfig() { diff --git a/src/main/java/com/hbm/handler/guncfg/Gun22LRFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun22LRFactory.java index 5158a693a..aa669affa 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun22LRFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun22LRFactory.java @@ -61,7 +61,7 @@ public class Gun22LRFactory { static float inaccuracy = 5; public static BulletConfiguration get22LRConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_22lr; bullet.spread *= inaccuracy; @@ -73,7 +73,7 @@ public class Gun22LRFactory { public static BulletConfiguration get22LRAPConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_22lr_ap; bullet.spread *= inaccuracy; diff --git a/src/main/java/com/hbm/handler/guncfg/Gun357MagnumFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun357MagnumFactory.java index e050b315d..9cacf7258 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun357MagnumFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun357MagnumFactory.java @@ -193,7 +193,7 @@ public class Gun357MagnumFactory { public static BulletConfiguration getRevIronConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.gun_revolver_iron_ammo; bullet.dmgMin = 8; @@ -204,7 +204,7 @@ public class Gun357MagnumFactory { public static BulletConfiguration getRevSteelConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.gun_revolver_ammo; bullet.dmgMin = 18; @@ -215,7 +215,7 @@ public class Gun357MagnumFactory { public static BulletConfiguration getRevLeadConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.gun_revolver_lead_ammo; bullet.dmgMin = 10; @@ -229,7 +229,7 @@ public class Gun357MagnumFactory { public static BulletConfiguration getRevGoldConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.gun_revolver_gold_ammo; bullet.dmgMin = 25; @@ -240,7 +240,7 @@ public class Gun357MagnumFactory { public static BulletConfiguration getRevDeshConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_357_desh; bullet.dmgMin = 30; @@ -251,7 +251,7 @@ public class Gun357MagnumFactory { public static BulletConfiguration getRevSchrabidiumConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.gun_revolver_schrabidium_ammo; bullet.dmgMin = 10000; @@ -263,7 +263,7 @@ public class Gun357MagnumFactory { public static BulletConfiguration getRevCursedConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.gun_revolver_cursed_ammo; bullet.dmgMin = 18; @@ -274,7 +274,7 @@ public class Gun357MagnumFactory { public static BulletConfiguration getRevNightmareConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.gun_revolver_nightmare_ammo; bullet.dmgMin = 1; diff --git a/src/main/java/com/hbm/handler/guncfg/Gun44MagnumFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun44MagnumFactory.java index 09da3c53d..af0fc44cd 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun44MagnumFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun44MagnumFactory.java @@ -169,7 +169,7 @@ public class Gun44MagnumFactory { public static BulletConfiguration getNoPipConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_44; bullet.dmgMin = 18; @@ -180,7 +180,7 @@ public class Gun44MagnumFactory { public static BulletConfiguration getNoPipAPConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_44_ap; bullet.dmgMin = 25; @@ -193,7 +193,7 @@ public class Gun44MagnumFactory { public static BulletConfiguration getNoPipDUConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_44_du; bullet.dmgMin = 28; @@ -206,7 +206,7 @@ public class Gun44MagnumFactory { public static BulletConfiguration getPhosphorusConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_44_phosphorus; bullet.dmgMin = 18; @@ -240,7 +240,7 @@ public class Gun44MagnumFactory { public static BulletConfiguration getNoPipStarConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_44_star; bullet.dmgMin = 42; @@ -253,7 +253,7 @@ public class Gun44MagnumFactory { public static BulletConfiguration getPipConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_44_pip; bullet.dmgMin = 30; @@ -290,7 +290,7 @@ public class Gun44MagnumFactory { public static BulletConfiguration getBJConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_44_bj; bullet.dmgMin = 30; @@ -328,7 +328,7 @@ public class Gun44MagnumFactory { public static BulletConfiguration getSilverStormConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_44_silver; bullet.dmgMin = 30; diff --git a/src/main/java/com/hbm/handler/guncfg/Gun50AEFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun50AEFactory.java index dc7d07191..1fe1ce16c 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun50AEFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun50AEFactory.java @@ -54,7 +54,7 @@ public class Gun50AEFactory { static float inaccuracy = 0.0005F; public static BulletConfiguration get50AEConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_50ae; bullet.spread *= inaccuracy; @@ -66,7 +66,7 @@ public class Gun50AEFactory { public static BulletConfiguration get50APConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_50ae_ap; bullet.spread *= inaccuracy; @@ -80,7 +80,7 @@ public class Gun50AEFactory { public static BulletConfiguration get50DUConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_50ae_du; bullet.spread *= inaccuracy; @@ -94,7 +94,7 @@ public class Gun50AEFactory { public static BulletConfiguration get50StarConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_50ae_star; bullet.spread *= inaccuracy; diff --git a/src/main/java/com/hbm/handler/guncfg/Gun9mmFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun9mmFactory.java index aae7fb0f3..5b3e4370d 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun9mmFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun9mmFactory.java @@ -77,7 +77,7 @@ public class Gun9mmFactory { static float inaccuracy = 5; public static BulletConfiguration get9mmConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_9mm; bullet.spread *= inaccuracy; @@ -89,7 +89,7 @@ public class Gun9mmFactory { public static BulletConfiguration get9mmAPConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_9mm_ap; bullet.spread *= inaccuracy; @@ -103,7 +103,7 @@ public class Gun9mmFactory { public static BulletConfiguration get9mmDUConfig() { - BulletConfiguration bullet = BulletConfigFactory.standardBulletConfig(); + BulletConfiguration bullet = BulletConfigFactory.standardPistolConfig(); bullet.ammo = ModItems.ammo_9mm_du; bullet.spread *= inaccuracy; diff --git a/src/main/java/com/hbm/inventory/FluidTank.java b/src/main/java/com/hbm/inventory/FluidTank.java index d5d3360b0..eaad80666 100644 --- a/src/main/java/com/hbm/inventory/FluidTank.java +++ b/src/main/java/com/hbm/inventory/FluidTank.java @@ -3,6 +3,8 @@ package com.hbm.inventory; import java.util.ArrayList; import java.util.List; +import org.lwjgl.opengl.GL11; + import com.hbm.handler.ArmorModHandler; import com.hbm.interfaces.IPartiallyFillable; import com.hbm.inventory.fluid.FluidType; @@ -261,7 +263,9 @@ public class FluidTank { */ //TODO: add a directional parameter to allow tanks to grow horizontally public void renderTank(int x, int y, double z, int width, int height) { - + + GL11.glEnable(GL11.GL_BLEND); + y -= height; Minecraft.getMinecraft().getTextureManager().bindTexture(type.getTexture()); @@ -285,6 +289,8 @@ public class FluidTank { tessellator.addVertexWithUV(maxX, minY, z, maxU, minV); tessellator.addVertexWithUV(minX, minY, z, minU, minV); tessellator.draw(); + + GL11.glDisable(GL11.GL_BLEND); } public void renderTankInfo(GuiInfoContainer gui, int mouseX, int mouseY, int x, int y, int width, int height) { @@ -293,24 +299,8 @@ public class FluidTank { List list = new ArrayList(); list.add(I18n.format(this.type.getUnlocalizedName())); list.add(fluid + "/" + maxFluid + "mB"); - - /*if(type.temperature < 0) - list.add(EnumChatFormatting.BLUE + "" + type.temperature + "°C"); - if(type.temperature > 0) - list.add(EnumChatFormatting.RED + "" + type.temperature + "°C"); - if(type.isAntimatter()) - list.add(EnumChatFormatting.DARK_RED + "Antimatter"); - if(type.traits.contains(FluidTrait.CORROSIVE)) - list.add(EnumChatFormatting.YELLOW + "Corrosive"); - if(type.traits.contains(FluidTrait.CORROSIVE_2)) - list.add(EnumChatFormatting.GOLD + "Strongly Corrosive"); - if(type.traits.contains(FluidTrait.NO_CONTAINER)) - list.add(EnumChatFormatting.RED + "Cannot be stored in any universal tank"); - if(type.traits.contains(FluidTrait.LEAD_CONTAINER)) - list.add(EnumChatFormatting.YELLOW + "Requires hazardous material tank to hold");*/ type.addInfo(list); - gui.drawFluidInfo(list.toArray(new String[0]), mouseX, mouseY); } } @@ -329,7 +319,7 @@ public class FluidTank { if(max > 0) maxFluid = nbt.getInteger(s + "_max"); - type = FluidType.getEnumFromName(nbt.getString(s + "_type")); //compat + type = Fluids.fromName(nbt.getString(s + "_type")); //compat if(type == Fluids.NONE) type = Fluids.fromID(nbt.getInteger(s + "_type")); } diff --git a/src/main/resources/assets/hbm/textures/gui/fluids/water.png b/src/main/resources/assets/hbm/textures/gui/fluids/water.png index ba345dc31d42026a9d95976872c8596ec3fce9c3..87753a2e78ffb8fd382cae055dd4ac54e3ddb635 100644 GIT binary patch delta 2029 zcmVDdQ@0+Qek%>aB^>EX>4U6ba`-PAZ2)IW&i+q+O1bvuERDA z{MRXZ1d$T897l@<^aeeCN2?PjDbS)ZUaZg*ml=}sQ`cXAHuVQStQ{*WKDg+d#>Yk* zIbjj>{LDLPJHFQsy%%qCbsjK826r=mx@+kt$mQPP?ULtrxqtFy*$K zVKZdGc#d35r@;1$8haB>RVIL+0@e(~d}5*DHx7S=0z6lOCKHU&VD@pTZ^Hj_9Yd}4 z(k0U2V1>B27a+pu%=K?*fe>m7QyKVc`uF8cJfsDiLwwB}kOyjI&OhbKdnCmAvuRi+A4p;G<8$ z1REr{;D191F{H@RV1!9@(W@9@j48osg6V|a2^uM7&L-O|*=3(YjyV;SPq9UcE53vh zOR8K=Mf+D*y{e(cnl8FfN|(Lla+klt6|dA#Yt1yXtAZk+G6#cHF_}j&#cj6 ztutnap1)ax*!yjQ`Z$r!85m`i<<4B^Oh-mj2!l0}PEMuH7#Oq{ zu{1i|-OT+XZ%XXH;*EbXr#f~22Xm@Zx0w6n?F(x)jT6NTf_fKrOtonkY?pH(aY(Hi z+gPV&g{-(>beD3(3>k|+p^QZedi+ixW9Y(QRbvG@=XR!hmkcd9n)Y;vb9*FOt^?a# z$A3O=RAf8XR)@~TXew*V%VLq~LQ~yNj}M#Fav#St)7yUTTES~qhoHD^Pe1Q@ zYz0O~qfPr5Aaip-F${A!%C=p*6QA4f-D(-cfS)=ERa@UIL$WYk@CWcTR8W6Ay^kYt(6TBePOinNSt+JC{W#B^NT+!jc#A*$Nl{_4VrkLNJ8(kJs9 z*xmGy9TMBYtMYv zouF!RS$p~(O$V?(*pF8UDhNJ*Pn z1(sR)Y3Q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