mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58:34 +01:00
finish the firecracker gaze
This commit is contained in:
parent
47af8bb798
commit
7e6f6450e4
8 changed files with 141 additions and 39 deletions
|
@ -1,10 +1,31 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
|
import de.ellpeck.naturesaura.api.render.IVisualizable;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityFireworkGenerator;
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityFireworkGenerator;
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockFireworkGenerator extends BlockContainerImpl {
|
public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable {
|
||||||
public BlockFireworkGenerator() {
|
public BlockFireworkGenerator() {
|
||||||
super(Material.ROCK, "firework_generator", TileEntityFireworkGenerator.class, "firework_generator");
|
super(Material.ROCK, "firework_generator", TileEntityFireworkGenerator.class, "firework_generator");
|
||||||
|
this.setSoundType(SoundType.STONE);
|
||||||
|
this.setHardness(3F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||||
|
return new AxisAlignedBB(pos).grow(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getVisualizationColor(World world, BlockPos pos) {
|
||||||
|
return 0xa442f4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,15 +56,16 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.trackedEntity != null && this.trackedEntity.isDead) {
|
if (this.trackedEntity != null && this.trackedEntity.isDead) {
|
||||||
|
if (this.trackedItem.hasTagCompound()) {
|
||||||
float generateFactor = 0;
|
float generateFactor = 0;
|
||||||
Set<Integer> usedColors = new HashSet<>();
|
Set<Integer> usedColors = new HashSet<>();
|
||||||
|
|
||||||
NBTTagCompound compound = this.trackedItem.getTagCompound();
|
NBTTagCompound compound = this.trackedItem.getTagCompound();
|
||||||
NBTTagCompound fireworks = compound.getCompoundTag("Fireworks");
|
NBTTagCompound fireworks = compound.getCompoundTag("Fireworks");
|
||||||
|
|
||||||
|
int flightTime = fireworks.getInteger("Flight");
|
||||||
NBTTagList explosions = fireworks.getTagList("Explosions", 10);
|
NBTTagList explosions = fireworks.getTagList("Explosions", 10);
|
||||||
if (!explosions.isEmpty()) {
|
if (!explosions.isEmpty()) {
|
||||||
int flightTime = fireworks.getInteger("Flight");
|
|
||||||
generateFactor += flightTime;
|
generateFactor += flightTime;
|
||||||
|
|
||||||
for (NBTBase base : explosions) {
|
for (NBTBase base : explosions) {
|
||||||
|
@ -91,10 +92,11 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (generateFactor > 0) {
|
||||||
int toAdd = MathHelper.ceil(generateFactor * 10000F);
|
int toAdd = MathHelper.ceil(generateFactor * 10000F);
|
||||||
if (this.canGenerateRightNow(35, toAdd)) {
|
if (this.canGenerateRightNow(35, toAdd)) {
|
||||||
this.toRelease = toAdd;
|
this.toRelease = toAdd;
|
||||||
this.releaseTimer = 80;
|
this.releaseTimer = 15 * flightTime + 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Integer> data = new ArrayList<>();
|
List<Integer> data = new ArrayList<>();
|
||||||
|
@ -105,6 +107,8 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick
|
||||||
PacketHandler.sendToAllLoaded(this.world, this.pos, new PacketParticles(
|
PacketHandler.sendToAllLoaded(this.world, this.pos, new PacketParticles(
|
||||||
(float) this.trackedEntity.posX, (float) this.trackedEntity.posY, (float) this.trackedEntity.posZ,
|
(float) this.trackedEntity.posX, (float) this.trackedEntity.posY, (float) this.trackedEntity.posZ,
|
||||||
24, Ints.toArray(data)));
|
24, Ints.toArray(data)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.trackedEntity = null;
|
this.trackedEntity = null;
|
||||||
this.trackedItem = null;
|
this.trackedItem = null;
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "minecraft:cube",
|
||||||
|
"textures": {
|
||||||
|
"particle": "naturesaura:blocks/firework_generator",
|
||||||
|
"up": "naturesaura:blocks/firework_generator_top",
|
||||||
|
"down": "#particle",
|
||||||
|
"north": "#particle",
|
||||||
|
"east": "#particle",
|
||||||
|
"south": "#particle",
|
||||||
|
"west": "#particle"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"normal": [{}],
|
||||||
|
"inventory": [{}]
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,6 +47,7 @@ tile.naturesaura.time_changer.name=Shifting Sundial
|
||||||
tile.naturesaura.generator_limit_remover.name=Creational Catalyst
|
tile.naturesaura.generator_limit_remover.name=Creational Catalyst
|
||||||
tile.naturesaura.ender_crate.name=Ender Crate
|
tile.naturesaura.ender_crate.name=Ender Crate
|
||||||
tile.naturesaura.powder_placer.name=Powder Manipulator
|
tile.naturesaura.powder_placer.name=Powder Manipulator
|
||||||
|
tile.naturesaura.firework_generator.name=Firecracker Gaze
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"name": "Firecracker Gaze",
|
||||||
|
"icon": "naturesaura:firework_generator",
|
||||||
|
"category": "creating",
|
||||||
|
"advancement": "naturesaura:offering",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "$(item)Fireworks$() are beautiful to look at, while it is a bit pricy to create ones that look really good. The $(item)Firecracker Gaze$() seemingly shares this opinion especially: Consuming any fireworks that are $(thing)dropped$() on the ground around it, it will shoot them up into the air. Once they explode, their explosive and colorful energy is absorbed, and, based on the complexity of the firework,"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "more or less $(aura) is created and spread into the environment as a result. For the complexity, especially the $(thing)value$() of the items used in the firework's creation is of importance, but also, the amount of $(thing)firework stars$(), the amount of $(thing)colors$() and some other variables factor into the amount of $(aura) created from each shot."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Additionally, it should be noted that, while a firework is already being shot into the air by the $(item)Firecracker Gaze$(), or while it is consuming an explosion's energy, dropping any more fireworks into its collection area will cause the fireworks to be consumed, but no $(aura) to be created from them. This implies that it would be wise to set up some sort of $(thing)timer$() for its automation."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "crafting",
|
||||||
|
"recipe": "naturesaura:firework_generator",
|
||||||
|
"text": "Creating the $(item)Firecracker Gaze$()"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"type": "forge:ore_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"SFS",
|
||||||
|
"GIG",
|
||||||
|
"TSJ"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"F": {
|
||||||
|
"item": "minecraft:fireworks"
|
||||||
|
},
|
||||||
|
"G": {
|
||||||
|
"item": "minecraft:gunpowder"
|
||||||
|
},
|
||||||
|
"S": {
|
||||||
|
"item": "naturesaura:infused_stone"
|
||||||
|
},
|
||||||
|
"T": {
|
||||||
|
"item": "naturesaura:token_rage"
|
||||||
|
},
|
||||||
|
"J": {
|
||||||
|
"item": "naturesaura:token_joy"
|
||||||
|
},
|
||||||
|
"I": {
|
||||||
|
"item": "naturesaura:sky_ingot"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"item": "naturesaura:firework_generator"
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 694 B |
Binary file not shown.
After Width: | Height: | Size: 600 B |
Loading…
Reference in a new issue