diff --git a/changelog b/changelog index dd49c2343..c802deca0 100644 --- a/changelog +++ b/changelog @@ -1,7 +1,13 @@ ## Changed * The DNT suit now has a damage threshold of 1,000 +* Compressed biomass now has a nice cube shape +* The new chemical plant's indicator lights are now functional +* The new chemical plant can now use upgrades ## Fixed * Chemical plant ports. For real this time. * Fixed cable and pipe gauges returning the incomplete delta second value for OC and ROR readers -* Fixed new chemical plant not saving power values to disk \ No newline at end of file +* Fixed new chemical plant not saving power values to disk +* Fixed laser rifle scope texture being missing +* Potentially fixed shift clicking issue with the new chemical plant +* Fixed blowtorch having a minimum gas requirement of 1,000mB despite only using 250mB \ No newline at end of file diff --git a/src/main/java/com/hbm/handler/HbmKeybinds.java b/src/main/java/com/hbm/handler/HbmKeybinds.java index 9cfcd65fb..5f85ce886 100644 --- a/src/main/java/com/hbm/handler/HbmKeybinds.java +++ b/src/main/java/com/hbm/handler/HbmKeybinds.java @@ -71,7 +71,8 @@ public class HbmKeybinds { @SubscribeEvent public void mouseEvent(MouseInputEvent event) { - HbmPlayerProps props = HbmPlayerProps.getData(MainRegistry.proxy.me()); + EntityPlayer player = MainRegistry.proxy.me(); + HbmPlayerProps props = HbmPlayerProps.getData(player); for(EnumKeybind key : EnumKeybind.values()) { boolean last = props.getKeyPressed(key); @@ -80,6 +81,7 @@ public class HbmKeybinds { if(last != current) { PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, current)); props.setKeyPressed(key, current); + onPressedClient(player, key, current); } } } @@ -87,7 +89,8 @@ public class HbmKeybinds { @SubscribeEvent public void keyEvent(KeyInputEvent event) { EntityPlayer player = MainRegistry.proxy.me(); - if (calculatorKey.getIsKeyPressed()) { // handle the calculator client-side only + + if(calculatorKey.getIsKeyPressed()) { // handle the calculator client-side only player.closeScreen(); FMLCommonHandler.instance().showGuiScreen(new GUICalculator()); } diff --git a/src/main/java/com/hbm/inventory/container/ContainerBase.java b/src/main/java/com/hbm/inventory/container/ContainerBase.java index 665d3d275..565d8861a 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerBase.java +++ b/src/main/java/com/hbm/inventory/container/ContainerBase.java @@ -31,6 +31,12 @@ public class ContainerBase extends Container { public boolean canInteractWith(EntityPlayer player) { return tile.isUseableByPlayer(player); } + + /** Respects slot restrictions */ + @Override + protected boolean mergeItemStack(ItemStack slotStack, int start, int end, boolean direction) { + return super.mergeItemStack(slotStack, start, end, direction); // overriding this with InventoryUtil.mergeItemStack breaks it but invoking it directly doesn't? wtf? + } @Override public ItemStack transferStackInSlot(EntityPlayer player, int index) { diff --git a/src/main/java/com/hbm/inventory/container/ContainerMachineChemicalPlant.java b/src/main/java/com/hbm/inventory/container/ContainerMachineChemicalPlant.java index dd453f93c..2c4f4052a 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerMachineChemicalPlant.java +++ b/src/main/java/com/hbm/inventory/container/ContainerMachineChemicalPlant.java @@ -5,6 +5,7 @@ import com.hbm.inventory.SlotNonRetarded; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemChemistryTemplate; import com.hbm.items.machine.ItemMachineUpgrade; +import com.hbm.util.InventoryUtil; import api.hbm.energymk2.IBatteryItem; import net.minecraft.entity.player.EntityPlayer; @@ -61,7 +62,7 @@ public class ContainerMachineChemicalPlant extends ContainerBase { } else if(slotOriginal.getItem() instanceof ItemMachineUpgrade) { if(!this.mergeItemStack(slotStack, 2, 4, false)) return null; } else { - if(!this.mergeItemStack(slotStack, 4, 7, false)) return null; + if(!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 4, 7, false)) return null; } } diff --git a/src/main/java/com/hbm/inventory/gui/GUIMachineChemicalPlant.java b/src/main/java/com/hbm/inventory/gui/GUIMachineChemicalPlant.java index 8e3285f5b..9f02d0adf 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIMachineChemicalPlant.java +++ b/src/main/java/com/hbm/inventory/gui/GUIMachineChemicalPlant.java @@ -80,6 +80,21 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer { } GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule.recipe); + + /// LEFT LED + if(chemplant.didProcess) { + drawTexturedModalRect(guiLeft + 51, guiTop + 121, 195, 0, 3, 6); + } else if(recipe != null) { + drawTexturedModalRect(guiLeft + 51, guiTop + 121, 192, 0, 3, 6); + } + + /// RIGHT LED + if(chemplant.didProcess) { + drawTexturedModalRect(guiLeft + 56, guiTop + 121, 195, 0, 3, 6); + } else if(recipe != null && chemplant.power >= recipe.power) { + drawTexturedModalRect(guiLeft + 56, guiTop + 121, 192, 0, 3, 6); + } + this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 8, 126); if(recipe != null && recipe.inputItem != null) { diff --git a/src/main/java/com/hbm/items/tool/ItemBlowtorch.java b/src/main/java/com/hbm/items/tool/ItemBlowtorch.java index 27dc2d48e..35bcd3da1 100644 --- a/src/main/java/com/hbm/items/tool/ItemBlowtorch.java +++ b/src/main/java/com/hbm/items/tool/ItemBlowtorch.java @@ -134,7 +134,7 @@ public class ItemBlowtorch extends Item implements IFillableItem { if(b instanceof IToolable) { if(this == ModItems.blowtorch) { - if(this.getFill(stack, Fluids.GAS) < 1000) return false; + if(this.getFill(stack, Fluids.GAS) < 250) return false; } if(this == ModItems.acetylene_torch) { diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryEnergy.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryEnergy.java index a2e230d27..1d30e41ce 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryEnergy.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryEnergy.java @@ -49,7 +49,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class XFactoryEnergy { - public static final ResourceLocation scope_luna = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_luna.png"); + public static final ResourceLocation scope_luna = new ResourceLocation(RefStrings.MODID, "textures/misc/scope_amat.png"); public static BulletConfig energy_tesla; public static BulletConfig energy_tesla_overcharge; diff --git a/src/main/java/com/hbm/main/ModEventHandlerClient.java b/src/main/java/com/hbm/main/ModEventHandlerClient.java index 1598278d7..967f76977 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerClient.java +++ b/src/main/java/com/hbm/main/ModEventHandlerClient.java @@ -15,7 +15,6 @@ import com.hbm.handler.HTTPHandler; import com.hbm.handler.HazmatRegistry; import com.hbm.handler.HbmKeybinds; import com.hbm.handler.ImpactWorldHandler; -import com.hbm.handler.HbmKeybinds.EnumKeybind; import com.hbm.hazard.HazardSystem; import com.hbm.interfaces.IHoldableWeapon; import com.hbm.interfaces.IItemHUD; @@ -36,7 +35,6 @@ import com.hbm.lib.Library; import com.hbm.lib.RefStrings; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.toserver.AuxButtonPacket; -import com.hbm.packet.toserver.KeybindPacket; import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations.Animation; import com.hbm.render.block.ct.CTStitchReceiver; @@ -1081,7 +1079,8 @@ public class ModEventHandlerClient { } } - if(event.phase == Phase.START) { + // ??? + /*if(event.phase == Phase.START) { Minecraft mc = Minecraft.getMinecraft(); @@ -1097,7 +1096,7 @@ public class ModEventHandlerClient { } } } - } + }*/ } @SideOnly(Side.CLIENT) diff --git a/src/main/java/com/hbm/module/ModuleMachineChemplant.java b/src/main/java/com/hbm/module/ModuleMachineChemplant.java index 258f8fcc4..06fe32d84 100644 --- a/src/main/java/com/hbm/module/ModuleMachineChemplant.java +++ b/src/main/java/com/hbm/module/ModuleMachineChemplant.java @@ -29,7 +29,7 @@ public class ModuleMachineChemplant { public FluidTank[] outputTanks = new FluidTank[3]; // running vars public String recipe = "null"; - public float progress; + public double progress; // return signals public boolean didProcess = false; public boolean markDirty = false; @@ -48,9 +48,10 @@ public class ModuleMachineChemplant { } /** Expects the tanks to be set up correctly beforehand */ - public boolean canProcess(GenericRecipe recipe) { + public boolean canProcess(GenericRecipe recipe, double speed, double power) { if(recipe == null) return false; - if(battery.getPower() < recipe.power) return false; + if(power != 1 && battery.getPower() < recipe.power * power) return false; // only check with floating point numbers if mult is not 1 + if(power == 1 && battery.getPower() < recipe.power) return false; if(recipe.inputItem != null) { for(int i = 0; i < Math.min(recipe.inputItem.length, inputSlots.length); i++) { @@ -87,14 +88,13 @@ public class ModuleMachineChemplant { return true; } - public void process(GenericRecipe recipe) { + public void process(GenericRecipe recipe, double speed, double power) { - this.battery.setPower(this.battery.getPower() - recipe.power); - float step = Math.min(1F / recipe.duration, 1F); // can't do more than one recipe per tick, might look into that later + this.battery.setPower(this.battery.getPower() - (power == 1 ? recipe.power : (long) (recipe.power * power))); + double step = Math.min(speed / recipe.duration, 1D); // can't do more than one recipe per tick, might look into that later this.progress += step; - if(this.progress >= 1F) { - this.progress -= 1F; + if(this.progress >= 1D) { if(recipe.inputItem != null) { for(int i = 0; i < Math.min(recipe.inputItem.length, inputSlots.length); i++) { @@ -127,18 +127,23 @@ public class ModuleMachineChemplant { } this.markDirty = true; + + if(this.canProcess(recipe, speed, power)) + this.progress -= 1D; + else + this.progress = 0D; } } - public void update() { + public void update(double speed, double power) { GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.recipe); this.setupTanks(recipe); this.didProcess = false; this.markDirty = false; - if(this.canProcess(recipe)) { - this.process(recipe); + if(this.canProcess(recipe, speed, power)) { + this.process(recipe, speed, power); this.didProcess = true; } else { this.progress = 0F; @@ -164,22 +169,22 @@ public class ModuleMachineChemplant { public ModuleMachineChemplant fluidOutput(FluidTank a, FluidTank b, FluidTank c) { outputTanks[0] = a; outputTanks[1] = b; outputTanks[2] = c; return this; } public void serialize(ByteBuf buf) { - buf.writeFloat(progress); + buf.writeDouble(progress); ByteBufUtils.writeUTF8String(buf, recipe); } public void deserialize(ByteBuf buf) { - this.progress = buf.readFloat(); + this.progress = buf.readDouble(); this.recipe = ByteBufUtils.readUTF8String(buf); } public void readFromNBT(NBTTagCompound nbt) { - this.progress = nbt.getFloat("progress"); + this.progress = nbt.getDouble("progress"); this.recipe = nbt.getString("recipe"); } public void writeToNBT(NBTTagCompound nbt) { - nbt.setFloat("progress", progress); + nbt.setDouble("progress", progress); nbt.setString("recipe", recipe); } } diff --git a/src/main/java/com/hbm/tileentity/IUpgradeInfoProvider.java b/src/main/java/com/hbm/tileentity/IUpgradeInfoProvider.java index 001ae77b3..fce89cf26 100644 --- a/src/main/java/com/hbm/tileentity/IUpgradeInfoProvider.java +++ b/src/main/java/com/hbm/tileentity/IUpgradeInfoProvider.java @@ -25,6 +25,7 @@ public interface IUpgradeInfoProvider { public static final String KEY_CONSUMPTION = "upgrade.consumption"; public static final String KEY_COOLANT_CONSUMPTION = "upgrade.coolantConsumption"; public static final String KEY_DELAY = "upgrade.delay"; + public static final String KEY_SPEED = "upgrade.speed"; public static final String KEY_EFFICIENCY = "upgrade.efficiency"; public static final String KEY_PRODUCTIVITY = "upgrade.productivity"; public static final String KEY_FORTUNE = "upgrade.fortune"; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java index 7d6c0d0e3..0dc1dd1ad 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java @@ -75,6 +75,8 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem @Override public void updateEntity() { + if(maxPower <= 0) this.maxPower = 1_000_000; + if(!worldObj.isRemote) { this.power = Library.chargeTEFromItems(slots, 0, power, maxPower); @@ -93,8 +95,18 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem for(FluidTank tank : inputTanks) if(tank.getTankType() != Fluids.NONE) this.trySubscribe(tank.getTankType(), worldObj, pos); for(FluidTank tank : outputTanks) if(tank.getFill() > 0) this.tryProvide(tank, worldObj, pos); } + + double speed = 1D; + double pow = 1D; + + speed += Math.min(upgradeManager.getLevel(UpgradeType.SPEED), 3) / 3D; + speed += Math.min(upgradeManager.getLevel(UpgradeType.OVERDRIVE), 3); + + pow -= Math.min(upgradeManager.getLevel(UpgradeType.POWER), 3) * 0.25D; + pow += Math.min(upgradeManager.getLevel(UpgradeType.SPEED), 3) * 1D; + pow += Math.min(upgradeManager.getLevel(UpgradeType.OVERDRIVE), 3) * 10D / 3D; - this.chemplantModule.update(); + this.chemplantModule.update(speed, pow); this.didProcess = this.chemplantModule.didProcess; if(this.chemplantModule.markDirty) this.markDirty(); @@ -237,19 +249,18 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem @Override public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) { - return false; //return type == UpgradeType.SPEED || type == UpgradeType.POWER || type == UpgradeType.OVERDRIVE; + return type == UpgradeType.SPEED || type == UpgradeType.POWER || type == UpgradeType.OVERDRIVE; } @Override public void provideInfo(UpgradeType type, int level, List info, boolean extendedInfo) { info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_chemical_plant)); if(type == UpgradeType.SPEED) { - info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_DELAY, "-" + (level * 25) + "%")); - info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_CONSUMPTION, "+" + (level * 300) + "%")); + info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_SPEED, "+" + (level * 100 / 3) + "%")); + info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_CONSUMPTION, "+" + (level * 50) + "%")); } if(type == UpgradeType.POWER) { - info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_CONSUMPTION, "-" + (level * 30) + "%")); - info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_DELAY, "+" + (level * 5) + "%")); + info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_CONSUMPTION, "-" + (level * 25) + "%")); } if(type == UpgradeType.OVERDRIVE) { info.add((BobMathUtil.getBlink() ? EnumChatFormatting.RED : EnumChatFormatting.DARK_GRAY) + "YES"); @@ -261,7 +272,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem HashMap upgrades = new HashMap<>(); upgrades.put(UpgradeType.SPEED, 3); upgrades.put(UpgradeType.POWER, 3); - upgrades.put(UpgradeType.OVERDRIVE, 6); + upgrades.put(UpgradeType.OVERDRIVE, 3); return upgrades; } } diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index d690efe90..a3a94ae52 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -6172,6 +6172,7 @@ upgrade.fortune=Fortune %s upgrade.overheatChance=Overheat chance %s upgrade.productivity=Productivity %s upgrade.range=Range %s +upgrade.speed=Process speed %s upgrade.gui.title=§lAcceptable Upgrades:§r upgrade.gui.afterburner= * §dAfterburner§r: Stacks to level %s diff --git a/src/main/resources/assets/hbm/textures/gui/processing/gui_chemical_factory.png b/src/main/resources/assets/hbm/textures/gui/processing/gui_chemical_factory.png new file mode 100644 index 000000000..d8ce9926c Binary files /dev/null and b/src/main/resources/assets/hbm/textures/gui/processing/gui_chemical_factory.png differ diff --git a/src/main/resources/assets/hbm/textures/items/biomass_compressed.png b/src/main/resources/assets/hbm/textures/items/biomass_compressed.png index 2beb95ecb..f206fa55c 100644 Binary files a/src/main/resources/assets/hbm/textures/items/biomass_compressed.png and b/src/main/resources/assets/hbm/textures/items/biomass_compressed.png differ