Jump to content

Recommended Posts

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

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