Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.9] Bug causing ClientSide and ServerSide to use different Containers?


needoriginalname
 Share

Recommended Posts

I am trying to make a backpack like item in my Mod, yet for some reason I been getting index of range errors on my mod, causing my item's behavior to act strangly and never putting items in the backpack.

 

When I tried to look into it, it turns out for some reason on the Client Side the Container class is using the one I made called ContainerStorableItem.  But on the Server Side, it says that it is ContainerCrafting, as if I just opened up my inventory.

 

Any ideas what is going on?

 

Here is a link to my source code on pastebin:

IGuiHander is in CommonProxy: http://pastebin.com/rhk3DX1Z

Container Class, ContainerStorableItem: http://pastebin.com/tte4fZXa

 

PS: currently the new Slot isn't overriding any functions as of yet.

 

 

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • This doesn't make any sense. There is no stack here.
    • Hello, Sorry for writing back again but despite several attempts I did not manage to change/create the tags. They always have the value 0.0 here's my code: package net.the_goldbeards.lootdebugs.Items.Weapons.Drills; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.BlockTags; import net.minecraft.tags.Tag; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.*; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.TorchBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.Tags; import net.the_goldbeards.lootdebugs.util.ModSounds; import net.the_goldbeards.lootdebugs.util.ModTags; import org.jetbrains.annotations.Nullable; import java.util.List; public class DrillsItem extends Item { @Override public int getItemStackLimit(ItemStack stack) { return 1; } public DrillsItem(Properties pProperties, float FUELAMMOUNT) { super(pProperties); ItemStack pStack = new ItemStack(this); pStack.getOrCreateTag().putFloat("lootdebugs.drillfuel", FUELAMMOUNT); } @Override public InteractionResult useOn(UseOnContext pContext) { ItemStack pStack = new ItemStack(pContext.getPlayer().getItemInHand(pContext.getHand()).getItem()); pStack.getOrCreateTag().putFloat("lootdebugs.drillfuel", 12f);//Debug return InteractionResult.PASS; } @Override public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List<Component> pTooltipComponents, TooltipFlag pIsAdvanced) { Float val = pStack.getOrCreateTag().getFloat("lootdebugs.drillfuel"); pTooltipComponents.add(new TextComponent(val.toString())); } }   Thanks
    • Just a gradle plugin that can use yarn mapping for forge developing
    • Well, it's ok. Caused by the modid shouldn't include "-". Replaced with "_"
    • You registered something to the event bus, but it has no event handler methods. So nothing happens. Use OverlayRegistry to add something to the HUD.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.