Fixes, block models

This commit is contained in:
paulevsGitch 2021-03-01 21:44:17 +03:00
parent 2fd19ac328
commit 697d2bfe20
11 changed files with 123 additions and 21 deletions

View file

@ -5,10 +5,14 @@ import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.ShapeContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldView;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.EndPlantBlock;
@ -16,19 +20,25 @@ import ru.betterend.registry.EndBlocks;
public class LargeAmaranitaBlock extends EndPlantBlock {
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
private static final VoxelShape SHAPE_BOTTOM = Block.createCuboidShape(4, 0, 4, 12, 14, 12);
private static final VoxelShape SHAPE_TOP = VoxelShapes.union(Block.createCuboidShape(1, 3, 1, 15, 16, 15), SHAPE_BOTTOM);
public LargeAmaranitaBlock() {
super(FabricBlockSettings.of(Material.PLANT)
.luminance((state) -> (state.get(SHAPE) == TripleShape.TOP) ? 15 : 0)
.breakByTool(FabricToolTags.SHEARS)
.sounds(BlockSoundGroup.GRASS)
.breakByHand(true)
.noCollision());
.breakByHand(true));
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
return state.get(SHAPE) == TripleShape.TOP ? SHAPE_TOP : SHAPE_BOTTOM;
}
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == EndBlocks.SANGNUM;
return state.isOf(EndBlocks.SANGNUM) || state.isOf(EndBlocks.MOSSY_OBSIDIAN) || state.isOf(EndBlocks.MOSSY_BONE);
}
@Override

View file

@ -2,17 +2,24 @@ package ru.betterend.blocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import ru.betterend.blocks.basis.EndPlantBlock;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
public class SmallAmaranitaBlock extends EndPlantBlock {
private static final VoxelShape SHAPE = Block.createCuboidShape(4, 0, 4, 12, 10, 12);
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == EndBlocks.SANGNUM;
return state.isOf(EndBlocks.SANGNUM) || state.isOf(EndBlocks.MOSSY_OBSIDIAN) || state.isOf(EndBlocks.MOSSY_BONE);
}
@Override
@ -24,6 +31,12 @@ public class SmallAmaranitaBlock extends EndPlantBlock {
EndFeatures.LARGE_AMARANITA.getFeature().generate(world, null, random, pos, null);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
Vec3d vec3d = state.getModelOffset(view, pos);
return SHAPE.offset(vec3d.x, vec3d.y, vec3d.z);
}
private BlockPos growBig(ServerWorld world, BlockPos pos) {
for (int x = -1; x < 2; x++) {
for (int z = -1; z < 2; z++) {

View file

@ -47,6 +47,18 @@ public class BonemealUtil {
addBonemealGrass(EndBlocks.RUTISCUS, EndBlocks.AERIDIUM, 0.2F);
addBonemealGrass(EndBlocks.RUTISCUS, EndBlocks.LUTEBUS, 0.2F);
addBonemealGrass(EndBlocks.RUTISCUS, EndBlocks.LAMELLARIUM);
addBonemealGrass(EndBlocks.SANGNUM, EndBlocks.GLOBULAGUS);
addBonemealGrass(EndBlocks.SANGNUM, EndBlocks.CLAWFERN);
addBonemealGrass(EndBlocks.SANGNUM, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F);
addBonemealGrass(EndBlocks.MOSSY_BONE, EndBlocks.GLOBULAGUS);
addBonemealGrass(EndBlocks.MOSSY_BONE, EndBlocks.CLAWFERN);
addBonemealGrass(EndBlocks.MOSSY_BONE, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F);
addBonemealGrass(EndBlocks.MOSSY_OBSIDIAN, EndBlocks.GLOBULAGUS);
addBonemealGrass(EndBlocks.MOSSY_OBSIDIAN, EndBlocks.CLAWFERN);
addBonemealGrass(EndBlocks.MOSSY_OBSIDIAN, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F);
}
public static void addBonemealGrass(Block terrain, Block plant) {

View file

@ -1,8 +1,5 @@
{
"variants": {
"": [
{ "model": "betterend:block/small_amaranita_mushroom_01" },
{ "model": "betterend:block/small_amaranita_mushroom_02" }
]
"": { "model": "betterend:block/small_amaranita_mushroom" }
}
}

View file

@ -0,0 +1,81 @@
{
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
"textures": {
"particle": "betterend:block/small_amaranita_mushroom",
"texture": "betterend:block/small_amaranita_mushroom"
},
"elements": [
{
"__comment": "Box1",
"from": [ 4, 4, 4 ],
"to": [ 12, 8, 12 ],
"faces": {
"down": { "uv": [ 0, 8, 8, 16 ], "texture": "#texture" },
"up": { "uv": [ 0, 0, 8, 8 ], "texture": "#texture" },
"north": { "uv": [ 8, 4, 16, 8 ], "texture": "#texture" },
"south": { "uv": [ 8, 4, 16, 8 ], "texture": "#texture" },
"west": { "uv": [ 8, 4, 16, 8 ], "texture": "#texture" },
"east": { "uv": [ 8, 4, 16, 8 ], "texture": "#texture" }
}
},
{
"__comment": "Box1",
"from": [ 7, 0, 7 ],
"to": [ 9, 4, 9 ],
"faces": {
"north": { "uv": [ 14, 8, 16, 12 ], "texture": "#texture" },
"south": { "uv": [ 14, 8, 16, 12 ], "texture": "#texture" },
"west": { "uv": [ 14, 8, 16, 12 ], "texture": "#texture" },
"east": { "uv": [ 14, 8, 16, 12 ], "texture": "#texture" }
}
},
{
"__comment": "Box1",
"from": [ 5, 8, 5 ],
"to": [ 11, 10, 11 ],
"faces": {
"up": { "uv": [ 1, 1, 7, 7 ], "texture": "#texture" },
"north": { "uv": [ 9, 2, 15, 4 ], "texture": "#texture" },
"south": { "uv": [ 9, 2, 15, 4 ], "texture": "#texture" },
"west": { "uv": [ 9, 2, 15, 4 ], "texture": "#texture" },
"east": { "uv": [ 9, 2, 15, 4 ], "texture": "#texture" }
}
},
{
"__comment": "PlaneX4",
"from": [ 4.5, 2, 4 ],
"to": [ 4.501, 4, 12 ],
"faces": {
"west": { "uv": [ 8, 13, 16, 15 ], "texture": "#texture" },
"east": { "uv": [ 8, 13, 16, 15 ], "texture": "#texture" }
}
},
{
"__comment": "PlaneX4",
"from": [ 11.5, 2, 4 ],
"to": [ 11.501, 4, 12 ],
"faces": {
"west": { "uv": [ 8, 13, 16, 15 ], "texture": "#texture" },
"east": { "uv": [ 8, 13, 16, 15 ], "texture": "#texture" }
}
},
{
"__comment": "PlaneZ6",
"from": [ 4, 2, 4.5 ],
"to": [ 12, 4, 4.501 ],
"faces": {
"north": { "uv": [ 8, 13, 16, 15 ], "texture": "#texture" },
"south": { "uv": [ 8, 13, 16, 15 ], "texture": "#texture" }
}
},
{
"__comment": "PlaneZ6",
"from": [ 4, 2, 11.5 ],
"to": [ 12, 4, 11.501 ],
"faces": {
"north": { "uv": [ 8, 13, 16, 15 ], "texture": "#texture" },
"south": { "uv": [ 8, 13, 16, 15 ], "texture": "#texture" }
}
}
]
}

View file

@ -1,6 +0,0 @@
{
"parent": "block/cross",
"textures": {
"cross": "betterend:block/small_amaranita_mushroom"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "betterend:block/cross_inverted",
"textures": {
"cross": "betterend:block/small_amaranita_mushroom"
}
}

View file

@ -1,6 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betterend:block/small_amaranita_mushroom"
"layer0": "betterend:item/small_amaranita_mushroom"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 462 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B