mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-25 12:58:33 +01:00
finish up the ritual of the brewer
This commit is contained in:
parent
6d50aa10d4
commit
fe07d9304e
8 changed files with 122 additions and 26 deletions
|
@ -12,11 +12,14 @@ public final class ModConfig {
|
|||
|
||||
public static class General {
|
||||
|
||||
@Comment("If using Dragon's Breath in a Brewing Stand should not cause a glass bottle to appear")
|
||||
public boolean removeDragonBreathContainerItem = true;
|
||||
|
||||
}
|
||||
|
||||
public static class Client {
|
||||
|
||||
@Comment("The percentage of particles that should be displayed, where 1 is 100% and 0 is 0%.")
|
||||
@Comment("The percentage of particles that should be displayed, where 1 is 100% and 0 is 0%")
|
||||
@RangeDouble(min = 0, max = 1)
|
||||
public double particleAmount = 1;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import de.ellpeck.naturesaura.proxy.IProxy;
|
|||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
|
@ -84,6 +85,10 @@ public final class NaturesAura {
|
|||
public void postInit(FMLPostInitializationEvent event) {
|
||||
ModRegistry.postInit(event);
|
||||
proxy.postInit(event);
|
||||
|
||||
if (ModConfig.general.removeDragonBreathContainerItem) {
|
||||
Items.DRAGON_BREATH.setContainerItem(null);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
|
|
@ -6,5 +6,7 @@ import net.minecraft.block.material.Material;
|
|||
public class BlockPotionGenerator extends BlockContainerImpl {
|
||||
public BlockPotionGenerator() {
|
||||
super(Material.ROCK, "potion_generator", TileEntityPotionGenerator.class, "potion_generator");
|
||||
this.setHardness(5F);
|
||||
this.setHarvestLevel("pickaxe", 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,13 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
|
||||
import de.ellpeck.naturesaura.aura.chunk.AuraChunk;
|
||||
import de.ellpeck.naturesaura.blocks.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.entity.EntityAreaEffectCloud;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.potion.PotionType;
|
||||
import net.minecraft.potion.PotionUtils;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -22,40 +25,48 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab
|
|||
if (Multiblocks.POTION_GENERATOR.validate(this.world, this.pos)) {
|
||||
boolean addedOne = false;
|
||||
|
||||
List<EntityAreaEffectCloud> clouds = this.world.getEntitiesWithinAABB(EntityAreaEffectCloud.class, new AxisAlignedBB(this.pos).grow(3));
|
||||
List<EntityAreaEffectCloud> clouds = this.world.getEntitiesWithinAABB(EntityAreaEffectCloud.class, new AxisAlignedBB(this.pos).grow(2));
|
||||
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()) {
|
||||
if (!addedOne) {
|
||||
PotionType type = ReflectionHelper.getPrivateValue(EntityAreaEffectCloud.class, cloud, "field_184502_e", "potion");
|
||||
if (type == null)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!addedOne) {
|
||||
int toAdd = (effect.getAmplifier() * 5 + 1) * (effect.getDuration() / 80);
|
||||
for (PotionEffect effect : type.getEffects()) {
|
||||
Potion potion = effect.getPotion();
|
||||
if (potion.isBadEffect() || potion.isInstant()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean dispersed = false;
|
||||
int toAdd = (effect.getAmplifier() * 5 + 1) * (effect.getDuration() / 40);
|
||||
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);
|
||||
dispersed = true;
|
||||
}
|
||||
}
|
||||
addedOne = true;
|
||||
}
|
||||
|
||||
float newRadius = cloud.getRadius() - 0.25F;
|
||||
if (newRadius < 0.5F)
|
||||
cloud.setDead();
|
||||
else
|
||||
cloud.setRadius(newRadius);
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
|
||||
this.pos.getX(), this.pos.getY(), this.pos.getZ(), 5,
|
||||
PotionUtils.getPotionColor(type), dispersed ? 1 : 0));
|
||||
|
||||
addedOne = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float newRadius = cloud.getRadius() - 0.25F;
|
||||
if (newRadius < 0.5F)
|
||||
cloud.setDead();
|
||||
else
|
||||
cloud.setRadius(newRadius);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,14 @@ public class PacketParticles implements IMessage {
|
|||
private float posY;
|
||||
private float posZ;
|
||||
private int type;
|
||||
private int[] data;
|
||||
|
||||
public PacketParticles(float posX, float posY, float posZ, int type) {
|
||||
public PacketParticles(float posX, float posY, float posZ, int type, int... data) {
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public PacketParticles() {
|
||||
|
@ -38,7 +40,12 @@ public class PacketParticles implements IMessage {
|
|||
this.posX = buf.readFloat();
|
||||
this.posY = buf.readFloat();
|
||||
this.posZ = buf.readFloat();
|
||||
this.type = buf.readInt();
|
||||
this.type = buf.readByte();
|
||||
|
||||
this.data = new int[buf.readByte()];
|
||||
for (int i = 0; i < this.data.length; i++) {
|
||||
this.data[i] = buf.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,7 +53,12 @@ public class PacketParticles implements IMessage {
|
|||
buf.writeFloat(this.posX);
|
||||
buf.writeFloat(this.posY);
|
||||
buf.writeFloat(this.posZ);
|
||||
buf.writeInt(this.type);
|
||||
buf.writeByte(this.type);
|
||||
|
||||
buf.writeByte(this.data.length);
|
||||
for (int i : this.data) {
|
||||
buf.writeInt(i);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<PacketParticles, IMessage> {
|
||||
|
@ -106,6 +118,32 @@ public class PacketParticles implements IMessage {
|
|||
world.rand.nextGaussian() * 0.01F, world.rand.nextFloat() * 0.01F, world.rand.nextGaussian() * 0.01F,
|
||||
0x00FF00, world.rand.nextFloat() * 1.5F + 0.75F, 40, 0F, false, true);
|
||||
}
|
||||
break;
|
||||
case 5: // Potion generator
|
||||
int color = message.data[0];
|
||||
boolean disperse = message.data[1] > 0;
|
||||
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--) {
|
||||
NaturesAura.proxy.spawnMagicParticle(world,
|
||||
message.posX + world.rand.nextFloat(),
|
||||
message.posY + 1.1F,
|
||||
message.posZ + world.rand.nextFloat(),
|
||||
world.rand.nextGaussian() * 0.005F, world.rand.nextFloat() * 0.05F, world.rand.nextGaussian() * 0.005F,
|
||||
color, 2F + world.rand.nextFloat(), 80, 0F, true, true);
|
||||
|
||||
if (disperse)
|
||||
for (int x = -1; x <= 1; x += 2)
|
||||
for (int z = -1; z <= 1; z += 2) {
|
||||
NaturesAura.proxy.spawnMagicParticle(world,
|
||||
message.posX + x * 3 + 0.5F,
|
||||
message.posY + 2.5,
|
||||
message.posZ + z * 3 + 0.5F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.02F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0xd6340c, 1F + world.rand.nextFloat() * 2F, 150, 0F, true, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -29,7 +29,10 @@ public class ParticleMagic extends Particle {
|
|||
this.motionY = motionY;
|
||||
this.motionZ = motionZ;
|
||||
|
||||
this.setRBGColorF(((color >> 16) & 255) / 255F, ((color >> 8) & 255) / 255F, (color & 255) / 255F);
|
||||
float r = (((color >> 16) & 255) / 255F) * (1F - this.rand.nextFloat() * 0.35F);
|
||||
float g = (((color >> 8) & 255) / 255F) * (1F - this.rand.nextFloat() * 0.35F);
|
||||
float b = ((color & 255) / 255F) * (1F - this.rand.nextFloat() * 0.35F);
|
||||
this.setRBGColorF(r, g, b);
|
||||
|
||||
TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks();
|
||||
this.setParticleTexture(map.getAtlasSprite(TEXTURE.toString()));
|
||||
|
|
|
@ -3,15 +3,24 @@
|
|||
"icon": "naturesaura:potion_generator",
|
||||
"category": "creating",
|
||||
"advancement": "naturesaura:infused_materials",
|
||||
"priority": true,
|
||||
"pages": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "bla bla bla"
|
||||
"text": "As ashes turn to ashes, and dust to dust, a similar natural conversion can be achieved with $(aura) and equally magic $(item)Potions$(). Specifically, $(item)Lingering Potions$() have certain magical abilities that allow one to extract the effects and convert them into $(aura) efficiently.$(p)To do this, simply build the $(item)Ritual of the Brewer$() as depicted on the next page."
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Then, throwing any kind of positive, lasting $(item)Lingering Potion$() down in its vicinity will cause the effect to be consumed and turned into $(aura) that will be spread into the area.$(p)Notice that, however, only one effect can be converted at one time, and throwing multiple potions at the ritual will cause their powers to go to waste. Additionally, once there is enough $(aura) in the area, additional potion effects will similarly go to waste."
|
||||
},
|
||||
{
|
||||
"type": "multiblock",
|
||||
"multiblock_id": "naturesaura:potion_generator"
|
||||
"multiblock_id": "naturesaura:potion_generator",
|
||||
"text": "Creating the $(item)Ritual of the Brewer$() with the $(item)Absorber of Lingering$() in the center"
|
||||
},
|
||||
{
|
||||
"type": "crafting",
|
||||
"recipe": "naturesaura:potion_generator",
|
||||
"text": "Creating the $(item)Absorber of Lingering$()"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"type": "forge:ore_shaped",
|
||||
"pattern": [
|
||||
"BRB",
|
||||
"IWI",
|
||||
"BRB"
|
||||
],
|
||||
"key": {
|
||||
"B": {
|
||||
"item": "minecraft:nether_brick"
|
||||
},
|
||||
"R": {
|
||||
"item": "minecraft:blaze_rod"
|
||||
},
|
||||
"I": {
|
||||
"item": "naturesaura:infused_iron"
|
||||
},
|
||||
"W": {
|
||||
"item": "minecraft:nether_wart"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "naturesaura:potion_generator"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue