Teleposers and refractoring

This commit is contained in:
Arcaratus 2016-01-01 12:08:17 -05:00
parent 1b9f72b494
commit a8a0ae6e8b
145 changed files with 594 additions and 162 deletions

View file

@ -0,0 +1,44 @@
package WayofTime.bloodmagic.client.gui;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.tile.TileTeleposer;
import WayofTime.bloodmagic.tile.container.ContainerTeleposer;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
public class GuiHandler implements IGuiHandler
{
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
BlockPos pos = new BlockPos(x, y, z);
switch (id)
{
case Constants.Gui.TELEPOSER_GUI:
return new ContainerTeleposer(player.inventory, (TileTeleposer) world.getTileEntity(pos));
}
return null;
}
@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
if (world instanceof WorldClient)
{
BlockPos pos = new BlockPos(x, y, z);
switch (id)
{
case Constants.Gui.TELEPOSER_GUI:
return new GuiTeleposer(player.inventory, (TileTeleposer) world.getTileEntity(pos));
}
}
return null;
}
}

View file

@ -0,0 +1,40 @@
package WayofTime.bloodmagic.client.gui;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.tile.container.ContainerTeleposer;
import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiTeleposer extends GuiContainer
{
public GuiTeleposer(InventoryPlayer playerInventory, IInventory tileTeleposer)
{
super(new ContainerTeleposer(playerInventory, tileTeleposer));
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
this.fontRendererObj.drawString(TextHelper.localize("tile.BloodMagic.teleposer.name"), 64, 23, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, 47, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
ResourceLocation teleposerGuiTextures = new ResourceLocation(Constants.Mod.MODID + ":textures/gui/teleposer.png");
this.mc.getTextureManager().bindTexture(teleposerGuiTextures);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(i, j + 18, 0, 0, this.xSize, this.ySize);
}
}

View file

@ -1,4 +1,4 @@
package WayofTime.bloodmagic.client.gui;
package WayofTime.bloodmagic.client.gui.config;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.api.Constants;

View file

@ -1,4 +1,4 @@
package WayofTime.bloodmagic.client.gui;
package WayofTime.bloodmagic.client.gui.config;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;