From 9bdd738fdc90ac8770a9d7f68689e40c50fe4084 Mon Sep 17 00:00:00 2001 From: Bob Date: Thu, 18 Aug 2022 20:33:27 +0200 Subject: [PATCH] it's to prevent you from healing how come every time i port some absolute garbage feature that people keep telling me is "good" and "justified" those very people start to scream, it's almost like it wasn't good to begin with --- .../container/ContainerArmorTable.java | 37 ++++++++++--------- .../fluid/tank/FluidLoaderFillableItem.java | 3 ++ .../fluid/tank/FluidLoaderStandard.java | 2 +- .../com/hbm/inventory/gui/GUIArmorTable.java | 16 ++++---- src/main/java/com/hbm/items/ModItems.java | 16 ++++---- .../java/com/hbm/items/armor/ItemModV1.java | 20 ++++++++++ .../com/hbm/items/tool/ItemToolAbility.java | 2 +- .../machine/rbmk/TileEntityRBMKConsole.java | 3 +- 8 files changed, 62 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/hbm/inventory/container/ContainerArmorTable.java b/src/main/java/com/hbm/inventory/container/ContainerArmorTable.java index ab6baa31b..f8da90d3d 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerArmorTable.java +++ b/src/main/java/com/hbm/inventory/container/ContainerArmorTable.java @@ -2,6 +2,7 @@ package com.hbm.inventory.container; import com.hbm.handler.ArmorModHandler; import com.hbm.items.armor.ItemArmorMod; +import com.hbm.util.InventoryUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -24,16 +25,16 @@ public class ContainerArmorTable extends Container { public ContainerArmorTable(InventoryPlayer inventory) { EntityPlayer player = inventory.player; - this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.helmet_only, 26, 27)); // helmet only - this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.plate_only, 62, 27)); // chestplate only - this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.legs_only, 98, 27)); // leggins only - this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.boots_only, 134, 45)); // boots only - this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.servos, 134, 81)); //servos/frame - this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.cladding, 98, 99)); //radiation cladding - this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.kevlar, 62, 99)); //kevlar/sapi/(ERA? :) ) - this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.extra, 26, 99)); //special parts + this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.helmet_only, 26 + 22, 27)); // helmet only + this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.plate_only, 62 + 22, 27)); // chestplate only + this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.legs_only, 98 + 22, 27)); // leggins only + this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.boots_only, 134 + 22, 45)); // boots only + this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.servos, 134 + 22, 81)); //servos/frame + this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.cladding, 98 + 22, 99)); //radiation cladding + this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.kevlar, 62 + 22, 99)); //kevlar/sapi/(ERA? :) ) + this.addSlotToContainer(new UpgradeSlot(upgrades, ArmorModHandler.extra, 26 + 22, 99)); //special parts - this.addSlotToContainer(new Slot(armor, 0, 44, 63) { + this.addSlotToContainer(new Slot(armor, 0, 44 + 22, 63) { @Override public boolean isItemValid(ItemStack stack) { @@ -79,7 +80,7 @@ public class ContainerArmorTable extends Container { //player armor slots for easy accessibility for(int i = 0; i < 4; ++i) { final int k = i; - this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory() - 1 - i, -18, 36 + i * 18) { + this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory() - 1 - i, -17 + 22, 36 + i * 18) { public int getSlotStackLimit() { return 1; @@ -100,12 +101,12 @@ public class ContainerArmorTable extends Container { for(int i = 0; i < 3; i++) { for(int j = 0; j < 9; j++) { - this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 56)); + this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18 + 22, 84 + i * 18 + 56)); } } for(int i = 0; i < 9; i++) { - this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142 + 56)); + this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18 + 22, 142 + 56)); } this.onCraftMatrixChanged(this.upgrades); @@ -120,17 +121,17 @@ public class ContainerArmorTable extends Container { public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) { ItemStack var3 = null; Slot var4 = (Slot) this.inventorySlots.get(par2); - + if(var4 != null && var4.getHasStack()) { ItemStack var5 = var4.getStack(); var3 = var5.copy(); if(par2 <= 8) { - if(!this.mergeItemStack(var5, 9, this.inventorySlots.size(), true)) { - return null; - } else { - var4.onPickupFromSlot(p_82846_1_, var5); - } + if(par2 != 8 || !InventoryUtil.mergeItemStack(this.inventorySlots, var5, 9, 13, false)) + if(!this.mergeItemStack(var5, 13, this.inventorySlots.size(), true)) + return null; + + var4.onPickupFromSlot(p_82846_1_, var5); } else { if(var5.getItem() instanceof ItemArmor) { diff --git a/src/main/java/com/hbm/inventory/fluid/tank/FluidLoaderFillableItem.java b/src/main/java/com/hbm/inventory/fluid/tank/FluidLoaderFillableItem.java index 787abe844..8228afc44 100644 --- a/src/main/java/com/hbm/inventory/fluid/tank/FluidLoaderFillableItem.java +++ b/src/main/java/com/hbm/inventory/fluid/tank/FluidLoaderFillableItem.java @@ -16,6 +16,9 @@ public class FluidLoaderFillableItem extends FluidLoadingHandler { public boolean fill(ItemStack stack, FluidTank tank) { + if(stack == null) + return false; + FluidType type = tank.getTankType(); if(stack.getItem() instanceof ItemArmor && ArmorModHandler.hasMods(stack)) { diff --git a/src/main/java/com/hbm/inventory/fluid/tank/FluidLoaderStandard.java b/src/main/java/com/hbm/inventory/fluid/tank/FluidLoaderStandard.java index 78a46441a..d4c784396 100644 --- a/src/main/java/com/hbm/inventory/fluid/tank/FluidLoaderStandard.java +++ b/src/main/java/com/hbm/inventory/fluid/tank/FluidLoaderStandard.java @@ -16,7 +16,7 @@ public class FluidLoaderStandard extends FluidLoadingHandler { FluidType type = tank.getTankType(); ItemStack full = FluidContainerRegistry.getFullContainer(slots[in], type); - if(slots[in] != null && tank.getFill() - FluidContainerRegistry.getFluidContent(full, type) >= 0) { + if(full != null && slots[in] != null && tank.getFill() - FluidContainerRegistry.getFluidContent(full, type) >= 0) { ItemStack fullContainer = FluidContainerRegistry.getFullContainer(slots[in], type); diff --git a/src/main/java/com/hbm/inventory/gui/GUIArmorTable.java b/src/main/java/com/hbm/inventory/gui/GUIArmorTable.java index 3713846e4..e255586cf 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIArmorTable.java +++ b/src/main/java/com/hbm/inventory/gui/GUIArmorTable.java @@ -24,7 +24,7 @@ public class GUIArmorTable extends GuiInfoContainer { public GUIArmorTable(InventoryPlayer player) { super(new ContainerArmorTable(player)); - this.xSize = 176; + this.xSize = 176 + 22; this.ySize = 222; guiLeft = (this.width - this.xSize) / 2; @@ -62,8 +62,9 @@ public class GUIArmorTable extends GuiInfoContainer { protected void drawGuiContainerForegroundLayer(int mX, int mY) { - this.fontRendererObj.drawString(I18n.format("container.armorTable"), 28, 6, 4210752); - this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + String name = I18n.format("container.armorTable"); + this.fontRendererObj.drawString(name, (this.xSize - 22) / 2 - this.fontRendererObj.getStringWidth(name) / 2 + 22, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8 + 22, this.ySize - 96 + 2, 4210752); } protected void drawGuiContainerBackgroundLayer(float inter, int mX, int mY) { @@ -71,20 +72,21 @@ public class GUIArmorTable extends GuiInfoContainer { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(texture); - this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize); + this.drawTexturedModalRect(guiLeft + 22, guiTop, 0, 0, this.xSize - 22, this.ySize); + this.drawTexturedModalRect(guiLeft, guiTop + 31, 176, 96, 22, 100); ItemStack armor = this.inventorySlots.getSlot(8).getStack(); if(armor != null) { if(armor.getItem() instanceof ItemArmor) - this.drawTexturedModalRect(guiLeft + 41, guiTop + 60, 176, 74, 22, 22); + this.drawTexturedModalRect(guiLeft + 41 + 22, guiTop + 60, 176, 74, 22, 22); else - this.drawTexturedModalRect(guiLeft + 41, guiTop + 60, 176, 52, 22, 22); + this.drawTexturedModalRect(guiLeft + 41 + 22, guiTop + 60, 176, 52, 22, 22); } else { if(System.currentTimeMillis() % 1000 < 500) - this.drawTexturedModalRect(guiLeft + 41, guiTop + 60, 176, 52, 22, 22); + this.drawTexturedModalRect(guiLeft + 41 + 22, guiTop + 60, 176, 52, 22, 22); } for(int i = 0; i < 8; i++) { diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 16bf83180..62873ca8e 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -5006,7 +5006,7 @@ public class ModItems { ArmorMaterial aMatDesh = EnumHelper.addArmorMaterial("HBM_DESH", 150, new int[] { 3, 8, 6, 3 }, 0); aMatDesh.customCraftingMaterial = ModItems.ingot_desh; - steamsuit_helmet = new ArmorDesh(aMatDesh, 2, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.STEAM, 360000, 500, 50, 1).setThreshold(5F).setMod(0.8F) + steamsuit_helmet = new ArmorDesh(aMatDesh, 2, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.STEAM, 64_000, 500, 50, 1).setThreshold(5F).setMod(0.8F) .setFireproof(true) .setHasHardLanding(true) .addEffect(new PotionEffect(Potion.digSpeed.id, 20, 4)) @@ -5015,22 +5015,22 @@ public class ModItems { .addResistance("fall", 0) .hides(EnumPlayerPart.HAT) .setUnlocalizedName("steamsuit_helmet").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_helmet"); - steamsuit_plate = new ArmorDesh(aMatDesh, 2, 1, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.STEAM, 360000, 500, 50, 1).cloneStats((ArmorFSB) steamsuit_helmet).setUnlocalizedName("steamsuit_plate").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_plate"); - steamsuit_legs = new ArmorDesh(aMatDesh, 2, 2, RefStrings.MODID + ":textures/armor/starmetal_2.png", Fluids.STEAM, 360000, 500, 50, 1).cloneStats((ArmorFSB) steamsuit_helmet).setUnlocalizedName("steamsuit_legs").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_legs"); - steamsuit_boots = new ArmorDesh(aMatDesh, 2, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.STEAM, 360000, 500, 50, 1).cloneStats((ArmorFSB) steamsuit_helmet).setUnlocalizedName("steamsuit_boots").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_boots"); + steamsuit_plate = new ArmorDesh(aMatDesh, 2, 1, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.STEAM, 64_000, 500, 50, 1).cloneStats((ArmorFSB) steamsuit_helmet).setUnlocalizedName("steamsuit_plate").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_plate"); + steamsuit_legs = new ArmorDesh(aMatDesh, 2, 2, RefStrings.MODID + ":textures/armor/starmetal_2.png", Fluids.STEAM, 64_000, 500, 50, 1).cloneStats((ArmorFSB) steamsuit_helmet).setUnlocalizedName("steamsuit_legs").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_legs"); + steamsuit_boots = new ArmorDesh(aMatDesh, 2, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.STEAM, 64_000, 500, 50, 1).cloneStats((ArmorFSB) steamsuit_helmet).setUnlocalizedName("steamsuit_boots").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":steamsuit_boots"); ArmorMaterial aMatDiesel = EnumHelper.addArmorMaterial("HBM_BNUUY", 150, new int[] { 3, 8, 6, 3 }, 0); aMatDiesel.customCraftingMaterial = ModItems.plate_copper; - dieselsuit_helmet = new ArmorDiesel(aMatDiesel, 2, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.DIESEL, 360000, 500, 50, 1).setThreshold(2F).setMod(0.7F) + dieselsuit_helmet = new ArmorDiesel(aMatDiesel, 2, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.DIESEL, 64_000, 500, 50, 1).setThreshold(2F).setMod(0.7F) .addEffect(new PotionEffect(Potion.moveSpeed.id, 20, 2)) .addEffect(new PotionEffect(Potion.jump.id, 20, 2)) .enableThermalSight(true) .enableVATS(true) .addResistance("fall", 0) .setUnlocalizedName("dieselsuit_helmet").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":dieselsuit_helmet"); - dieselsuit_plate = new ArmorDiesel(aMatDiesel, 2, 1, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.DIESEL, 360000, 500, 50, 1).cloneStats((ArmorFSB) dieselsuit_helmet).setUnlocalizedName("dieselsuit_plate").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":dieselsuit_plate"); - dieselsuit_legs = new ArmorDiesel(aMatDiesel, 2, 2, RefStrings.MODID + ":textures/armor/starmetal_2.png", Fluids.DIESEL, 360000, 500, 50, 1).cloneStats((ArmorFSB) dieselsuit_helmet).setUnlocalizedName("dieselsuit_legs").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":dieselsuit_legs"); - dieselsuit_boots = new ArmorDiesel(aMatDiesel, 2, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.DIESEL, 360000, 500, 50, 1).cloneStats((ArmorFSB) dieselsuit_helmet).setUnlocalizedName("dieselsuit_boots").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":dieselsuit_boots"); + dieselsuit_plate = new ArmorDiesel(aMatDiesel, 2, 1, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.DIESEL, 64_000, 500, 50, 1).cloneStats((ArmorFSB) dieselsuit_helmet).setUnlocalizedName("dieselsuit_plate").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":dieselsuit_plate"); + dieselsuit_legs = new ArmorDiesel(aMatDiesel, 2, 2, RefStrings.MODID + ":textures/armor/starmetal_2.png", Fluids.DIESEL, 64_000, 500, 50, 1).cloneStats((ArmorFSB) dieselsuit_helmet).setUnlocalizedName("dieselsuit_legs").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":dieselsuit_legs"); + dieselsuit_boots = new ArmorDiesel(aMatDiesel, 2, 3, RefStrings.MODID + ":textures/armor/starmetal_1.png", Fluids.DIESEL, 64_000, 500, 50, 1).cloneStats((ArmorFSB) dieselsuit_helmet).setUnlocalizedName("dieselsuit_boots").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":dieselsuit_boots"); ArmorMaterial aMatAJR = EnumHelper.addArmorMaterial("HBM_T45AJR", 150, new int[] { 3, 8, 6, 3 }, 100); aMatAJR.customCraftingMaterial = ModItems.plate_armor_ajr; diff --git a/src/main/java/com/hbm/items/armor/ItemModV1.java b/src/main/java/com/hbm/items/armor/ItemModV1.java index bb5d8a3a6..6d206fca6 100644 --- a/src/main/java/com/hbm/items/armor/ItemModV1.java +++ b/src/main/java/com/hbm/items/armor/ItemModV1.java @@ -7,15 +7,19 @@ import com.google.common.collect.Multimap; import com.hbm.handler.ArmorModHandler; import com.hbm.interfaces.IArmorModDash; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.IAttributeInstance; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.event.entity.living.LivingHurtEvent; public class ItemModV1 extends ItemArmorMod implements IArmorModDash { private static final UUID speed = UUID.fromString("1d11e63e-28c4-4e14-b09f-fe0bd1be708f"); + public static final UUID its_to_prevent_you_from_healing = UUID.fromString("9b0ff87a-6103-482b-b515-19ef2e6721ce"); public ItemModV1() { super(ArmorModHandler.extra, false, true, false, false); @@ -44,4 +48,20 @@ public class ItemModV1 extends ItemArmorMod implements IArmorModDash { public int getDashes() { return 3; } + + @Override + public void modDamage(LivingHurtEvent event, ItemStack armor) { + + EntityLivingBase entity = event.entityLiving; + + IAttributeInstance attributeinstance = entity.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth); + + float health = entity.getMaxHealth(); + + try { + attributeinstance.removeModifier(attributeinstance.getModifier(its_to_prevent_you_from_healing)); + } catch(Exception ex) { } + + attributeinstance.applyModifier(new AttributeModifier(its_to_prevent_you_from_healing, "hakita what is this bullshit", -(entity.getMaxHealth() - health + event.ammount * 0.35), 0)); + } } diff --git a/src/main/java/com/hbm/items/tool/ItemToolAbility.java b/src/main/java/com/hbm/items/tool/ItemToolAbility.java index 81e8d1a13..accb7ba63 100644 --- a/src/main/java/com/hbm/items/tool/ItemToolAbility.java +++ b/src/main/java/com/hbm/items/tool/ItemToolAbility.java @@ -137,7 +137,7 @@ public class ItemToolAbility extends ItemTool implements IItemAbility, IDepthRoc @Override public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase player) { - return false; + return super.onBlockDestroyed(stack, world, block, x, y, z, player); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKConsole.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKConsole.java index ac442c39a..5931e8a59 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKConsole.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKConsole.java @@ -10,7 +10,6 @@ import com.hbm.inventory.fluid.Fluids; import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKControlManual.RBMKColor; import com.hbm.util.I18nUtil; -import com.hbm.util.Tuple.Triplet; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -135,7 +134,7 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon case FUEL_POISON: if(col.data.hasKey("xenon")) { count++; - value += col.data.getDouble("xenon") * 100D; + value += col.data.getDouble("xenon"); } break; case FUEL_TEMP: