Skip to content
This repository has been archived by the owner on Apr 22, 2019. It is now read-only.

Commit

Permalink
Fleshing out a little more of the Alchenomicon gui
Browse files Browse the repository at this point in the history
  • Loading branch information
pahimar committed Feb 26, 2017
1 parent 2f65d3c commit 9c41bb5
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 35 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G

# Build related properties
minecraft_version = 1.11.2
forge_version = 13.20.0.2230
forge_version = 13.20.0.2252
mcp_mappings_version = snapshot_20161220
curseforge_plugin_version = 1.0.7

Expand Down
56 changes: 56 additions & 0 deletions src/main/java/com/pahimar/ee3/client/gui/GuiAlchenomicon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.pahimar.ee3.client.gui;

import com.pahimar.ee3.reference.Textures;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;

import java.io.IOException;

/**
* TODO Finish Javadoc
*
* @author Pahimar (pahimar@gmail.com
* @version 0.5.0
* @since 0.5.0
*/
public class GuiAlchenomicon extends GuiScreen {

final int guiWidth = 256;
final int guiHeight = 256;

private static final ResourceLocation TEXTURE = Textures.Gui.ALCHENOMICON;

@Override
public final void initGui() {
super.initGui();
}

@Override
public void updateScreen() {
super.updateScreen();
}

@Override
public final void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
GlStateManager.color(1f, 1f, 1f, 1f);
mc.renderEngine.bindTexture(TEXTURE);
drawTexturedModalRect(width / 2 - guiWidth / 2, height / 2 - guiHeight / 2, 0, 0, guiWidth, guiHeight);
}

@Override
protected void actionPerformed(GuiButton button) {
// NO-OP
}
@Override
public boolean doesGuiPauseGame() {
return false;
}

@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
super.keyTyped(typedChar, keyCode);
}
}
1 change: 1 addition & 0 deletions src/main/java/com/pahimar/ee3/client/gui/GuiFactory.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.pahimar.ee3.client.gui;

import com.pahimar.ee3.client.gui.config.ModGuiConfig;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.fml.client.IModGuiFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pahimar.ee3.client.gui;
package com.pahimar.ee3.client.gui.config;

import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.handler.ConfigurationHandler;
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/pahimar/ee3/handler/GuiHandler.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.pahimar.ee3.handler;

import com.pahimar.ee3.client.gui.GuiAlchenomicon;
import com.pahimar.ee3.reference.GuiIds;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
Expand All @@ -20,6 +22,10 @@ public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world

BlockPos blockPos = new BlockPos(x, y, z);

if (id == GuiIds.ALCHENOMICON) {
return new GuiAlchenomicon();
}

return null;
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/pahimar/ee3/item/ItemAlchemicalBag.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer entity
}

// TODO Get the Gui working again
// entityPlayer.openGui(EquivalentExchange3.instance, GUIs.ALCHEMICAL_BAG.ordinal(), entityPlayer.worldObj, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ);
// entityPlayer.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_BAG.ordinal(), entityPlayer.worldObj, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ);
}

return new ActionResult<>(EnumActionResult.PASS, entityPlayer.getHeldItem(hand));
Expand Down
20 changes: 3 additions & 17 deletions src/main/java/com/pahimar/ee3/item/ItemAlchenomicon.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.item.base.ItemBase;
import com.pahimar.ee3.reference.GUIs;
import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.util.ItemStackUtils;
import com.pahimar.ee3.reference.GuiIds;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;

public class ItemAlchenomicon extends ItemBase {
Expand All @@ -21,18 +18,7 @@ public ItemAlchenomicon() {

@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer entityPlayer, EnumHand hand) {

if (!world.isRemote) {
ItemStack itemStack = entityPlayer.getHeldItem(hand);
if (!ItemStackUtils.hasOwner(itemStack)) {
ItemStackUtils.setOwner(itemStack, entityPlayer);
entityPlayer.sendMessage(new TextComponentTranslation(Messages.OWNER_SET_TO_SELF, itemStack.getTextComponent()));
}
else {
entityPlayer.openGui(EquivalentExchange3.instance, GUIs.ALCHENOMICON.ordinal(), entityPlayer.getEntityWorld(), (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ);
}
}

return new ActionResult(EnumActionResult.SUCCESS, entityPlayer.getHeldItem(hand));
entityPlayer.openGui(EquivalentExchange3.instance, GuiIds.ALCHENOMICON, entityPlayer.getEntityWorld(), (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ);
return new ActionResult<>(EnumActionResult.SUCCESS, entityPlayer.getHeldItem(hand));
}
}
15 changes: 0 additions & 15 deletions src/main/java/com/pahimar/ee3/reference/GUIs.java

This file was deleted.

28 changes: 28 additions & 0 deletions src/main/java/com/pahimar/ee3/reference/GuiIds.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.pahimar.ee3.reference;

/**
* Reference class holding ids for the various GUI's in the mod.
*
* @author Pahimar (pahimar@gmail.com
* @version 0.5.0
* @since 0.5.0
*/
public class GuiIds {

/**
* The id for the Alchenomicon GUI
*
* @since 0.5.0
*/
public static final int ALCHENOMICON = 0;

public static final int PORTABLE_CRAFTING = -1;
public static final int CALCINATOR = -1;
public static final int ALUDEL = -1;
public static final int ALCHEMICAL_CHEST = -1;
public static final int ALCHEMICAL_BAG = -1;
public static final int GLASS_BELL = -1;
public static final int RESEARCH_STATION = -1;
public static final int AUGMENTATION_TABLE = -1;
public static final int TRANSMUTATION_TABLET = -1;
}

0 comments on commit 9c41bb5

Please sign in to comment.