From 6d50aa10d42ca48f7e11718cd953fb03dcb59c5c Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 28 Oct 2018 13:46:09 +0100 Subject: [PATCH] a lot of work on the Ritual of the Brewer --- .../blocks/BlockPotionGenerator.java | 10 +++ .../ellpeck/naturesaura/blocks/ModBlocks.java | 1 + .../naturesaura/blocks/Multiblocks.java | 12 ++++ .../tiles/TileEntityPotionGenerator.java | 63 ++++++++++++++++++ .../blockstates/potion_generator.json | 20 ++++++ .../assets/naturesaura/lang/en_US.lang | 1 + .../entries/creating/potion_generator.json | 17 +++++ .../textures/blocks/potion_generator.png | Bin 0 -> 645 bytes .../blocks/potion_generator_bottom.png | Bin 0 -> 691 bytes .../textures/blocks/potion_generator_top.png | Bin 0 -> 720 bytes 10 files changed, 124 insertions(+) create mode 100644 src/main/java/de/ellpeck/naturesaura/blocks/BlockPotionGenerator.java create mode 100644 src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java create mode 100644 src/main/resources/assets/naturesaura/blockstates/potion_generator.json create mode 100644 src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/potion_generator.json create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/potion_generator.png create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/potion_generator_bottom.png create mode 100644 src/main/resources/assets/naturesaura/textures/blocks/potion_generator_top.png diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPotionGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPotionGenerator.java new file mode 100644 index 00000000..135d634a --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPotionGenerator.java @@ -0,0 +1,10 @@ +package de.ellpeck.naturesaura.blocks; + +import de.ellpeck.naturesaura.blocks.tiles.TileEntityPotionGenerator; +import net.minecraft.block.material.Material; + +public class BlockPotionGenerator extends BlockContainerImpl { + public BlockPotionGenerator() { + super(Material.ROCK, "potion_generator", TileEntityPotionGenerator.class, "potion_generator"); + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java index b94321cc..2bf92c95 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java @@ -18,4 +18,5 @@ public final class ModBlocks { public static final Block WOOD_STAND = new BlockWoodStand(); public static final Block INFUSED_STONE = new BlockImpl("infused_stone", Material.ROCK).setSoundType(SoundType.STONE).setHardness(1.75F); public static final Block FURNACE_HEATER = new BlockFurnaceHeater(); + public static final Block POTION_GENERATOR = new BlockPotionGenerator(); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/Multiblocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/Multiblocks.java index 34e7c56f..6c9ff427 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/Multiblocks.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/Multiblocks.java @@ -36,4 +36,16 @@ public final class Multiblocks { '0', StateMatcher.fromPredicate(Blocks.SAPLING, state -> state.getBlock() instanceof BlockSapling || state.getBlock() instanceof BlockLog), ' ', StateMatcher.ANY) ).setSymmetrical(true); + public static final Multiblock POTION_GENERATOR = MultiblockRegistry.registerMultiblock( + new ResourceLocation(NaturesAura.MOD_ID, "potion_generator"), + new Multiblock(new String[][]{ + {"R R", " ", " ", " ", " ", " ", "R R"}, + {"N N", " ", " ", " ", " ", " ", "N N"}, + {"N N", " ", " ", " 0 ", " ", " ", "N N"}, + {" N N ", "NNN NNN", " NRRRN ", " R R ", " NRRRN ", "NNN NNN", " N N "}}, + 'N', Blocks.NETHER_BRICK, + 'R', Blocks.RED_NETHER_BRICK, + '0', ModBlocks.POTION_GENERATOR, + ' ', StateMatcher.ANY) + ).setSymmetrical(true); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java new file mode 100644 index 00000000..742192c6 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java @@ -0,0 +1,63 @@ +package de.ellpeck.naturesaura.blocks.tiles; + +import de.ellpeck.naturesaura.aura.chunk.AuraChunk; +import de.ellpeck.naturesaura.blocks.Multiblocks; +import net.minecraft.entity.EntityAreaEffectCloud; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.potion.PotionType; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.fml.relauncher.ReflectionHelper; + +import java.util.List; + +public class TileEntityPotionGenerator extends TileEntityImpl implements ITickable { + + @Override + public void update() { + if (!this.world.isRemote && this.world.getTotalWorldTime() % 10 == 0) { + if (Multiblocks.POTION_GENERATOR.validate(this.world, this.pos)) { + boolean addedOne = false; + + List clouds = this.world.getEntitiesWithinAABB(EntityAreaEffectCloud.class, new AxisAlignedBB(this.pos).grow(3)); + for (EntityAreaEffectCloud cloud : clouds) { + if (cloud.isDead) + continue; + + PotionType type = ReflectionHelper.getPrivateValue(EntityAreaEffectCloud.class, cloud, "field_184502_e", "potion"); + if (type == null) + continue; + + for (PotionEffect effect : type.getEffects()) { + Potion potion = effect.getPotion(); + if (potion.isBadEffect() || potion.isInstant()) { + continue; + } + + if (!addedOne) { + int toAdd = (effect.getAmplifier() * 5 + 1) * (effect.getDuration() / 80); + for (EnumFacing dir : EnumFacing.HORIZONTALS) { + BlockPos offset = this.pos.offset(dir, 8); + BlockPos spot = AuraChunk.getClosestSpot(this.world, offset, 10, offset); + if (AuraChunk.getAuraInArea(this.world, spot, 10) < 15000) { + AuraChunk chunk = AuraChunk.getAuraChunk(this.world, spot); + chunk.storeAura(spot, toAdd / 4); + } + } + addedOne = true; + } + + float newRadius = cloud.getRadius() - 0.25F; + if (newRadius < 0.5F) + cloud.setDead(); + else + cloud.setRadius(newRadius); + } + } + } + } + } +} diff --git a/src/main/resources/assets/naturesaura/blockstates/potion_generator.json b/src/main/resources/assets/naturesaura/blockstates/potion_generator.json new file mode 100644 index 00000000..b636eb86 --- /dev/null +++ b/src/main/resources/assets/naturesaura/blockstates/potion_generator.json @@ -0,0 +1,20 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "minecraft:cube", + "textures": { + "particle": "naturesaura:blocks/potion_generator", + "up": "naturesaura:blocks/potion_generator_top", + "down": "naturesaura:blocks/potion_generator_bottom", + "north": "#particle", + "east": "#particle", + "south": "#particle", + "west": "#particle" + }, + "transform": "forge:default-block" + }, + "variants": { + "normal": [{}], + "inventory": [{}] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/lang/en_US.lang b/src/main/resources/assets/naturesaura/lang/en_US.lang index 1c07a26a..140283e5 100644 --- a/src/main/resources/assets/naturesaura/lang/en_US.lang +++ b/src/main/resources/assets/naturesaura/lang/en_US.lang @@ -12,6 +12,7 @@ tile.naturesaura.wood_stand.name=Wooden Stand tile.naturesaura.ancient_planks.name=Ancient Planks tile.naturesaura.infused_stone.name=Infused Rock tile.naturesaura.furnace_heater.name=Extraneous Firestarter +tile.naturesaura.potion_generator.name=Absorber of Lingering item.naturesaura.eye.name=Environmental Eye item.naturesaura.gold_fiber.name=Brilliant Fiber diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/potion_generator.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/potion_generator.json new file mode 100644 index 00000000..5e7ac175 --- /dev/null +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/potion_generator.json @@ -0,0 +1,17 @@ +{ + "name": "Ritual of the Brewer", + "icon": "naturesaura:potion_generator", + "category": "creating", + "advancement": "naturesaura:infused_materials", + "priority": true, + "pages": [ + { + "type": "text", + "text": "bla bla bla" + }, + { + "type": "multiblock", + "multiblock_id": "naturesaura:potion_generator" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/textures/blocks/potion_generator.png b/src/main/resources/assets/naturesaura/textures/blocks/potion_generator.png new file mode 100644 index 0000000000000000000000000000000000000000..caea4192f584dc258d5225c48e2f17bd0c707554 GIT binary patch literal 645 zcmV;00($+4P)<{97<5HgbW?9;ba!ELWdLwtX>N2bZe?^J zG%hhNF=Hy6O8@`@14%?dR5(wKliQBkKoCU7p0Qaz2Z;sSfemC6AlQZ#2oM(u@&6yu zIW>@oO@r?K5`ZNJ~!`F#F_6^R>o7^})AlZo|uy+5Ph@7riJ zibM0~GhvleM1nMro8$4=zWUC84Plj2gv^{iTCCUWc(|h84?I|fj;7+ol zj1>kq{PP+=J}C7&@tHuq@vj0UAYV5|H7J;4^n&>UWzPhaPf(EDf8%e07C_DI4RMK@ z88^>Rxd1nX1Bmo0MIdY>h<_nTtYk6-P+*E!hmI$XvI?+_Drgv;S6P04 f){F{8gCy85s9SIx^2VK!00000NkvXXu0mjf<{97<5HgbW?9;ba!ELWdLwtX>N2bZe?^J zG%hhNF=Hy6O8@`@F-b&0R5(v9lj(B8Fbss9*yiZ_Kn@y)GXZh{L(}(v6ZKn9e;6A} zyIQRrSLNO+7p?Tc$~@TC1*_RhpIa4zZSrV^mf{)l%vWuLgR zPrkI-FYPyQX3ZHf0JG=p*VdCe5byjVk+`k*B&-1{LEx3WA$rDO&n()c1?ZJ860i@^ z2L4}JWg;N(fo+aUn@AY5g}tc!r1D7Yjr4)@Ku*v7BQC7vUaN%6>E{QwDR>B|M!zpS zP}LC+2Kv_Bkcd=$WjES9bGO4kS8@4-^(6ppJj239+UVH_)^y2~Kr*l8aov!t%AG?x=OaqL`Twm6pj_>{T4sp=U@{C~OA8(ELIfhx$PTD#05^~{ z9SH}fa-qVB7S4=%ukiueGkbk#TgXa1q>_Vx7e>{QbfXoG z>A-*OP4r3j1|oq9RMn`^m#Qz=6Q^Z<0W{k2LG8t8pta#0fO`kQZrr0(M Z_6GxROc@5x!EXQn002ovPDHLkV1k>mH8ubM literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/naturesaura/textures/blocks/potion_generator_top.png b/src/main/resources/assets/naturesaura/textures/blocks/potion_generator_top.png new file mode 100644 index 0000000000000000000000000000000000000000..fdff1a8cc1781ef7aea903d71061fae971bbbc5b GIT binary patch literal 720 zcmV;>0x$iEP)<{97<5HgbW?9;ba!ELWdLwtX>N2bZe?^J zG%hhNF=Hy6O8@`@PDw;TR5(vKWX?$^_L6Am zeZ+laCAU62J0=#>^a$BjTNoR<=j6Cw=)Tr5#r`KHVOR8d1}-mIkEW+B@T z`#JXyp)rA^-K+_coN>VNyy;XeFl#{ZjP{Hc1po zMv?$XF-27q!;GmcM@)@M0qcFv#)i+D$az^ea`G1l5RK7}_nsI40000