chunk-collector.sk

Created by erenkara

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:
	name: "&eChunk Collector"

on place:
	1 of player's tool is hopper named {@name}
	set {_cc} to {chunk.collector::%chunk at event-block%}
	if {_cc} is set:
		send "&cThere is already a chunk collector on this chunk. (%x-coord of {_cc}%, %y-coord of {_cc}%, %z-coord of {_cc}%)" to player
		stop
	set {chunk.collector::%chunk at event-block%} to event-block
	send "&aPlaced a chunk collector"

on break:
	{chunk.collector::%chunk at event-block%} is event-block
	send "&cBroke a chunk collector." to player
	delete {chunk.collector::%chunk at event-block%}
	cancel drops
	drop hopper named {@name} at event-block
	drop all items in event-block's inventory at event-block

on item spawn:
	if {chunk.collector::%chunk at event-location%}'s inventory has enough space for event-itemtype:
		give event-itemtype to {chunk.collector::%chunk at event-location%}'s inventory
		wait 1 tick
		kill event-entity

command givechunkcollector <player=%player%> <integer=1>:
	permission: chunk.collector.give
	trigger:
		give arg-2 of hopper named {@name} to arg-1