diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java index 735d540f..578570ea 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java @@ -48,4 +48,5 @@ public final class ModBlocks { public static final Block RF_CONVERTER = ModConfig.enabledFeatures.rfConverter ? new BlockRFConverter() : null; public static final Block MOSS_GENERATOR = new BlockMossGenerator(); public static final Block TIME_CHANGER = new BlockTimeChanger(); + public static final Block GENERATOR_LIMIT_REMOVER = new BlockImpl("generator_limit_remover",Material.ROCK).setSoundType(SoundType.STONE).setHardness(2F); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalGenerator.java index 56a11a80..855c7f5e 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalGenerator.java @@ -20,15 +20,17 @@ public class TileEntityAnimalGenerator extends TileEntityImpl implements ITickab return; int remain = this.amountToRelease; - while (remain > 0) { - BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 35, this.pos); - remain -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, remain); + if (this.canGenerateRightNow(35, remain)) { + while (remain > 0) { + BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 35, this.pos); + remain -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, remain); + } + + PacketHandler.sendToAllAround(this.world, this.pos, 32, + new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 16)); } this.timeRemaining -= 10; - - PacketHandler.sendToAllAround(this.world, this.pos, 32, - new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 16)); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java index 14b8a695..f436ad13 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java @@ -53,7 +53,7 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab int addAmount = 25000; int toAdd = Math.max(0, addAmount - curr.getValue() * 100); if (toAdd > 0) { - if (NaturesAuraAPI.TYPE_OVERWORLD.isPresentInWorld(this.world)) { + if (NaturesAuraAPI.TYPE_OVERWORLD.isPresentInWorld(this.world) && this.canGenerateRightNow(30, toAdd)) { int remain = toAdd; while (remain > 0) { BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java index 77ec065f..9accd999 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java @@ -1,7 +1,9 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.api.NaturesAuraAPI; +import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; +import de.ellpeck.naturesaura.blocks.ModBlocks; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; @@ -56,7 +58,7 @@ public class TileEntityImpl extends TileEntity { } } - public void onRedstonePowerChange(){ + public void onRedstonePowerChange() { } @@ -165,6 +167,14 @@ public class TileEntityImpl extends TileEntity { } } + public boolean canGenerateRightNow(int range, int toAdd) { + IBlockState below = this.world.getBlockState(this.pos.down()); + if (below.getBlock() == ModBlocks.GENERATOR_LIMIT_REMOVER) + return true; + int aura = IAuraChunk.getAuraInArea(this.world, this.pos, range); + return aura + toAdd <= IAuraChunk.DEFAULT_AURA * 2; + } + public enum SaveType { TILE, SYNC, diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityMossGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityMossGenerator.java index e1d71407..b7429c78 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityMossGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityMossGenerator.java @@ -38,15 +38,17 @@ public class TileEntityMossGenerator extends TileEntityImpl implements ITickable IBlockState result = NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.inverse().get(state); int toAdd = 15000; - while (toAdd > 0) { - BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 35, this.pos); - toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd); + if (this.canGenerateRightNow(35, toAdd)) { + while (toAdd > 0) { + BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 35, this.pos); + toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd); + } + + PacketHandler.sendToAllAround(this.world, this.pos, 32, + new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), 23)); } this.world.playEvent(2001, offset, Block.getStateId(state)); - PacketHandler.sendToAllAround(this.world, this.pos, 32, - new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), 23)); - this.world.setBlockState(offset, result); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java index 065e3559..23005d16 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java @@ -21,14 +21,16 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickable BlockPos pos = this.scheduledBigTrees.remove(); if (this.world.getBlockState(pos).getBlock() instanceof BlockLog) { int toAdd = 100000; - while (toAdd > 0) { - BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 25, this.pos); - toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd); - } + boolean canGen = this.canGenerateRightNow(25, toAdd); + if (canGen) + while (toAdd > 0) { + BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 25, this.pos); + toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd); + } PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles( this.pos.getX(), this.pos.getY(), this.pos.getZ(), 12, - pos.getX(), pos.getY(), pos.getZ())); + pos.getX(), pos.getY(), pos.getZ(), canGen ? 1 : 0)); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java index c2053408..d3315a3d 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java @@ -41,14 +41,16 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab } int toAdd = ((effect.getAmplifier() * 7 + 1) * (effect.getDuration() / 25)) * 100; - while (toAdd > 0) { - BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos); - toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd); - } + boolean canGen = this.canGenerateRightNow(30, toAdd); + if (canGen) + while (toAdd > 0) { + BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos); + toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd); + } PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles( this.pos.getX(), this.pos.getY(), this.pos.getZ(), 5, - PotionUtils.getPotionColor(type))); + PotionUtils.getPotionColor(type), canGen ? 1 : 0)); addedOne = true; break; diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java index bc3f67d8..7eddd4f9 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java @@ -124,6 +124,7 @@ public class PacketParticles implements IMessage { break; case 5: // Potion generator int color = message.data[0]; + boolean releaseAura = message.data[1] > 0; for (int i = world.rand.nextInt(5) + 5; i >= 0; i--) { NaturesAuraAPI.instance().spawnMagicParticle( message.posX + world.rand.nextFloat(), @@ -132,17 +133,18 @@ public class PacketParticles implements IMessage { world.rand.nextGaussian() * 0.01F, world.rand.nextFloat() * 0.1F, world.rand.nextGaussian() * 0.01F, color, 2F + world.rand.nextFloat(), 40, 0F, true, true); - for (int x = -1; x <= 1; x += 2) - for (int z = -1; z <= 1; z += 2) { - NaturesAuraAPI.instance().spawnMagicParticle( - message.posX + x * 3 + 0.5F, - message.posY + 2.5, - message.posZ + z * 3 + 0.5F, - world.rand.nextGaussian() * 0.02F, - world.rand.nextFloat() * 0.04F, - world.rand.nextGaussian() * 0.02F, - 0xd6340c, 1F + world.rand.nextFloat() * 2F, 75, 0F, true, true); - } + if (releaseAura) + for (int x = -1; x <= 1; x += 2) + for (int z = -1; z <= 1; z += 2) { + NaturesAuraAPI.instance().spawnMagicParticle( + message.posX + x * 3 + 0.5F, + message.posY + 2.5, + message.posZ + z * 3 + 0.5F, + world.rand.nextGaussian() * 0.02F, + world.rand.nextFloat() * 0.04F, + world.rand.nextGaussian() * 0.02F, + 0xd6340c, 1F + world.rand.nextFloat() * 2F, 75, 0F, true, true); + } } break; case 6: // Plant boost effect @@ -213,6 +215,7 @@ public class PacketParticles implements IMessage { int sapX = message.data[0]; int sapY = message.data[1]; int sapZ = message.data[2]; + releaseAura = message.data[3] > 0; for (int i = world.rand.nextInt(20) + 10; i >= 0; i--) NaturesAuraAPI.instance().spawnParticleStream( sapX + 0.5F + (float) world.rand.nextGaussian() * 3F, @@ -222,15 +225,16 @@ public class PacketParticles implements IMessage { message.posY + 0.5F, message.posZ + 0.5F, 0.6F, BiomeColorHelper.getFoliageColorAtPos(world, new BlockPos(sapX, sapY, sapZ)), 1.5F); - for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) - NaturesAuraAPI.instance().spawnMagicParticle( - message.posX + 0.25F + world.rand.nextFloat() * 0.5F, - message.posY + 1.01F, - message.posZ + 0.25F + world.rand.nextFloat() * 0.5F, - world.rand.nextGaussian() * 0.03F, - world.rand.nextFloat() * 0.04F + 0.04F, - world.rand.nextGaussian() * 0.03F, - 0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 60, 0F, false, true); + if (releaseAura) + for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) + NaturesAuraAPI.instance().spawnMagicParticle( + message.posX + 0.25F + world.rand.nextFloat() * 0.5F, + message.posY + 1.01F, + message.posZ + 0.25F + world.rand.nextFloat() * 0.5F, + world.rand.nextGaussian() * 0.03F, + world.rand.nextFloat() * 0.04F + 0.04F, + world.rand.nextGaussian() * 0.03F, + 0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 60, 0F, false, true); break; case 13: // Offering table int genX = message.data[0]; diff --git a/src/main/resources/assets/naturesaura/blockstates/generator_limit_remover.json b/src/main/resources/assets/naturesaura/blockstates/generator_limit_remover.json new file mode 100644 index 00000000..9bede05a --- /dev/null +++ b/src/main/resources/assets/naturesaura/blockstates/generator_limit_remover.json @@ -0,0 +1,20 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "minecraft:cube", + "textures": { + "particle": "naturesaura:blocks/generator_limit_remover", + "up": "naturesaura:blocks/generator_limit_remover_top", + "down": "naturesaura:blocks/infused_stone", + "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 c1ae8609..3832883f 100644 --- a/src/main/resources/assets/naturesaura/lang/en_US.lang +++ b/src/main/resources/assets/naturesaura/lang/en_US.lang @@ -44,6 +44,7 @@ tile.naturesaura.gold_brick.name=Golden Stone Bricks tile.naturesaura.rf_converter.name=Energetic Aura Forge tile.naturesaura.moss_generator.name=Swamp Homi tile.naturesaura.time_changer.name=Shifting Sundial +tile.naturesaura.generator_limit_remover.name=Creational Catalyst item.naturesaura.eye.name=Environmental Eye item.naturesaura.eye_improved.name=Environmental Ocular diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/ancient_tree.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/ancient_tree.json index d5aecb59..a357c5fa 100644 --- a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/ancient_tree.json +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/ancient_tree.json @@ -3,7 +3,6 @@ "icon": "naturesaura:ancient_leaves", "category": "creating", "advancement": "naturesaura:wood_stand", - "priority": true, "pages": [ { "type": "text", diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/generator_limit_remover.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/generator_limit_remover.json new file mode 100644 index 00000000..e03c702b --- /dev/null +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/generator_limit_remover.json @@ -0,0 +1,18 @@ +{ + "name": "Creational Catalyst", + "icon": "naturesaura:generator_limit_remover", + "category": "creating", + "advancement": "naturesaura:offering", + "priority": true, + "pages": [ + { + "type": "text", + "text": "As described in the $(l:creating/on_generating)On Creating Aura$() section, most $(thing)creational devices$() lack the ability to create $(aura) beyond a certain point. The $(item)Creational Catalyst$() easily solves this problem: Placing it directly below any creational device will cause its limit to be lifted, making it able to generate $(aura) far beyond the previously mentioned point.$(br)This comes at no cost in return." + }, + { + "type": "crafting", + "recipe": "naturesaura:generator_limit_remover", + "text": "Crafting the $(item)Creational Catalyst$() using the tokens" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/on_generating.json b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/on_generating.json new file mode 100644 index 00000000..f6425f09 --- /dev/null +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/en_us/entries/creating/on_generating.json @@ -0,0 +1,17 @@ +{ + "name": "On Creating Aura", + "icon": "naturesaura:gold_leaf", + "category": "creating", + "advancement": "naturesaura:wood_stand", + "priority": true, + "pages": [ + { + "type": "text", + "text": "$(thing)Creating$() $(aura) is a practice that will quickly be required by any magical botanist making use of it. Before getting into the matter, it should be noted that there are several $(thing)devices$() whose sole purpose is to create $(aura), most of which the reader may discover later down the line. By default, most of these devices do not have the $(thing)creational strength$() to create $(aura) beyond the range of the $(l:items/eye)Environmental Eye$()." + }, + { + "type": "text", + "text": "Once an amount of $(aura) close to that is reached in the area, these creational devices will behave in different ways, some shutting off completely, others continuing their behavior without creating any $(aura) in the process. Of course, they can be stopped manually using an $(l:devices/aura_detector)Aura Detector$() or similar. $(p)Later on, this behavior can be changed using the $(l:creating/generator_limit_remover)Creational Catalyst$()." + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/recipes/generator_limit_remover.json b/src/main/resources/assets/naturesaura/recipes/generator_limit_remover.json new file mode 100644 index 00000000..fd0bc9fa --- /dev/null +++ b/src/main/resources/assets/naturesaura/recipes/generator_limit_remover.json @@ -0,0 +1,31 @@ +{ + "type": "forge:ore_shaped", + "pattern": [ + "S1S", + "2I3", + "S4S" + ], + "key": { + "S": { + "item": "naturesaura:infused_stone" + }, + "1": { + "item": "naturesaura:token_euphoria" + }, + "2": { + "item": "naturesaura:token_terror" + }, + "3": { + "item": "naturesaura:token_rage" + }, + "4": { + "item": "naturesaura:token_grief" + }, + "I": { + "item": "naturesaura:infused_iron" + } + }, + "result": { + "item": "naturesaura:generator_limit_remover" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/textures/blocks/generator_limit_remover.png b/src/main/resources/assets/naturesaura/textures/blocks/generator_limit_remover.png new file mode 100644 index 00000000..f6dfe576 Binary files /dev/null and b/src/main/resources/assets/naturesaura/textures/blocks/generator_limit_remover.png differ diff --git a/src/main/resources/assets/naturesaura/textures/blocks/generator_limit_remover_top.png b/src/main/resources/assets/naturesaura/textures/blocks/generator_limit_remover_top.png new file mode 100644 index 00000000..2c827c24 Binary files /dev/null and b/src/main/resources/assets/naturesaura/textures/blocks/generator_limit_remover_top.png differ