diff --git a/src/main/java/com/pahimar/ee3/EquivalentExchange3.java b/src/main/java/com/pahimar/ee3/EquivalentExchange3.java index aecbcde0..4002327d 100644 --- a/src/main/java/com/pahimar/ee3/EquivalentExchange3.java +++ b/src/main/java/com/pahimar/ee3/EquivalentExchange3.java @@ -54,6 +54,12 @@ public class EquivalentExchange3 // Register the GUI Handler NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler()); + // Initialize mod tile entities + proxy.registerTileEntities(); + + // Initialize custom rendering and pre-load textures (Client only) + proxy.initRenderingAndTextures(); + // Register the Items Event Handler FMLCommonHandler.instance().bus().register(EventHandlers.itemEventHandler); MinecraftForge.EVENT_BUS.register(EventHandlers.itemEventHandler); diff --git a/src/main/java/com/pahimar/ee3/block/BlockAlchemicalChest.java b/src/main/java/com/pahimar/ee3/block/BlockAlchemicalChest.java new file mode 100644 index 00000000..03c821de --- /dev/null +++ b/src/main/java/com/pahimar/ee3/block/BlockAlchemicalChest.java @@ -0,0 +1,105 @@ +package com.pahimar.ee3.block; + +import com.pahimar.ee3.EquivalentExchange3; +import com.pahimar.ee3.reference.GuiIds; +import com.pahimar.ee3.reference.Names; +import com.pahimar.ee3.reference.RenderIds; +import com.pahimar.ee3.tileentity.TileAlchemicalChest; +import com.pahimar.ee3.tileentity.TileAlchemicalChestLarge; +import com.pahimar.ee3.tileentity.TileAlchemicalChestMedium; +import com.pahimar.ee3.tileentity.TileAlchemicalChestSmall; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.List; + +public class BlockAlchemicalChest extends BlockEE implements ITileEntityProvider +{ + public BlockAlchemicalChest() + { + super(Material.wood); + this.setHardness(2.5f); + this.setBlockName(Names.Blocks.ALCHEMICAL_CHEST); + this.setBlockBounds(0.0625f, 0.0f, 0.0625f, 0.9375f, 0.875f, 0.9375f); + } + + @Override + public TileEntity createNewTileEntity(World var1, int metaData) + { + if (metaData == 0) + { + return new TileAlchemicalChestSmall(); + } + else if (metaData == 1) + { + return new TileAlchemicalChestMedium(); + } + else if (metaData == 2) + { + return new TileAlchemicalChestLarge(); + } + + return null; + } + + @Override + public int damageDropped(int metaData) + { + return metaData; + } + + @Override + public boolean renderAsNormalBlock() + { + return false; + } + + @Override + public boolean isOpaqueCube() + { + return false; + } + + @Override + public int getRenderType() + { + return RenderIds.alchemicalChest; + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) + { + if (player.isSneaking() || world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) + { + return true; + } + else + { + if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileAlchemicalChest) + { + player.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_CHEST, world, x, y, z); + } + + return true; + } + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) + { + for (int meta = 0; meta < 3; meta++) + { + list.add(new ItemStack(item, 1, meta)); + } + } +} diff --git a/src/main/java/com/pahimar/ee3/block/ModBlocks.java b/src/main/java/com/pahimar/ee3/block/ModBlocks.java index 4a8b6cba..46bc02ff 100644 --- a/src/main/java/com/pahimar/ee3/block/ModBlocks.java +++ b/src/main/java/com/pahimar/ee3/block/ModBlocks.java @@ -1,9 +1,6 @@ package com.pahimar.ee3.block; -import com.pahimar.ee3.item.ItemBlockAlchemicalFuel; -import com.pahimar.ee3.item.ItemBlockInfusedCloth; -import com.pahimar.ee3.item.ItemBlockInfusedPlank; -import com.pahimar.ee3.item.ItemBlockInfusedWood; +import com.pahimar.ee3.item.*; import com.pahimar.ee3.reference.Names; import cpw.mods.fml.common.registry.GameRegistry; @@ -14,6 +11,7 @@ public class ModBlocks public static final BlockEE infusedCloth = new BlockInfusedCloth(); public static final BlockEE infusedWood = new BlockInfusedWood(); public static final BlockEE infusedPlank = new BlockInfusedPlank(); + public static final BlockEE alchemicalChest = new BlockAlchemicalChest(); public static void init() @@ -23,5 +21,6 @@ public class ModBlocks GameRegistry.registerBlock(infusedCloth, ItemBlockInfusedCloth.class, "tile." + Names.Blocks.INFUSED_CLOTH); GameRegistry.registerBlock(infusedWood, ItemBlockInfusedWood.class, "tile." + Names.Blocks.INFUSED_WOOD); GameRegistry.registerBlock(infusedPlank, ItemBlockInfusedPlank.class, "tile." + Names.Blocks.INFUSED_PLANK); + GameRegistry.registerBlock(alchemicalChest, ItemBlockAlchemicalChest.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST); } } diff --git a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalChest.java b/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalChest.java new file mode 100644 index 00000000..68903a63 --- /dev/null +++ b/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalChest.java @@ -0,0 +1,70 @@ +package com.pahimar.ee3.client.gui.inventory; + +import com.pahimar.ee3.inventory.ContainerAlchemicalChest; +import com.pahimar.ee3.reference.Names; +import com.pahimar.ee3.reference.Textures; +import com.pahimar.ee3.tileentity.TileAlchemicalChest; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; + +public class GuiAlchemicalChest extends GuiContainer +{ + private TileAlchemicalChest tileAlchemicalChest; + + public GuiAlchemicalChest(InventoryPlayer inventoryPlayer, TileAlchemicalChest alchemicalChest) + { + super(new ContainerAlchemicalChest(inventoryPlayer, alchemicalChest)); + tileAlchemicalChest = alchemicalChest; + + if (this.tileAlchemicalChest.getState() == 0) + { + xSize = 230; + ySize = 186; + } + else if (this.tileAlchemicalChest.getState() == 1) + { + xSize = 230; + ySize = 240; + } + else if (this.tileAlchemicalChest.getState() == 2) + { + xSize = 248; + ySize = 256; + } + } + + @Override + protected void drawGuiContainerForegroundLayer(int x, int y) + { + if (tileAlchemicalChest.getState() == 0 || tileAlchemicalChest.getState() == 1) + { + fontRendererObj.drawString(tileAlchemicalChest.hasCustomInventoryName() ? tileAlchemicalChest.getInventoryName() : StatCollector.translateToLocal(tileAlchemicalChest.getInventoryName()), 8, 6, 4210752); + fontRendererObj.drawString(StatCollector.translateToLocal(Names.Containers.CONTAINER_INVENTORY), 35, ySize - 95 + 2, 4210752); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + if (tileAlchemicalChest.getState() == 0) + { + this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_CHEST_SMALL); + } + else if (tileAlchemicalChest.getState() == 1) + { + this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_CHEST_MEDIUM); + } + else if (tileAlchemicalChest.getState() == 2) + { + this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_CHEST_LARGE); + } + + int xStart = (width - xSize) / 2; + int yStart = (height - ySize) / 2; + this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); + } +} diff --git a/src/main/java/com/pahimar/ee3/client/renderer/item/ItemAlchemicalChestRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/item/ItemAlchemicalChestRenderer.java new file mode 100644 index 00000000..e1d3be3f --- /dev/null +++ b/src/main/java/com/pahimar/ee3/client/renderer/item/ItemAlchemicalChestRenderer.java @@ -0,0 +1,83 @@ +package com.pahimar.ee3.client.renderer.item; + +import com.pahimar.ee3.reference.Textures; +import cpw.mods.fml.client.FMLClientHandler; +import net.minecraft.client.model.ModelChest; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.IItemRenderer; +import org.lwjgl.opengl.GL11; + +public class ItemAlchemicalChestRenderer implements IItemRenderer +{ + private final ModelChest modelChest; + + public ItemAlchemicalChestRenderer() + { + modelChest = new ModelChest(); + } + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) + { + return true; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) + { + return true; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) + { + switch (type) + { + case ENTITY: + { + renderAlchemicalChest(0.5F, 0.5F, 0.5F, item.getItemDamage()); + break; + } + case EQUIPPED: + { + renderAlchemicalChest(1.0F, 1.0F, 1.0F, item.getItemDamage()); + break; + } + case EQUIPPED_FIRST_PERSON: + { + renderAlchemicalChest(1.0F, 1.0F, 1.0F, item.getItemDamage()); + break; + } + case INVENTORY: + { + renderAlchemicalChest(0.0F, 0.075F, 0.0F, item.getItemDamage()); + break; + } + default: + break; + } + } + + private void renderAlchemicalChest(float x, float y, float z, int metaData) + { + if (metaData == 0) + { + FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_SMALL); + } + else if (metaData == 1) + { + FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_MEDIUM); + } + else if (metaData == 2) + { + FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_LARGE); + } + + GL11.glPushMatrix(); //start + GL11.glTranslatef(x, y, z); //size + GL11.glRotatef(180, 1, 0, 0); + GL11.glRotatef(-90, 0, 1, 0); + modelChest.renderAll(); + GL11.glPopMatrix(); //end + } +} diff --git a/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java b/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java new file mode 100644 index 00000000..7ec6d088 --- /dev/null +++ b/src/main/java/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java @@ -0,0 +1,85 @@ +package com.pahimar.ee3.client.renderer.tileentity; + +import com.pahimar.ee3.reference.Textures; +import com.pahimar.ee3.tileentity.TileAlchemicalChest; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelChest; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +@SideOnly(Side.CLIENT) +public class TileEntityAlchemicalChestRenderer extends TileEntitySpecialRenderer +{ + private final ModelChest modelChest = new ModelChest(); + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) + { + if (tileEntity instanceof TileAlchemicalChest) + { + TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) tileEntity; + ForgeDirection direction = null; + + if (tileAlchemicalChest.getWorldObj() != null) + { + direction = tileAlchemicalChest.getOrientation(); + } + + if (tileAlchemicalChest.getState() == 0) + { + this.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_SMALL); + } + else if (tileAlchemicalChest.getState() == 1) + { + this.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_MEDIUM); + } + else if (tileAlchemicalChest.getState() == 2) + { + this.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_LARGE); + } + + GL11.glPushMatrix(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F); + GL11.glScalef(1.0F, -1.0F, -1.0F); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + short angle = 0; + + if (direction != null) + { + if (direction == ForgeDirection.NORTH) + { + angle = 180; + } + else if (direction == ForgeDirection.SOUTH) + { + angle = 0; + } + else if (direction == ForgeDirection.WEST) + { + angle = 90; + } + else if (direction == ForgeDirection.EAST) + { + angle = -90; + } + } + + GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + float adjustedLidAngle = tileAlchemicalChest.prevLidAngle + (tileAlchemicalChest.lidAngle - tileAlchemicalChest.prevLidAngle) * tick; + adjustedLidAngle = 1.0F - adjustedLidAngle; + adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle; + modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F); + modelChest.renderAll(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + } +} diff --git a/src/main/java/com/pahimar/ee3/handler/CraftingHandler.java b/src/main/java/com/pahimar/ee3/handler/CraftingHandler.java index 418ee0dc..a4f2b15f 100644 --- a/src/main/java/com/pahimar/ee3/handler/CraftingHandler.java +++ b/src/main/java/com/pahimar/ee3/handler/CraftingHandler.java @@ -16,6 +16,6 @@ public class CraftingHandler @SubscribeEvent public void onItemCraftedEvent(PlayerEvent.ItemCraftedEvent event) { - + // TODO Set owner on who crafted the item (make sure it's not a FakePlayer) } } diff --git a/src/main/java/com/pahimar/ee3/handler/GuiHandler.java b/src/main/java/com/pahimar/ee3/handler/GuiHandler.java index 52f4b7fa..4cff6ea9 100644 --- a/src/main/java/com/pahimar/ee3/handler/GuiHandler.java +++ b/src/main/java/com/pahimar/ee3/handler/GuiHandler.java @@ -1,5 +1,9 @@ package com.pahimar.ee3.handler; +import com.pahimar.ee3.client.gui.inventory.GuiAlchemicalChest; +import com.pahimar.ee3.inventory.ContainerAlchemicalChest; +import com.pahimar.ee3.reference.GuiIds; +import com.pahimar.ee3.tileentity.TileAlchemicalChest; import cpw.mods.fml.common.network.IGuiHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; @@ -7,14 +11,26 @@ import net.minecraft.world.World; public class GuiHandler implements IGuiHandler { @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) + public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { + if (id == GuiIds.ALCHEMICAL_CHEST) + { + TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getTileEntity(x, y, z); + return new ContainerAlchemicalChest(player.inventory, tileAlchemicalChest); + } + return null; } @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) + public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { + if (id == GuiIds.ALCHEMICAL_CHEST) + { + TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getTileEntity(x, y, z); + return new GuiAlchemicalChest(player.inventory, tileAlchemicalChest); + } + return null; } } diff --git a/src/main/java/com/pahimar/ee3/inventory/ContainerAlchemicalChest.java b/src/main/java/com/pahimar/ee3/inventory/ContainerAlchemicalChest.java new file mode 100644 index 00000000..36735088 --- /dev/null +++ b/src/main/java/com/pahimar/ee3/inventory/ContainerAlchemicalChest.java @@ -0,0 +1,161 @@ +package com.pahimar.ee3.inventory; + +import com.pahimar.ee3.tileentity.TileAlchemicalChest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerAlchemicalChest extends Container +{ + // Small Chest + public static final int SMALL_CHEST_INVENTORY_ROWS = 4; + public static final int SMALL_CHEST_INVENTORY_COLUMNS = 12; + public static final int SMALL_INVENTORY_SIZE = SMALL_CHEST_INVENTORY_ROWS * SMALL_CHEST_INVENTORY_COLUMNS; + // Medium Chest + public static final int MEDIUM_CHEST_INVENTORY_ROWS = 7; + public static final int MEDIUM_CHEST_INVENTORY_COLUMNS = 12; + public static final int MEDIUM_INVENTORY_SIZE = MEDIUM_CHEST_INVENTORY_ROWS * MEDIUM_CHEST_INVENTORY_COLUMNS; + // Large Chest + public static final int LARGE_CHEST_INVENTORY_ROWS = 9; + public static final int LARGE_CHEST_INVENTORY_COLUMNS = 13; + public static final int LARGE_INVENTORY_SIZE = LARGE_CHEST_INVENTORY_ROWS * LARGE_CHEST_INVENTORY_COLUMNS; + // Player Inventory + private final int PLAYER_INVENTORY_ROWS = 3; + private final int PLAYER_INVENTORY_COLUMNS = 9; + private TileAlchemicalChest tileAlchemicalChest; + private int chestInventoryRows; + private int chestInventoryColumns; + + public ContainerAlchemicalChest(InventoryPlayer inventoryPlayer, TileAlchemicalChest tileAlchemicalChest) + { + this.tileAlchemicalChest = tileAlchemicalChest; + tileAlchemicalChest.openInventory(); + + if (this.tileAlchemicalChest.getState() == 0) + { + chestInventoryRows = SMALL_CHEST_INVENTORY_ROWS; + chestInventoryColumns = SMALL_CHEST_INVENTORY_COLUMNS; + } + else if (this.tileAlchemicalChest.getState() == 1) + { + chestInventoryRows = MEDIUM_CHEST_INVENTORY_ROWS; + chestInventoryColumns = MEDIUM_CHEST_INVENTORY_COLUMNS; + } + else if (this.tileAlchemicalChest.getState() == 2) + { + chestInventoryRows = LARGE_CHEST_INVENTORY_ROWS; + chestInventoryColumns = LARGE_CHEST_INVENTORY_COLUMNS; + } + + // Add the Alchemical Chest slots to the container + for (int chestRowIndex = 0; chestRowIndex < chestInventoryRows; ++chestRowIndex) + { + for (int chestColumnIndex = 0; chestColumnIndex < chestInventoryColumns; ++chestColumnIndex) + { + if (this.tileAlchemicalChest.getState() == 0) + { + this.addSlotToContainer(new Slot(tileAlchemicalChest, chestColumnIndex + chestRowIndex * chestInventoryColumns, 8 + chestColumnIndex * 18, 18 + chestRowIndex * 18)); + } + else if (this.tileAlchemicalChest.getState() == 1) + { + this.addSlotToContainer(new Slot(tileAlchemicalChest, chestColumnIndex + chestRowIndex * chestInventoryColumns, 8 + chestColumnIndex * 18, 18 + chestRowIndex * 18)); + } + else if (this.tileAlchemicalChest.getState() == 2) + { + this.addSlotToContainer(new Slot(tileAlchemicalChest, chestColumnIndex + chestRowIndex * chestInventoryColumns, 8 + chestColumnIndex * 18, 8 + chestRowIndex * 18)); + } + } + } + + // Add the player's inventory slots to the container + for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) + { + for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) + { + if (this.tileAlchemicalChest.getState() == 0) + { + this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 35 + inventoryColumnIndex * 18, 104 + inventoryRowIndex * 18)); + } + else if (this.tileAlchemicalChest.getState() == 1) + { + this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 35 + inventoryColumnIndex * 18, 158 + inventoryRowIndex * 18)); + } + else if (this.tileAlchemicalChest.getState() == 2) + { + this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 44 + inventoryColumnIndex * 18, 174 + inventoryRowIndex * 18)); + } + } + } + + // Add the player's action bar slots to the container + for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) + { + if (this.tileAlchemicalChest.getState() == 0) + { + this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 35 + actionBarSlotIndex * 18, 162)); + } + else if (this.tileAlchemicalChest.getState() == 1) + { + this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 35 + actionBarSlotIndex * 18, 216)); + } + else if (this.tileAlchemicalChest.getState() == 2) + { + this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 44 + actionBarSlotIndex * 18, 232)); + } + } + } + + @Override + public boolean canInteractWith(EntityPlayer entityPlayer) + { + return true; + } + + /** + * Callback for when the crafting gui is closed. + */ + @Override + public void onContainerClosed(EntityPlayer entityPlayer) + { + super.onContainerClosed(entityPlayer); + tileAlchemicalChest.closeInventory(); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) + { + ItemStack newItemStack = null; + Slot slot = (Slot) inventorySlots.get(slotIndex); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemStack = slot.getStack(); + newItemStack = itemStack.copy(); + + if (slotIndex < chestInventoryRows * chestInventoryColumns) + { + if (!this.mergeItemStack(itemStack, chestInventoryRows * chestInventoryColumns, inventorySlots.size(), false)) + { + return null; + } + } + else if (!this.mergeItemStack(itemStack, 0, chestInventoryRows * chestInventoryColumns, false)) + { + return null; + } + + if (itemStack.stackSize == 0) + { + slot.putStack(null); + } + else + { + slot.onSlotChanged(); + } + } + + return newItemStack; + } +} diff --git a/src/main/java/com/pahimar/ee3/item/ItemBlockAlchemicalChest.java b/src/main/java/com/pahimar/ee3/item/ItemBlockAlchemicalChest.java new file mode 100644 index 00000000..2652788f --- /dev/null +++ b/src/main/java/com/pahimar/ee3/item/ItemBlockAlchemicalChest.java @@ -0,0 +1,45 @@ +package com.pahimar.ee3.item; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +import java.util.List; + +public class ItemBlockAlchemicalChest extends ItemBlock +{ + public ItemBlockAlchemicalChest(Block block) + { + super(block); + this.setHasSubtypes(true); + } + + @Override + public int getMetadata(int meta) + { + return meta; + } + + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean flag) + { + // TODO Localize and add more descriptive text + int metaData = itemStack.getItemDamage(); + + if (metaData == 0) + { + list.add("Small"); + } + else if (metaData == 1) + { + list.add("Medium"); + } + else if (metaData == 2) + { + list.add("Large"); + } + } +} diff --git a/src/main/java/com/pahimar/ee3/item/ModItems.java b/src/main/java/com/pahimar/ee3/item/ModItems.java index 73182edb..7b19f184 100644 --- a/src/main/java/com/pahimar/ee3/item/ModItems.java +++ b/src/main/java/com/pahimar/ee3/item/ModItems.java @@ -1,7 +1,9 @@ package com.pahimar.ee3.item; +import com.pahimar.ee3.block.ModBlocks; import com.pahimar.ee3.reference.Names; import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.item.ItemBlock; public class ModItems { @@ -15,6 +17,7 @@ public class ModItems public static final ItemEE alchemicalInventoryUpgrade = new ItemAlchemicalInventoryUpgrade(); public static final ItemEE chalk = new ItemChalk(); public static final ItemEE diviningRod = new ItemDiviningRod(); + public static final ItemBlock alchemicalChest = new ItemBlockAlchemicalChest(ModBlocks.alchemicalChest); public static void init() { diff --git a/src/main/java/com/pahimar/ee3/proxy/ClientProxy.java b/src/main/java/com/pahimar/ee3/proxy/ClientProxy.java index d189bf83..2413598c 100644 --- a/src/main/java/com/pahimar/ee3/proxy/ClientProxy.java +++ b/src/main/java/com/pahimar/ee3/proxy/ClientProxy.java @@ -1,5 +1,28 @@ package com.pahimar.ee3.proxy; +import com.pahimar.ee3.block.ModBlocks; +import com.pahimar.ee3.client.renderer.item.ItemAlchemicalChestRenderer; +import com.pahimar.ee3.client.renderer.tileentity.TileEntityAlchemicalChestRenderer; +import com.pahimar.ee3.reference.RenderIds; +import com.pahimar.ee3.tileentity.TileAlchemicalChest; +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.client.registry.RenderingRegistry; +import net.minecraft.item.Item; +import net.minecraftforge.client.MinecraftForgeClient; + public class ClientProxy extends CommonProxy { + @Override + public void initRenderingAndTextures() + { + RenderIds.calcinator = RenderingRegistry.getNextAvailableRenderId(); + RenderIds.aludel = RenderingRegistry.getNextAvailableRenderId(); + RenderIds.alchemicalChest = RenderingRegistry.getNextAvailableRenderId(); + RenderIds.glassBell = RenderingRegistry.getNextAvailableRenderId(); + RenderIds.researchStation = RenderingRegistry.getNextAvailableRenderId(); + + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.alchemicalChest), new ItemAlchemicalChestRenderer()); + + ClientRegistry.bindTileEntitySpecialRenderer(TileAlchemicalChest.class, new TileEntityAlchemicalChestRenderer()); + } } diff --git a/src/main/java/com/pahimar/ee3/proxy/CommonProxy.java b/src/main/java/com/pahimar/ee3/proxy/CommonProxy.java index 7118aee4..7384d0d7 100644 --- a/src/main/java/com/pahimar/ee3/proxy/CommonProxy.java +++ b/src/main/java/com/pahimar/ee3/proxy/CommonProxy.java @@ -1,5 +1,19 @@ package com.pahimar.ee3.proxy; -public class CommonProxy implements IProxy +import com.pahimar.ee3.reference.Names; +import com.pahimar.ee3.tileentity.TileAlchemicalChest; +import com.pahimar.ee3.tileentity.TileAlchemicalChestLarge; +import com.pahimar.ee3.tileentity.TileAlchemicalChestMedium; +import com.pahimar.ee3.tileentity.TileAlchemicalChestSmall; +import cpw.mods.fml.common.registry.GameRegistry; + +public abstract class CommonProxy implements IProxy { + public void registerTileEntities() + { + GameRegistry.registerTileEntity(TileAlchemicalChest.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST); + GameRegistry.registerTileEntity(TileAlchemicalChestSmall.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST + "Small"); + GameRegistry.registerTileEntity(TileAlchemicalChestMedium.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST + "Medium"); + GameRegistry.registerTileEntity(TileAlchemicalChestLarge.class, "tile." + Names.Blocks.ALCHEMICAL_CHEST + "Large"); + } } diff --git a/src/main/java/com/pahimar/ee3/proxy/IProxy.java b/src/main/java/com/pahimar/ee3/proxy/IProxy.java index 146fe7d2..79c17ba7 100644 --- a/src/main/java/com/pahimar/ee3/proxy/IProxy.java +++ b/src/main/java/com/pahimar/ee3/proxy/IProxy.java @@ -2,4 +2,7 @@ package com.pahimar.ee3.proxy; public interface IProxy { + public abstract void registerTileEntities(); + + public abstract void initRenderingAndTextures(); } diff --git a/src/main/java/com/pahimar/ee3/proxy/ServerProxy.java b/src/main/java/com/pahimar/ee3/proxy/ServerProxy.java index 79f9d0fc..5d8d357f 100644 --- a/src/main/java/com/pahimar/ee3/proxy/ServerProxy.java +++ b/src/main/java/com/pahimar/ee3/proxy/ServerProxy.java @@ -2,4 +2,9 @@ package com.pahimar.ee3.proxy; public class ServerProxy extends CommonProxy { + @Override + public void initRenderingAndTextures() + { + // NOOP + } } diff --git a/src/main/java/com/pahimar/ee3/reference/Names.java b/src/main/java/com/pahimar/ee3/reference/Names.java index 107043ac..9a0b7922 100644 --- a/src/main/java/com/pahimar/ee3/reference/Names.java +++ b/src/main/java/com/pahimar/ee3/reference/Names.java @@ -7,6 +7,7 @@ public class Names public static final String INFUSED_CLOTH = "infusedCloth"; public static final String INFUSED_WOOD = "infusedWood"; public static final String INFUSED_PLANK = "infusedPlank"; + public static final String ALCHEMICAL_CHEST = "alchemicalChest"; } public static class Items @@ -45,4 +46,11 @@ public class Names public static final String DIRECTION = "teDirection"; public static final String OWNER = "owner"; } + + public static class Containers + { + public static final String CONTAINER_INVENTORY = "container.inventory"; + + public static final String ALCHEMICAL_CHEST = "container.ee3:" + Blocks.ALCHEMICAL_CHEST; + } } diff --git a/src/main/java/com/pahimar/ee3/reference/RenderIds.java b/src/main/java/com/pahimar/ee3/reference/RenderIds.java new file mode 100644 index 00000000..59a08299 --- /dev/null +++ b/src/main/java/com/pahimar/ee3/reference/RenderIds.java @@ -0,0 +1,10 @@ +package com.pahimar.ee3.reference; + +public class RenderIds +{ + public static int calcinator; + public static int aludel; + public static int alchemicalChest; + public static int glassBell; + public static int researchStation; +} diff --git a/src/main/java/com/pahimar/ee3/reference/Textures.java b/src/main/java/com/pahimar/ee3/reference/Textures.java index 8625a0bd..fc237e3c 100644 --- a/src/main/java/com/pahimar/ee3/reference/Textures.java +++ b/src/main/java/com/pahimar/ee3/reference/Textures.java @@ -1,6 +1,43 @@ package com.pahimar.ee3.reference; +import com.pahimar.ee3.util.ResourceLocationHelper; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.ResourceLocation; + public class Textures { public static final String RESOURCE_PREFIX = Reference.MOD_ID.toLowerCase() + ":"; + + // Base file paths + public static final String MODEL_TEXTURE_LOCATION = "textures/models/"; + // Model textures + public static final ResourceLocation MODEL_CALCINATOR_IDLE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "calcinator_idle.png"); + public static final ResourceLocation MODEL_CALCINATOR_ACTIVE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "calcinator_active.png"); + public static final ResourceLocation MODEL_ALUDEL = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "aludel.png"); + public static final ResourceLocation MODEL_ALCHEMICAL_CHEST_SMALL = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "alchemicalChest_small.png"); + public static final ResourceLocation MODEL_ALCHEMICAL_CHEST_MEDIUM = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "alchemicalChest_medium.png"); + + // Armor sprite sheets + public static final ResourceLocation MODEL_ALCHEMICAL_CHEST_LARGE = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "alchemicalChest_large.png"); + public static final ResourceLocation MODEL_GLASS_BELL = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "aludel.png"); + public static final ResourceLocation MODEL_RESEARCH_STATION = ResourceLocationHelper.getResourceLocation(MODEL_TEXTURE_LOCATION + "researchStation.png"); + public static final String ARMOR_SHEET_LOCATION = "textures/armor/"; + public static final String GUI_SHEET_LOCATION = "textures/gui/"; + // GUI textures + public static final ResourceLocation GUI_CALCINATOR = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "calcinator.png"); + public static final ResourceLocation GUI_ALUDEL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "aludel.png"); + public static final ResourceLocation GUI_ALCHEMICAL_BAG_SMALL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalBag_small.png"); + public static final ResourceLocation GUI_ALCHEMICAL_BAG_MEDIUM = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalBag_medium.png"); + public static final ResourceLocation GUI_ALCHEMICAL_BAG_LARGE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalBag_large.png"); + public static final ResourceLocation GUI_ALCHEMICAL_CHEST_SMALL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalChest_small.png"); + public static final ResourceLocation GUI_ALCHEMICAL_CHEST_MEDIUM = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalChest_medium.png"); + public static final ResourceLocation GUI_ALCHEMICAL_CHEST_LARGE = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "alchemicalChest_large.png"); + public static final ResourceLocation GUI_GLASS_BELL = ResourceLocationHelper.getResourceLocation(GUI_SHEET_LOCATION + "glassBell.png"); + public static final String EFFECTS_LOCATION = "textures/effects/"; + // Effect textures + public static final ResourceLocation EFFECT_WORLD_TRANSMUTATION = ResourceLocationHelper.getResourceLocation(EFFECTS_LOCATION + "noise.png"); + // Item/Block sprite sheets + public static final ResourceLocation VANILLA_BLOCK_TEXTURE_SHEET = TextureMap.locationBlocksTexture; + public static final ResourceLocation VANILLA_ITEM_TEXTURE_SHEET = TextureMap.locationItemsTexture; + public static final ResourceLocation GUI_PORTABLE_CRAFTING = new ResourceLocation("textures/gui/container/crafting_table.png"); } diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChest.java b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChest.java new file mode 100644 index 00000000..c22dfe6a --- /dev/null +++ b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChest.java @@ -0,0 +1,284 @@ +package com.pahimar.ee3.tileentity; + +import com.pahimar.ee3.block.ModBlocks; +import com.pahimar.ee3.inventory.ContainerAlchemicalChest; +import com.pahimar.ee3.reference.Names; +import com.pahimar.ee3.reference.Sounds; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class TileAlchemicalChest extends TileEntityEE implements IInventory +{ + /** + * The current angle of the chest lid (between 0 and 1) + */ + public float lidAngle; + + /** + * The angle of the chest lid last tick + */ + public float prevLidAngle; + + /** + * The number of players currently using this chest + */ + public int numUsingPlayers; + + /** + * Server sync counter (once per 20 ticks) + */ + private int ticksSinceSync; + + /** + * The ItemStacks that hold the items currently being used in the Alchemical Chest + */ + private ItemStack[] inventory; + + public TileAlchemicalChest(int metaData) + { + super(); + this.state = (byte) metaData; + + if (metaData == 0) + { + inventory = new ItemStack[ContainerAlchemicalChest.SMALL_INVENTORY_SIZE]; + } + else if (metaData == 1) + { + inventory = new ItemStack[ContainerAlchemicalChest.MEDIUM_INVENTORY_SIZE]; + } + else if (metaData == 2) + { + inventory = new ItemStack[ContainerAlchemicalChest.LARGE_INVENTORY_SIZE]; + } + } + + @Override + public int getSizeInventory() + { + return inventory.length; + } + + @Override + public ItemStack getStackInSlot(int slotIndex) + { + return inventory[slotIndex]; + } + + @Override + public ItemStack decrStackSize(int slotIndex, int decrementAmount) + { + ItemStack itemStack = getStackInSlot(slotIndex); + if (itemStack != null) + { + if (itemStack.stackSize <= decrementAmount) + { + setInventorySlotContents(slotIndex, null); + } + else + { + itemStack = itemStack.splitStack(decrementAmount); + if (itemStack.stackSize == 0) + { + setInventorySlotContents(slotIndex, null); + } + } + } + + return itemStack; + } + + @Override + public ItemStack getStackInSlotOnClosing(int slotIndex) + { + if (inventory[slotIndex] != null) + { + ItemStack itemStack = inventory[slotIndex]; + inventory[slotIndex] = null; + return itemStack; + } + else + { + return null; + } + } + + @Override + public void setInventorySlotContents(int slotIndex, ItemStack itemStack) + { + inventory[slotIndex] = itemStack; + + if (itemStack != null && itemStack.stackSize > this.getInventoryStackLimit()) + { + itemStack.stackSize = this.getInventoryStackLimit(); + } + + this.markDirty(); + } + + @Override + public String getInventoryName() + { + return this.hasCustomName() ? this.getCustomName() : Names.Containers.ALCHEMICAL_CHEST; + } + + @Override + public boolean hasCustomInventoryName() + { + return false; + } + + @Override + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + * + * @param entityplayer + * The player we are checking to see if they can use this chest + */ + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) + { + return true; + } + + /** + * Called when a client event is received with the event number and argument, see World.sendClientEvent + */ + @Override + public boolean receiveClientEvent(int eventID, int numUsingPlayers) + { + if (eventID == 1) + { + this.numUsingPlayers = numUsingPlayers; + return true; + } + else + { + return super.receiveClientEvent(eventID, numUsingPlayers); + } + } + + @Override + public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) + { + return true; + } + + @Override + public void openInventory() + { + ++numUsingPlayers; + worldObj.addBlockEvent(xCoord, yCoord, zCoord, ModBlocks.alchemicalChest, 1, numUsingPlayers); + } + + @Override + public void closeInventory() + { + --numUsingPlayers; + worldObj.addBlockEvent(xCoord, yCoord, zCoord, ModBlocks.alchemicalChest, 1, numUsingPlayers); + } + + @Override + public void readFromNBT(NBTTagCompound nbtTagCompound) + { + super.readFromNBT(nbtTagCompound); + + // Read in the ItemStacks in the inventory from NBT + NBTTagList tagList = nbtTagCompound.getTagList("Items", 10); + inventory = new ItemStack[this.getSizeInventory()]; + for (int i = 0; i < tagList.tagCount(); ++i) + { + NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); + byte slotIndex = tagCompound.getByte("Slot"); + if (slotIndex >= 0 && slotIndex < inventory.length) + { + inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); + } + } + } + + @Override + public void writeToNBT(NBTTagCompound nbtTagCompound) + { + super.writeToNBT(nbtTagCompound); + + // Write the ItemStacks in the inventory to NBT + NBTTagList tagList = new NBTTagList(); + for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) + { + if (inventory[currentIndex] != null) + { + NBTTagCompound tagCompound = new NBTTagCompound(); + tagCompound.setByte("Slot", (byte) currentIndex); + inventory[currentIndex].writeToNBT(tagCompound); + tagList.appendTag(tagCompound); + } + } + nbtTagCompound.setTag("Items", tagList); + } + + /** + * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count + * ticks and creates a new spawn inside its implementation. + */ + @Override + public void updateEntity() + { + super.updateEntity(); + + if (++ticksSinceSync % 20 * 4 == 0) + { + worldObj.addBlockEvent(xCoord, yCoord, zCoord, ModBlocks.alchemicalChest, 1, numUsingPlayers); + } + + prevLidAngle = lidAngle; + float angleIncrement = 0.1F; + double adjustedXCoord, adjustedZCoord; + + if (numUsingPlayers > 0 && lidAngle == 0.0F) + { + adjustedXCoord = xCoord + 0.5D; + adjustedZCoord = zCoord + 0.5D; + worldObj.playSoundEffect(adjustedXCoord, yCoord + 0.5D, adjustedZCoord, Sounds.CHEST_OPEN, 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + + if (numUsingPlayers == 0 && lidAngle > 0.0F || numUsingPlayers > 0 && lidAngle < 1.0F) + { + float var8 = lidAngle; + + if (numUsingPlayers > 0) + { + lidAngle += angleIncrement; + } + else + { + lidAngle -= angleIncrement; + } + + if (lidAngle > 1.0F) + { + lidAngle = 1.0F; + } + + if (lidAngle < 0.5F && var8 >= 0.5F) + { + adjustedXCoord = xCoord + 0.5D; + adjustedZCoord = zCoord + 0.5D; + worldObj.playSoundEffect(adjustedXCoord, yCoord + 0.5D, adjustedZCoord, Sounds.CHEST_CLOSE, 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + + if (lidAngle < 0.0F) + { + lidAngle = 0.0F; + } + } + } +} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestLarge.java b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestLarge.java new file mode 100644 index 00000000..e31de027 --- /dev/null +++ b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestLarge.java @@ -0,0 +1,9 @@ +package com.pahimar.ee3.tileentity; + +public class TileAlchemicalChestLarge extends TileAlchemicalChest +{ + public TileAlchemicalChestLarge() + { + super(2); + } +} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestMedium.java b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestMedium.java new file mode 100644 index 00000000..7851756f --- /dev/null +++ b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestMedium.java @@ -0,0 +1,9 @@ +package com.pahimar.ee3.tileentity; + +public class TileAlchemicalChestMedium extends TileAlchemicalChest +{ + public TileAlchemicalChestMedium() + { + super(1); + } +} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestSmall.java b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestSmall.java new file mode 100644 index 00000000..28f5ffc6 --- /dev/null +++ b/src/main/java/com/pahimar/ee3/tileentity/TileAlchemicalChestSmall.java @@ -0,0 +1,9 @@ +package com.pahimar.ee3.tileentity; + +public class TileAlchemicalChestSmall extends TileAlchemicalChest +{ + public TileAlchemicalChestSmall() + { + super(0); + } +} diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileEntityEE.java b/src/main/java/com/pahimar/ee3/tileentity/TileEntityEE.java index d667ebc2..ea00e745 100644 --- a/src/main/java/com/pahimar/ee3/tileentity/TileEntityEE.java +++ b/src/main/java/com/pahimar/ee3/tileentity/TileEntityEE.java @@ -17,6 +17,7 @@ public class TileEntityEE extends TileEntity orientation = ForgeDirection.SOUTH; state = 0; customName = ""; + owner = ""; } public ForgeDirection getOrientation() @@ -24,16 +25,16 @@ public class TileEntityEE extends TileEntity return orientation; } - public void setOrientation(int orientation) - { - this.orientation = ForgeDirection.getOrientation(orientation); - } - public void setOrientation(ForgeDirection orientation) { this.orientation = orientation; } + public void setOrientation(int orientation) + { + this.orientation = ForgeDirection.getOrientation(orientation); + } + public short getState() { return state; diff --git a/src/main/java/com/pahimar/ee3/util/ResourceLocationHelper.java b/src/main/java/com/pahimar/ee3/util/ResourceLocationHelper.java new file mode 100644 index 00000000..e34c23ca --- /dev/null +++ b/src/main/java/com/pahimar/ee3/util/ResourceLocationHelper.java @@ -0,0 +1,17 @@ +package com.pahimar.ee3.util; + +import com.pahimar.ee3.reference.Reference; +import net.minecraft.util.ResourceLocation; + +public class ResourceLocationHelper +{ + public static ResourceLocation getResourceLocation(String modId, String path) + { + return new ResourceLocation(modId, path); + } + + public static ResourceLocation getResourceLocation(String path) + { + return getResourceLocation(Reference.MOD_ID.toLowerCase(), path); + } +}