i ate poisoned grilled cheeses and now i am dying

This commit is contained in:
Bob 2023-12-06 20:08:24 +01:00
parent b69351f857
commit 8dc217b5f7
4 changed files with 62 additions and 1 deletions

View File

@ -29,6 +29,7 @@
* Added config options to the ground water pumps
* Missile parts such as non-custom thrusters and fuselages are now made in the arc welder, recipe ingredients have been adjusted as well
* Null grenades now have a slightly larger radius, should no longer wipe playerdata and require UNDEFINED to make
* Added some breedable material to BFB PWR fuel rods, meaning that the recycling recipes now actually yield a net positive instead of being a massive waste of time
## Fixed
* Fixed ancient bug where custom missiles launched using the launch table would not use the accuracy calculation and always be pin-point accurate

View File

@ -3,8 +3,15 @@ package com.hbm.items.machine;
import java.util.List;
import com.hbm.items.ModItems;
import com.hbm.tileentity.IUpgradeInfoProvider;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
@ -32,6 +39,24 @@ public class ItemMachineUpgrade extends Item {
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
GuiScreen open = Minecraft.getMinecraft().currentScreen;
if(open != null && open instanceof GuiContainer) {
GuiContainer guiContainer = (GuiContainer) open;
Container container = guiContainer.inventorySlots;
if(container.inventorySlots.size() > 0) {
Slot first = container.getSlot(0);
IInventory inv = (IInventory) first.inventory;
if(inv instanceof IUpgradeInfoProvider) {
IUpgradeInfoProvider provider = (IUpgradeInfoProvider) inv;
if(provider.canProvideInfo(this.type, this.tier, bool)) {
provider.provideInfo(this.type, this.tier, list, bool);
return;
}
}
}
}
if(this.type == UpgradeType.SPEED) {
list.add(EnumChatFormatting.RED + "Mining Drill:");
list.add("Delay -" + (15 * this.tier) + "% / Consumption +" + (300 * this.tier) + "HE/t");

View File

@ -0,0 +1,11 @@
package com.hbm.tileentity;
import java.util.List;
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
public interface IUpgradeInfoProvider {
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo);
public void provideInfo(UpgradeType type, int level, List<String> info, boolean extendedInfo);
}

View File

@ -1,5 +1,8 @@
package com.hbm.tileentity.machine;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.MachineElectricFurnace;
import com.hbm.inventory.UpgradeManager;
import com.hbm.inventory.container.ContainerElectricFurnace;
@ -7,7 +10,9 @@ import com.hbm.inventory.gui.GUIMachineElectricFurnace;
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
import com.hbm.lib.Library;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.IUpgradeInfoProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.I18nUtil;
import api.hbm.energy.IBatteryItem;
import api.hbm.energy.IEnergyUser;
@ -20,10 +25,11 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineElectricFurnace extends TileEntityMachineBase implements ISidedInventory, IEnergyUser, IGUIProvider {
public class TileEntityMachineElectricFurnace extends TileEntityMachineBase implements ISidedInventory, IEnergyUser, IGUIProvider, IUpgradeInfoProvider {
// HOLY FUCKING SHIT I SPENT 5 DAYS ON THIS SHITFUCK CLASS FILE
// thanks Martin, vaer and Bob for the help
@ -263,4 +269,22 @@ public class TileEntityMachineElectricFurnace extends TileEntityMachineBase impl
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIMachineElectricFurnace(player.inventory, this);
}
@Override
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) {
return type == UpgradeType.SPEED || type == UpgradeType.POWER;
}
@Override
public void provideInfo(UpgradeType type, int level, List<String> info, boolean extendedInfo) {
info.add(EnumChatFormatting.GREEN.YELLOW + ">>> " + I18nUtil.resolveKey(ModBlocks.machine_electric_furnace_off.getUnlocalizedName() + ".name") + " <<<");
if(type == UpgradeType.SPEED) {
info.add(EnumChatFormatting.GREEN + "Process time -" + (level * 25) + "%");
info.add(EnumChatFormatting.RED + "Consumption +" + (level * 100) + "%");
}
if(type == UpgradeType.POWER) {
info.add(EnumChatFormatting.GREEN + "Consumption -" + (level * 30) + "%");
info.add(EnumChatFormatting.RED + "Process time +" + (level * 10) + "%");
}
}
}