mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
a lot of work on the Ritual of the Brewer
This commit is contained in:
parent
b6a496ed99
commit
6d50aa10d4
10 changed files with 124 additions and 0 deletions
|
@ -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");
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<EntityAreaEffectCloud> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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": [{}]
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 645 B |
Binary file not shown.
After Width: | Height: | Size: 691 B |
Binary file not shown.
After Width: | Height: | Size: 720 B |
Loading…
Reference in a new issue