Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.
options:
# If you want your generators to run at tick speeds, change this to something like 1, 5, 10 or 15 ticks to be able to set the generator timespan delay to any tick.
# This value must be lower than the value you're setting the generator to.
clock-speed: 1 second
command /creategenerator <itemtypes> <timespan> [<boolean>]:
permission: generators.create
trigger:
set {_id} to amount of indices of {generators::*}
set {generators::%{_id}%::items::*} to argument 1
loop indices of {generators::*}:
{generators::%loop-value%::location} is location above target block
argument 3 is not set
message "&cThere is already a generator under this location. Type /creategenerator <itemstacks> <timespan> true to override this warning."
stop
set {generators::%{_id}%::location} to location above target block
set {generators::%{_id}%::running} to true
set {generators::%{_id}%::timespan} to argument 2
set {generators::%{_id}%::limit} to 25
message "Added generator %{_id}% with %argument 1% at %{generators::%{_id}%::location}% with delay %argument 2%"
command /generators:
permission: generators.list
trigger:
loop indices of {generators::*}:
message "Generator %loop-value% - &7Running: %{generators::%loop-value%::running}%:"
message " &e- Location: &7%{generators::%loop-value%::location}%"
message " &e- Timespan: &7%{generators::%loop-value%::timespan}%"
message " &e- Limit: &7%{generators::%loop-value%::limit}%"
message " &e- Items: &7%{generators::%loop-value%::items::*}%"
command /setgeneratoritems <number> <itemtypes>:
permission: generators.items
trigger:
if {generators::%argument 1%::*} is not set:
message "&cThere was no generator under the id %argument 1%"
stop
set {generators::%argument 1%::items::*} to argument 2
message "Changed items for generator %argument 1% to %argument 2%"
command /setgeneratorlocation <number>:
permission: generators.location
trigger:
if {generators::%argument 1%::*} is not set:
message "&cThere was no generator under the id %argument 1%"
stop
set {generators::%argument 1%::location} to location above target block
message "Changed location for generator %argument 1% to %{generators::%argument 1%::location}%"
command /setgeneratorlimit <number> <number>:
permission: generators.limit
trigger:
if {generators::%argument 1%::*} is not set:
message "&cThere was no generator under the id %argument 1%"
stop
set {generators::%argument 1%::limit} to argument 2
message "Changed limit for generator %argument 1% to %argument 2%"
command /setgeneratortime <number> <timespan>:
permission: generators.time
trigger:
if {generators::%argument 1%::*} is not set:
message "&cThere was no generator under the id %argument 1%"
stop
set {generators::%argument 1%::timespan} to argument 2
message "Changed time delay for generator %argument 1% to %argument 2%"
command /togglegenerator <number>:
permission: generators.toggle
trigger:
if {generators::%argument%::*} is not set:
message "&cThere was no generator under the id %argument%"
stop
if {generators::%argument%::running} is set:
delete {generators::%argument%::running}
message "&6Stopped generator %argument%"
stop
set {generators::%argument%::running} to true
message "&aStarted generator %argument%"
command /deletegenerator [<number>] [<boolean>]:
permission: generators.delete
trigger:
if argument 1 is not set:
if argument 2 is not set:
message "Type /deletegenerators true to delete all generators"
stop
message "Deleted all generators"
delete {generators::*}
stop
if {generators::%argument 1%::*} is not set:
message "&cThere was no generator under the id %argument 1%"
stop
message "&cDeleted generator %argument 1% &cat %{generators::%argument 1%::location}%"
delete {generators::%argument 1%::*}
command /cleargeneratordrops [<number>]:
permission: generators.clear
trigger:
loop all dropped items:
if argument is not set:
metadata "generator-item" of loop-entity is set
clear loop-entity
else:
metadata "generator-id" of loop-entity is argument
clear loop-entity
every {@clock-speed}:
loop indices of {generators::*}:
{generators::%loop-value%::running} is set
if {generators::%loop-value%::cooldown} is not set:
set {generators::%loop-value%::cooldown} to {generators::%loop-value%::timespan}
add a second to {generators::%loop-value%::cooldown}
subtract {@clock-speed} from {generators::%loop-value%::cooldown}
{generators::%loop-value%::cooldown} is less than or equal to 0 seconds
delete {generators::%loop-value%::cooldown}
set {_location} to {generators::%loop-value%::location}
if {generators::%loop-value%::limit} is set:
clear {_count}
loop dropped items:
metadata "generator-id" of loop-entity is loop-value-1
add 1 to {_count}
{_count} is greater or equal to {generators::%loop-value%::limit}
stop
loop {generators::%loop-value%::items::*}:
# comment out 'without velocity' if you want the items to be randomly thrown. I personally like the velocity.
drop loop-value-2 at {_location} without velocity
set metadata "generator-item" of last dropped item to true
set metadata "generator-id" of last dropped item to loop-value-1
on item merge:
# Avoid items merging. This is optional, but I think it looks cleaner.
metadata "generator-item" of event-entity is set
cancel event
on script unload:
# Remove this console command if you don't want the items to be cleared on script unload.
execute console command "cleardrops"
loop indices of {generators::*}:
delete {generators::%loop-value%::running}
delete {generators::%loop-value%::cooldown}
# Dp what you want when they pickup the items.
on pickup:
metadata "generator-item" of event-entity is set
# If you want to get what generator the item came from.
# set {_generator} to metadata "generator-id" of event-entity
play sound "ENTITY_EXPERIENCE_ORB_PICKUP" at volume 0.4 at player for player