Skip to content

Commit

Permalink
Merge pull request #31 from ShadowCreator250/v0.6
Browse files Browse the repository at this point in the history
v0.6: Fully implemented AutoFields and more
  • Loading branch information
ShadowCreator250 authored Aug 8, 2019
2 parents e4e4827 + 7067c96 commit 87d58fe
Show file tree
Hide file tree
Showing 60 changed files with 415 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
setblock ~ ~ ~ beetroots[age=0] destroy
execute store result score @s af_crop_count run data get entity @e[type=item,distance=..2,sort=nearest,limit=1,nbt={Item:{id:"minecraft:beetroot_seeds"}}] Item.Count
scoreboard players remove @s af_crop_count 1
execute store result entity @e[type=item,distance=..2,sort=nearest,limit=1,nbt={Item:{id:"minecraft:beetroot_seeds"}}] Item.Count int 1.0 run scoreboard players get @s af_crop_count
scoreboard players set @s af_crop_count 0
5 changes: 5 additions & 0 deletions vanillaMods/data/autofields/functions/crop_carrots.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
setblock ~ ~ ~ carrots[age=0] destroy
execute store result score @s af_crop_count run data get entity @e[type=item,distance=..2,sort=nearest,limit=1,nbt={Item:{id:"minecraft:carrot"}}] Item.Count
scoreboard players remove @s af_crop_count 1
execute store result entity @e[type=item,distance=..2,sort=nearest,limit=1,nbt={Item:{id:"minecraft:carrot"}}] Item.Count int 1.0 run scoreboard players get @s af_crop_count
scoreboard players set @s af_crop_count 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
setblock ~ ~ ~ potatoes[age=0] destroy
execute store result score @s af_crop_count run data get entity @e[type=item,distance=..2,sort=nearest,limit=1,nbt={Item:{id:"minecraft:potato"}}] Item.Count
scoreboard players remove @s af_crop_count 1
execute store result entity @e[type=item,distance=..2,sort=nearest,limit=1,nbt={Item:{id:"minecraft:potato"}}] Item.Count int 1.0 run scoreboard players get @s af_crop_count
scoreboard players set @s af_crop_count 0
5 changes: 5 additions & 0 deletions vanillaMods/data/autofields/functions/crop_wheat.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
setblock ~ ~ ~ wheat[age=0] destroy
execute store result score @s af_crop_count run data get entity @e[type=item,distance=..2,sort=nearest,limit=1,nbt={Item:{id:"minecraft:wheat_seeds"}}] Item.Count
scoreboard players remove @s af_crop_count 1
execute store result entity @e[type=item,distance=..2,sort=nearest,limit=1,nbt={Item:{id:"minecraft:wheat_seeds"}}] Item.Count int 1.0 run scoreboard players get @s af_crop_count
scoreboard players set @s af_crop_count 0
4 changes: 4 additions & 0 deletions vanillaMods/data/autofields/functions/give.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function autofields:give_tier1
function autofields:give_tier2
function autofields:give_tier3
give @p[limit=1,distance=..5] minecraft:coal_block 64
11 changes: 11 additions & 0 deletions vanillaMods/data/autofields/functions/give_advanced.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function autofields:give
give @p[limit=1,distance=..5] minecraft:diamond 64
give @p[limit=1,distance=..5] minecraft:ender_eye 64
give @p[limit=1,distance=..5] minecraft:dropper 64
give @p[limit=1,distance=..5] minecraft:wheat_seeds 64
give @p[limit=1,distance=..5] minecraft:beetroot_seeds 64
give @p[limit=1,distance=..5] minecraft:carrot 64
give @p[limit=1,distance=..5] minecraft:potato 64
give @p[limit=1,distance=..5] minecraft:stone_hoe 2
give @p[limit=1,distance=..5] minecraft:iron_hoe 2
give @p[limit=1,distance=..5] minecraft:diamond_hoe 2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
give @p minecraft:magma_cube_spawn_egg{display:{Name:"{\"text\":\"Spawn AutoFarmer Tier 1\",\"color\":\"dark_green\"}",Lore:["§bThis machine automatically harvests and replants","§ba 9x9 field with a water source in the middle.","§bPlace this spawn egg in the water source.","§bThrow 1 coal block in the reach of the machine","§bto power it for 9 Minecraft days.","§bDropping a book near the machine","§bwill show you the expected positions","§bfor the water source and the corners","§bof the field with particles."]},EntityTag:{NoGravity:1b,Silent:1b,Invulnerable:1b,CustomNameVisible:0b,NoAI:1b,CanPickUpLoot:0b,Size:0,Tags:["af_spawn_t1","af_spawn","vm_entity"],CustomName:"{\"text\":\"Spawn AutoFarmer Tier 1\",\"color\":\"dark_green\"}",ActiveEffects:[{Id:14b,Amplifier:10b,Duration:199980,ShowParticles:0b}]}} 1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
give @p minecraft:magma_cube_spawn_egg{display:{Name:"{\"text\":\"Spawn AutoFarmer Tier 2\",\"color\":\"dark_green\"}",Lore:["§bThis machine automatically harvests and replants","§ba 13x13 field with a water source in the middle.","§bPlace this spawn egg in the water source.","§bThrow 1 coal block in the reach of the machine","§bto power it for 6 Minecraft days.","§bDropping a book near the machine","§bwill show you the expected positions","§bfor the water sources and the corners","§bof the field with particles."]},EntityTag:{NoGravity:1b,Silent:1b,Invulnerable:1b,CustomNameVisible:0b,NoAI:1b,CanPickUpLoot:0b,Size:0,Tags:["af_spawn_t2","af_spawn","vm_entity"],CustomName:"{\"text\":\"Spawn AutoFarmer Tier 2\",\"color\":\"dark_green\"}",ActiveEffects:[{Id:14b,Amplifier:10b,Duration:199980,ShowParticles:0b}]}} 1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
give @p minecraft:magma_cube_spawn_egg{display:{Name:"{\"text\":\"Spawn AutoFarmer Tier 3\",\"color\":\"dark_green\"}",Lore:["§bThis machine automatically harvests and replants","§ba 17x17 field with a water source in the middle.","§bPlace this spawn egg in the water source.","§bThrow 1 coal block in the reach of the machine","§bto power it for 3 Minecraft days.","§bDropping a book near the machine","§bwill show you the expected positions","§bfor the water sources and the corners","§bof the field with particles."]},EntityTag:{NoGravity:1b,Silent:1b,Invulnerable:1b,CustomNameVisible:0b,NoAI:1b,CanPickUpLoot:0b,Size:0,Tags:["af_spawn_t3","af_spawn","vm_entity"],CustomName:"{\"text\":\"Spawn AutoFarmer Tier 3\",\"color\":\"dark_green\"}",ActiveEffects:[{Id:14b,Amplifier:10b,Duration:199980,ShowParticles:0b}]}} 1
6 changes: 6 additions & 0 deletions vanillaMods/data/autofields/functions/harvest.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
execute if entity @e[type=player,distance=..30] run particle end_rod ~ ~0.2 ~ 0.1 0.2 0.1 0.005 10
execute if block ~ ~ ~ minecraft:potatoes[age=7] run function autofields:crop_potatoes
execute if block ~ ~ ~ minecraft:carrots[age=7] run function autofields:crop_carrots
execute if block ~ ~ ~ minecraft:wheat[age=7] run function autofields:crop_wheat
execute if block ~ ~ ~ minecraft:beetroots[age=3] run function autofields:crop_beetroots
function autofields:item_tags
6 changes: 6 additions & 0 deletions vanillaMods/data/autofields/functions/item_tags.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tag @e[nbt={Item:{id:"minecraft:carrot"}},distance=..2] add af_crop
tag @e[nbt={Item:{id:"minecraft:potato"}},distance=..2] add af_crop
tag @e[nbt={Item:{id:"minecraft:wheat"}},distance=..2] add af_crop
tag @e[nbt={Item:{id:"minecraft:wheat_seeds"}},distance=..2] add af_crop
tag @e[nbt={Item:{id:"minecraft:beetroot"}},distance=..2] add af_crop
tag @e[nbt={Item:{id:"minecraft:beetroot_seeds"}},distance=..2] add af_crop
3 changes: 3 additions & 0 deletions vanillaMods/data/autofields/functions/load.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tellraw @a[tag=vm_admin] [{"text":"[VanillaMods-Core] "},{"text":"The add-on "},{"text":"AutoFields ","color":"dark_green"},{"text":"is now active."}]
function vmcore:turnon
function autofields:setup
62 changes: 62 additions & 0 deletions vanillaMods/data/autofields/functions/main.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Spawn Control
execute as @a at @s as @e[type=magma_cube,tag=af_spawn_t1,distance=..7] at @s align xyz positioned ~0.5 ~1 ~0.5 run summon armor_stand ~ ~ ~ {NoGravity:1b,Invulnerable:1b,ShowArms:1b,Invisible:1b,NoBasePlate:1b,Tags:["af_controler_t1","af_controler","vm_entity","vm_block_machine","new"],DisabledSlots:4144959,Pose:{},Rotation:[90f,0.0f],HandItems:[{id:"minecraft:stone_hoe",Count:1b},{id:"minecraft:stone_hoe",Count:1b}],Pose:{LeftArm:[349f,0f,0f],RightArm:[349f,180f,0f]},CustomName:"{\"text\":\"AutoFarmer Tier 1 Controler\"}"}
execute as @a at @s as @e[type=magma_cube,tag=af_spawn_t1,distance=..7] at @s run kill @s

execute as @a at @s as @e[type=magma_cube,tag=af_spawn_t2,distance=..7] at @s align xyz positioned ~0.5 ~1 ~0.5 run summon armor_stand ~ ~ ~ {NoGravity:1b,Invulnerable:1b,ShowArms:1b,Invisible:1b,NoBasePlate:1b,Tags:["af_controler_t2","af_controler","vm_entity","vm_block_machine","new"],DisabledSlots:4144959,Pose:{},Rotation:[90f,0.0f],HandItems:[{id:"minecraft:iron_hoe",Count:1b},{id:"minecraft:iron_hoe",Count:1b}],Pose:{LeftArm:[349f,0f,0f],RightArm:[349f,180f,0f]},CustomName:"{\"text\":\"AutoFarmer Tier 2 Controler\"}"}
execute as @a at @s as @e[type=magma_cube,tag=af_spawn_t2,distance=..7] at @s run kill @s

execute as @a at @s as @e[type=magma_cube,tag=af_spawn_t3,distance=..7] at @s align xyz positioned ~0.5 ~1 ~0.5 run summon armor_stand ~ ~ ~ {NoGravity:1b,Invulnerable:1b,ShowArms:1b,Invisible:1b,NoBasePlate:1b,Tags:["af_controler_t3","af_controler","vm_entity","vm_block_machine","new"],DisabledSlots:4144959,Pose:{},Rotation:[90f,0.0f],HandItems:[{id:"minecraft:diamond_hoe",Count:1b},{id:"minecraft:diamond_hoe",Count:1b}],Pose:{LeftArm:[349f,0f,0f],RightArm:[349f,180f,0f]},CustomName:"{\"text\":\"AutoFarmer Tier 3 Controler\"}"}
execute as @a at @s as @e[type=magma_cube,tag=af_spawn_t3,distance=..7] at @s run kill @s

# Destroy Control
execute as @a at @s as @e[type=armor_stand,tag=af_controler,distance=..7,tag=old] at @s if block ~ ~ ~ #vmcore:noblocks run tag @s add af_kill
execute as @a at @s as @e[type=armor_stand,tag=af_controler_t1,distance=..7,tag=old,tag=af_kill] at @s if block ~ ~ ~ #vmcore:noblocks run function autofields:give_tier1
execute as @a at @s as @e[type=armor_stand,tag=af_controler_t2,distance=..7,tag=old,tag=af_kill] at @s if block ~ ~ ~ #vmcore:noblocks run function autofields:give_tier2
execute as @a at @s as @e[type=armor_stand,tag=af_controler_t3,distance=..7,tag=old,tag=af_kill] at @s if block ~ ~ ~ #vmcore:noblocks run function autofields:give_tier3
execute as @a at @s as @e[type=armor_stand,tag=af_controler_t1,distance=..7,tag=old,tag=af_kill] at @s if block ~ ~ ~ #vmcore:noblocks positioned ~-5 ~-1 ~-5 run kill @e[type=armor_stand,limit=1,sort=nearest,tag=af_farmer_t1,dx=10,dy=3,dz=10]
execute as @a at @s as @e[type=armor_stand,tag=af_controler_t2,distance=..7,tag=old,tag=af_kill] at @s if block ~ ~ ~ #vmcore:noblocks positioned ~-7 ~-1 ~-7 run kill @e[type=armor_stand,limit=1,sort=nearest,tag=af_farmer_t2,dx=14,dy=3,dz=14]
execute as @a at @s as @e[type=armor_stand,tag=af_controler_t3,distance=..7,tag=old,tag=af_kill] at @s if block ~ ~ ~ #vmcore:noblocks positioned ~-9 ~-1 ~-9 run kill @e[type=armor_stand,limit=1,sort=nearest,tag=af_farmer_t3,dx=18,dy=3,dz=18]
execute as @a at @s as @e[type=armor_stand,tag=af_controler,distance=..7,tag=old,tag=af_kill] at @s if block ~ ~ ~ #vmcore:noblocks run kill @e[type=item,distance=..2,limit=1,sort=nearest,nbt={Item:{id:"minecraft:dropper",Count:1b}}]
execute as @a at @s as @e[type=armor_stand,tag=af_controler,distance=..7,tag=old,tag=af_kill] at @s if block ~ ~ ~ #vmcore:noblocks run kill @s

# Fuel Control
execute as @a at @s as @e[type=armor_stand,tag=af_controler,distance=..7,tag=old] at @s run tag @e[type=item,tag=!af_fuel_item,distance=..2.5,nbt={Item:{id:"minecraft:coal_block"}}] add af_fuel_item
execute as @e[type=item,tag=af_fuel_item] at @s run tag @e[type=armor_stand,tag=af_controler,distance=..2.5,tag=old,limit=1,sort=nearest] add af_add_fuel
execute as @a at @s as @e[type=armor_stand,tag=af_controler_t1,distance=..7,tag=old,tag=af_add_fuel] at @s run scoreboard players add @s af_fuel 216000
execute as @a at @s as @e[type=armor_stand,tag=af_controler_t2,distance=..7,tag=old,tag=af_add_fuel] at @s run scoreboard players add @s af_fuel 144000
execute as @a at @s as @e[type=armor_stand,tag=af_controler_t3,distance=..7,tag=old,tag=af_add_fuel] at @s run scoreboard players add @s af_fuel 72000
execute as @a at @s as @e[type=armor_stand,tag=af_controler,distance=..7,tag=old,tag=af_add_fuel] at @s run kill @e[type=item,distance=..2.5,tag=af_fuel_item,limit=1,sort=nearest]
execute as @a at @s as @e[type=armor_stand,tag=af_controler,distance=..7,tag=old,tag=af_add_fuel] at @s run tag @s remove af_add_fuel

scoreboard players remove @e[type=armor_stand,tag=af_controler,tag=old,scores={af_fuel=1..}] af_fuel 1

# Timer Control
scoreboard players set @e[type=armor_stand,tag=af_controler,tag=old,scores={af_timer=20}] af_timer 0
scoreboard players add @e[type=armor_stand,tag=af_controler,tag=old] af_timer 1

# Runtime Actions
execute as @a at @s as @e[type=armor_stand,tag=af_controler,tag=old,distance=..20,scores={af_fuel=0}] at @s run particle cloud ~ ~0.9 ~ 0 0.2 0 0.004 1
execute as @a at @s as @e[type=armor_stand,tag=af_controler,tag=old,distance=..20,scores={af_fuel=1..}] at @s run particle large_smoke ~ ~0.9 ~ 0 0 0 0.004 1
execute as @a at @s as @e[type=armor_stand,tag=af_controler,tag=old,distance=..20,scores={af_fuel=1..}] at @s run particle flame ~ ~1.05 ~ 0.1 0 0.1 0.0005 1
execute as @a at @s as @e[type=armor_stand,tag=af_controler,tag=old,distance=..20,scores={af_fuel=1..}] at @s run tp @s ~ ~ ~ ~3 ~

execute as @e[type=armor_stand,tag=af_controler,scores={af_fuel=1..}] at @s run tag @e[type=item,tag=af_crop,tag=!af_crop_tpd,distance=..1] add af_crop_tpd
execute as @e[type=armor_stand,tag=af_controler_t1,scores={af_fuel=1..}] at @s positioned ~-5 ~-1 ~-5 run tp @e[type=item,tag=af_crop,dx=10,dy=3,dz=10,tag=!af_crop_tpd] ~5 ~0.7 ~5
execute as @e[type=armor_stand,tag=af_controler_t2,scores={af_fuel=1..}] at @s positioned ~-7 ~-1 ~-7 run tp @e[type=item,tag=af_crop,dx=14,dy=3,dz=14,tag=!af_crop_tpd] ~7 ~0.7 ~7
execute as @e[type=armor_stand,tag=af_controler_t3,scores={af_fuel=1..}] at @s positioned ~-9 ~-1 ~-9 run tp @e[type=item,tag=af_crop,dx=18,dy=3,dz=18,tag=!af_crop_tpd] ~9 ~0.7 ~9

execute as @e[type=armor_stand,tag=af_controler_t1,scores={af_fuel=1..,af_timer=20}] at @s positioned ~-5 ~-1 ~-5 as @e[type=armor_stand,limit=1,sort=nearest,tag=af_farmer_t1,dx=10,dy=3,dz=10] at @s run function autofields:t1_step_control
execute as @e[type=armor_stand,tag=af_controler_t2,scores={af_fuel=1..,af_timer=20}] at @s positioned ~-7 ~-1 ~-7 as @e[type=armor_stand,limit=1,sort=nearest,tag=af_farmer_t2,dx=14,dy=3,dz=14] at @s run function autofields:t2_step_control
execute as @e[type=armor_stand,tag=af_controler_t3,scores={af_fuel=1..,af_timer=20}] at @s positioned ~-9 ~-1 ~-9 as @e[type=armor_stand,limit=1,sort=nearest,tag=af_farmer_t3,dx=18,dy=3,dz=18] at @s run function autofields:t3_step_control

execute as @e[type=armor_stand,tag=af_controler_t1,scores={af_fuel=..0,af_timer=20}] at @s positioned ~-5 ~-1 ~-5 as @e[type=armor_stand,limit=1,sort=nearest,tag=af_farmer_t1,dx=10,dy=3,dz=10] at @s if entity @e[type=player,distance=..30] run particle crit ~ ~0.2 ~ 0.1 0.2 0.1 0.005 20
execute as @e[type=armor_stand,tag=af_controler_t2,scores={af_fuel=..0,af_timer=20}] at @s positioned ~-7 ~-1 ~-7 as @e[type=armor_stand,limit=1,sort=nearest,tag=af_farmer_t2,dx=14,dy=3,dz=14] at @s if entity @e[type=player,distance=..30] run particle crit ~ ~0.2 ~ 0.1 0.2 0.1 0.005 20
execute as @e[type=armor_stand,tag=af_controler_t3,scores={af_fuel=..0,af_timer=20}] at @s positioned ~-9 ~-1 ~-9 as @e[type=armor_stand,limit=1,sort=nearest,tag=af_farmer_t3,dx=18,dy=3,dz=18] at @s if entity @e[type=player,distance=..30] run particle crit ~ ~0.2 ~ 0.1 0.2 0.1 0.005 20

# Help Control Main
execute as @a at @s as @e[type=armor_stand,tag=af_controler,distance=..7,tag=old] at @s run tag @e[type=item,tag=!af_help_item,nbt={Item:{id:"minecraft:book"}}] add af_help_item

# Tier Main Control
execute if entity @e[type=armor_stand,tag=af_controler_t1] run function autofields:t1_main
execute if entity @e[type=armor_stand,tag=af_controler_t2] run function autofields:t2_main
execute if entity @e[type=armor_stand,tag=af_controler_t3] run function autofields:t3_main
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scoreboard players set @s af_fuel 0
scoreboard players set @s af_timer 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scoreboard players set @s af_row 0
scoreboard players set @s af_col 0
Loading

0 comments on commit 87d58fe

Please sign in to comment.