
Kwibble
Forge Modder-
Posts
340 -
Joined
-
Last visited
Everything posted by Kwibble
-
Would it help if I made a small video of the behavior so you can see the results of it? I will also show what has happened with the vanilla code?
-
So now am I absolutely miffed. What the heck is going wrong? Does diesieben07 have any input that could probably save the day? This is really aggregating me because while there are other ways to do this... This is the best and most user friendly.
-
You just want a white screen. That's all? You could make a class that extends Gui, then have a method in it that is the @SubscribeEvent method to RenderGameOveralyEvent.PRE then call the drawRect method that is inside GUI. Draw a white rectangle that fills the screen. Done.
-
I don't know how the graphics could effect the slots But I copied the player inventory. The image size is 256x256 and the actual bit thelat gets rendered is the 176x166 (I think. Whatever it is) So I have no clue... And I don't think the graphic has anything to do with it. I copied the ContainerPlayer code as my container code, my graphic was my custom one and my custom GUI. So I have no clue.
-
.obj objects are so much better... If you don't want to do much animation (as in none). I have no clue how to animate an .obj in Minecraft.
-
What was really weird though -> I could replace the crafting slots with own custom ones without a problem. As soon as I changed their position though... Nope
-
Still the same as it was before. The vanilla code wasn't working, so I just reverted. I mean... There was no difference in the end.
-
Oh wow >.> This is what I get for assuming that doors had a onDoorActivated method. I mean, it makes so much sense!
-
Naming conventions and parameters in the forge code (not Java)?
Kwibble replied to icecubert's topic in Modder Support
I have discovered what a few of the parameters are for methods. If I don't know it, I play around with to see if I can figure it out. Once/If I do, I rename it to what it is. -
diesieben07, I take it you mean something along these lines..? BiomeManager.coolBiomes.add(); BiomeManager.desertBiomes.add(); BiomeManager.icyBiomes.add(); BiomeManager.oceanBiomes.add();
-
I just copied the ContainerPlayer code, it worked perfectly fine. So It is somewhere in my code... [EDIT] I am trying to remove the crafting slots and that seems to break it [EDIT 2] So I tried leaving the crafting and only removing the armour slots... Still no luck This thing hates me. Even tweaking the vanilla code breaks.
-
Yeah, it is all correct. * I think * [EDIT] Well, I tried moving the registry and that didn't work... Its freaking annoying me. I guess next I will copy-paste vanilla inventory code and see if that works. If it does, then we have a big problem.
-
I can't pick it up from ANY slot - custom are generic. No...I don't override it in client proxy. I'll change that and the init bit. I open the GUI via a key bind that calls a packet that opens the GUI: Here's the packet: package com.kwibble.dendri.network.message; import com.kwibble.dendri.ModuleDendri; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; /** * Created by Kwibble on 24/06/14. */ public class MessageServerRequestGuiOpen implements IMessage { private int guiID; public MessageServerRequestGuiOpen() {} public MessageServerRequestGuiOpen(int guiID) { this.guiID = guiID; } @Override public void fromBytes(ByteBuf buf) { buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(this.guiID); } public static class Handler implements IMessageHandler<MessageServerRequestGuiOpen, IMessage> { @Override public IMessage onMessage(MessageServerRequestGuiOpen message, MessageContext ctx) { EntityPlayer player = ModuleDendri.proxy.getPlayerFromMessageContext(ctx); player.openGui(ModuleDendri.instance, message.guiID, player.worldObj, 0, 0, 0); return null; } } }
-
Well... Here is my common proxy: package com.kwibble.dendri; import com.kwibble.dendri.block.BlockDendri; import com.kwibble.dendri.client.gui.EnumGui; import com.kwibble.dendri.client.gui.inventory.GuiDendrikBeltInventory; import com.kwibble.dendri.entity.dendri.DendriRegistry; import com.kwibble.dendri.entity.player.PlayerInformation; import com.kwibble.dendri.handlers.DendriExperienceHandler; import com.kwibble.dendri.handlers.GenericEventHandler; import com.kwibble.dendri.inventory.ContainerDendrikBeltInventory; import com.kwibble.dendri.item.ItemDendri; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; public class CommonProxy implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID == EnumGui.DENDRIK_BELT_INVENTORY.getGuiID()) return new ContainerDendrikBeltInventory(player.inventory, player); return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { PlayerInformation playerinfo = PlayerInformation.forPlayer(player); if (ID == EnumGui.DENDRIK_BELT_INVENTORY.getGuiID()) return new GuiDendrikBeltInventory(player, playerinfo); return null; } public void initializeMod() { BlockDendri.registerBlocks(); ItemDendri.registerItems(); registerEvents(); registerEntities(); registerRenders(); registerKeyBindings(); } protected void registerEvents() { MinecraftForge.EVENT_BUS.register(new DendriExperienceHandler()); MinecraftForge.EVENT_BUS.register(new GenericEventHandler()); } private void registerEntities() { DendriRegistry.registerAllDendri(); registerTileEntities(); } /* * Actual functionality in ClientProxy */ public void registerRenders() {} /* * Actual functionality in ClientProxy */ public void registerDendriRender(Class<? extends Entity> dendriClass, Render dendriRender) {} /* * Actual functionality in ClientProxy */ protected void registerMobEntityRenders() {} /* * Actual functionality in ClientProxy */ protected void registerTileEntityRenders() {} /* * Actual functionality in ClientProxy */ protected void registerTileEntities() {} /* * Actual functionality in ClientProxy */ protected void registerKeyBindings() {} public EntityPlayer getPlayerFromMessageContext(MessageContext ctx) { return ctx.getServerHandler().playerEntity; } public EntityPlayer getPlayer(String username) { return MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(username); } public GuiScreen getCurrentScreen() { return null; } } Here is my mod file: package com.kwibble.dendri; import com.kwibble.dendri.network.DendriNetwork; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; import java.util.ArrayList; import java.util.List; @Mod (modid = ModuleDendri.MODID, name = ModuleDendri.NAME, version = ModuleDendri.VERSION) public class ModuleDendri { public static final String NAME = "Dendri"; public static final String MODID = "dendri"; public static final String VERSION = "1.7.2_0.0.1"; @Instance (ModuleDendri.MODID) public static ModuleDendri instance; @SidedProxy (clientSide = "com.kwibble.dendri.client.ClientProxy", serverSide = "com.kwibble.dendri.CommonProxy") public static CommonProxy proxy; @Mod.EventHandler public void on(FMLPreInitializationEvent event) { DendriNetwork.registerNetwork(); NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy); proxy.initializeMod(); } @Mod.EventHandler public void on(FMLInitializationEvent event) { } @Mod.EventHandler public void on(FMLPostInitializationEvent event) { } } I have it being registered pre unit.. Surely that shouldn't make a difference?
-
That would be in my CommonProxy... When you say keep the client/server in sync, I am not sending packets anywhere. Only to open the GUI. How do I keep it in sync?
-
Well... In case I haven't explained the problem well enough: By nothing happens I mean that I click on an item and it gets put right back in the slot I picked it up from. It sounds like I haven't called all the right flags. So I have no idea what the issue is. Any help it's appreciated.
-
Subscribe to the event living death event. Check to see if the events damage source entity is an instance of EntityPlayer. Check to see if the events entity is an instance of EntityMob. Do whatever.
-
No, all blocks can have that method if they choose to override it. I just checked and no, there is no tile entity for a door. Oh well. I have no idea what the problem is. Please show your code so we can get a better idea of the problem.
-
Nice idea! I quite like it. Can't wait to see it in action! And as to the question... Isn't the vanilla door a tile entity?
-
This is a bit of a joke.... But: BIND EVERY KEY!!!! Good question this.
-
Scale only one axis using OpenGL? That could be a possibility
-
I have been trying to implement my own custom inventory, and lets just say the results aren't very satisfactory. I am displaying the inventory and everything is there correctly. Then I try and move an item. Nothing happens. I have all the flags (I think) that I need to call saying that the player can interact with the inventory. So without further ka fluffle. GuiDendrikBeltInventory: package com.kwibble.dendri.client.gui.inventory; import com.kwibble.dendri.ModuleDendri; import com.kwibble.dendri.inventory.ContainerDendrikBeltInventory; import com.kwibble.dendri.entity.dendri.EntityDendri; import com.kwibble.dendri.entity.player.PlayerInformation; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; public class GuiDendrikBeltInventory extends GuiContainer { /** * x size of the inventory window in pixels. Defined as float, passed as int */ private float xSizeFloat; /** * y size of the inventory window in pixels. Defined as float, passed as int. */ private float ySizeFloat; private ResourceLocation tab_main, tab_dendri; private PlayerInformation playerinfo; public GuiDendrikBeltInventory(EntityPlayer player, PlayerInformation playerinfo) { super(new ContainerDendrikBeltInventory(player.inventory, player)); this.allowUserInput = true; this.playerinfo = playerinfo; this.tab_main = new ResourceLocation(ModuleDendri.MODID, "textures/gui/dendrikbeltinventory/tab_main.png"); this.tab_dendri = new ResourceLocation(ModuleDendri.MODID, "textures/gui/dendrikbeltinventory/tab_dendri.png"); } @Override public void initGui() { this.buttonList.clear(); super.initGui(); } @Override public void drawScreen(int par1, int par2, float par3) { super.drawScreen(par1, par2, par3); this.xSizeFloat = (float)par1; this.ySizeFloat = (float)par2; } @Override protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(this.tab_main); int k = this.guiLeft; int l = this.guiTop; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); func_147046_a(k + 34, l + 75, 30, (float)(k + 34) - this.xSizeFloat, (float)(l + 75 - 50) - this.ySizeFloat, this.mc.thePlayer); } public static void func_147046_a(int p_147046_0_, int p_147046_1_, int p_147046_2_, float p_147046_3_, float p_147046_4_, EntityLivingBase p_147046_5_) { GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix(); GL11.glTranslatef((float)p_147046_0_, (float)p_147046_1_, 50.0F); GL11.glScalef((float)(-p_147046_2_), (float)p_147046_2_, (float)p_147046_2_); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); float f2 = p_147046_5_.renderYawOffset; float f3 = p_147046_5_.rotationYaw; float f4 = p_147046_5_.rotationPitch; float f5 = p_147046_5_.prevRotationYawHead; float f6 = p_147046_5_.rotationYawHead; GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-((float)Math.atan((double)(p_147046_4_ / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); p_147046_5_.renderYawOffset = (float)Math.atan((double)(p_147046_3_ / 40.0F)) * 20.0F; p_147046_5_.rotationYaw = (float)Math.atan((double)(p_147046_3_ / 40.0F)) * 40.0F; p_147046_5_.rotationPitch = -((float)Math.atan((double)(p_147046_4_ / 40.0F))) * 20.0F; p_147046_5_.rotationYawHead = p_147046_5_.rotationYaw; p_147046_5_.prevRotationYawHead = p_147046_5_.rotationYaw; GL11.glTranslatef(0.0F, p_147046_5_.yOffset, 0.0F); RenderManager.instance.playerViewY = 180.0F; RenderManager.instance.renderEntityWithPosYaw(p_147046_5_, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); p_147046_5_.renderYawOffset = f2; p_147046_5_.rotationYaw = f3; p_147046_5_.rotationPitch = f4; p_147046_5_.prevRotationYawHead = f5; p_147046_5_.rotationYawHead = f6; GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); } } ContainerDendrikBeltInventory: package com.kwibble.dendri.inventory; import com.kwibble.dendri.entity.player.PlayerInformation; import com.kwibble.dendri.network.DendriNetwork; import com.kwibble.dendri.network.message.MessageClientPlayerInfo; import com.kwibble.dendri.network.message.MessageServerRequestPlayerInfo; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; /** * Created by Kwibble on 25/06/14. */ public class ContainerDendrikBeltInventory extends Container { private static final int INV_START = 3, INV_END = INV_START+26, HOTBAR_START = INV_END+1, HOTBAR_END = HOTBAR_START+8; public ContainerDendrikBeltInventory(final InventoryPlayer inventoryPlayer, final EntityPlayer player) { PlayerInformation playerinfo = PlayerInformation.forPlayer(player); if (!player.worldObj.isRemote) DendriNetwork.dendriNetwork.sendTo(new MessageClientPlayerInfo(playerinfo), ( EntityPlayerMP ) player); int i; int j; this.addSlotToContainer(new SlotDendrikBelt(playerinfo, 0, 62, ); for (i = 0; i < 4; ++i) { int x = 27; int y = 0; if (i > 0) { x = 28; y = 1; } this.addSlotToContainer(new SlotMistBottle(playerinfo.getInventoryDendrikBelt(), 1 + i, 68 + (i * x) - y, 45)); } for (i = 0; i < 3; ++i) { for (j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(inventoryPlayer, j + ( i + 1 ) * 9, 8 + j * 18, 84 + i * 18)); } } for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); } } @Override public boolean canInteractWith(EntityPlayer player) { return true; } /** * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. */ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot) this.inventorySlots.get(par2); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (par2 < INV_START) { if (!this.mergeItemStack(itemstack1, INV_START, HOTBAR_END + 1, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); } else { if (par2 >= INV_START && par2 < HOTBAR_START) { if (!this.mergeItemStack(itemstack1, HOTBAR_START, HOTBAR_END + 1, false)) { return null; } } else if (par2 >= HOTBAR_START && par2 < HOTBAR_END + 1) { if (!this.mergeItemStack(itemstack1, INV_START, INV_END + 1, false)) { return null; } } } if (itemstack1.stackSize == 0) { slot.putStack((ItemStack) null); } else { slot.onSlotChanged(); } if (itemstack1.stackSize == itemstack.stackSize) { return null; } slot.onPickupFromSlot(par1EntityPlayer, itemstack1); } return itemstack; } } InventoryDendrikBelt: package com.kwibble.dendri.inventory; import com.kwibble.dendri.item.ItemDendrikBelt; import com.kwibble.dendri.network.DendriNetwork; import com.kwibble.dendri.network.message.MessageServerRequestPlayerInfo; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; /** * Created by Kwibble on 25/06/14. */ public class InventoryDendrikBelt implements IInventory { public ItemStack[] mainInventory = new ItemStack[1]; public void setCurrentDendrikBelt(ItemStack par1ItemStack) { this.mainInventory[0] = par1ItemStack; } public Item getCurrentDendrikBelt() { return this.mainInventory[0] != null ? this.mainInventory[0].getItem() : new ItemStack(Blocks.stone).getItem(); } /** * Returns the stack in slot i * * @param slot */ @Override public ItemStack getStackInSlot(int slot) { if (slot > 0) return null; return this.mainInventory[slot]; } /** * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a * new stack. * * @param slot * @param amount */ @Override public ItemStack decrStackSize(int slot, int amount) { ItemStack stack = getStackInSlot(slot); if (stack != null){ if (stack.stackSize > amount){ stack = stack.splitStack(amount); if (stack.stackSize == 0){ setInventorySlotContents(slot, null); } } else { setInventorySlotContents(slot, null); } this.markDirty(); } return stack; } /** * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - * like when you close a workbench GUI. * * @param par1 */ @Override public ItemStack getStackInSlotOnClosing(int par1) { return null; } /** * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). * * @param slotID * @param itemstack */ @Override public void setInventorySlotContents(int slotID, ItemStack itemstack) { this.mainInventory[slotID] = itemstack; if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()){ itemstack.stackSize = this.getInventoryStackLimit(); } this.markDirty(); } /** * Returns the name of the inventory */ @Override public String getInventoryName() { return "dendrikbeltinventory"; } /** * Returns if the inventory is named */ @Override public boolean hasCustomInventoryName() { return true; } /** * Returns the maximum stack size for a inventory slot. */ @Override public int getInventoryStackLimit() { return 1; } /** * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it * hasn't changed and skip it. */ @Override public void markDirty() { // Something is supposed to go here... } /** * Do not make give this method the name canInteractWith because it clashes with Container * * @param par1EntityPlayer */ @Override public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { return true; } @Override public void openInventory() {} @Override public void closeInventory() {} /** * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. * * @param slotID * @param par2ItemStack */ @Override public boolean isItemValidForSlot(int slotID, ItemStack par2ItemStack) { return (slotID == 0 && par2ItemStack.getItem() instanceof ItemDendrikBelt); } /** * Returns the number of slots in the inventory. */ @Override public int getSizeInventory() { return this.mainInventory.length; } public void writeToNBT(NBTTagCompound nbt) { Item item = this.getCurrentDendrikBelt(); if (item instanceof ItemDendrikBelt) { ((ItemDendrikBelt) this.getCurrentDendrikBelt()).saveDendrikBeltStorage(nbt); } } public void readFromNBT(NBTTagCompound nbt) { if (this.getCurrentDendrikBelt() instanceof ItemDendrikBelt) ((ItemDendrikBelt) this.getCurrentDendrikBelt()).loadDendrikBeltStorage(nbt); } } SlotDendrikBelt: package com.kwibble.dendri.inventory; import com.kwibble.dendri.ModuleDendri; import com.kwibble.dendri.entity.player.PlayerInformation; import com.kwibble.dendri.item.ItemDendrikBelt; import com.kwibble.dendri.network.DendriNetwork; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; /** * Created by Kwibble on 25/06/14. */ public class SlotDendrikBelt extends Slot { private PlayerInformation playerinfo; private final ResourceLocation backgroundIcon = new ResourceLocation(ModuleDendri.MODID, "textures/items/master_dendrik_belt.png"); public SlotDendrikBelt(PlayerInformation playerinfo, int par2, int par3, int par4) { super(playerinfo.getInventoryDendrikBelt(), par2, par3, par4); this.inventory.setInventorySlotContents(0, new ItemStack(playerinfo.getCurrentDendrikBelt())); this.playerinfo = playerinfo; } /** * Helper method to put a stack in the slot. * * @param par1ItemStack */ @Override public void putStack(ItemStack par1ItemStack) { super.putStack(par1ItemStack); } /** * Check if the stack is a valid item for this slot. Always true beside for the armor slots. * * @param par1ItemStack */ @Override public boolean isItemValid(ItemStack par1ItemStack) { return (par1ItemStack.getItem() instanceof ItemDendrikBelt); } } SlotMistBottle: package com.kwibble.dendri.inventory; import com.kwibble.dendri.ModuleDendri; import com.kwibble.dendri.item.ItemMistBottle; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; /** * Created by Kwibble on 25/06/14. */ public class SlotMistBottle extends Slot { public SlotMistBottle(InventoryDendrikBelt inventoryDendrikBelt, int par2, int par3, int par4) { super(inventoryDendrikBelt, par2, par3, par4); this.setBackgroundIconTexture(new ResourceLocation(ModuleDendri.MODID, "textures/items/master_dendrik_belt.png")); } /** * Helper method to put a stack in the slot. * * @param par1ItemStack */ @Override public void putStack(ItemStack par1ItemStack) { super.putStack(par1ItemStack); } /** * Check if the stack is a valid item for this slot. Always true beside for the armor slots. * * @param par1ItemStack */ @Override public boolean isItemValid(ItemStack par1ItemStack) { return (par1ItemStack.getItem() instanceof ItemMistBottle); } } And if you need where I am saving my inventory... Here it is in my PlayerInformation (IExtendedEntityProperties): package com.kwibble.dendri.entity.player; import com.kwibble.dendri.ModuleDendri; import com.kwibble.dendri.inventory.InventoryDendrikBelt; import com.kwibble.dendri.item.ItemDendrikBelt; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; public class PlayerInformation implements IExtendedEntityProperties { public static final String IDENTIFIER = ModuleDendri.MODID + "_playerProperties"; private static final String SHOULD_DISPLAY_OVERLAY_IDENTIFIER = IDENTIFIER + "_shouldDisplayOverlay"; private static final String IS_OVERLAY_MINIMIZED_IDENTIFIER = IDENTIFIER + "_isOverlayMinimized"; private static final String CURRENT_DENDRIK_BELT_IDENTIFIER = IDENTIFIER + "_currentDendrikbelt"; public static PlayerInformation forPlayer(Entity player) { return (PlayerInformation) player.getExtendedProperties(IDENTIFIER); } private EntityPlayer player; private boolean isOverlayMinimized; private boolean shouldDisplayOverlay; private InventoryDendrikBelt inventoryDendrikBelt = new InventoryDendrikBelt(); public PlayerInformation(EntityPlayer player) { this.player = player; } @Override public void init(Entity entity, World world) { } @Override public void saveNBTData(NBTTagCompound nbt) { if (this.getCurrentDendrikBelt() == null) { this.setShouldDisplayOverlay(false); } NBTTagCompound compound = new NBTTagCompound(); System.out.println("Saving NBT Data:"); compound.setBoolean(IS_OVERLAY_MINIMIZED_IDENTIFIER, this.isOverlayMinimized); System.out.println("Saved isOverlayMinimized with value of: " + this.isOverlayMinimized); compound.setBoolean(SHOULD_DISPLAY_OVERLAY_IDENTIFIER, this.shouldDisplayOverlay); System.out.println("Saved shouldDisplayOverlay with value of: " + this.shouldDisplayOverlay); this.inventoryDendrikBelt.writeToNBT(compound); System.out.println("Saved currentDendrikBelt with value of: " + this.getCurrentDendrikBelt()); System.out.println("NBT Data Saved"); nbt.setTag(IDENTIFIER, compound); } @Override public void loadNBTData(NBTTagCompound nbt) { NBTTagCompound compound = nbt.getCompoundTag(IDENTIFIER); System.out.println("Loading NBT Data:"); this.isOverlayMinimized = compound.getBoolean(IS_OVERLAY_MINIMIZED_IDENTIFIER); System.out.println("Loaded isOverlayMinimized with value of: " + this.isOverlayMinimized); this.shouldDisplayOverlay = compound.getBoolean(SHOULD_DISPLAY_OVERLAY_IDENTIFIER); System.out.println("Loaded shouldDisplayOverlay with value of: " + this.shouldDisplayOverlay); this.inventoryDendrikBelt.readFromNBT(compound); System.out.println("Loaded currentDendrikBelt with value of: " + this.getCurrentDendrikBelt()); System.out.println("Loaded NBT Data"); if (this.getCurrentDendrikBelt() == null) { this.setShouldDisplayOverlay(false); } } public void setCurrentDendrikBelt(Item belt) { if (belt instanceof ItemDendrikBelt) this.inventoryDendrikBelt.setCurrentDendrikBelt(new ItemStack(belt)); else System.out.println("A Dendrik Belt was not passed in"); } public Item getCurrentDendrikBelt() { return this.inventoryDendrikBelt.getCurrentDendrikBelt(); } public void setIsOverlayMinimized(boolean isOverlayMinimized) { this.isOverlayMinimized = isOverlayMinimized; } public boolean getIsOverlayMinimized() { return this.isOverlayMinimized; } public void setShouldDisplayOverlay(boolean shouldDisplayOverlay) { this.shouldDisplayOverlay = shouldDisplayOverlay; } public boolean getShouldDisplayOverlay() { return this.shouldDisplayOverlay; } public InventoryDendrikBelt getInventoryDendrikBelt() { return this.inventoryDendrikBelt; } } Any and all help is appreciated, thanks!
-
Wrong event bus. Yes,I know. It sucks. Use MinecraftForge.EVENT_BUS.register()
-
That is how you are supposed to do it...
-
Explanation of userProperties and userType minecraft args?
Kwibble replied to Alix_The_Alicorn's topic in Modder Support
Have you tried creating the default IDEA workspace? It generates those configurations for you. Then, you can copy/paste them into your custom workspace.