Skip to content

Commit

Permalink
Added test textures for all remaining blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
stuin committed Jun 14, 2021
1 parent e19089b commit fbb58d3
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 17 deletions.
14 changes: 0 additions & 14 deletions src/main/java/modfest/lacrimis/block/NetworkLinkBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,6 @@ public void onWrenched(World world, PlayerEntity player, BlockHitResult result)
}
}

public VoxelShape getVisualShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return VoxelShapes.empty();
}

@Environment(EnvType.CLIENT)
public float getAmbientOcclusionLightLevel(BlockState state, BlockView world, BlockPos pos) {
return 1.0F;
}

@Override
public boolean isTranslucent(BlockState state, BlockView world, BlockPos pos) {
return true;
}

@Override
public void onBroken(WorldAccess world, BlockPos pos, BlockState state) {
NetworkLinkEntity linkEntity = ((NetworkLinkEntity) world.getBlockEntity(pos));
Expand Down
51 changes: 51 additions & 0 deletions src/main/java/modfest/lacrimis/block/TearCollectorBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.FacingBlock;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.util.BlockMirror;
import net.minecraft.util.BlockRotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;

public class TearCollectorBlock extends FacingBlock implements DuctConnectBlock {
private static final VoxelShape[] SHAPES = generateShapes();

public TearCollectorBlock(Settings settings) {
super(settings);
}
Expand Down Expand Up @@ -49,4 +55,49 @@ public int extractTears(BlockPos pos, World world, int request, boolean simulate
public boolean insert(BlockPos pos, World world, Object value) {
return false;
}

@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
int idx = (byte) (state.get(FACING) == Direction.DOWN ? 3 : 0) |
(byte) (state.get(FACING) == Direction.UP ? 3 : 0) |
(byte) (state.get(FACING) == Direction.NORTH ? 12 : 0) |
(byte) (state.get(FACING) == Direction.SOUTH ? 12 : 0) |
(byte) (state.get(FACING) == Direction.WEST ? 48 : 0) |
(byte) (state.get(FACING) == Direction.EAST ? 48 : 0) |
(byte) (64);
return SHAPES[idx];
}

private static VoxelShape[] generateShapes() {
float radius = 1 / 16f;
VoxelShape[] shapes = new VoxelShape[128];
float min = 0.5F - radius;
float max = 0.5F + radius;
VoxelShape center = VoxelShapes.cuboid(min, min, min, max, max, max);

VoxelShape[] connections = new VoxelShape[]{
VoxelShapes.cuboid(min, 0f, min, max, max, max),
VoxelShapes.cuboid(min, min, min, max, 1f, max),
VoxelShapes.cuboid(min, min, 0f, max, max, max),
VoxelShapes.cuboid(min, min, min, max, max, 1f),
VoxelShapes.cuboid(0f, min, min, max, max, max),
VoxelShapes.cuboid(min, min, min, 1f, max, max)
};

float nodeRadius = 2 / 16f;
float nodeMin = 0.5F - nodeRadius;
float nodeMax = 0.5F + nodeRadius;
VoxelShape node = VoxelShapes.cuboid(nodeMin, nodeMin, nodeMin, nodeMax, nodeMax, nodeMax);

for (int i = 0; i < 128; i++) {
VoxelShape shape = i >= 64 ? node : center;
for (int side = 0; side < FACINGS.length; ++side) {
if ((i & 1 << side) != 0) {
shape = VoxelShapes.union(shape, connections[side]);
}
}
shapes[i] = shape;
}
return shapes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@

@Environment(EnvType.CLIENT)
public class SoulShellRenderer extends LivingEntityRenderer<SoulShellEntity, SoulShellModel<SoulShellEntity>> {
public static final Identifier TEXTURE = new Identifier(Lacrimis.MODID, "textures/entity/soul_shel.png");
public static final Identifier TEXTURE = new Identifier(Lacrimis.MODID, "textures/entity/soul_shell.png");

public SoulShellRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, new SoulShellModel<>(0.0F), 0.5F);
this.addFeature(new ArmorFeatureRenderer(this, new BipedEntityModel<SoulShellEntity>(0.5F), new BipedEntityModel<SoulShellEntity>(1.0F)));
this.addFeature(new HeldItemFeatureRenderer<>(this));
//this.addFeature(new HeadFeatureRenderer<>(this));
this.addFeature(new HeadFeatureRenderer<>(this));
this.addFeature(new ElytraFeatureRenderer<>(this));
}

Expand Down
52 changes: 52 additions & 0 deletions src/main/resources/assets/lacrimis/blockstates/tear_collector.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"multipart": [
{
"when": { "facing": "down" },
"apply": { "model": "lacrimis:block/duct/collector_node", "x": 180 }
},
{
"when": { "facing": "east" },
"apply": { "model": "lacrimis:block/duct/collector_node", "x": 90, "y": 90 }
},
{
"when": { "facing": "north" },
"apply": { "model": "lacrimis:block/duct/collector_node", "x": 90 }
},
{
"when": { "facing": "south" },
"apply": { "model": "lacrimis:block/duct/collector_node", "x": 90, "y": 180 }
},
{
"when": { "facing": "up" },
"apply": { "model": "lacrimis:block/duct/collector_node" }
},
{
"when": { "facing": "west" },
"apply": { "model": "lacrimis:block/duct/collector_node", "x": 90, "y": 270 }
},
{
"when": { "facing": "up|down" },
"apply": { "model": "lacrimis:block/duct/collector_side" }
},
{
"when": { "facing": "up|down" },
"apply": { "model": "lacrimis:block/duct/collector_side", "uvlock": true, "x": 180 }
},
{
"when": { "facing": "north|south" },
"apply": { "model": "lacrimis:block/duct/collector_side", "uvlock": true, "x": 90 }
},
{
"when": { "facing": "north|south" },
"apply": { "model": "lacrimis:block/duct/collector_side", "uvlock": true, "x": 90, "y": 180 }
},
{
"when": { "facing": "east|west" },
"apply": { "model": "lacrimis:block/duct/collector_side", "uvlock": true, "x": 90, "y": 90 }
},
{
"when": { "facing": "east|west" },
"apply": { "model": "lacrimis:block/duct/collector_side", "uvlock": true, "x": 90, "y": 270 }
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"parent": "block/block",
"textures": {
"particle": "#arrows",
"arrows": "lacrimis:block/tear_collector",
"face": "lacrimis:block/duct_node"
},
"elements": [
{
"from": [6, 6, 6],
"to": [10, 10, 10],
"faces": {
"north": { "texture": "#arrows"},
"south": { "texture": "#arrows" },
"east": { "texture": "#arrows" },
"west": { "texture": "#arrows" },
"up": { "texture": "#face" },
"down": { "texture": "#face" }
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"parent": "block/block",
"textures": {
"particle": "#block",
"block": "lacrimis:block/tear_collector"
},
"elements": [
{
"from": [7, 0, 7],
"to": [9, 7, 9],
"faces": {
"north": { "texture": "#block" },
"south": { "texture": "#block" },
"east": { "texture": "#block" },
"west": { "texture": "#block" },
"up": { "texture": "#block" },
"down": { "texture": "#block" }
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"particle": "block/glass",
"glass": "block/glass",
"obsidian": "block/obsidian",
"obsidian": "block/crying_obsidian",
"beacon": "block/beacon"
},
"elements": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "lacrimis:item/soul_shell"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "lacrimis:item/soul_totem"
}
}
23 changes: 23 additions & 0 deletions src/main/resources/assets/lacrimis/models/item/tear_collector.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"parent": "block/block",
"textures": {
"particle": "#arrows",
"arrows": "lacrimis:block/tear_collector",
"face": "lacrimis:block/duct_node",
"block": "lacrimis:block/tear_collector"
},
"elements": [
{
"from": [6, 6, 6],
"to": [10, 10, 10],
"faces": {
"north": { "texture": "#arrows"},
"south": { "texture": "#arrows" },
"east": { "texture": "#arrows" },
"west": { "texture": "#arrows" },
"up": { "texture": "#face" },
"down": { "texture": "#face" }
}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fbb58d3

Please sign in to comment.