mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
mh
This commit is contained in:
parent
77c1b53e31
commit
a0332d4241
@ -16,17 +16,19 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// and you may ask yourself: vaer, why do this? this is basically just a copy of GUIScreenGuide.
|
||||
// and I would answer, shut the fuck up nerd, the guide book system is too involved for my small
|
||||
// brain to use for god knows how many tidbits of lore. i'll settle for a text box and cool textures, thanks
|
||||
public class GUIBookLore extends GuiScreen {
|
||||
|
||||
//TODO: refactor some of these variables
|
||||
protected int xSize;
|
||||
protected int ySize;
|
||||
protected int guiLeft;
|
||||
protected int guiTop;
|
||||
|
||||
private World world; //Used for save-dependent information, like the MKU recipe
|
||||
private BookLoreType type;
|
||||
private GUIAppearance setup;
|
||||
|
||||
@ -35,6 +37,7 @@ public class GUIBookLore extends GuiScreen {
|
||||
|
||||
public GUIBookLore(EntityPlayer player) {
|
||||
|
||||
world = player.worldObj;
|
||||
type = BookLoreType.getTypeFromStack(player.getHeldItem());
|
||||
setup = type.appearance;
|
||||
|
||||
@ -134,12 +137,14 @@ public class GUIBookLore extends GuiScreen {
|
||||
// turn page buttons, one-page, both page textures, sizes, positions, etc.
|
||||
public enum GUIAppearance {
|
||||
GUIDEBOOK(new GUIPage(272, 182, 20, 20, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/book.png")).setScale(2F),
|
||||
new GUIPageButton(18, 10, 24, 155, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/starter6.png")).setUV(0, 0, 500, 200),
|
||||
0),
|
||||
LOOSEPAPER(new GUIPage(133, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F),
|
||||
new GUIPage(130, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F).setUV(133, 0),
|
||||
new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512),
|
||||
1);
|
||||
0),
|
||||
LOOSEPAPER(new GUIPage(130, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F).setUV(133, 0),
|
||||
new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512),
|
||||
1), //Singular loose page
|
||||
LOOSEPAPERS(new GUIPage(133, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F),
|
||||
new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512),
|
||||
2);
|
||||
|
||||
public int itemTexture;
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import com.hbm.util.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -62,8 +63,8 @@ public class ItemBookLore extends Item implements IGUIProvider {
|
||||
}
|
||||
|
||||
protected IIcon[] icons;
|
||||
//fuck you, fuck enums, fuck guis, fuck this shitty ass fork. shove that string array up your ass.
|
||||
public static String[] itemTextures = new String[] { ":book_guide", ":papers_loose" };
|
||||
|
||||
public final static String[] itemTextures = new String[] { ":book_guide", ":paper_loose", ":papers_loose" };
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
@ -98,7 +99,9 @@ public class ItemBookLore extends Item implements IGUIProvider {
|
||||
}
|
||||
|
||||
public enum BookLoreType {
|
||||
TEST(true, "test", 5, GUIAppearance.LOOSEPAPER);
|
||||
TEST(true, "test", 5, GUIAppearance.GUIDEBOOK),
|
||||
REL_RAMBLINGS("rel_ramblings", 3, GUIAppearance.LOOSEPAPERS);
|
||||
|
||||
|
||||
//Why? it's quite simple; i am too burnt out and also doing it the other way
|
||||
//is too inflexible for my taste
|
||||
@ -121,15 +124,35 @@ public class ItemBookLore extends Item implements IGUIProvider {
|
||||
this.appearance = appearance;
|
||||
}
|
||||
|
||||
//TODO: actually shove this into the gui
|
||||
/** Function to resolve I18n keys using potential save-dependent information, a la format specifiers. */
|
||||
public String resolveKey(String key, World world) {
|
||||
return I18nUtil.resolveKey(key);
|
||||
}
|
||||
|
||||
public static BookLoreType getTypeFromStack(ItemStack stack) {
|
||||
if(!stack.hasTagCompound()) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
int ordinal = tag.getInteger("bookLoreOrdinal");
|
||||
int ordinal = tag.getInteger("Book_Lore_Type");
|
||||
|
||||
return BookLoreType.values()[Math.abs(ordinal) % BookType.values().length];
|
||||
}
|
||||
|
||||
public static ItemStack setTypeForStack(ItemStack stack, BookLoreType num) {
|
||||
|
||||
if(stack.getItem() instanceof ItemBookLore) {
|
||||
if(!stack.hasTagCompound()) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
tag.setInteger("Book_Lore_Type", num.ordinal());
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.entity.effect.EntityNukeTorex;
|
||||
import com.hbm.entity.mob.siege.EntitySiegeTunneler;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemBookLore;
|
||||
import com.hbm.items.special.ItemBookLore.BookLoreType;
|
||||
import com.hbm.items.special.ItemKitCustom;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.world.feature.OilSpot;
|
||||
@ -34,12 +36,18 @@ public class ItemWandD extends Item {
|
||||
|
||||
if(pos != null) {
|
||||
|
||||
//use sparingly
|
||||
ItemStack itemStack = new ItemStack(ModItems.book_lore);
|
||||
BookLoreType.setTypeForStack(itemStack, BookLoreType.REL_RAMBLINGS);
|
||||
|
||||
player.inventory.addItemStackToInventory(itemStack);
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
|
||||
/*//use sparingly
|
||||
int k = ((pos.blockX >> 4) << 4) + 8;
|
||||
int l = ((pos.blockZ >> 4) << 4) + 8;
|
||||
|
||||
Start start = new Start(world, world.rand, pos.blockX >> 4, pos.blockZ >> 4);
|
||||
start.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124));
|
||||
start.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124));*/
|
||||
|
||||
/*OilSpot.generateOilSpot(world, pos.blockX, pos.blockZ, 20, 500);*/
|
||||
|
||||
|
||||
BIN
src/main/resources/assets/hbm/textures/items/paper_loose.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/paper_loose.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 239 B |
Loading…
x
Reference in New Issue
Block a user