Make items glitchy and unstackable???

Discussion in 'Plugin Development' started by CookCreeperz, Sep 5, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    CookCreeperz

    Please help I really need this and I can't setup the constructor from the API docs.
     
  2. I don't even know what you really want, so first explain what you want before you ask for help:p
     
  3. Offline

    CookCreeperz

    Ok so I want items to be unstackable!
     
  4. all items, only wood, only cobblestone?
     
  5. Offline

    CookCreeperz

    No like apples,wheat,paper,cocoa beans
     
  6. what did you tried so farm, you cant accept from us that we will write code for you, whitout something you tried by your own
     
  7. Offline

    MrFigg

  8. Offline

    Malikk

    It's pretty easy, just simple reflection.
     
  9. Offline

    CookCreeperz

    Trying This code:

    1. @Override
    2. public void onEnable(){
    3. Field field=net.minecraft.server.Item.class.getDeclaredField("maxStackSize");
    4. field.setAccessible(true);
    5. field.setInt(net.minecraft.server.Item.ENDER_PEARL, 64);
    6. }
    7. }

    Ok guys, Got This:
    Code:
    package me.Jordan.Stackables;
     
     
    import java.lang.reflect.Field;
     
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class main extends JavaPlugin{
     
    @Override
    public void onDisable(){
     
    }
     
    @Override
    public void onEnable(){
    Field field=net.minecraft.server.Item.class.getDeclaredField("maxStackSize");
      field.setAccessible(true);
      field.setInt(net.minecraft.server.Item.ENDER_PEARL, 1);
     
          }
    }
    But, Eclipse is saying surround with try/catch. I've seen this before but what do I do?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  10. Offline

    MrFigg

  11. Offline

    CookCreeperz

    I still don't get it. Sorry I'm a noob. I just really need this. My code from what you gave me,
    Code:
    @Override
    public void onEnable(){
    }try
    Field field=net.minecraft.server.Item.class.getDeclaredField("maxStackSize");
      field.setAccessible(true);
      field.setInt(net.minecraft.server.Item.APPLE, 1);
    }catch{
    field.setInt(net.minecraft.server.Item.APPLE, 1);
     
          }
    }
    With Errors.

    This sorta works in-game but only unstacks when you move it with your mouse.
    Code:
    @Override
    public void onEnable(){
    Field field = null;
    try {
        field = net.minecraft.server.Item.class.getDeclaredField("maxStackSize");
    } catch (NoSuchFieldException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (SecurityException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
      field.setAccessible(true);
      try {
        field.setInt(net.minecraft.server.Item.APPLE, 1);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
     
          }
    }
    
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  12. Offline

    MrFigg

    Code:
    try {
                Field field = net.minecraft.server.Item.class.getDeclaredField("maxStackSize");
                field.setAccessible(true);
                field.setInt(net.minecraft.server.Item.ENDER_PEARL, 1);
            } catch (SecurityException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (NoSuchFieldException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
     
  13. Offline

    CookCreeperz

    Only unstacks when you move it.
     
  14. Offline

    MrFigg

    Any ItemStacks that already exist will still have the old max, but you shouldn't be able to combine them after this is implemented. If it's really a problem you'd have to go through all the ItemStacks in every players inventory manually and unstack them.
     
  15. Offline

    CookCreeperz

    Thanks For Your Help! I Appreciate It.
    -CookCreeperz
     
  16. Offline

    TheSmallBones

    I've said it before and I'll say it again. You keep making threads on how to replicate things in MineZ such as this. If you really wanna copy MineZ then just make a thread saying "How do I copy MineZ?"...
     
    Tirelessly and Squish000 like this.
  17. Offline

    CookCreeperz

    I made fast zombies, custom commands, chests that disappear and come back. And Glitchy items, which I'm testing.
    Some helped me with random spawn though.
     
  18. Wtf is MineZ, i never ever heard of it...
     
  19. Offline

    makskay

    blackwolf12333 likes this.
  20. Offline

    TheSmallBones

    Great job. Tons of other people here know how to do this within a few minutes. The only difference from you to them is they are not trying to copy MineZ without any knowledge.
     
  21. Offline

    CookCreeperz

    Ok whatever you say, thanks for the opinion though!
     
    blackwolf12333 likes this.
Thread Status:
Not open for further replies.

Share This Page