Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hey Guys, i have some problems,

I created some methods, that could handle every specific Recipe a minecraft Modder will ever need, maybe more. Everything works really fine, but my problem is, the Input Handler(The Handler, which Handles the Input Slots, so it removes the items after crafting) removes the Items not really good, I think its a problem between Server and Client syncing, it decreases the Item stacksize not correctly, and in fact, when it crafts with NBT, it deletes the NBT after crafting, but I really have no Idea how to fix this.

I cant show you the howl code, because you probably may need more than 5 hour so understand this.

 

public final ItemStack addInputSlotManager(ItemStack[] slots, int inputSlotArrayNumber){
	ItemStack itemstack = slots[inputSlotArrayNumber];
	boolean flag = false;
	if(getWorkingItemBasedRecipe(slots) != -1 && System.currentTimeMillis() -10 > lastCrafted && !(System.currentTimeMillis()-50 > lastCrafted)){

		for(int a = 0; a < slots.length; a++){
			if(a > slots.length - outPutSlots){
				if(slots[a] == null){
					flag = true;
					System.out.println("Yolo");
				}
			}		
		}
		if(flag && slots[inputSlotArrayNumber] != null){
			itemstack.stackSize -= itemBasedInputSlotDecrease[getWorkingItemBasedRecipe(slots)][inputSlotArrayNumber];
			if(itemstack.stackSize <= 0){
				return null;
			}
		}
	}else{
		if(getWorkingItemGroupBasedRecipe(slots) != -1){

			if(System.currentTimeMillis() -10 > lastCrafted){

				if(!(System.currentTimeMillis()-50 > lastCrafted)){

					for(int a = 0; a < slots.length; a++){
						if(a >= slots.length - 1){
							if(slots[a] == null){
								flag = true;
								System.out.println("yolo");
							}
						}		
					}
				}
			}



			if(flag && slots[inputSlotArrayNumber] != null){
				itemstack.stackSize -= itemGroupBasedInputSlotDecrease[getWorkingItemGroupBasedRecipe(slots)][inputSlotArrayNumber];
				if(itemstack.stackSize <= 0){
					return null;
				}
			}
		}
	}
	return itemstack;	
}

 

Some code that handles NBT Crafting

if(itemGroupBasedRecipeInput[l][m - outPutSlots] != null){
						for(int v = 0; v < itemGroupBasedRecipeInput[l][m - outPutSlots].getItemLength(); v++){
							itemGroupBasedfinalItemStacks[l][m][v] = new ItemStack(Items.diamond_horse_armor);
							System.out.println("\t\t\t\t\t ----------");
							System.out.println(itemGroupBasedfinalItemStacks[l][m][v] + "\t" + l + "\t" + m + "\t" + v);
							itemGroupBasedfinalItemStacks[l][m][v].stackSize = itemGroupBasedRecipeOutputStackSize[l][m];
							if(itemGroupBasedNBTagFlag[l][m] == true && itemGroupBasedRecipeInput[l][m - outPutSlots] != null){
								itemGroupBasedfinalItemStacks[l][m][v].stackSize = 1;
								itemGroupBasedfinalItemStacks[l][m][v].stackTagCompound = new NBTTagCompound();
								for(int n = 0; n < itemGroupBasedMaxNBTTagStringsOnSlot; n++){
									try{
										itemGroupBasedfinalItemStacks[l][m][v].stackTagCompound.setString(n+"", itemGroupBasedOutputNBTString[l][slots.length - 1 - m][n]);
									}catch(Exception e){
									}
								}
							}
						}

 

The Tile Entity update Code

 

this.slots[0] = rh.addInputSlotManager(slots, 0);
	this.slots[1] = rh.addInputSlotManager(slots, 1);
	if(slots[2] == null && rh.getWorkingItemGroupBasedRecipe(slots) != -1 && System.currentTimeMillis() -10 > lastCrafted && !(System.currentTimeMillis()-50 > lastCrafted)){
		System.out.println("Gecraftet");
	}

	this.slots[2] = rh.addOutputSlotManagerforItemBase(slots, 2);
	if(rh.getWorkingItemGroupBasedRecipe(slots) != -1){
		lastCrafted = System.currentTimeMillis();
	}

 

Ignore those Yolos :D They are just for me, to look when it does this :D

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.