CraftTweaker

CraftTweaker

151M Downloads

Assistance required

bookerthegeek opened this issue · 13 comments

commented

Heyo!

Tis I. And I for the life of me can not figure out what I am messed up in this script. If you could so kindly take a quick look and let me know where I went wrong that would be greatly appreciated. The other recipes.remove(); sections are commented out till I can get the script to actually work.

Script used

Uploaded to GIST

Crafttweaker.log file

[INITIALIZATION][CLIENT][INFO] CraftTweaker: Building registry
[INITIALIZATION][CLIENT][INFO] CraftTweaker: Successfully built item registry
[INITIALIZATION][CLIENT][INFO] Loading scripts
[INITIALIZATION][CLIENT][INFO] [crafttweaker | SIDE_CLIENT]: Loading Script: {[0:crafttweaker]: IronChests.zs}
[INITIALIZATION][CLIENT][ERROR] [crafttweaker | SIDE_CLIENT]: Error parsing VoidOf Chests.zs:76 -- ; expected
[INITIALIZATION][CLIENT][INFO] Completed script loading in: 295ms
[SERVER_STARTED][CLIENT][INFO] Fixed the RecipeBook

Affected Versions (Do not use "latest"):

  • Minecraft: 1.12.2
  • Forge: 1.12.2-14.23.2.2624
  • Crafttweaker: 1.12-4.1.6
  • Modtweaker 4.0.8
  • MTLib 3.0.4
commented
commented

Tried that. It then tells me the = is not allowed.

commented

Change p to be a var, or just get rid of p all together since you only use it in two places (line 80 and 86)

then change it to use =

if that still doesn't work, remove the brackets ( ) from the if statements, since they don't need them

commented

I count one more close-brace than open-brace. Is that the kind of thing that would confuse it?

commented

That could be it, on line 89

commented

Ok,
@Ommina, that is a good catch, got that removed.

@jaredlll08, I changed removed the brackets, changed p to a var and then the == to =, and I get the following when I restart or run /ct syntax

[SERVER_STARTED][SERVER][ERROR] IronChests.zs:69 > value cannot be changed
[SERVER_STARTED][SERVER][ERROR] IronChests.zs:70 > operator not supported
[SERVER_STARTED][SERVER][ERROR] IronChests.zs:78 > operator not supported
[SERVER_STARTED][SERVER][ERROR] IronChests.zs:80 > operator not supported
[SERVER_STARTED][SERVER][ERROR] IronChests.zs:83 > operator not supported
[SERVER_STARTED][SERVER][ERROR] IronChests.zs:85 > operator not supported

If I leave the == in there I get

[SERVER_STARTED][SERVER][ERROR] [crafttweaker | SIDE_CLIENT]: Error parsing IronChests.zs:77 -- ; expected

The corresponding code (first line is line 69)

if i = 0 {
	recipes.addShaped(boxChest[i], [
		[oreDictPlates[i],	oreDictPlates[i],	oreDictPlates[i]],
		[oreDictPlates[i],	<ore:chestWood>,	oreDictPlates[i]],
		[oreDictPlates[i],	oreDictPlates[i],	oreDictPlates[i]]]);
	}
#	Upgrade Chest recipes
if i > 0 {
	var p = i - 1;
	recipes.addShaped(boxChest[i], [
		[oreDictPlates[i],	oreDictPlates[i],	oreDictPlates[i]],
		[oreDictPlates[i],	boxChest[p],		oreDictPlates[i]],
		[oreDictPlates[i],	oreDictPlates[i],	oreDictPlates[i]]]);
#	Secondary Upgrade Chest recipes
	recipes.addShaped(boxChest[i], [
		[<ore:blockGlass>,	oreDictPlates[i],	<ore:blockGlass>],
		[oreDictPlates[i],	boxChest[p],		oreDictPlates[i]], 
		[<ore:blockGlass>,	oreDictPlates[i],	<ore:blockGlass>]]);
	}
}

If I removed the p completely, how would I go about implementing using the previous chest as the center item in the recipe without adding it as another line in the var ironChests?

commented

so when I said remove == I meant remove p ==, the first if statement should use ==

and you could just replace all uses of p with i-1

if i == 0 {
	recipes.addShaped(boxChest[i], [
		[oreDictPlates[i],	oreDictPlates[i],	oreDictPlates[i]],
		[oreDictPlates[i],	<ore:chestWood>,	oreDictPlates[i]],
		[oreDictPlates[i],	oreDictPlates[i],	oreDictPlates[i]]]);
	}
#	Upgrade Chest recipes
if i > 0 {
	var p = i - 1;
	recipes.addShaped(boxChest[i], [
		[oreDictPlates[i],	oreDictPlates[i],	oreDictPlates[i]],
		[oreDictPlates[i],	boxChest[p],		oreDictPlates[i]],
		[oreDictPlates[i],	oreDictPlates[i],	oreDictPlates[i]]]);
#	Secondary Upgrade Chest recipes
	recipes.addShaped(boxChest[i], [
		[<ore:blockGlass>,	oreDictPlates[i],	<ore:blockGlass>],
		[oreDictPlates[i],	boxChest[p],		oreDictPlates[i]], 
		[<ore:blockGlass>,	oreDictPlates[i],	<ore:blockGlass>]]);
	}
}

this code should hopefully work :)

commented

Using that snippet, I get...

[SERVER_STARTED][SERVER][ERROR] IronChests.zs:70 > operator not supported
[SERVER_STARTED][SERVER][ERROR] IronChests.zs:78 > operator not supported
[SERVER_STARTED][SERVER][ERROR] IronChests.zs:80 > operator not supported
[SERVER_STARTED][SERVER][ERROR] IronChests.zs:83 > operator not supported
[SERVER_STARTED][SERVER][ERROR] IronChests.zs:85 > operator not supported

New Gist

commented

Hmm I think it's related to missing the name parameter since you work on 1.12

//pre-1.12
recipes.addShaped(output,inputs,function,action);

//1.12
recipes.addShaped(name,output,inputs,function,action);
commented

@Guinaro not required as it is automatically assigned one when the script works correctly.

commented

@bookerthegeek Well the information is contradictory at one place it says required:
Notes On 1.12

On 1.12, each added recipe requires a UNIQUE identifier, because the forge dev team wanted it that way.
This means, all add functions now require an additional parameter name at the start (which cannot be omitted).

Further on you then read this:
name is a string and needs to be unique but is also optional

Just thought I would mention it. Even when docs says so, bugs do happen.

Have you tried to declare your Input ingredients as an IIngredient or IItemStack[][]. Probably won't make a difference, but I have come to assume it is better to declare unnecessary than expecting of Zenscript to make the right call.

commented

@bookerthegeek
Error is that you are using an indexof operator on an IItemStack:

var ironChests as IItemStack[][] =[

//ChestList is an IItemStack[]
for i, chestList in ironChests {

//boxChest is an IItemStack
var boxChest =		chestList[0];


//Later
//You cannot indexOf an IItemStack
boxChest[p],
commented

Thank you, sorry for the late response. That was it.