Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • StackSize porting mod error 1.12.2
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
richie995

StackSize porting mod error 1.12.2

By richie995, June 26, 2019 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

richie995    0

richie995

richie995    0

  • Tree Puncher
  • richie995
  • Members
  • 0
  • 4 posts
Posted June 26, 2019

I'm porting mob properties from 1.10.2 to 1.12.2 in eclipse and I've received the following error 

Spoiler
 
 
 
Spoiler

private int removeDrop(final Item item, final int damage, int count, final boolean infinite, final List<EntityItem> drops) {
        final Iterator<EntityItem> iterator = drops.iterator();
        while (iterator.hasNext()) {
            final EntityItem drop = iterator.next();
            final ItemStack dropStack = drop.getItem();
            if (item == dropStack.getItem() && (damage < 0 || damage == dropStack.getItemDamage())) {
                if (infinite) {
                    iterator.remove();
                }
                else {
                    count += dropStack.stackSize;
                    if (count < 0) {
                        iterator.remove();
                    }
                    else {
                        if (count == 0) {
                            iterator.remove();
                            return 0;
                        }
                        dropStack.stackSize = count;
                        drop.setEntityItemStack(dropStack);
                        return 0;

I'm relatively new to porting mod, so I'm unsure of what to do. The bolded functions are ones highlighted in red in eclipse. For the error "setEntityItemStack" when hovered over it says "The method setEntityItemStack(ItemStack) is undefined for the type EntityItem" and when hovering over "stacksize" it says "The field ItemStack.stackSize is not visible" I'm unsure of how to fix this error, and could use some help

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7595

diesieben07

diesieben07    7595

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7595
  • 55088 posts
Posted June 26, 2019

To get the size of an ItemStack use getCount. To modify it use setCount, grow and shrink.

To set the ItemStack of an EntityItem use setItem.

 

In the future please use your IDE to look at the code, these things are very easy to find.

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • diesieben07
      game launch fail

      By diesieben07 · Posted 25 minutes ago

      User was banned for piracy. Buy the game.
    • C0nnieD
      game launch fail

      By C0nnieD · Posted 34 minutes ago

    • diesieben07
      [1.16.4] what difference between custom slots and EquipmentSlotType

      By diesieben07 · Posted 47 minutes ago

      LazyOptional is just that: An optional value that is computed lazily.   No, you need to create a combined IItemHandler by using CombinedInvWrapper. This should not happen inside getCapability, you should create this handler and the LazyOptional once (in your class' constructor) and then just return the value in getCapability.
    • diesieben07
      game launch fail

      By diesieben07 · Posted 48 minutes ago

      That log does not even contain Forge. Please post a screenshot of your logs folder.
    • Klarks
      [1.16.4] what difference between custom slots and EquipmentSlotType

      By Klarks · Posted 53 minutes ago

      Do i need to return a list of ItemHandlers?
  • Topics

    • C0nnieD
      13
      game launch fail

      By C0nnieD
      Started 3 hours ago

    • Klarks
      18
      [1.16.4] what difference between custom slots and EquipmentSlotType

      By Klarks
      Started 8 hours ago

    • juggler
      0
      Modded server stall on startup

      By juggler
      Started 1 hour ago

    • rennmaus
      1
      gradlew build file too small (forge 1.12.2)

      By rennmaus
      Started 3 hours ago

    • Shinzu🖤
      1
      Ive been trying to make my own server and whenever i run the command that microsoft/minecraft gave me it just says the following

      By Shinzu🖤
      Started 3 hours ago

  • Who's Online (See full list)

    • kiou.23
    • diesieben07
    • MemeMan
    • Saksham4106
    • Draco18s
    • juggler
    • Warsade
    • ElpisII
    • gottsch
    • Webberjo
    • merlin
    • C0nnieD
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • StackSize porting mod error 1.12.2
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community