finished the corporeal eye

This commit is contained in:
Ellpeck 2020-02-02 19:43:40 +01:00
parent 75fb931c5f
commit 2a88c1e7ac
11 changed files with 174 additions and 3 deletions

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "naturesaura:block/animal_container"
}
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "naturesaura:block/animal_container"
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:animal_container"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -2,17 +2,31 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAnimalContainer;
import net.minecraft.block.material.Material;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockAnimalContainer extends BlockContainerImpl implements IVisualizable {
public class BlockAnimalContainer extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
private static final VoxelShape SHAPE = makeCuboidShape(5, 0, 5, 11, 13, 11);
public BlockAnimalContainer() {
super("animal_container", TileEntityAnimalContainer::new, ModBlocks.prop(Material.WOOD).hardnessAndResistance(2));
super("animal_container", TileEntityAnimalContainer::new, ModBlocks.prop(Blocks.STONE));
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return SHAPE;
}
@Override
@ -32,4 +46,9 @@ public class BlockAnimalContainer extends BlockContainerImpl implements IVisuali
public int getVisualizationColor(World world, BlockPos pos) {
return 0x42ddf5;
}
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
}
}

View file

@ -1,5 +1,7 @@
package de.ellpeck.naturesaura.blocks.tiles;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.math.AxisAlignedBB;
@ -40,6 +42,12 @@ public class TileEntityAnimalContainer extends TileEntityImpl implements ITickab
Vec3d distance = pos.subtract(this.pos.getX(), pos.getY(), this.pos.getZ());
distance = distance.normalize().scale(-0.15F);
animal.setMotion(distance);
if (this.world.rand.nextBoolean()) {
Vec3d eye = animal.getEyePosition(1).add(animal.getLookVec());
PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles((float) eye.getX(), (float) eye.getY(), (float) eye.getZ(), PacketParticles.Type.ANIMAL_CONTAINER));
}
}
}
}

View file

@ -450,6 +450,15 @@ public class PacketParticles {
0.25F, color, 0.5F + world.rand.nextFloat()
);
}
}),
ANIMAL_CONTAINER((message, world) -> {
for (int i = world.rand.nextInt(2) + 1; i > 0; i--)
NaturesAuraAPI.instance().spawnMagicParticle(
message.posX + world.rand.nextGaussian() * 0.15F,
message.posY - world.rand.nextFloat() * 0.5F,
message.posZ + world.rand.nextGaussian() * 0.15F,
0, 0, 0, 0x42e9f5, 1 + world.rand.nextFloat() * 2, 40, 0, false, true
);
});
public final BiConsumer<PacketParticles, World> action;

View file

@ -55,6 +55,7 @@
"block.naturesaura.projectile_generator": "Shooting Mark",
"block.naturesaura.blast_furnace_booster": "Armorer's Aid",
"block.naturesaura.nether_wart_mushroom": "Nether Wart Mushroom",
"block.naturesaura.animal_container": "Corporeal Eye",
"item.naturesaura.eye": "Environmental Eye",
"item.naturesaura.eye_improved": "Environmental Ocular",
"item.naturesaura.gold_fiber": "Brilliant Fiber",

View file

@ -0,0 +1,63 @@
{
"credit": "Made with Blockbench",
"parent": "minecraft:block/block",
"textures": {
"0": "naturesaura:block/infused_brick",
"1": "naturesaura:block/animal_container_eye",
"particle": "naturesaura:block/infused_brick"
},
"elements": [
{
"name": "base",
"from": [3, 0, 3],
"to": [13, 1, 13],
"faces": {
"north": {"uv": [0, 0, 10, 1], "texture": "#0"},
"east": {"uv": [0, 0, 10, 1], "texture": "#0"},
"south": {"uv": [0, 0, 10, 1], "texture": "#0"},
"west": {"uv": [0, 0, 10, 1], "texture": "#0"},
"up": {"uv": [0, 0, 10, 10], "texture": "#0"},
"down": {"uv": [0, 0, 10, 10], "texture": "#0"}
}
},
{
"name": "base2",
"from": [4, 1, 4],
"to": [12, 2, 12],
"faces": {
"north": {"uv": [0, 0, 8, 1], "texture": "#0"},
"east": {"uv": [0, 0, 8, 1], "texture": "#0"},
"south": {"uv": [0, 0, 8, 1], "texture": "#0"},
"west": {"uv": [0, 0, 8, 1], "texture": "#0"},
"up": {"uv": [0, 0, 8, 8], "texture": "#0"},
"down": {"uv": [0, 0, 8, 8], "texture": "#0"}
}
},
{
"name": "stem",
"from": [6, 2, 6],
"to": [10, 7, 10],
"faces": {
"north": {"uv": [0, 0, 4, 5], "texture": "#0"},
"east": {"uv": [0, 0, 4, 5], "texture": "#0"},
"south": {"uv": [0, 0, 4, 5], "texture": "#0"},
"west": {"uv": [0, 0, 4, 5], "texture": "#0"},
"up": {"uv": [0, 0, 4, 4], "texture": "#0"},
"down": {"uv": [0, 0, 4, 4], "texture": "#0"}
}
},
{
"name": "eye",
"from": [5, 7, 5],
"to": [11, 13, 11],
"faces": {
"north": {"uv": [0, 0, 6, 6], "texture": "#1"},
"east": {"uv": [0, 0, 6, 6], "texture": "#1"},
"south": {"uv": [0, 0, 6, 6], "texture": "#1"},
"west": {"uv": [0, 0, 6, 6], "texture": "#1"},
"up": {"uv": [6, 0, 12, 6], "texture": "#1"},
"down": {"uv": [6, 0, 12, 6], "texture": "#1"}
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

View file

@ -0,0 +1,17 @@
{
"name": "Corporeal Eye",
"icon": "naturesaura:animal_container",
"category": "devices",
"advancement": "naturesaura:eye",
"pages": [
{
"type": "text",
"text": "Sometimes, as a farmer, one wants their $(thing)animals$() to be contained in a small area as to prevent them from running away.$(br)The $(item)Corporeal Eye$() prevents any animals from exiting its area of effect without needing any blocks around it. Its $(thing)range$() for this containment is determined by the $(thing)redstone signal$() applied to it - the stronger it is, the bigger the area."
},
{
"type": "crafting",
"text": "Creating the $(item)Corporeal Eye$()",
"recipe": "naturesaura:animal_container"
}
]
}

View file

@ -0,0 +1,25 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"SES",
"WBW",
"BBB"
],
"key": {
"W": {
"item": "minecraft:wheat"
},
"S": {
"item": "minecraft:wheat_seeds"
},
"E": {
"item": "naturesaura:eye"
},
"B": {
"item": "naturesaura:infused_brick"
}
},
"result": {
"item": "naturesaura:animal_container"
}
}