Jump to content

Mavigno42

Members
  • Posts

    8
  • Joined

  • Last visited

Mavigno42's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. It must be something wrong at my end, later I will figure it out. But can you check if the TileEntity actually works?
  2. New GitHub Repo access: https://github.com/Mavigno42/ModTest
  3. Did the MCP update and updated my code to suit the change public class TileEntityBasicInventory extends TileEntityBase { protected NonNullList<ItemStack> tileEntityContents; protected StackHandler stackHandler; public TileEntityBasicInventory(String name, short numberOfSlots) { super(name, numberOfSlots); tileEntityContents = NonNullList.<ItemStack>withSize(numberOfSlots, ItemStack.EMPTY); stackHandler = new StackHandler(this, numberOfSlots); } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); ItemStackHelper.loadAllItems(compound, this.tileEntityContents); } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); ItemStackHelper.saveAllItems(compound, this.tileEntityContents); return compound; } @Override public boolean hasCapability(Capability<?> capability, EnumFacing enumFacing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return true; return super.hasCapability(capability, enumFacing); } @Override public <T> T getCapability(Capability<T> capability, EnumFacing enumFacing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return (T) stackHandler; return super.getCapability(capability, enumFacing); } } StackHandler public class StackHandler extends ItemStackHandler { private final TileEntityBase tileEntityBase; public StackHandler(TileEntityBase tileEntityBase, int size) { super(size); this.tileEntityBase = tileEntityBase; } @Override protected void onContentsChanged(int slot) { tileEntityBase.markDirty(); } } Nothing changed I actually had to redo my setup and create a new Repo and run setupDecompWorkspace... But the Gradle Idea setup wasn't perfect, I had to manually reassign the Source and Resources Directories.
  4. Tried that, it didn't work, and if did it would be very confusing since I'm handling the getUnlocalizedName. @Override public String getUnlocalizedName(ItemStack itemStack) { if (hasSubtypes && itemStack.getMetadata() < VARIANTS.length) return String.format("item.%s:%s", Reference.MOD_ID, VARIANTS[itemStack.getMetadata()]); else return String.format("item.%s:%s", Reference.MOD_ID, ITEM_BASE_NAME); }
  5. I did the update, but it still the same
  6. I don't know, but I would guess no
  7. 1) I renamed the Lang file to en_us.lang, but it didn't change anything. 2) Changed some things, still doesn't work: public class TileEntityBasicInventory extends TileEntityBase { protected NonNullList<ItemStack> tileEntityContents; protected StackHandler stackHandler; public TileEntityBasicInventory(String name, short numberOfSlots) { super(name, numberOfSlots); tileEntityContents = NonNullList.<ItemStack>func_191197_a(numberOfSlots, ItemStack.field_190927_a); stackHandler = new StackHandler(this, numberOfSlots); } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); ItemStackHelper.func_191283_b(compound, this.tileEntityContents); } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); ItemStackHelper.func_191282_a(compound, this.tileEntityContents); return compound; } @Override public boolean hasCapability(Capability<?> capability, EnumFacing enumFacing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return true; return super.hasCapability(capability, enumFacing); } @Override public <T> T getCapability(Capability<T> capability, EnumFacing enumFacing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return (T) stackHandler; return super.getCapability(capability, enumFacing); } } StackHandler class public class StackHandler extends ItemStackHandler { private final TileEntityBase tileEntityBase; public StackHandler(TileEntityBase tileEntityBase, int size) { super(size); this.tileEntityBase = tileEntityBase; } @Override protected void onContentsChanged(int slot) { tileEntityBase.markDirty(); } } The Log - (from World Start to World Close) MinecraftLog.txt I didn't Push the changes to the GitHub access by the way.
  8. Just a heads up: english is not my native language, I'm new to Java therefore to Minecraft modding too and I'm following as base the EE3 and MinecraftByExample Codes as well as McJty Wiki (http://wiki.mcjty.eu/modding/index.php/Main_Page); OBS.: McJty's Code it's actually ported to 1.10.2 and I use it to understand the How's to make a TileEntity with GUI and a Inventory. Right now I have two errors, at least that it´s all think I have. NUMBER 1: I've been struggling with localization. Basically it was all fine until I tried to upgrade my ItemBase.class (it's package "com.mavigno.modtest.common.items.base") so I would be able to add ItemVariants too my Mod, now nothing seems to be localized any more; NUMBER 2: In the past couple weeks I've been trying to make a TIleEntity that can hold Items and have a GUI, like a Chest. I got everything set and ready, but the TileEntity won't save it's content on a world close. Container related classes are in this package "com.mavigno.modtest.client.gui.container.base", "com.mavigno.modtest.client.gui.GuiBasicInventory" is the class responsable for drawing the GUI, everything related to how I'm handling TileEntities it's ih this package "com.mavigno.modtest.tileentity", GuiHandler "com.mavigno.modtest.handler.GuiHandler". IDE: IntellijIDEA 2017.1; Forge Version: 1.11-13.19.1.2189; Minecraft Version: 1.11; Java: 1.8; GitHub Access to the Code: https://github.com/Mavigno42/ModTest; Anything out of common please point out, this Mod is attempt of trying to learn how to actually do it!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.