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 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);
}

View file

@ -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));
}
}

View file

@ -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);

View file

@ -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,

View file

@ -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);
}
}

View file

@ -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));
}
}
}

View file

@ -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;

View file

@ -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];

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.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

View file

@ -3,7 +3,6 @@
"icon": "naturesaura:ancient_leaves",
"category": "creating",
"advancement": "naturesaura:wood_stand",
"priority": true,
"pages": [
{
"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