From 3a65e1dd1e846956a42f679a533417fcd94a5b8e Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 5 May 2020 00:05:38 +0200 Subject: [PATCH] finished the chorus generator --- .../tiles/TileEntityChorusGenerator.java | 27 ++++++++++++++++++ .../naturesaura/packet/PacketParticles.java | 2 +- .../assets/naturesaura/lang/en_us.json | 2 +- .../entries/creating/chorus_generator.json | 21 ++++++++++++++ .../naturesaura/recipes/chorus_generator.json | 28 +++++++++++++++++++ 5 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/creating/chorus_generator.json create mode 100644 src/main/resources/data/naturesaura/recipes/chorus_generator.json diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityChorusGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityChorusGenerator.java index 7be48df3..ccdfd9d7 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityChorusGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityChorusGenerator.java @@ -6,6 +6,9 @@ import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; +import net.minecraft.nbt.NBTUtil; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; @@ -98,4 +101,28 @@ public class TileEntityChorusGenerator extends TileEntityImpl implements ITickab this.collectChorusPlant(offset, blocks); } } + + @Override + public void writeNBT(CompoundNBT compound, SaveType type) { + super.writeNBT(compound, type); + if (type == SaveType.TILE) { + ListNBT list = new ListNBT(); + for (BlockPos pos : this.currentlyBreaking) + list.add(NBTUtil.writeBlockPos(pos)); + compound.put("breaking", list); + compound.putInt("aura", this.auraPerBlock); + } + } + + @Override + public void readNBT(CompoundNBT compound, SaveType type) { + super.readNBT(compound, type); + if (type == SaveType.TILE) { + this.currentlyBreaking.clear(); + ListNBT list = compound.getList("breaking", 10); + for (int i = 0; i < list.size(); i++) + this.currentlyBreaking.add(NBTUtil.readBlockPos(list.getCompound(i))); + this.auraPerBlock = compound.getInt("aura"); + } + } } diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java index ecb3a2b1..2519d2f0 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java @@ -503,7 +503,7 @@ public class PacketParticles { world.rand.nextGaussian() * 0.01F, world.rand.nextFloat() * 0.04F + 0.02F, world.rand.nextGaussian() * 0.01F, - 0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true); + IAuraType.forWorld(world).getColor(), 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true); }); public final BiConsumer action; diff --git a/src/main/resources/assets/naturesaura/lang/en_us.json b/src/main/resources/assets/naturesaura/lang/en_us.json index 8af30095..552223d0 100644 --- a/src/main/resources/assets/naturesaura/lang/en_us.json +++ b/src/main/resources/assets/naturesaura/lang/en_us.json @@ -63,7 +63,7 @@ "block.naturesaura.aura_cactus": "Aura Cactus", "block.naturesaura.tainted_gold_block": "Tainted Gold Block", "block.naturesaura.nether_grass": "Grassy Netherrack", - "block.naturesaura.chorus_generator": "Reaper of the Ender Heights", + "block.naturesaura.chorus_generator": "Reaper of Ender Heights", "item.naturesaura.eye": "Environmental Eye", "item.naturesaura.eye_improved": "Environmental Ocular", "item.naturesaura.gold_fiber": "Brilliant Fiber", diff --git a/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/creating/chorus_generator.json b/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/creating/chorus_generator.json new file mode 100644 index 00000000..a2c04476 --- /dev/null +++ b/src/main/resources/data/naturesaura/patchouli_books/book/en_us/entries/creating/chorus_generator.json @@ -0,0 +1,21 @@ +{ + "name": "Reaper of Ender Heights", + "icon": "naturesaura:chorus_generator", + "category": "creating", + "advancement": "naturesaura:aura_bottle_end", + "pages": [ + { + "type": "text", + "text": "Once the mighty dragon of $(thing)the End$() has been defeated, one may start venturing out through the many barren islands around its lair. While doing so, one can discover $(thing)chorus$() plants: Flowers that sprout upwards and high into the sky. Flowers of this kind contain quite a substantial amount of $(aura), gathered from the ender air around them." + }, + { + "type": "text", + "text": "Through the $(item)Reaper of Ender Heights$(), this energy can be extracted. First of all, a $(thing)chorus flower$() has to be grown at most about two blocks away from it. Once it has grown high enough, supplying the $(item)Reaper of Ender Heights$() with a $(thing)redstone signal$() will cause it to start harvesting the entire plant, dispersing $(aura) in the process.$(br)The higher and broader the plant has grown prior to harvesting, the more $(aura) is created." + }, + { + "type": "crafting", + "recipe": "naturesaura:chorus_generator", + "text": "Creating the $(item)Reaper of Ender Heights$()" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/naturesaura/recipes/chorus_generator.json b/src/main/resources/data/naturesaura/recipes/chorus_generator.json new file mode 100644 index 00000000..759c584d --- /dev/null +++ b/src/main/resources/data/naturesaura/recipes/chorus_generator.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "EPE", + "RFJ", + "EPE" + ], + "key": { + "E": { + "item": "minecraft:end_stone" + }, + "R": { + "item": "naturesaura:token_rage" + }, + "J": { + "item": "naturesaura:token_joy" + }, + "P": { + "item": "minecraft:popped_chorus_fruit" + }, + "F": { + "item": "minecraft:chorus_flower" + } + }, + "result": { + "item": "naturesaura:chorus_generator" + } +} \ No newline at end of file