CraftTweaker

CraftTweaker

151M Downloads

.transformReplace / .giveBack corner cases

flapee opened this issue · 31 comments

commented

Having this recipe
recipes.addShapeless(plank, [sign.giveBack(woodShard)]);

and using just one sign in crafting, i get plank + shard in the inventory
but when using 2 signs, I get just plank + shard in the inventory as opposed to what it should have been: 2 planks + 2 shards

another recipe:
recipes.addShaped(plank, [[sign.giveBack(woodShard), sign, sign]]);

after crafting (sign, sign, sign ) I get:
plank + shard,
but the crafting grid shows still shows in place of the second and third place sign and red 0
shilst after removing on of thouse, one can still craft with the 0sign an item :D ?!

after crafting (2signs, 2signs, sign ) I get:
plank + shard,
but the first 2 signs get consumed, the second one remain in tact and the third chaneg to 0sign

side note: my end-goal is to be able to output multiple items in (de)crafting recipes, while the recipes would work for multiples of the ingredients

MC1.10.2
Forge:12.18.1.2011
CT/MT3: 1.10.2-3.0.13

commented

:( no change in either case

On Sun, Oct 30, 2016 at 5:07 PM, Jared [email protected] wrote:

try this version
http://blamejared.com:8080/job/CraftTweaker/37/


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-257160160,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWFHS7qzXIgyp8d-USHoK0Rtkr1uJ5twks5q5MDZgaJpZM4Kkadk
.

Peter Flachbart

commented

are you using shift clicking when crafting?

commented

either way; with(out) shift the result is the same

On Sun, Oct 30, 2016 at 5:16 PM, Jared [email protected] wrote:

are you using shift clicking when crafting?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-257160712,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWFHS8xv4q6hHZafoGTWegsBoDASeWUUks5q5ML5gaJpZM4Kkadk
.

Peter Flachbart

commented

ok, can you clarify more? because you just contradicted yourself...
"but when using 2 signs, I get just plank + shard in the inventory as opposed to what it should have been: 2 planks + 2 shards"
how would you use 2 signs if you arn't shift clicking? pictures would be nice :)

commented

oh, if not shift clicking, the remaining resources(1sign) should stay in
the crafting grid, but it does not

now pics:
crafting 1 sign / result vs 2 sign crafting / result

[image: Inline image 2][image: Inline image 3]
[image: Inline image 4][image: Inline image 5]

On Sun, Oct 30, 2016 at 5:22 PM, Jared [email protected] wrote:

ok, can you clarify more? because you just contradicted yourself...
"but when using 2 signs, I get just plank + shard in the inventory as
opposed to what it should have been: 2 planks + 2 shards"
how would you use 2 signs if you arn't shift clicking? pictures would be
nice :)


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-257161061,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWFHSwvPbuFjAObPJ5zIju6GVTNzSvBBks5q5MRjgaJpZM4Kkadk
.

Peter Flachbart

commented

yea, you are going to have to upload those to imgur or something, not showing

commented

there you go:
http://imgur.com/a/vA7Z8

On Sun, Oct 30, 2016 at 5:39 PM, Jared [email protected] wrote:

yea, you are going to have to upload those to imgur or something, not
showing


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-257161994,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWFHS1ajzFZ9023LBN93skOA_Bg3tcxMks5q5MhUgaJpZM4Kkadk
.

Peter Flachbart

commented

that tells me literally nothing, besides that it works with one item

commented

when i put 2signs in crafting grid and click (with or without shift) on the
shown result(plank) i end up with 1 shard and one plank and the 2signs are
gone

let me know if (and how) you need it be illustrated some other way

On Sun, Oct 30, 2016 at 5:56 PM, Jared [email protected] wrote:

that tells me literally nothing, besides that it works with one item


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-257163156,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWFHS9MgD7_5V7LJdMqGDHJJjN5iJZbXks5q5MxMgaJpZM4Kkadk
.

Peter Flachbart

commented

ok yea, was actually fixing that now, thanks for the info

commented

Build #37 has a new bug ( which is not present
in CraftTweaker-1.10.2-3.0.13 )

with recipe:
recipes.addShaped(plank, [[sign,flint.transformReplace(flint)]]);
one would expect the flint to stay in the crafting table, which with build
#37 is not the case, the flint gets lost

On Sun, Oct 30, 2016 at 6:10 PM, Jared [email protected] wrote:

ok yea, was actually fixing that now, thanks for the info


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-257164012,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWFHS2-dkVtHibuq910JIpTO4Ryrz0hSks5q5M-ggaJpZM4Kkadk
.

Peter Flachbart

commented

build #35
recipes.addShaped(plank, [[sign,flint.transformReplace(flint)]]); - no bug

rest of it still the same

On Sun, Oct 30, 2016 at 9:13 PM, Jared [email protected] wrote:

try http://blamejared.com:8080/job/CraftTweaker/35/ please


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-257175853,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWFHS38Ps9f2znqSNTF6Yp3mSCODWpbuks5q5PqFgaJpZM4Kkadk
.

Peter Flachbart

commented

ok, I need to revert the changes I did in 36

commented

Does the stencil return on normal non minetweaker recipes?

On Oct 31, 2016 12:35 AM, "flapee" [email protected] wrote:

another issue:
recipes.addShapeless(stick, [pattern.giveBack(woodShard)]);

while working with TiC stencil table, creating patter i receive the
woodShard on top of the chosen patter XD ?!

On Sun, Oct 30, 2016 at 11:17 PM, Jared [email protected] wrote:

ok, I need to revert the changes I did in 36


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-
257183702>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/
AWFHS6gEn31oFadvzMsd9bhS4MxzowN3ks5q5Rd2gaJpZM4Kkadk>
.

Peter Flachbart


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-257184821,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFS9xTAE0nM_eAfoWy7Nj3fp4GTtzda_ks5q5Ru7gaJpZM4Kkadk
.

commented

another issue:
recipes.addShapeless(stick, [pattern.giveBack(woodShard)]);

while working with TiC stencil table, creating patter i receive the
woodShard on top of the chosen patter XD ?!

On Sun, Oct 30, 2016 at 11:17 PM, Jared [email protected] wrote:

ok, I need to revert the changes I did in 36


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-257183702,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWFHS6gEn31oFadvzMsd9bhS4MxzowN3ks5q5Rd2gaJpZM4Kkadk
.

Peter Flachbart

commented

none of the pattern recipes in regards to stencil table can be looked up in
JEI/NEI ( as if that was a separate pool of recipes )
the original recipe goes as this
pattern -> pattern
while the resulting pattern gets its TAG changed based on the chosen pattern

same thing happens if you get two recipes (for crafting table) with same
inputs and one of the recipes uses giveBack

On Sun, Oct 30, 2016 at 11:36 PM, Jared [email protected] wrote:

Does the stencil return on normal non minetweaker recipes?

On Oct 31, 2016 12:35 AM, "flapee" [email protected] wrote:

another issue:
recipes.addShapeless(stick, [pattern.giveBack(woodShard)]);

while working with TiC stencil table, creating patter i receive the
woodShard on top of the chosen patter XD ?!

On Sun, Oct 30, 2016 at 11:17 PM, Jared [email protected]
wrote:

ok, I need to revert the changes I did in 36


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-
257183702>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/
AWFHS6gEn31oFadvzMsd9bhS4MxzowN3ks5q5Rd2gaJpZM4Kkadk>
.

Peter Flachbart


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-
257184821>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFS9xTAE0nM_
eAfoWy7Nj3fp4GTtzda_ks5q5Ru7gaJpZM4Kkadk>
.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-257184890,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWFHSxDs3rieQXi-GvC_9uJMTrnAtsgpks5q5Rv8gaJpZM4Kkadk
.

Peter Flachbart

commented

few more oddities:
recipes.addShapeless(pattern, [partBuilder.giveBack(null) ]); // gives back partBuilder

recipes.addShapeless(pattern, [partBuilder.transformReplace(null) ]); // NPE
recipes.addShapeless(pattern, [partBuilder.transformReplace(woodShard) ]);
transformation results in 2 woodShards instead of just one

commented

there might be other things at play:
recipes.addShaped(plank, [[sign, breaker.reuse()]], function(output, inputs, crafting) {
crafting.player.sendChat("executed");
crafting.player.give(minecraft:stick);
return output;
});

just putting the resources into crafting results in seeing "executed" in chat, twice,
but player inventory receives a stick, then when actual crafting occurs, same situation occurs;
in the end chat log contains 4x "executed" and players inventory 2x stick.

its understandable that the function needs to be called multiple times,
but why the player inventory modification is withheld only sometimes ...
this might be the root of all the issues

commented

jared, it's still buggy, for multiples of ingredients

the answer is the contract of
net.minecraft.inventory.SlotCrafting.onPickupFromSlot

Recipe[i] - recipe cost
Remainder[i] - what remains after crafting, if of different type (than Recipe[i]), returned into inventory/droped
CraftingMatrix - current state of crafting (table, ... )

CraftingMatrix{n}[i] = CraftingMatrix{n-1}[i] - (Recipe[i]/Recipe[i]) + Remain[i]

-- MUST NOT invoke "apply transformations" onPlayerItemCrafted, because of side effects:
-TiC stencil table/etc.. actually invokes onPlayerItemCrafted and transformations get applied even though thay should not have
-TiC crafting station ghosting items

-- "apply transformations" might be used as result for getRemainingItems,
IF their contract changes a bit
-automatic De-bottlink/De-bucketing might be enabled

already got the patch:
fix against build 35.zip

cheeers

commented

Oh, well yesterday I just reverted to what it was before, so not sure if it
works, will have to check

On Nov 6, 2016 7:16 PM, "flapee" [email protected] wrote:

jared, it's still buggy, for multiples of ingredients

the answer is the contract of
net.minecraft.inventory.SlotCrafting.onPickupFromSlot

Recipe[i] - recipe cost
Remainder[i] - what remains after crafting, if of different type (than
Recipe[i]), returned into inventory/droped

CraftingMatrix - current state of crafting (table, ... )

CraftingMatrix{n}[i] = CraftingMatrix{n-1}[i] - (Recipe[i]/Recipe[i]) +
Remain[i]

-- MUST NOT invoke "apply transformations" onPlayerItemCrafted, because of
side effects:
-TiC stencil table/etc.. actually invokes onPlayerItemCrafted and
transformations get applied even though thay should not have
-TiC crafting station ghosting items

-- "apply transformations" might be used as result for getRemainingItems,
IF their contract changes a bit
-automatic De-bottlink/De-bucketing might be enabled

already got the patch:
fix against build 35.zip
https://github.com/jaredlll08/CraftTweaker/files/573969/fix.against.build.35.zip

cheeers


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-258695236,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFS9xRh8omzQtCcJxC_6N79aCRL5_2pOks5q7gt4gaJpZM4Kkadk
.

commented

I just tried making this recipe in CraftTweaker version 3.0.15:

recipes.addShaped(<immersiveengineering:treatedWood>*8,
    [[<ore:plankWood>.noReturn(),<ore:plankWood>.noReturn(),<ore:plankWood>.noReturn()],
     [<ore:plankWood>.noReturn(),<railcraft:fluid_bottle_creosote>.giveBack(<minecraft:glass_bottle>),<ore:plankWood>.noReturn()],
     [<ore:plankWood>.noReturn(),<ore:plankWood>.noReturn(),<ore:plankWood>.noReturn()]]);

Putting 8 planks in each slot and a bottle of creosote in the middle (that is 64 total planks), I get 8 treated wood and a glass bottle, but all of the leftover planks are destroyed, where I should've had 56 planks left (7 in each slot).

Similar happens if you put in more creosote. It destroys the entire stack in the crafting grid and gives you one result (8 treated wood planks, in this case) back.

commented

Remove noReturn and try again

On Nov 22, 2016 3:36 PM, "Andrew Sage" [email protected] wrote:

I just tried making this recipe in CraftTweaker version 3.0.15:

recipes.addShaped(immersiveengineering:treatedWood*8,
[[ore:plankWood.noReturn(),ore:plankWood.noReturn(),ore:plankWood.noReturn()],
[ore:plankWood.noReturn(),railcraft:fluid_bottle_creosote.giveBack(minecraft:glass_bottle),ore:plankWood.noReturn()],
[ore:plankWood.noReturn(),ore:plankWood.noReturn(),ore:plankWood.noReturn()]]);

Putting 8 planks in each slot and a bottle of creosote in the middle (that
is 64 total planks), I get 8 treated wood and a glass bottle, but all of
the leftover planks are destroyed, where I should've had 56 planks left (7
in each slot).

Similar happens if you put in more creosote. It destroys the entire stack
in the crafting grid and gives you one result (8 treated wood planks, in
this case) back.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-262242004,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGHyAvpqOTt9JJVzQcFhyfaw50lkFpKSks5rAu_igaJpZM4Kkadk
.

commented

The problem I was trying to resolve is that by not using noReturn, the recipe doesn't consume the planks; I was getting planks only at the cost of creosote. That problem is/was probably something that Immersive Engineering did it its recipe handler.

commented

Well noReturn removes the hole stack...

On Nov 22, 2016 3:40 PM, "Andrew Sage" [email protected] wrote:

The problem I was trying to resolve is that by not using noReturn, the
recipe doesn't consume the planks; I was getting planks only at the cost of
creosote. That problem is/was probably something that Immersive Engineering
did it its recipe handler.


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-262242919,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFS9xTsnHuQsDD9YwB_bjTznBTkuamwLks5rAvDjgaJpZM4Kkadk
.

commented

The documentation says that noReturn is supposed to suppress the return of an item, like giving back an empty bucket when crafting something with a bucket of water. I don't know why anyone would want to remove the entire stack.

In addition, giveBack is also removing the entire stack.

commented

Jared, please consider the code I have provided,
Even in Andrej's case, the recipe (without using no return ) would work as
expected. Cheers. p

On Tue, Nov 22, 2016 at 2:47 PM, Andrew Sage [email protected]
wrote:

The documentation says that noReturn is supposed to suppress the return of
an item, like giving back an empty bucket when crafting something with a
bucket of water. I don't know why anyone would want to remove the entire
stack.

In addition, giveBack is also removing the entire stack.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-262244337,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWFHS3yguh9m_0YxRlF_Z0wZhHAWkqeZks5rAvJlgaJpZM4Kkadk
.

Peter Flachbart

commented

I thought I fixed that? Got a link to your code?

On Nov 22, 2016 4:17 PM, "flapee" [email protected] wrote:

Jared, please consider the code I have provided,
Even in Andrej's case, the recipe (without using no return ) would work as
expected. Cheers. p

On Tue, Nov 22, 2016 at 2:47 PM, Andrew Sage [email protected]
wrote:

The documentation says that noReturn is supposed to suppress the return
of
an item, like giving back an empty bucket when crafting something with a
bucket of water. I don't know why anyone would want to remove the entire
stack.

In addition, giveBack is also removing the entire stack.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-
262244337>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AWFHS3yguh9m_0YxRlF_
Z0wZhHAWkqeZks5rAvJlgaJpZM4Kkadk>
.

Peter Flachbart


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-262251725,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFS9xV0jEvwxwWB-23N1srvj31oVIsivks5rAvmSgaJpZM4Kkadk
.

commented

see this post:
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-258695236

code in the link at the bottom

Cheers
p

On Tue, Nov 22, 2016 at 3:18 PM, Jared [email protected] wrote:

I thought I fixed that? Got a link to your code?

On Nov 22, 2016 4:17 PM, "flapee" [email protected] wrote:

Jared, please consider the code I have provided,
Even in Andrej's case, the recipe (without using no return ) would work
as
expected. Cheers. p

On Tue, Nov 22, 2016 at 2:47 PM, Andrew Sage [email protected]
wrote:

The documentation says that noReturn is supposed to suppress the return
of
an item, like giving back an empty bucket when crafting something with
a
bucket of water. I don't know why anyone would want to remove the
entire
stack.

In addition, giveBack is also removing the entire stack.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-
262244337>,
or mute the thread
<https://github.com/notifications/unsubscribe-
auth/AWFHS3yguh9m_0YxRlF_
Z0wZhHAWkqeZks5rAvJlgaJpZM4Kkadk>
.

Peter Flachbart


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-
262251725>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFS9xV0jEvwxwWB-
23N1srvj31oVIsivks5rAvmSgaJpZM4Kkadk>

.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jaredlll08/CraftTweaker/issues/71#issuecomment-262251901,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWFHS0dCWkRd9AVoOT53YWyMFhUI9AJKks5rAvm8gaJpZM4Kkadk
.

Peter Flachbart

commented

@flapee implementing your stuff now, you did test it though right?