condenser and cooling tower block tooltip

This commit is contained in:
Boblet 2022-05-13 11:59:35 +02:00
parent 2b914628b5
commit 041b684d26
7 changed files with 187 additions and 11 deletions

View File

@ -1,13 +1,20 @@
package com.hbm.blocks.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ILookOverlay;
import com.hbm.tileentity.machine.TileEntityCondenser;
import com.hbm.util.I18nUtil;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class MachineCondenser extends BlockContainer {
public class MachineCondenser extends BlockContainer implements ILookOverlay {
public MachineCondenser(Material mat) {
super(mat);
@ -17,4 +24,22 @@ public class MachineCondenser extends BlockContainer {
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityCondenser();
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityCondenser))
return;
TileEntityCondenser condenser = (TileEntityCondenser) te;
List<String> text = new ArrayList();
for(int i = 0; i < condenser.tanks.length; i++)
text.add((i < 1 ? (EnumChatFormatting.GREEN + "-> ") : (EnumChatFormatting.RED + "<- ")) + EnumChatFormatting.RESET + I18nUtil.resolveKey("hbmfluid." + condenser.tanks[i].getTankType().getName().toLowerCase()) + ": " + condenser.tanks[i].getFill() + "/" + condenser.tanks[i].getMaxFill() + "mB");
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
}

View File

@ -1,15 +1,23 @@
package com.hbm.blocks.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ILookOverlay;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityTowerLarge;
import com.hbm.tileentity.machine.TileEntityTowerSmall;
import com.hbm.util.I18nUtil;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineTowerLarge extends BlockDummyable {
public class MachineTowerLarge extends BlockDummyable implements ILookOverlay {
public MachineTowerLarge(Material mat) {
super(mat);
@ -52,4 +60,26 @@ public class MachineTowerLarge extends BlockDummyable {
this.makeExtra(world, x + dr2.offsetX * 4 + rot.offsetX * -3, y, z + dr2.offsetZ * 4 + rot.offsetZ * -3);
}
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
int[] pos = this.findCore(world, x, y, z);
if(pos == null)
return;
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
if(!(te instanceof TileEntityTowerSmall))
return;
TileEntityTowerSmall tower = (TileEntityTowerSmall) te;
List<String> text = new ArrayList();
for(int i = 0; i < tower.tanks.length; i++)
text.add((i < 1 ? (EnumChatFormatting.GREEN + "-> ") : (EnumChatFormatting.RED + "<- ")) + EnumChatFormatting.RESET + I18nUtil.resolveKey("hbmfluid." + tower.tanks[i].getTankType().getName().toLowerCase()) + ": " + tower.tanks[i].getFill() + "/" + tower.tanks[i].getMaxFill() + "mB");
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
}

View File

@ -1,15 +1,22 @@
package com.hbm.blocks.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ILookOverlay;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityTowerSmall;
import com.hbm.util.I18nUtil;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineTowerSmall extends BlockDummyable {
public class MachineTowerSmall extends BlockDummyable implements ILookOverlay {
public MachineTowerSmall(Material mat) {
super(mat);
@ -49,4 +56,26 @@ public class MachineTowerSmall extends BlockDummyable {
this.makeExtra(world, x + dr2.offsetX * 2, y, z + dr2.offsetZ * 2);
}
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
int[] pos = this.findCore(world, x, y, z);
if(pos == null)
return;
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
if(!(te instanceof TileEntityTowerSmall))
return;
TileEntityTowerSmall tower = (TileEntityTowerSmall) te;
List<String> text = new ArrayList();
for(int i = 0; i < tower.tanks.length; i++)
text.add((i < 1 ? (EnumChatFormatting.GREEN + "-> ") : (EnumChatFormatting.RED + "<- ")) + EnumChatFormatting.RESET + I18nUtil.resolveKey("hbmfluid." + tower.tanks[i].getTankType().getName().toLowerCase()) + ": " + tower.tanks[i].getFill() + "/" + tower.tanks[i].getMaxFill() + "mB");
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
}

View File

@ -1980,6 +1980,10 @@ public class ModItems {
public static Item steamsuit_plate;
public static Item steamsuit_legs;
public static Item steamsuit_boots;
public static Item dieselsuit_helmet;
public static Item dieselsuit_plate;
public static Item dieselsuit_legs;
public static Item dieselsuit_boots;
public static Item chainsaw;
@ -4940,7 +4944,7 @@ public class ModItems {
t45_plate = new ArmorT45(aMatT45, 2, 1, 1000000, 10000, 1000, 5).cloneStats((ArmorFSB) t45_helmet).setUnlocalizedName("t45_plate").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":t45_plate");
t45_legs = new ArmorT45(aMatT45, 2, 2, 1000000, 10000, 1000, 5).cloneStats((ArmorFSB) t45_helmet).setUnlocalizedName("t45_legs").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":t45_legs");
t45_boots = new ArmorT45(aMatT45, 2, 3, 1000000, 10000, 1000, 5).cloneStats((ArmorFSB) t45_helmet).setUnlocalizedName("t45_boots").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":t45_boots");
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)
@ -4955,6 +4959,20 @@ public class ModItems {
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");
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(5F).setMod(0.8F)
.setHasHardLanding(true)
.addEffect(new PotionEffect(Potion.digSpeed.id, 20, 4))
.setBlastProtection(0.5F)
.addResistance("monoxide", 0F)
.addResistance("fall", 0)
.hides(EnumPlayerPart.HAT)
.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");
ArmorMaterial aMatAJR = EnumHelper.addArmorMaterial("HBM_T45AJR", 150, new int[] { 3, 8, 6, 3 }, 100);
aMatAJR.customCraftingMaterial = ModItems.plate_armor_ajr;

View File

@ -0,0 +1,47 @@
package com.hbm.items.armor;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.hbm.handler.ArmorModHandler;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.render.model.ModelArmorDesh;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.item.ItemStack;
public class ArmorDiesel extends ArmorFSBFueled {
public ArmorDiesel(ArmorMaterial material, int layer, int slot, String texture, FluidType fuelType, int maxFuel, int fillRate, int consumption, int drain) {
super(material, layer, slot, texture, fuelType, maxFuel, fillRate, consumption, drain);
}
@Override
public Multimap getItemAttributeModifiers() {
Multimap multimap = HashMultimap.create();
multimap.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), new AttributeModifier(ArmorModHandler.fixedUUIDs[this.armorType], "Armor modifier", 0.25D, 1));
return multimap;
}
@SideOnly(Side.CLIENT)
ModelArmorDesh[] models;
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
if(models == null) {
models = new ModelArmorDesh[4];
for(int i = 0; i < 4; i++)
models[i] = new ModelArmorDesh(i);
}
return models[armorSlot];
}
}

View File

@ -0,0 +1,34 @@
package com.hbm.tileentity.machine;
import com.hbm.tileentity.TileEntityMachineBase;
import api.hbm.energy.IEnergyUser;
import net.minecraft.util.ChunkCoordinates;
public abstract class TileEntityMachineAssemblerBase extends TileEntityMachineBase implements IEnergyUser {
public long power;
public int[] progress;
public int[] maxProgress;
public boolean isProgressing;
public TileEntityMachineAssemblerBase(int scount) {
super(scount);
int count = this.getRecipeCount();
progress = new int[count];
maxProgress = new int[count];
}
public abstract int getRecipeCount();
public abstract int getTemplateIndex(int index);
/**
* @param index
* @return A size 4 int array containing min input, max input and output indices in that order.
*/
public abstract int[] getSlotIndicesFromIndex(int index);
public abstract ChunkCoordinates[] getInputPositions();
public abstract ChunkCoordinates[] getOutputPositions();
}

View File

@ -323,13 +323,6 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
@Override
public int getMaxFluidFillForReceive(FluidType type) {
/*int fill = this.getMaxFluidFill(type);
if(type == Fluids.WATER)
fill += water.getMaxFill();
return fill;*/
return super.getMaxFluidFillForReceive(type);
}