This commit is contained in:
Boblet 2025-06-13 14:47:50 +02:00
parent 590da72fbb
commit 3303df8345
14 changed files with 80 additions and 32 deletions

View File

@ -1,7 +1,13 @@
## Changed ## Changed
* The DNT suit now has a damage threshold of 1,000 * 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 ## Fixed
* Chemical plant ports. For real this time. * Chemical plant ports. For real this time.
* Fixed cable and pipe gauges returning the incomplete delta second value for OC and ROR readers * 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 * 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

View File

@ -71,7 +71,8 @@ public class HbmKeybinds {
@SubscribeEvent @SubscribeEvent
public void mouseEvent(MouseInputEvent event) { 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()) { for(EnumKeybind key : EnumKeybind.values()) {
boolean last = props.getKeyPressed(key); boolean last = props.getKeyPressed(key);
@ -80,6 +81,7 @@ public class HbmKeybinds {
if(last != current) { if(last != current) {
PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, current)); PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, current));
props.setKeyPressed(key, current); props.setKeyPressed(key, current);
onPressedClient(player, key, current);
} }
} }
} }
@ -87,7 +89,8 @@ public class HbmKeybinds {
@SubscribeEvent @SubscribeEvent
public void keyEvent(KeyInputEvent event) { public void keyEvent(KeyInputEvent event) {
EntityPlayer player = MainRegistry.proxy.me(); 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(); player.closeScreen();
FMLCommonHandler.instance().showGuiScreen(new GUICalculator()); FMLCommonHandler.instance().showGuiScreen(new GUICalculator());
} }

View File

@ -31,6 +31,12 @@ public class ContainerBase extends Container {
public boolean canInteractWith(EntityPlayer player) { public boolean canInteractWith(EntityPlayer player) {
return tile.isUseableByPlayer(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 @Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) { public ItemStack transferStackInSlot(EntityPlayer player, int index) {

View File

@ -5,6 +5,7 @@ import com.hbm.inventory.SlotNonRetarded;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemChemistryTemplate; import com.hbm.items.machine.ItemChemistryTemplate;
import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade;
import com.hbm.util.InventoryUtil;
import api.hbm.energymk2.IBatteryItem; import api.hbm.energymk2.IBatteryItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -61,7 +62,7 @@ public class ContainerMachineChemicalPlant extends ContainerBase {
} else if(slotOriginal.getItem() instanceof ItemMachineUpgrade) { } else if(slotOriginal.getItem() instanceof ItemMachineUpgrade) {
if(!this.mergeItemStack(slotStack, 2, 4, false)) return null; if(!this.mergeItemStack(slotStack, 2, 4, false)) return null;
} else { } else {
if(!this.mergeItemStack(slotStack, 4, 7, false)) return null; if(!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 4, 7, false)) return null;
} }
} }

View File

@ -80,6 +80,21 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
} }
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(chemplant.chemplantModule.recipe); 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); this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 8, 126);
if(recipe != null && recipe.inputItem != null) { if(recipe != null && recipe.inputItem != null) {

View File

@ -134,7 +134,7 @@ public class ItemBlowtorch extends Item implements IFillableItem {
if(b instanceof IToolable) { if(b instanceof IToolable) {
if(this == ModItems.blowtorch) { 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) { if(this == ModItems.acetylene_torch) {

View File

@ -49,7 +49,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public class XFactoryEnergy { 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;
public static BulletConfig energy_tesla_overcharge; public static BulletConfig energy_tesla_overcharge;

View File

@ -15,7 +15,6 @@ import com.hbm.handler.HTTPHandler;
import com.hbm.handler.HazmatRegistry; import com.hbm.handler.HazmatRegistry;
import com.hbm.handler.HbmKeybinds; import com.hbm.handler.HbmKeybinds;
import com.hbm.handler.ImpactWorldHandler; import com.hbm.handler.ImpactWorldHandler;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.hazard.HazardSystem; import com.hbm.hazard.HazardSystem;
import com.hbm.interfaces.IHoldableWeapon; import com.hbm.interfaces.IHoldableWeapon;
import com.hbm.interfaces.IItemHUD; import com.hbm.interfaces.IItemHUD;
@ -36,7 +35,6 @@ import com.hbm.lib.Library;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.packet.PacketDispatcher; import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toserver.AuxButtonPacket; import com.hbm.packet.toserver.AuxButtonPacket;
import com.hbm.packet.toserver.KeybindPacket;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
import com.hbm.render.anim.HbmAnimations.Animation; import com.hbm.render.anim.HbmAnimations.Animation;
import com.hbm.render.block.ct.CTStitchReceiver; 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(); Minecraft mc = Minecraft.getMinecraft();
@ -1097,7 +1096,7 @@ public class ModEventHandlerClient {
} }
} }
} }
} }*/
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)

View File

@ -29,7 +29,7 @@ public class ModuleMachineChemplant {
public FluidTank[] outputTanks = new FluidTank[3]; public FluidTank[] outputTanks = new FluidTank[3];
// running vars // running vars
public String recipe = "null"; public String recipe = "null";
public float progress; public double progress;
// return signals // return signals
public boolean didProcess = false; public boolean didProcess = false;
public boolean markDirty = false; public boolean markDirty = false;
@ -48,9 +48,10 @@ public class ModuleMachineChemplant {
} }
/** Expects the tanks to be set up correctly beforehand */ /** 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(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) { if(recipe.inputItem != null) {
for(int i = 0; i < Math.min(recipe.inputItem.length, inputSlots.length); i++) { for(int i = 0; i < Math.min(recipe.inputItem.length, inputSlots.length); i++) {
@ -87,14 +88,13 @@ public class ModuleMachineChemplant {
return true; return true;
} }
public void process(GenericRecipe recipe) { public void process(GenericRecipe recipe, double speed, double power) {
this.battery.setPower(this.battery.getPower() - recipe.power); this.battery.setPower(this.battery.getPower() - (power == 1 ? recipe.power : (long) (recipe.power * power)));
float step = Math.min(1F / recipe.duration, 1F); // can't do more than one recipe per tick, might look into that later 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; this.progress += step;
if(this.progress >= 1F) { if(this.progress >= 1D) {
this.progress -= 1F;
if(recipe.inputItem != null) { if(recipe.inputItem != null) {
for(int i = 0; i < Math.min(recipe.inputItem.length, inputSlots.length); i++) { for(int i = 0; i < Math.min(recipe.inputItem.length, inputSlots.length); i++) {
@ -127,18 +127,23 @@ public class ModuleMachineChemplant {
} }
this.markDirty = true; 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); GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.recipe);
this.setupTanks(recipe); this.setupTanks(recipe);
this.didProcess = false; this.didProcess = false;
this.markDirty = false; this.markDirty = false;
if(this.canProcess(recipe)) { if(this.canProcess(recipe, speed, power)) {
this.process(recipe); this.process(recipe, speed, power);
this.didProcess = true; this.didProcess = true;
} else { } else {
this.progress = 0F; 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 ModuleMachineChemplant fluidOutput(FluidTank a, FluidTank b, FluidTank c) { outputTanks[0] = a; outputTanks[1] = b; outputTanks[2] = c; return this; }
public void serialize(ByteBuf buf) { public void serialize(ByteBuf buf) {
buf.writeFloat(progress); buf.writeDouble(progress);
ByteBufUtils.writeUTF8String(buf, recipe); ByteBufUtils.writeUTF8String(buf, recipe);
} }
public void deserialize(ByteBuf buf) { public void deserialize(ByteBuf buf) {
this.progress = buf.readFloat(); this.progress = buf.readDouble();
this.recipe = ByteBufUtils.readUTF8String(buf); this.recipe = ByteBufUtils.readUTF8String(buf);
} }
public void readFromNBT(NBTTagCompound nbt) { public void readFromNBT(NBTTagCompound nbt) {
this.progress = nbt.getFloat("progress"); this.progress = nbt.getDouble("progress");
this.recipe = nbt.getString("recipe"); this.recipe = nbt.getString("recipe");
} }
public void writeToNBT(NBTTagCompound nbt) { public void writeToNBT(NBTTagCompound nbt) {
nbt.setFloat("progress", progress); nbt.setDouble("progress", progress);
nbt.setString("recipe", recipe); nbt.setString("recipe", recipe);
} }
} }

View File

@ -25,6 +25,7 @@ public interface IUpgradeInfoProvider {
public static final String KEY_CONSUMPTION = "upgrade.consumption"; public static final String KEY_CONSUMPTION = "upgrade.consumption";
public static final String KEY_COOLANT_CONSUMPTION = "upgrade.coolantConsumption"; public static final String KEY_COOLANT_CONSUMPTION = "upgrade.coolantConsumption";
public static final String KEY_DELAY = "upgrade.delay"; 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_EFFICIENCY = "upgrade.efficiency";
public static final String KEY_PRODUCTIVITY = "upgrade.productivity"; public static final String KEY_PRODUCTIVITY = "upgrade.productivity";
public static final String KEY_FORTUNE = "upgrade.fortune"; public static final String KEY_FORTUNE = "upgrade.fortune";

View File

@ -75,6 +75,8 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
@Override @Override
public void updateEntity() { public void updateEntity() {
if(maxPower <= 0) this.maxPower = 1_000_000;
if(!worldObj.isRemote) { if(!worldObj.isRemote) {
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower); 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 : 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); 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; this.didProcess = this.chemplantModule.didProcess;
if(this.chemplantModule.markDirty) this.markDirty(); if(this.chemplantModule.markDirty) this.markDirty();
@ -237,19 +249,18 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
@Override @Override
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) { 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 @Override
public void provideInfo(UpgradeType type, int level, List<String> info, boolean extendedInfo) { public void provideInfo(UpgradeType type, int level, List<String> info, boolean extendedInfo) {
info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_chemical_plant)); info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_chemical_plant));
if(type == UpgradeType.SPEED) { if(type == UpgradeType.SPEED) {
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_DELAY, "-" + (level * 25) + "%")); info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_SPEED, "+" + (level * 100 / 3) + "%"));
info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_CONSUMPTION, "+" + (level * 300) + "%")); info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_CONSUMPTION, "+" + (level * 50) + "%"));
} }
if(type == UpgradeType.POWER) { if(type == UpgradeType.POWER) {
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_CONSUMPTION, "-" + (level * 30) + "%")); info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_CONSUMPTION, "-" + (level * 25) + "%"));
info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_DELAY, "+" + (level * 5) + "%"));
} }
if(type == UpgradeType.OVERDRIVE) { if(type == UpgradeType.OVERDRIVE) {
info.add((BobMathUtil.getBlink() ? EnumChatFormatting.RED : EnumChatFormatting.DARK_GRAY) + "YES"); info.add((BobMathUtil.getBlink() ? EnumChatFormatting.RED : EnumChatFormatting.DARK_GRAY) + "YES");
@ -261,7 +272,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
HashMap<UpgradeType, Integer> upgrades = new HashMap<>(); HashMap<UpgradeType, Integer> upgrades = new HashMap<>();
upgrades.put(UpgradeType.SPEED, 3); upgrades.put(UpgradeType.SPEED, 3);
upgrades.put(UpgradeType.POWER, 3); upgrades.put(UpgradeType.POWER, 3);
upgrades.put(UpgradeType.OVERDRIVE, 6); upgrades.put(UpgradeType.OVERDRIVE, 3);
return upgrades; return upgrades;
} }
} }

View File

@ -6172,6 +6172,7 @@ upgrade.fortune=Fortune %s
upgrade.overheatChance=Overheat chance %s upgrade.overheatChance=Overheat chance %s
upgrade.productivity=Productivity %s upgrade.productivity=Productivity %s
upgrade.range=Range %s upgrade.range=Range %s
upgrade.speed=Process speed %s
upgrade.gui.title=§lAcceptable Upgrades:§r upgrade.gui.title=§lAcceptable Upgrades:§r
upgrade.gui.afterburner= * §dAfterburner§r: Stacks to level %s upgrade.gui.afterburner= * §dAfterburner§r: Stacks to level %s

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 B

After

Width:  |  Height:  |  Size: 430 B