added the creational catalyst

This commit is contained in:
Ellpeck 2019-02-16 01:43:40 +01:00
parent 0adea79fb6
commit ae701c4f1e
16 changed files with 154 additions and 45 deletions

View file

@ -48,4 +48,5 @@ public final class ModBlocks {
public static final Block RF_CONVERTER = ModConfig.enabledFeatures.rfConverter ? new BlockRFConverter() : null; public static final Block RF_CONVERTER = ModConfig.enabledFeatures.rfConverter ? new BlockRFConverter() : null;
public static final Block MOSS_GENERATOR = new BlockMossGenerator(); public static final Block MOSS_GENERATOR = new BlockMossGenerator();
public static final Block TIME_CHANGER = new BlockTimeChanger(); 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);
} }

View file

@ -20,16 +20,18 @@ public class TileEntityAnimalGenerator extends TileEntityImpl implements ITickab
return; return;
int remain = this.amountToRelease; int remain = this.amountToRelease;
if (this.canGenerateRightNow(35, remain)) {
while (remain > 0) { while (remain > 0) {
BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 35, this.pos); BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 35, this.pos);
remain -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, remain); remain -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, remain);
} }
this.timeRemaining -= 10;
PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 16)); new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 16));
} }
this.timeRemaining -= 10;
}
} }
public boolean isBusy() { public boolean isBusy() {

View file

@ -53,7 +53,7 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
int addAmount = 25000; int addAmount = 25000;
int toAdd = Math.max(0, addAmount - curr.getValue() * 100); int toAdd = Math.max(0, addAmount - curr.getValue() * 100);
if (toAdd > 0) { if (toAdd > 0) {
if (NaturesAuraAPI.TYPE_OVERWORLD.isPresentInWorld(this.world)) { if (NaturesAuraAPI.TYPE_OVERWORLD.isPresentInWorld(this.world) && this.canGenerateRightNow(30, toAdd)) {
int remain = toAdd; int remain = toAdd;
while (remain > 0) { while (remain > 0) {
BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos); BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos);

View file

@ -1,7 +1,9 @@
package de.ellpeck.naturesaura.blocks.tiles; package de.ellpeck.naturesaura.blocks.tiles;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; 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.api.aura.container.IAuraContainer;
import de.ellpeck.naturesaura.blocks.ModBlocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
@ -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 { public enum SaveType {
TILE, TILE,
SYNC, SYNC,

View file

@ -38,15 +38,17 @@ public class TileEntityMossGenerator extends TileEntityImpl implements ITickable
IBlockState result = NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.inverse().get(state); IBlockState result = NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.inverse().get(state);
int toAdd = 15000; int toAdd = 15000;
if (this.canGenerateRightNow(35, toAdd)) {
while (toAdd > 0) { while (toAdd > 0) {
BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 35, this.pos); BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 35, this.pos);
toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd); toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd);
} }
this.world.playEvent(2001, offset, Block.getStateId(state));
PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), 23)); new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), 23));
}
this.world.playEvent(2001, offset, Block.getStateId(state));
this.world.setBlockState(offset, result); this.world.setBlockState(offset, result);
} }
} }

View file

@ -21,6 +21,8 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickable
BlockPos pos = this.scheduledBigTrees.remove(); BlockPos pos = this.scheduledBigTrees.remove();
if (this.world.getBlockState(pos).getBlock() instanceof BlockLog) { if (this.world.getBlockState(pos).getBlock() instanceof BlockLog) {
int toAdd = 100000; int toAdd = 100000;
boolean canGen = this.canGenerateRightNow(25, toAdd);
if (canGen)
while (toAdd > 0) { while (toAdd > 0) {
BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 25, this.pos); BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 25, this.pos);
toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd); toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd);
@ -28,7 +30,7 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickable
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles( PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
this.pos.getX(), this.pos.getY(), this.pos.getZ(), 12, 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));
} }
} }
} }

View file

@ -41,6 +41,8 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab
} }
int toAdd = ((effect.getAmplifier() * 7 + 1) * (effect.getDuration() / 25)) * 100; int toAdd = ((effect.getAmplifier() * 7 + 1) * (effect.getDuration() / 25)) * 100;
boolean canGen = this.canGenerateRightNow(30, toAdd);
if (canGen)
while (toAdd > 0) { while (toAdd > 0) {
BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos); BlockPos spot = IAuraChunk.getLowestSpot(this.world, this.pos, 30, this.pos);
toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd); toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd);
@ -48,7 +50,7 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles( PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
this.pos.getX(), this.pos.getY(), this.pos.getZ(), 5, this.pos.getX(), this.pos.getY(), this.pos.getZ(), 5,
PotionUtils.getPotionColor(type))); PotionUtils.getPotionColor(type), canGen ? 1 : 0));
addedOne = true; addedOne = true;
break; break;

View file

@ -124,6 +124,7 @@ public class PacketParticles implements IMessage {
break; break;
case 5: // Potion generator case 5: // Potion generator
int color = message.data[0]; int color = message.data[0];
boolean releaseAura = message.data[1] > 0;
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--) { for (int i = world.rand.nextInt(5) + 5; i >= 0; i--) {
NaturesAuraAPI.instance().spawnMagicParticle( NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextFloat(), message.posX + world.rand.nextFloat(),
@ -132,6 +133,7 @@ public class PacketParticles implements IMessage {
world.rand.nextGaussian() * 0.01F, world.rand.nextFloat() * 0.1F, world.rand.nextGaussian() * 0.01F, world.rand.nextGaussian() * 0.01F, world.rand.nextFloat() * 0.1F, world.rand.nextGaussian() * 0.01F,
color, 2F + world.rand.nextFloat(), 40, 0F, true, true); color, 2F + world.rand.nextFloat(), 40, 0F, true, true);
if (releaseAura)
for (int x = -1; x <= 1; x += 2) for (int x = -1; x <= 1; x += 2)
for (int z = -1; z <= 1; z += 2) { for (int z = -1; z <= 1; z += 2) {
NaturesAuraAPI.instance().spawnMagicParticle( NaturesAuraAPI.instance().spawnMagicParticle(
@ -213,6 +215,7 @@ public class PacketParticles implements IMessage {
int sapX = message.data[0]; int sapX = message.data[0];
int sapY = message.data[1]; int sapY = message.data[1];
int sapZ = message.data[2]; int sapZ = message.data[2];
releaseAura = message.data[3] > 0;
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--) for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnParticleStream( NaturesAuraAPI.instance().spawnParticleStream(
sapX + 0.5F + (float) world.rand.nextGaussian() * 3F, sapX + 0.5F + (float) world.rand.nextGaussian() * 3F,
@ -222,6 +225,7 @@ public class PacketParticles implements IMessage {
message.posY + 0.5F, message.posY + 0.5F,
message.posZ + 0.5F, message.posZ + 0.5F,
0.6F, BiomeColorHelper.getFoliageColorAtPos(world, new BlockPos(sapX, sapY, sapZ)), 1.5F); 0.6F, BiomeColorHelper.getFoliageColorAtPos(world, new BlockPos(sapX, sapY, sapZ)), 1.5F);
if (releaseAura)
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle( NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + 0.25F + world.rand.nextFloat() * 0.5F, message.posX + 0.25F + world.rand.nextFloat() * 0.5F,

View file

@ -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": [{}]
}
}

View file

@ -44,6 +44,7 @@ tile.naturesaura.gold_brick.name=Golden Stone Bricks
tile.naturesaura.rf_converter.name=Energetic Aura Forge tile.naturesaura.rf_converter.name=Energetic Aura Forge
tile.naturesaura.moss_generator.name=Swamp Homi tile.naturesaura.moss_generator.name=Swamp Homi
tile.naturesaura.time_changer.name=Shifting Sundial tile.naturesaura.time_changer.name=Shifting Sundial
tile.naturesaura.generator_limit_remover.name=Creational Catalyst
item.naturesaura.eye.name=Environmental Eye item.naturesaura.eye.name=Environmental Eye
item.naturesaura.eye_improved.name=Environmental Ocular item.naturesaura.eye_improved.name=Environmental Ocular

View file

@ -3,7 +3,6 @@
"icon": "naturesaura:ancient_leaves", "icon": "naturesaura:ancient_leaves",
"category": "creating", "category": "creating",
"advancement": "naturesaura:wood_stand", "advancement": "naturesaura:wood_stand",
"priority": true,
"pages": [ "pages": [
{ {
"type": "text", "type": "text",

View file

@ -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"
}
]
}

View file

@ -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$()."
}
]
}

View file

@ -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"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B