Changed the way tile entity registering and name rendering is handled

This commit is contained in:
Ellpeck 2016-07-03 21:57:33 +02:00
parent 6176404cf1
commit a5e10de4b3
31 changed files with 114 additions and 93 deletions

View file

@ -119,10 +119,12 @@ public final class InitBlocks{
public static Block blockBookletStand;
public static Block blockDisplayStand;
public static Block blockShockSuppressor;
public static void init(){
ModUtil.LOGGER.info("Initializing Blocks...");
blockShockSuppressor = new BlockShockSuppressor("blockShockSuppressor");
blockDisplayStand = new BlockDisplayStand("blockDisplayStand");
blockPlayerInterface = new BlockPlayerInterface("blockPlayerInterface");
blockBookletStand = new BlockBookletStand("blockBookletStand");

View file

@ -35,13 +35,11 @@ public class CreativeTab extends CreativeTabs{
super(ModUtil.MOD_ID);
}
@Override
public ItemStack getIconItemStack(){
return new ItemStack(this.getTabIconItem());
}
@Override
public Item getTabIconItem(){
return InitItems.itemBooklet;
@ -75,6 +73,7 @@ public class CreativeTab extends CreativeTabs{
this.add(InitBlocks.blockXPSolidifier);
this.add(InitBlocks.blockDisplayStand);
this.add(InitBlocks.blockShockSuppressor);
this.add(InitBlocks.blockMiner);
this.add(InitBlocks.blockGreenhouseGlass);
this.add(InitBlocks.blockGrinder);
@ -135,6 +134,7 @@ public class CreativeTab extends CreativeTabs{
this.add(InitBlocks.blockTreasureChest);
this.add(InitBlocks.blockBlackLotus);
this.add(InitBlocks.blockBookletStand);
this.add(InitItems.itemColorLens);
this.add(InitItems.itemExplosionLens);

View file

@ -36,7 +36,7 @@ public class GuiBreaker extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.breaker.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.breaker);
}
@Override

View file

@ -53,7 +53,7 @@ public class GuiCanolaPress extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.press.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.press);
}
@Override

View file

@ -47,7 +47,7 @@ public class GuiCoalGenerator extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.generator.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.generator);
}
@Override

View file

@ -81,7 +81,7 @@ public class GuiCoffeeMachine extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.machine.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.machine);
}
@Override

View file

@ -48,7 +48,7 @@ public class GuiDirectionalBreaker extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.breaker.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.breaker);
}
@Override

View file

@ -36,7 +36,7 @@ public class GuiDropper extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.dropper.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.dropper);
}
@Override

View file

@ -47,7 +47,7 @@ public class GuiEnergizer extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.energizer.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.energizer);
}
@Override

View file

@ -47,7 +47,7 @@ public class GuiEnervator extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.enervator.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.enervator);
}
@Override

View file

@ -49,7 +49,7 @@ public class GuiFeeder extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileFeeder.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileFeeder);
}
@Override

View file

@ -54,7 +54,7 @@ public class GuiFermentingBarrel extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.press.name);
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.press);
}
@Override

View file

@ -49,7 +49,7 @@ public class GuiFluidCollector extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.collector.name);
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.collector);
}
@Override

View file

@ -47,7 +47,7 @@ public class GuiFurnaceDouble extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileFurnace.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileFurnace);
}
@Override

View file

@ -74,7 +74,7 @@ public class GuiGiantChest extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.chest.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.chest);
}
@Override

View file

@ -54,7 +54,7 @@ public class GuiGrinder extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileGrinder.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileGrinder);
}
@Override

View file

@ -157,7 +157,7 @@ public class GuiInputter extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileInputter.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileInputter);
}
@Override

View file

@ -108,7 +108,7 @@ public class GuiLaserRelayItemWhitelist extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tile.name);
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tile);
String s1 = "INBOUND";
String s2 = "OUTBOUND";

View file

@ -53,7 +53,7 @@ public class GuiMiner extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.miner.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.miner);
}
@Override

View file

@ -52,7 +52,7 @@ public class GuiOilGenerator extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.generator.name);
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.generator);
}
@Override

View file

@ -36,7 +36,7 @@ public class GuiPhantomPlacer extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.placer.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.placer);
}
@Override

View file

@ -75,7 +75,7 @@ public class GuiRangedCollector extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.collector.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.collector);
}
@Override

View file

@ -47,7 +47,7 @@ public class GuiRepairer extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileRepairer.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.tileRepairer);
}
@Override

View file

@ -76,7 +76,7 @@ public class GuiXPSolidifier extends GuiContainer{
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.solidifier.getName());
AssetUtil.displayNameString(this.fontRendererObj, this.xSize, -10, this.solidifier);
}
@Override

View file

@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import de.ellpeck.actuallyadditions.mod.util.compat.TeslaUtil;
import net.minecraft.block.state.IBlockState;
@ -27,6 +28,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@ -38,69 +41,70 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
public abstract class TileEntityBase extends TileEntity implements ITickable{
public static boolean teslaLoaded;
public final String name;
public boolean isRedstonePowered;
public boolean isPulseMode;
protected int ticksElapsed;
public final String name;
public TileEntityBase(String name){
this.name = "container."+ModUtil.MOD_ID+"."+name;
this.name = name;
}
//TODO Change for next major update to use the name variable automatically
public static void init(){
ModUtil.LOGGER.info("Registering TileEntities...");
GameRegistry.registerTileEntity(TileEntityCompost.class, ModUtil.MOD_ID+":tileEntityCompost");
GameRegistry.registerTileEntity(TileEntityFeeder.class, ModUtil.MOD_ID+":tileEntityFeeder");
GameRegistry.registerTileEntity(TileEntityGiantChest.class, ModUtil.MOD_ID+":tileEntityGiantChest");
GameRegistry.registerTileEntity(TileEntityGiantChestMedium.class, ModUtil.MOD_ID+":tileEntityGiantChestMedium");
GameRegistry.registerTileEntity(TileEntityGiantChestLarge.class, ModUtil.MOD_ID+":tileEntityGiantChestLarge");
GameRegistry.registerTileEntity(TileEntityGrinder.class, ModUtil.MOD_ID+":tileEntityGrinder");
GameRegistry.registerTileEntity(TileEntityFurnaceDouble.class, ModUtil.MOD_ID+":tileEntityFurnaceDouble");
GameRegistry.registerTileEntity(TileEntityInputter.class, ModUtil.MOD_ID+":tileEntityInputter");
GameRegistry.registerTileEntity(TileEntityFishingNet.class, ModUtil.MOD_ID+":tileEntityFishingNet");
GameRegistry.registerTileEntity(TileEntityFurnaceSolar.class, ModUtil.MOD_ID+":tileEntityFurnaceSolar");
GameRegistry.registerTileEntity(TileEntityHeatCollector.class, ModUtil.MOD_ID+":tileEntityHeatCollector");
GameRegistry.registerTileEntity(TileEntityItemRepairer.class, ModUtil.MOD_ID+":tileEntityRepairer");
GameRegistry.registerTileEntity(TileEntityGreenhouseGlass.class, ModUtil.MOD_ID+":tileEntityGreenhouseGlass");
GameRegistry.registerTileEntity(TileEntityBreaker.class, ModUtil.MOD_ID+":tileEntityBreaker");
GameRegistry.registerTileEntity(TileEntityDropper.class, ModUtil.MOD_ID+":tileEntityDropper");
GameRegistry.registerTileEntity(TileEntityInputterAdvanced.class, ModUtil.MOD_ID+":tileEntityInputterAdvanced");
GameRegistry.registerTileEntity(TileEntityPlacer.class, ModUtil.MOD_ID+":tileEntityPlacer");
GameRegistry.registerTileEntity(TileEntityGrinderDouble.class, ModUtil.MOD_ID+":tileEntityGrinderDouble");
GameRegistry.registerTileEntity(TileEntityCanolaPress.class, ModUtil.MOD_ID+":tileEntityCanolaPress");
GameRegistry.registerTileEntity(TileEntityFermentingBarrel.class, ModUtil.MOD_ID+":tileEntityFermentingBarrel");
GameRegistry.registerTileEntity(TileEntityOilGenerator.class, ModUtil.MOD_ID+":tileEntityOilGenerator");
GameRegistry.registerTileEntity(TileEntityCoalGenerator.class, ModUtil.MOD_ID+":tileEntityCoalGenerator");
GameRegistry.registerTileEntity(TileEntityPhantomItemface.class, ModUtil.MOD_ID+":tileEntityPhantomItemface");
GameRegistry.registerTileEntity(TileEntityPhantomLiquiface.class, ModUtil.MOD_ID+":tileEntityPhantomLiquiface");
GameRegistry.registerTileEntity(TileEntityPhantomEnergyface.class, ModUtil.MOD_ID+":tileEntityPhantomEnergyface");
GameRegistry.registerTileEntity(TileEntityPlayerInterface.class, ModUtil.MOD_ID+":tileEntityPlayerInterface");
GameRegistry.registerTileEntity(TileEntityPhantomPlacer.class, ModUtil.MOD_ID+":tileEntityPhantomPlacer");
GameRegistry.registerTileEntity(TileEntityPhantomBreaker.class, ModUtil.MOD_ID+":tileEntityPhantomBreaker");
GameRegistry.registerTileEntity(TileEntityFluidCollector.class, ModUtil.MOD_ID+":tileEntityFluidCollector");
GameRegistry.registerTileEntity(TileEntityFluidPlacer.class, ModUtil.MOD_ID+":tileEntityFluidPlacer");
GameRegistry.registerTileEntity(TileEntityLavaFactoryController.class, ModUtil.MOD_ID+":tileEntityLavaFactoryController");
GameRegistry.registerTileEntity(TileEntityCoffeeMachine.class, ModUtil.MOD_ID+":tileEntityCoffeeMachine");
GameRegistry.registerTileEntity(TileEntityPhantomBooster.class, ModUtil.MOD_ID+":tileEntityPhantomBooster");
GameRegistry.registerTileEntity(TileEntityEnergizer.class, ModUtil.MOD_ID+":tileEntityEnergizer");
GameRegistry.registerTileEntity(TileEntityEnervator.class, ModUtil.MOD_ID+":tileEntityEnervator");
GameRegistry.registerTileEntity(TileEntityXPSolidifier.class, ModUtil.MOD_ID+":tileEntityXPSolidifier");
GameRegistry.registerTileEntity(TileEntitySmileyCloud.class, ModUtil.MOD_ID+":tileEntityCloud");
GameRegistry.registerTileEntity(TileEntityLeafGenerator.class, ModUtil.MOD_ID+":tileEntityLeafGenerator");
GameRegistry.registerTileEntity(TileEntityDirectionalBreaker.class, ModUtil.MOD_ID+":tileEntityDirectionalBreaker");
GameRegistry.registerTileEntity(TileEntityRangedCollector.class, ModUtil.MOD_ID+":tileEntityRangedCollector");
GameRegistry.registerTileEntity(TileEntityAtomicReconstructor.class, ModUtil.MOD_ID+":tileEntityAtomicReconstructor");
GameRegistry.registerTileEntity(TileEntityMiner.class, ModUtil.MOD_ID+":tileEntityMiner");
GameRegistry.registerTileEntity(TileEntityFireworkBox.class, ModUtil.MOD_ID+":tileEntityFireworkBox");
GameRegistry.registerTileEntity(TileEntityPhantomRedstoneface.class, ModUtil.MOD_ID+":tileEntityPhantomRedstoneface");
GameRegistry.registerTileEntity(TileEntityLaserRelayItem.class, ModUtil.MOD_ID+":tileEntityLaserRelayItem");
GameRegistry.registerTileEntity(TileEntityLaserRelayEnergy.class, ModUtil.MOD_ID+":tileEntityLaserRelay");
GameRegistry.registerTileEntity(TileEntityLaserRelayItemWhitelist.class, ModUtil.MOD_ID+":tileEntityLaserRelayItemWhitelist");
GameRegistry.registerTileEntity(TileEntityItemViewer.class, ModUtil.MOD_ID+":tileItemViewer");
GameRegistry.registerTileEntity(TileEntityBookletStand.class, ModUtil.MOD_ID+":tileEntityBookletStand");
GameRegistry.registerTileEntity(TileEntityDisplayStand.class, ModUtil.MOD_ID+":tileEntityDisplayStand");
register(TileEntityCompost.class, "Compost");
register(TileEntityFeeder.class, "Feeder");
register(TileEntityGiantChest.class, "GiantChest");
register(TileEntityGiantChestMedium.class, "GiantChestMedium");
register(TileEntityGiantChestLarge.class, "GiantChestLarge");
register(TileEntityGrinder.class, "Grinder");
register(TileEntityFurnaceDouble.class, "FurnaceDouble");
register(TileEntityInputter.class, "Inputter");
register(TileEntityFishingNet.class, "FishingNet");
register(TileEntityFurnaceSolar.class, "FurnaceSolar");
register(TileEntityHeatCollector.class, "HeatCollector");
register(TileEntityItemRepairer.class, "Repairer");
register(TileEntityGreenhouseGlass.class, "GreenhouseGlass");
register(TileEntityBreaker.class, "Breaker");
register(TileEntityDropper.class, "Dropper");
register(TileEntityInputterAdvanced.class, "InputterAdvanced");
register(TileEntityPlacer.class, "Placer");
register(TileEntityGrinderDouble.class, "GrinderDouble");
register(TileEntityCanolaPress.class, "CanolaPress");
register(TileEntityFermentingBarrel.class, "FermentingBarrel");
register(TileEntityOilGenerator.class, "OilGenerator");
register(TileEntityCoalGenerator.class, "CoalGenerator");
register(TileEntityPhantomItemface.class, "PhantomItemface");
register(TileEntityPhantomLiquiface.class, "PhantomLiquiface");
register(TileEntityPhantomEnergyface.class, "PhantomEnergyface");
register(TileEntityPlayerInterface.class, "PlayerInterface");
register(TileEntityPhantomPlacer.class, "PhantomPlacer");
register(TileEntityPhantomBreaker.class, "PhantomBreaker");
register(TileEntityFluidCollector.class, "FluidCollector");
register(TileEntityFluidPlacer.class, "FluidPlacer");
register(TileEntityLavaFactoryController.class, "LavaFactoryController");
register(TileEntityCoffeeMachine.class, "CoffeeMachine");
register(TileEntityPhantomBooster.class, "PhantomBooster");
register(TileEntityEnergizer.class, "Energizer");
register(TileEntityEnervator.class, "Enervator");
register(TileEntityXPSolidifier.class, "XPSolidifier");
register(TileEntitySmileyCloud.class, "Cloud");
register(TileEntityLeafGenerator.class, "LeafGenerator");
register(TileEntityDirectionalBreaker.class, "DirectionalBreaker");
register(TileEntityRangedCollector.class, "RangedCollector");
register(TileEntityAtomicReconstructor.class, "AtomicReconstructor");
register(TileEntityMiner.class, "Miner");
register(TileEntityFireworkBox.class, "FireworkBox");
register(TileEntityPhantomRedstoneface.class, "PhantomRedstoneface");
register(TileEntityLaserRelayItem.class, "LaserRelayItem");
register(TileEntityLaserRelayEnergy.class, "LaserRelay");
register(TileEntityLaserRelayItemWhitelist.class, "LaserRelayItemWhitelist");
register(TileEntityItemViewer.class, "ItemViewer");
register(TileEntityBookletStand.class, "BookletStand");
register(TileEntityDisplayStand.class, "DisplayStand");
register(TileEntityShockSuppressor.class, "ShockSuppressor");
if(ModAPIManager.INSTANCE.hasAPI("Tesla|API")){
ModUtil.LOGGER.info("Tesla API loaded... Activating Tesla Power System integration...");
@ -111,13 +115,24 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
}
}
private static void register(Class<? extends TileEntityBase> tileClass, String legacyName){
try{
//This is hacky and dirty but it works so whatever
String name = ModUtil.MOD_ID+":"+tileClass.newInstance().name;
String oldName = ModUtil.MOD_ID+":tileEntity"+legacyName;
GameRegistry.registerTileEntityWithAlternatives(tileClass, name, oldName);
}
catch(Exception e){
ModUtil.LOGGER.fatal("Registering a TileEntity failed!", e);
}
}
@Override
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
this.readSyncableNBT(compound, NBTType.SAVE_TILE);
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound){
compound = super.writeToNBT(compound);
@ -173,6 +188,11 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
}
}
@Override
public ITextComponent getDisplayName(){
return new TextComponentTranslation("container."+ModUtil.MOD_ID+"."+this.name+".name");
}
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
if(type == NBTType.SAVE_TILE){
this.isRedstonePowered = compound.getBoolean("Redstone");

View file

@ -20,12 +20,12 @@ import net.minecraft.util.EnumFacing;
public class TileEntityGiantChest extends TileEntityInventoryBase implements IButtonReactor{
public TileEntityGiantChest(int slotAmount){
super(slotAmount, "giantChest");
public TileEntityGiantChest(int slotAmount, String name){
super(slotAmount, name);
}
public TileEntityGiantChest(){
this(9*13);
this(9*13, "giantChest");
}
@Override

View file

@ -13,6 +13,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
public class TileEntityGiantChestLarge extends TileEntityGiantChest{
public TileEntityGiantChestLarge(){
super(9*13*3);
super(9*13*3, "giantChestLarge");
}
}

View file

@ -13,6 +13,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
public class TileEntityGiantChestMedium extends TileEntityGiantChest{
public TileEntityGiantChestMedium(){
super(9*13*2);
super(9*13*2, "giantChestMedium");
}
}

View file

@ -191,7 +191,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
return stack;
}
@Override
public String getName(){
return this.name;
@ -202,12 +201,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
return false;
}
@Override
public ITextComponent getDisplayName(){
return new TextComponentTranslation(this.getName());
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){
if(this.hasInvWrapperCapabilities() && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){

View file

@ -24,6 +24,7 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformT
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@ -44,9 +45,12 @@ public final class AssetUtil{
return new ResourceLocation(ModUtil.MOD_ID, "textures/gui/booklet/"+file+".png");
}
public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, String machineName){
String localMachineName = StringUtil.localize(machineName+".name");
font.drawString(localMachineName, xSize/2-font.getStringWidth(localMachineName)/2, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE);
public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, String text){
font.drawString(text, xSize/2-font.getStringWidth(text)/2, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE);
}
public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, TileEntity tile){
displayNameString(font, xSize, yPositionOfMachineText, tile.getDisplayName().getFormattedText());
}
@SideOnly(Side.CLIENT)

View file

@ -568,7 +568,9 @@ container.actuallyadditions.grinder.name=Crusher
container.actuallyadditions.grinderDouble.name=Double Crusher
container.actuallyadditions.furnaceDouble.name=Double Furnace
container.actuallyadditions.feeder.name=Feeder
container.actuallyadditions.giantChest.name=Storage Crate
container.actuallyadditions.giantChest.name=Small Storage Crate
container.actuallyadditions.giantChestMedium.name=Medium Storage Crate
container.actuallyadditions.giantChestLarge.name=Large Storage Crate
container.actuallyadditions.repairer.name=Repairer
container.actuallyadditions.placer.name=Placer
container.actuallyadditions.breaker.name=Breaker