I have a freezer (iron block) that opens a hopper inventory when you right click it. I want to be able to put an item in the freezer and track how long it is in for so that I can freeze it once it has been inside for long enough. I can't find any expressions about the time an inventory slot has been set for and I can't think of any ways of doing it.
Skript Version: 2.7.0-beta2
Skript Author: Bensku
Minecraft Version: 1.19.4
Full Code:
Edit: I thought of a way to do it and i wrote some code, but whenever the player closes the inventory it loses track of the time.
new code:
[doublepost=1684710559,1684635646][/doublepost]it works guys, i did it. i really want to thank the 22 people that saw what i was asking and gave up. heres the code incase yall weird ass mfs want a meth freezer
Skript Version: 2.7.0-beta2
Skript Author: Bensku
Minecraft Version: 1.19.4
Full Code:
Code:
on rightclick on iron block:
if {statuscook::%location of event-block%} is true:
cancel event
open a hopper inventory named "%location of event-block%" to the player
loop integers from 0 to 4:
set slot loop-value of player's current inventory to {freezer::%loop-value%::%name of player's current inventory%}
else if name of player's held item is "&9Cook Hammer":
cancel event
set {statuscook::%location of event-block%} to true
send "&5This is now a freezer." to the player
on inventory close:
event-inventory's type is a hopper inventory
loop integers from 0 to 4:
set {freezer::%loop-value%::%name of event-inventory%} to slot loop-value of event-inventory
Edit: I thought of a way to do it and i wrote some code, but whenever the player closes the inventory it loses track of the time.
new code:
Code:
on rightclick on iron block:
name of player's held item isn't "&9Debug Axe"
if {statuscook::%location of event-block%} is true:
cancel event
open a chest inventory with 1 row named "&9Freezer" to the player
set {_i} to "%location of event-block%"
set slot 0 of player's current inventory to light gray stained glass pane named "%{_i}%"
set slot 1 of player's current inventory to light gray stained glass pane named "%{_i}%"
set slot 7 of player's current inventory to light gray stained glass pane named "%{_i}%"
set slot 8 of player's current inventory to light gray stained glass pane named "%{_i}%"
loop integers from 2 to 6:
set slot loop-value of player's current inventory to {freezer::%loop-value%::%{_i}%}
else if name of player's held item is "&9Cook Hammer":
cancel event
set {statuscook::%location of event-block%} to true
send "&5This is now a freezer." to the player
on inventory close:
event-inventory's type is a chest inventory with 1 row named "&9Freezer"
set {_i} to name of slot 0 of event-inventory
loop integers from 2 to 6:
set {freezer::%loop-value%::%{_i}%} to slot loop-value of event-inventory
on inventory click:
event-inventory's name is "&9Freezer"
if the clicked slot is light gray stained glass pane:
cancel event
stop
else if clicked slot is air:
cursor slot of player is clay ball named "&9Meth Sludge"
if item size of cursor slot of player is greater than 1:
send "&5Please move items one at a time" to the player
cancel event
else:
wait 1 tick
set {_i} to 0
while clicked slot is clay ball named "&9Meth Sludge":
wait 1 second
add 1 to {_i}
if {_i} is greater than 5:
set clicked slot to prismarine shard named "&9Meth Crystal"
stop
else if cursor slot of player is not air:
send "&5Please move items one at a time" to the player
cancel event
Code:
on rightclick on iron block:
name of player's held item isn't "&9Debug Axe"
if {statuscook::%location of event-block%} is true:
cancel event
set {_i} to "%location of event-block%"
if {statusfiltering::%{_i}%} is not true:
open a chest inventory with 1 row named "&9Freezer" to the player
set slot 0 of player's current inventory to light gray stained glass pane named "%{_i}%"
set slot 1 of player's current inventory to lime stained glass pane named "&aStart" with lore "&aFreeze time: 5 minutes"
set slot 7 of player's current inventory to lime stained glass pane named "&aStart" with lore "&aFreeze time: 5 minutes"
set slot 8 of player's current inventory to light gray stained glass pane named "%{_i}%"
loop integers from 2 to 6:
set slot loop-value of player's current inventory to {freezer::%loop-value%::%{_i}%}
else:
send "&5Freezing. Time left: %{cooktime::%{_i}%}% minutes" to the player
else if name of player's held item is "&9Cook Hammer":
cancel event
set {statuscook::%location of event-block%} to true
send "&5This is now a freezer." to the player
on inventory close:
event-inventory's type is a chest inventory with 1 row named "&9Freezer"
set {_i} to name of slot 0 of event-inventory
loop integers from 2 to 6:
set {freezer::%loop-value%::%{_i}%} to slot loop-value of event-inventory
on inventory click:
event-inventory's name is "&9Freezer"
if the clicked slot is light gray stained glass pane:
cancel event
stop
else if clicked slot is lime stained glass pane named "&aStart":
cancel event
set {_i} to name of slot 0 of event-inventory
close the inventory of player
set {statusfiltering::%{_i}%} to true
loop integers from 2 to 6:
name of slot loop-value of event-inventory is "&9Meth Sludge"
set {freezer::%loop-value%::%{_i}%} to prismarine shard named "&9Meth Crystal"
set {cooktime::%{_i}%} to 5
loop 5 times:
wait 1 minute
subtract 1 from {cooktime::%{_i}%}
delete {cooktime::%{_i}%}
delete {statusfiltering::%{_i}%}
else if clicked slot is air:
cursor slot of player is not mushroom stew named "&9Meth Sludge" or air
cursor slot of player is not prismarine shards named "&9Meth Crystal"
cancel event
send "&5Please only put Meth Sludge in the freezer."
stop
else if clicked slot is not mushroom stew named "&9Meth Sludge":
if clicked slot is not prismarine shards named "&9Meth Crystal":
cancel event
send "&5Please only put Meth Sludge in the freezer."
stop