Jump to content

Recommended Posts

Posted

I have looked into this quite a lot and all the usual errors are not present in my code.

Whole creating a new container and shift-clicking items in or out of the container, the items will leave a ghost item behind. After looking around its mostly the slotObject.onSlotChanged(); area that needs to be added or edited however i already have that code as it should be (i think).

 

Container.class

 

 

  Reveal hidden contents

 

 

any other information can be provided on request.

I am still learning java so please show examples if necessary. I don't like to copy paste code, i like to know what the code does and how it does it.

 

(This is an old mod i plan to update to 1.7.10 once i finished this section of it)

 

Posted

I thought it was a pretty basic class so i haven't looked much into this one.

 

 

  Reveal hidden contents

 

 

actually thinking about it, if this is because of a serverside - clientside issue it may have something to do with my proxy classes. Back when i first started modding having a clommon proxy and a client proxy really messed up the mod i was working on and just kept throwing out errors. removing the classes made the mod work so i paid hem no mind.

Just in case ill include my current client proxy although my common proxy is completly empty apart from the basic public class commonproxy line

 

 

  Reveal hidden contents

 

Posted

No, your GuiHandler looks fine, and the proxies shouldn't have anything to do with it. Are you doing anything out of the ordinary in the Gui class? For reference, this is all you need for a functional container-based gui class.

 

How about your custom IInventory class, anything funky in there?

 

Otherwise, nothing really comes to mind. You do have a lot of unused and unnecessary code in your Container, stuff like:

// using loops for one iteration:
for(int i = 0; i < 1; i++) {
  for(int j = 0; j < 1; j++) {
  }
}

// unused variables:
Slot inSlot = (Slot) this.inventorySlots.get(0);
Slot outSlot = (Slot) this.inventorySlots.get(1);

Posted

Yea there is a lot of unused or unneeded code  while I'm working on it. i generally run optimizations after it actually works so I know i can test other things if what I'm doing isn't working.

 

My GUI class

 

  Reveal hidden contents

 

 

and i don't actually have a custom IInventory class. I was trying to get ISidedInventory working but this lead to some strange issues so i plan to take a look into that later. Right now my TileEntity Class just extends IInventory (net.minecraft)

Posted

I dont Have any IInventory class of my own. am I'm importing the one from net.minecraft.inventory.IInventory

 

I dont know if this will help with solving this but i have uploaded all my source code to my dropbox account so it can be downloaded quickly and easily.

[edited out] Oremanager.zip [/edited out]

Posted

Ok i added the !world.isRemote but still no change, not getting any errors and i have tried it with and without the other pieces of code in that function.

 

 

  Reveal hidden contents

 

Posted
  On 1/15/2015 at 4:33 PM, coolAlias said:

If your TileEntity implements IInventory, then that is your custom inventory class.

 

sorry i literally just realized what you meant by this (i think).

You mean my Tile Entity class IS my IInventory class ? i feel really stupid now :)

Anyway i posted a link to a github with it all on so you can see everything i have. Please ignore any junk code i got rid of the for(int i = 0; i < 1; i++) part already as that was making another part stupid to manage.

Posted
  On 1/15/2015 at 9:04 PM, AceScottie said:

Ok i added the !world.isRemote but still no change, not getting any errors and i have tried it with and without the other pieces of code in that function.

 

 

  Reveal hidden contents

 

 

I dont know what this code is supposed to do at all.

Just use this:

 

 
if(!world.isRemote) {
        TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
        if (tileEntity != null) player.openGui(OreManager.instance, 0, world, x, y, z);
}
        return true;

Posted
  On 1/16/2015 at 7:55 PM, ImaFool said:

 

I dont know what this code is supposed to do at all.

Just use this:

 

 
if(!world.isRemote) {
        TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
        if (tileEntity != null) player.openGui(OreManager.instance, 0, world, x, y, z);
}
        return true;

 

still same, no change at all.

 

Dont know if this helps at all but a few related bugs are:

Shift clicking will put items into  slot2 (if slot1 is full) even though its set not to receive items (cant place them there by normal methods).

Using a hopper with more than 1 item will destroy the stack and only leave 1 item(both on input and output).

 

 

Updated github with new code https://github.com/AceScottie/OreManager

Posted

After a little bit of searching i can safely say the issue im having is with my Container class.

I have found a little code online that i will post below which dose fix the ghost item but, however creates a few of its own.

~Firstly it only accepts ores (this is what i wanted anyway but may have to be modified for others)

~Secondly I can only shift click into the GUI, i cannot shift click them out.

~Lastly The very top left player inventory slot cannot shift click into the GUI

 

There are some lines commented out of the code, these lines were causing me to crash after a little while.

 

 

  Reveal hidden contents

 

 

I am currently in the process of comparing my original code to this one but to make sure ill put my code here

 

  Reveal hidden contents

 

Posted

[sOLVED]

 

The problem was i had too much code :)

I had some left over code after bug ficxing an Item duplication bug (i put 9 slots in a 2 slot GUI).

Fixed it now.

 

In my Container class i have removed the following lines

 

 

  Reveal hidden contents

 

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Yes that’s the full log, I managed to get it working last night, the anvil fix mod is what was causing it to crash
    • Hey guys, i'm currently developping a mod with forge 1.12.2 2860 and i'm using optifine and gradle 4.9. The thing is i'm trying to figure out how to show the player's body in first person. So far everything's going well since i've try to use a shader. The player's body started to blink dark when using a shader. I've try a lot of shader like chocapic, zeus etc etc but still the same issue. So my question is : How should i apply the current shader to the body ? At the same time i'm also drawing a HUD so maybe it could be the problem?   Here is the issue :    And here is the code where i'm trying to display the body :    private static void renderFirstPersonBody(EntityPlayerSP player, float partialTicks) { Minecraft mc = Minecraft.getMinecraft(); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); try { // Préparation OpenGL GlStateManager.enableDepth(); GlStateManager.depthMask(true); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // Éclairage correct pour shaders GlStateManager.enableLighting(); RenderHelper.enableStandardItemLighting(); GlStateManager.enableRescaleNormal(); // Active la lightmap pour les shaders mc.entityRenderer.enableLightmap(); // Position de rendu interpolée double px = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; double py = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; double pz = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; GlStateManager.translate( px - mc.getRenderManager().viewerPosX, py - mc.getRenderManager().viewerPosY, pz - mc.getRenderManager().viewerPosZ ); // Rendu du joueur sans la tête Render<?> render = mc.getRenderManager().getEntityRenderObject(player); if (render instanceof RenderPlayer) { RenderPlayer renderPlayer = (RenderPlayer) render; boolean oldHeadHidden = renderPlayer.getMainModel().bipedHead.isHidden; boolean oldHeadwearHidden = renderPlayer.getMainModel().bipedHeadwear.isHidden; renderPlayer.getMainModel().bipedHead.isHidden = true; renderPlayer.getMainModel().bipedHeadwear.isHidden = true; setArmorHeadVisibility(renderPlayer, false); renderPlayer.doRender(player, 0, 0, 0, player.rotationYaw, partialTicks); renderPlayer.getMainModel().bipedHead.isHidden = oldHeadHidden; renderPlayer.getMainModel().bipedHeadwear.isHidden = oldHeadwearHidden; setArmorHeadVisibility(renderPlayer, !oldHeadwearHidden); } // Nettoyage post rendu mc.entityRenderer.disableLightmap(); GlStateManager.disableRescaleNormal(); } catch (Exception e) { // silent fail } finally { GlStateManager.popAttrib(); GlStateManager.popMatrix(); } }   Ty for your help. 
    • Item successfully registered, but there was a problem with the texture of the item, it did not insert and has just the wrong texture.     
    • Keep on using the original Launcher Run Vanilla 1.12.2 once and close the game Download Optifine and run optifine as installer (click on the optifine jar) Start the launcher and make sure the Optifine profile is selected - then test it again  
    • Hi everyone, I’m hoping to revisit an old version of Minecraft — specifically around Beta 1.7.3 — for nostalgia’s sake. I’ve heard you can do this through the official Minecraft Launcher, but I’m unsure how to do it safely without affecting my current installation or save files. Are there any compatibility issues I should watch out for when switching between versions? Would really appreciate any tips or advice from anyone who’s done this before! – Adam
  • Topics

×
×
  • Create New...

Important Information

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