Skip to content

Commit

Permalink
Added data terminal which serves as an in-game guide.
Browse files Browse the repository at this point in the history
  • Loading branch information
Droog71 committed Oct 22, 2020
1 parent 03777a3 commit 0901a29
Show file tree
Hide file tree
Showing 27 changed files with 197 additions and 5 deletions.
2 changes: 1 addition & 1 deletion main/java/com/droog71/prospect/Prospect.java
Expand Up @@ -26,7 +26,7 @@ public class Prospect
{
public static final String MODID = "prospect";
public static final String NAME = "Prospect";
public static final String VERSION = "1.0.4";
public static final String VERSION = "1.0.5";

@Instance
public static Prospect instance;
Expand Down
5 changes: 3 additions & 2 deletions main/java/com/droog71/prospect/event/FMLEventHandler.java
Expand Up @@ -29,8 +29,9 @@ public void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event)
persistent = data.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
}
if (!persistent.hasKey(NBT_KEY)) //If this is the first time onPlayerJoin is called for this player, equip armor and spore filter.
{
if (!hasArmor(event.player))
{
event.player.inventory.addItemStackToInventory(new ItemStack(ProspectItems.data_terminal));
if (!hasArmor(event.player))
{
event.player.inventory.addItemStackToInventory(new ItemStack(ProspectItems.filter));
event.player.inventory.setInventorySlotContents(36, new ItemStack(ProspectItems.boots));
Expand Down
98 changes: 98 additions & 0 deletions main/java/com/droog71/prospect/gui/DataTerminalGUI.java
@@ -0,0 +1,98 @@
package com.droog71.prospect.gui;

import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class DataTerminalGUI extends GuiScreen
{
private int index;
private float zoom = 1;

private static final ResourceLocation[] pages =
{
new ResourceLocation("prospect:textures/gui/data_terminal_intro_1.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_intro_2.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_spores_1.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_spores_2.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_spores_3.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_igc_1.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_igc_2.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_igc_3.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_machines.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_schematics.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_solar.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_zero_point_reactor.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_transformers.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_conduits.png"),
new ResourceLocation("prospect:textures/gui/data_terminal_conveyor_tubes.png")
};

public DataTerminalGUI()
{

}

public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
drawImage();
super.drawScreen(mouseX, mouseY, partialTicks);
}

public void initGui()
{
super.initGui();
this.buttonList.add(new GuiButton(0, width - 200, (int)(height * 0.75f), "Zoom"));
this.buttonList.add(new GuiButton(1, width - 200, (int)(height * 0.8f), "Next"));
this.buttonList.add(new GuiButton(2, width - 200, (int)(height * 0.85f), "Previous"));
this.buttonList.add(new GuiButton(3, width - 200, (int)(height * 0.9f), "Close"));
}

public void drawImage()
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(pages[index]);
int size = (int) (height * zoom);
int offset = (int) ((zoom - 1) * height);
int height_offset = zoom == 1 ? 0 : (int) ((offset / 2) * -1);
drawModalRectWithCustomSizedTexture((size / 2) - (size / 2), height_offset, 0, 0, size, size, size, size);
}

protected void actionPerformed(GuiButton button)
{
if (button.id == 0)
{
zoom = zoom < 2 ? zoom + 0.25f : 1;
}
else if (button.id == 1)
{
if (index < pages.length - 1)
{
index++;
}
else
{
index = 0;
}
}
else if (button.id == 2)
{
if (index > 0)
{
index--;
}
else
{
index = pages.length - 1;
}
}
else
{
this.mc.displayGuiScreen((GuiScreen)null);
}
}
}
4 changes: 4 additions & 0 deletions main/java/com/droog71/prospect/gui/ProspectGuiHandler.java
Expand Up @@ -97,6 +97,10 @@ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int
{
return new ConveyorTubeGUI(player.inventory, (ConveyorTileEntity)world.getTileEntity(new BlockPos(x,y,z)));
}
if (ID == 9)
{
return new DataTerminalGUI();
}
return null;
}

Expand Down
13 changes: 13 additions & 0 deletions main/java/com/droog71/prospect/init/ProspectItems.java
Expand Up @@ -2,6 +2,7 @@

import com.droog71.prospect.Prospect;
import com.droog71.prospect.armor.ProspectArmor;
import com.droog71.prospect.items.DataTerminal;
import com.droog71.prospect.items.ProspectItem;
import com.droog71.prospect.items.Schematic;
import com.droog71.prospect.items.SporeFilter;
Expand All @@ -16,6 +17,9 @@
@Mod.EventBusSubscriber(modid=Prospect.MODID)
public class ProspectItems
{
//Book
public static Item data_terminal;

// Armor
public static Item helmet;
public static Item suit;
Expand Down Expand Up @@ -115,6 +119,9 @@ public class ProspectItems

public static void init()
{
//Book
data_terminal = new DataTerminal("data_terminal").setCreativeTab(Prospect.tabProspect).setMaxStackSize(1);

// Armor
helmet = new ProspectArmor("helmet",Prospect.tabProspect,ProspectArmor.PROSPECTOR_ARMOR, 0, EntityEquipmentSlot.HEAD);
suit = new ProspectArmor("suit",Prospect.tabProspect,ProspectArmor.PROSPECTOR_ARMOR, 0, EntityEquipmentSlot.CHEST);
Expand Down Expand Up @@ -216,6 +223,9 @@ public static void init()
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event)
{
//Book
event.getRegistry().registerAll(data_terminal);

// Armor
event.getRegistry().registerAll(helmet);
event.getRegistry().registerAll(suit);
Expand Down Expand Up @@ -317,6 +327,9 @@ public static void registerItems(RegistryEvent.Register<Item> event)
@SubscribeEvent
public static void registerRenders(ModelRegistryEvent event)
{
// Book
registerRender(data_terminal);

// Armor
registerRender(filter);
registerRender(helmet);
Expand Down
32 changes: 32 additions & 0 deletions main/java/com/droog71/prospect/items/DataTerminal.java
@@ -0,0 +1,32 @@
package com.droog71.prospect.items;

import com.droog71.prospect.Prospect;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;

public class DataTerminal extends ProspectItem
{
public DataTerminal(String name)
{
super(name);
}

@Override
public EnumAction getItemUseAction(ItemStack stack)
{
return EnumAction.NONE;
}

@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
{
ItemStack itemstack = playerIn.getHeldItem(handIn);
playerIn.openGui(Prospect.instance, 9, worldIn, (int)playerIn.posX, (int)playerIn.posY, (int)playerIn.posZ);
return new ActionResult<ItemStack>(EnumActionResult.PASS, itemstack);
}
}
2 changes: 1 addition & 1 deletion main/java/com/droog71/prospect/items/SporeFilter.java
Expand Up @@ -32,7 +32,7 @@ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player)
}

@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
{
if(itemSlot < 9) //Spore filters must be placed in the hotbar when in use.
{
Expand Down
1 change: 1 addition & 0 deletions main/resources/assets/prospect/lang/en_us.lang
@@ -1,3 +1,4 @@
item.data_terminal.name=Data Terminal
item.gem.name=Gem
item.credit.name=IGC
item.circuit.name=Circuit
Expand Down
19 changes: 19 additions & 0 deletions main/resources/assets/prospect/models/item/data_terminal.json
@@ -0,0 +1,19 @@
{
"parent": "item/generated",
"textures": {
"layer0": "prospect:items/data_terminal"
},

"display": {
"thirdperson": {
"rotation": [-90,0,0],
"translation": [0,1,-3],
"scale": [0.55,0.55,0.55]
},
"firstperson": {
"rotation": [0,-135,25],
"translation": [0,4,2],
"scale": [1.7,1.7,1.7]
}
}
}
24 changes: 24 additions & 0 deletions main/resources/assets/prospect/recipes/data_terminal.json
@@ -0,0 +1,24 @@
{
"type": "forge:ore_shaped",
"pattern": [
"AAA",
"CGC",
"ACA" ],
"key": {
"A": {
"item": "prospect:aluminum_plate"
},
"G": {
"item": "minecraft:glass"
},
"C": {
"item": "prospect:circuit"
}
},
"result": {
"item": "prospect:data_terminal",
"data": 0
}
}


Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion main/resources/mcmod.info
Expand Up @@ -3,7 +3,7 @@
"modid": "prospect",
"name": "Prospect",
"description": "Prospect Mod",
"version": "1.0.4",
"version": "1.0.5",
"mcversion": "1.12.2",
"url": "",
"updateUrl": "",
Expand Down

0 comments on commit 0901a29

Please sign in to comment.