Jump to content

[1.19.4] limit stack size to 1 for Item and for Block


perromercenary00

Recommended Posts

im updating mi briefcase item to 19.4 
i t has two parts an item whit a menu and a block whit a menu that spawn when shift right click on the floor 
i wanna limit this to only one for slot that's max stack size = one 

seems to have not this value and items says its deprecated use another thing 

	@Deprecated // Use ItemStack sensitive version.
public final int getMaxStackSize() {
return this.maxStackSize;
}
	

 

???

how do i set stack limits now 

Link to comment
Share on other sites

On 6/2/2023 at 8:00 AM, ChampionAsh5357 said:

Is this for the SlotItemHandler? If so, then just add the one with the ItemStack param. Regardless though, I don't see that deprecation warning.

no this is in the item class or in the block class in old version you set the limit of the stack size in the constructor 

 

Spoiler

				
			package mercenarymod.items.espadas;				
			
		import mercenarymod.materialesMercenarios;
		import mercenarymod.Mercenary;
		import net.minecraft.block.material.Material;
		import net.minecraft.creativetab.CreativeTabs;
		import net.minecraft.item.ItemSword;
		import net.minecraft.item.ItemHoe;
		import net.minecraft.item.ItemSpade;
		import net.minecraft.item.ItemPickaxe;
		import net.minecraft.item.Item;
		import net.minecraft.item.ItemAxe;
		import net.minecraftforge.fml.common.registry.GameRegistry;				
			public class espada extends ItemSword {
		  
		    public espada( Item.ToolMaterial mat, String name ) {
		        super(mat);				
			        setUnlocalizedName(Mercenary.MODID + "_" + name);
		        GameRegistry.registerItem(this, name);
		        setCreativeTab(Mercenary.herramientas);
		        this.maxStackSize = 1; <----------------------				
			    }
		}				
			

 

 

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

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