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 blockBookletStand;
public static Block blockDisplayStand; public static Block blockDisplayStand;
public static Block blockShockSuppressor;
public static void init(){ public static void init(){
ModUtil.LOGGER.info("Initializing Blocks..."); ModUtil.LOGGER.info("Initializing Blocks...");
blockShockSuppressor = new BlockShockSuppressor("blockShockSuppressor");
blockDisplayStand = new BlockDisplayStand("blockDisplayStand"); blockDisplayStand = new BlockDisplayStand("blockDisplayStand");
blockPlayerInterface = new BlockPlayerInterface("blockPlayerInterface"); blockPlayerInterface = new BlockPlayerInterface("blockPlayerInterface");
blockBookletStand = new BlockBookletStand("blockBookletStand"); blockBookletStand = new BlockBookletStand("blockBookletStand");

View file

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

View file

@ -36,7 +36,7 @@ public class GuiBreaker extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -53,7 +53,7 @@ public class GuiCanolaPress extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -47,7 +47,7 @@ public class GuiCoalGenerator extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -81,7 +81,7 @@ public class GuiCoffeeMachine extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -48,7 +48,7 @@ public class GuiDirectionalBreaker extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -36,7 +36,7 @@ public class GuiDropper extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -47,7 +47,7 @@ public class GuiEnergizer extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -47,7 +47,7 @@ public class GuiEnervator extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -49,7 +49,7 @@ public class GuiFeeder extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -54,7 +54,7 @@ public class GuiFermentingBarrel extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -49,7 +49,7 @@ public class GuiFluidCollector extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -47,7 +47,7 @@ public class GuiFurnaceDouble extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -74,7 +74,7 @@ public class GuiGiantChest extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -54,7 +54,7 @@ public class GuiGrinder extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -157,7 +157,7 @@ public class GuiInputter extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -108,7 +108,7 @@ public class GuiLaserRelayItemWhitelist extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 s1 = "INBOUND";
String s2 = "OUTBOUND"; String s2 = "OUTBOUND";

View file

@ -53,7 +53,7 @@ public class GuiMiner extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -52,7 +52,7 @@ public class GuiOilGenerator extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -36,7 +36,7 @@ public class GuiPhantomPlacer extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -75,7 +75,7 @@ public class GuiRangedCollector extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

@ -47,7 +47,7 @@ public class GuiRepairer extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ 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 @Override

View file

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

View file

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

View file

@ -13,6 +13,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
public class TileEntityGiantChestLarge extends TileEntityGiantChest{ public class TileEntityGiantChestLarge extends TileEntityGiantChest{
public TileEntityGiantChestLarge(){ 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 class TileEntityGiantChestMedium extends TileEntityGiantChest{
public TileEntityGiantChestMedium(){ 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; return stack;
} }
@Override @Override
public String getName(){ public String getName(){
return this.name; return this.name;
@ -202,12 +201,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
return false; return false;
} }
@Override
public ITextComponent getDisplayName(){
return new TextComponentTranslation(this.getName());
}
@Override @Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing){ public <T> T getCapability(Capability<T> capability, EnumFacing facing){
if(this.hasInvWrapperCapabilities() && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){ 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.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -44,9 +45,12 @@ public final class AssetUtil{
return new ResourceLocation(ModUtil.MOD_ID, "textures/gui/booklet/"+file+".png"); return new ResourceLocation(ModUtil.MOD_ID, "textures/gui/booklet/"+file+".png");
} }
public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, String machineName){ public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, String text){
String localMachineName = StringUtil.localize(machineName+".name"); font.drawString(text, xSize/2-font.getStringWidth(text)/2, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE);
font.drawString(localMachineName, xSize/2-font.getStringWidth(localMachineName)/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) @SideOnly(Side.CLIENT)

View file

@ -568,7 +568,9 @@ container.actuallyadditions.grinder.name=Crusher
container.actuallyadditions.grinderDouble.name=Double Crusher container.actuallyadditions.grinderDouble.name=Double Crusher
container.actuallyadditions.furnaceDouble.name=Double Furnace container.actuallyadditions.furnaceDouble.name=Double Furnace
container.actuallyadditions.feeder.name=Feeder 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.repairer.name=Repairer
container.actuallyadditions.placer.name=Placer container.actuallyadditions.placer.name=Placer
container.actuallyadditions.breaker.name=Breaker container.actuallyadditions.breaker.name=Breaker