Skip to content

Commit

Permalink
feat: update flesh spike model and interaction shape
Browse files Browse the repository at this point in the history
  • Loading branch information
Elenterius committed Jun 16, 2023
1 parent 7639dd1 commit 71f5dfd
Show file tree
Hide file tree
Showing 16 changed files with 991 additions and 198 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.elenterius.biomancy.BiomancyMod;
import com.github.elenterius.biomancy.block.*;
import com.github.elenterius.biomancy.block.fleshspike.FleshSpikeBlock;
import com.github.elenterius.biomancy.block.property.DirectionalSlabType;
import com.github.elenterius.biomancy.block.property.Orientation;
import com.github.elenterius.biomancy.init.ModBlocks;
Expand Down Expand Up @@ -66,7 +67,7 @@ protected void registerStatesAndModels() {

storageSac(ModBlocks.STORAGE_SAC.get());

geckolibModel(ModBlocks.FLESH_SPIKE.get());
fleshSpikes(ModBlocks.FLESH_SPIKE.get());

bioLantern(ModBlocks.BIO_LANTERN.get());
tendonChain(ModBlocks.TENDON_CHAIN.get());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.elenterius.biomancy.block.fleshspike;

import com.github.elenterius.biomancy.init.ModBlockEntities;
import com.github.elenterius.biomancy.init.ModDamageSources;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand All @@ -10,8 +9,10 @@
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
Expand All @@ -20,15 +21,14 @@
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;

public class FleshSpikeBlock extends BaseEntityBlock implements SimpleWaterloggedBlock {
public class FleshSpikeBlock extends Block implements SimpleWaterloggedBlock {

public static final DirectionProperty FACING = BlockStateProperties.FACING;
public static final int MIN_SPIKES = 1;
Expand Down Expand Up @@ -56,12 +56,6 @@ public FluidState getFluidState(BlockState state) {
return Boolean.TRUE.equals(state.getValue(WATERLOGGED)) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
}

@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return ModBlockEntities.FLESH_SPIKE.get().create(pos, state);
}

@Nullable
@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
Expand Down Expand Up @@ -105,16 +99,6 @@ public boolean isCollisionShapeFullBlock(BlockState state, BlockGetter level, Bl
return false;
}

@Override
public PushReaction getPistonPushReaction(BlockState state) {
return PushReaction.NORMAL; //TODO: what happens with piston?
}

@Override
public void stepOn(Level level, BlockPos pos, BlockState state, Entity entity) {
super.stepOn(level, pos, state, entity);
}

@Override
public void fallOn(Level level, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
if (state.getValue(FACING) == Direction.UP) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,53 @@ private static ComputedShapes computeShapes(BlockState blockState) {
}

private static VoxelShape computeBoundingShape(Direction direction, int spikes) {
if (spikes == 1) return VoxelShapeUtil.createXZRotatedTowards(direction, 6, 0, 6, 10, 7, 10);
if (spikes == 2)
return Stream.of(VoxelShapeUtil.createXZRotatedTowards(direction, 9, 0, 8, 13, 7, 12), VoxelShapeUtil.createXZRotatedTowards(direction, 4, 0, 4, 8, 8, 8), VoxelShapeUtil.createXZRotatedTowards(direction, 5, 0, 4, 12, 1, 11)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).orElse(Shapes.empty());
if (spikes == 3)
return Stream.of(VoxelShapeUtil.createXZRotatedTowards(direction, 1, 0, 9, 5, 6, 13), VoxelShapeUtil.createXZRotatedTowards(direction, 6, 3, 6, 10, 9, 10), VoxelShapeUtil.createXZRotatedTowards(direction, 8, 0, 11, 12, 6, 15), VoxelShapeUtil.createXZRotatedTowards(direction, 10, 0, 3, 14, 8, 7), VoxelShapeUtil.createXZRotatedTowards(direction, 11, 1, 7, 14, 3, 10), VoxelShapeUtil.createXZRotatedTowards(direction, 5, 1, 3, 8, 3, 6), VoxelShapeUtil.createXZRotatedTowards(direction, 3, 0, 2, 12, 1, 12), VoxelShapeUtil.createXZRotatedTowards(direction, 4, 1, 6, 10, 3, 11), VoxelShapeUtil.createXZRotatedTowards(direction, 12, 0, 6, 15, 1, 14)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).orElse(Shapes.empty());
if (spikes == 1) return VoxelShapeUtil.createXZRotatedTowards(direction, 4, 0, 4, 12, 7, 12);
if (spikes == 2) return VoxelShapeUtil.createXZRotatedTowards(direction, 2, 0, 2, 14, 8, 14);
if (spikes == 3) return VoxelShapeUtil.createXZRotatedTowards(direction, 1, 0, 1, 15, 11, 15);
return Shapes.empty();
}

private static VoxelShape computeCollisionShape(Direction direction, int spikes) {
if (spikes == 1) return VoxelShapeUtil.createXZRotatedTowards(direction, 6, 0, 6, 10, 2, 10);
if (spikes == 2)
return Stream.of(VoxelShapeUtil.createXZRotatedTowards(direction, 4, 0, 4, 8, 2, 8), VoxelShapeUtil.createXZRotatedTowards(direction, 5, 0, 4, 12, 1, 11), VoxelShapeUtil.createXZRotatedTowards(direction, 9, 0, 8, 13, 2, 12)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).orElse(Shapes.empty());
if (spikes == 3)
return Stream.of(VoxelShapeUtil.createXZRotatedTowards(direction, 3, 0, 2, 12, 1, 12), VoxelShapeUtil.createXZRotatedTowards(direction, 1, 0, 9, 5, 2, 13), VoxelShapeUtil.createXZRotatedTowards(direction, 4, 1, 6, 10, 3, 11), VoxelShapeUtil.createXZRotatedTowards(direction, 10, 0, 3, 14, 2, 7), VoxelShapeUtil.createXZRotatedTowards(direction, 12, 0, 6, 15, 1, 14), VoxelShapeUtil.createXZRotatedTowards(direction, 8, 0, 11, 12, 2, 15)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).orElse(Shapes.empty());
if (spikes == 1) {
return VoxelShapeUtil.createXZRotatedTowards(direction, 6, 0, 6, 10, 2, 10);
}
if (spikes == 2) {
return Stream.of(
VoxelShapeUtil.createXZRotatedTowards(direction, 4, 0, 6, 8, 2, 10),
VoxelShapeUtil.createXZRotatedTowards(direction, 8, 0, 7, 12, 2, 11)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).orElse(Shapes.empty());
}
if (spikes == 3) {
return Stream.of(
VoxelShapeUtil.createXZRotatedTowards(direction, 3, 0, 2, 7, 2, 6),
VoxelShapeUtil.createXZRotatedTowards(direction, 5, 0, 5, 11, 4, 11),
VoxelShapeUtil.createXZRotatedTowards(direction, 1, 0, 7, 5, 2, 11),
VoxelShapeUtil.createXZRotatedTowards(direction, 4, 0, 11, 8, 2, 15),
VoxelShapeUtil.createXZRotatedTowards(direction, 10, 0, 10, 14, 2, 14)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).orElse(Shapes.empty());
}
return Shapes.empty();
}

private static VoxelShape computeDamageShape(Direction direction, int spikes) {
if (spikes == 1) return VoxelShapeUtil.createXZRotatedTowards(direction, 6, 2, 6, 10, 7, 10);
if (spikes == 2) return Shapes.join(VoxelShapeUtil.createXZRotatedTowards(direction, 9, 2, 8, 13, 7, 12), VoxelShapeUtil.createXZRotatedTowards(direction, 4, 2, 4, 8, 8, 8), BooleanOp.OR);
if (spikes == 3)
return Stream.of(VoxelShapeUtil.createXZRotatedTowards(direction, 1, 2, 9, 5, 6, 13), VoxelShapeUtil.createXZRotatedTowards(direction, 6, 3, 6, 10, 9, 10), VoxelShapeUtil.createXZRotatedTowards(direction, 8, 2, 11, 12, 6, 15), VoxelShapeUtil.createXZRotatedTowards(direction, 10, 2, 3, 14, 8, 7), VoxelShapeUtil.createXZRotatedTowards(direction, 11, 1, 7, 14, 3, 10), VoxelShapeUtil.createXZRotatedTowards(direction, 5, 1, 3, 8, 3, 6)).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).orElse(Shapes.empty());
if (spikes == 2) {
return Stream.of(
VoxelShapeUtil.createXZRotatedTowards(direction, 4, 2, 6, 8, 8, 10),
VoxelShapeUtil.createXZRotatedTowards(direction, 8, 2, 7, 12, 7, 11),
VoxelShapeUtil.createXZRotatedTowards(direction, 7, 0, 4, 10, 2, 7)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).orElse(Shapes.empty());
}
if (spikes == 3) {
return Stream.of(
VoxelShapeUtil.createXZRotatedTowards(direction, 3, 2, 2, 7, 6, 6),
VoxelShapeUtil.createXZRotatedTowards(direction, 11, 2, 2, 15, 8, 6),
VoxelShapeUtil.createXZRotatedTowards(direction, 5, 4, 5, 11, 11, 11),
VoxelShapeUtil.createXZRotatedTowards(direction, 1, 2, 7, 5, 8, 11),
VoxelShapeUtil.createXZRotatedTowards(direction, 4, 2, 11, 8, 6, 15),
VoxelShapeUtil.createXZRotatedTowards(direction, 10, 2, 10, 14, 6, 14)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).orElse(Shapes.empty());
}
return Shapes.empty();
}

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ public static void handleMissingBlockEntityTypes(List<Mapping<BlockEntityType<?>
if (path.equals("creator")) {
mapping.remap(ModBlockEntities.PRIMORDIAL_CRADLE.get());
}
else if (path.equals("bone_spike")) {
mapping.remap(ModBlockEntities.FLESH_SPIKE.get());
}
else {
mapping.ignore();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.github.elenterius.biomancy.block.digester.DigesterBlockEntity;
import com.github.elenterius.biomancy.block.entity.BlockEntityDelegator;
import com.github.elenterius.biomancy.block.fleshkinchest.FleshkinChestBlockEntity;
import com.github.elenterius.biomancy.block.fleshspike.FleshSpikeBlockEntity;
import com.github.elenterius.biomancy.block.mawhopper.MawHopperBlockEntity;
import com.github.elenterius.biomancy.block.modularlarynx.VoiceBoxBlockEntity;
import com.github.elenterius.biomancy.block.ownable.OwnableBlockEntity;
Expand Down Expand Up @@ -37,7 +36,6 @@ public final class ModBlockEntities {
public static final RegistryObject<BlockEntityType<MawHopperBlockEntity>> MAW_HOPPER = register(ModBlocks.MAW_HOPPER, MawHopperBlockEntity::new);
public static final RegistryObject<BlockEntityType<StorageSacBlockEntity>> STORAGE_SAC = register(ModBlocks.STORAGE_SAC, StorageSacBlockEntity::new);
public static final RegistryObject<BlockEntityType<FleshkinChestBlockEntity>> FLESHKIN_CHEST = register(ModBlocks.FLESHKIN_CHEST, FleshkinChestBlockEntity::new);
public static final RegistryObject<BlockEntityType<FleshSpikeBlockEntity>> FLESH_SPIKE = register(ModBlocks.FLESH_SPIKE, FleshSpikeBlockEntity::new);
public static final RegistryObject<BlockEntityType<VoiceBoxBlockEntity>> VOICE_BOX = register(ModBlocks.VOICE_BOX, VoiceBoxBlockEntity::new);

//# Special
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public final class ModBlocks {
public static final RegistryObject<IrisDoorBlock> FLESH_IRIS_DOOR = register("flesh_iris_door", IrisDoorBlock::new);
public static final RegistryObject<FleshDoorBlock> FLESH_DOOR = register("flesh_door", FleshDoorBlock::new);
public static final RegistryObject<FullFleshDoorBlock> FULL_FLESH_DOOR = register("full_flesh_door", FullFleshDoorBlock::new);
public static final RegistryObject<FleshSpikeBlock> FLESH_SPIKE = register("flesh_spike", () -> new FleshSpikeBlock(createFleshyBoneProperties()));
public static final RegistryObject<FleshSpikeBlock> FLESH_SPIKE = register("flesh_spike", () -> new FleshSpikeBlock(createFleshyBoneProperties().noOcclusion()));
public static final RegistryObject<FleshLanternBlock> BIO_LANTERN = register("bio_lantern", properties -> new FleshLanternBlock(properties.sound(SoundType.SHROOMLIGHT).lightLevel(x -> 15).noOcclusion()));
public static final RegistryObject<FleshChainBlock> TENDON_CHAIN = register("tendon_chain", properties -> new FleshChainBlock(properties.noOcclusion()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public final class ModItems {
public static final RegistryObject<SimpleBlockItem> FLESH_IRIS_DOOR = registerSimpleBlockItem(ModBlocks.FLESH_IRIS_DOOR);
public static final RegistryObject<SimpleBlockItem> FLESH_DOOR = registerSimpleBlockItem(ModBlocks.FLESH_DOOR);
public static final RegistryObject<SimpleBlockItem> FULL_FLESH_DOOR = registerSimpleBlockItem(ModBlocks.FULL_FLESH_DOOR);
public static final RegistryObject<BEWLBlockItem> FLESH_SPIKE = registerBlockItem(ModBlocks.FLESH_SPIKE, BEWLBlockItem::new);
public static final RegistryObject<SimpleBlockItem> FLESH_SPIKE = registerSimpleBlockItem(ModBlocks.FLESH_SPIKE);
public static final RegistryObject<SimpleBlockItem> BIO_LANTERN = registerSimpleBlockItem(ModBlocks.BIO_LANTERN);
public static final RegistryObject<FleshChainBlockItem> TENDON_CHAIN = registerBlockItem(ModBlocks.TENDON_CHAIN, FleshChainBlockItem::new);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.github.elenterius.biomancy.client.render.block.decomposer.DecomposerRenderer;
import com.github.elenterius.biomancy.client.render.block.digester.DigesterRenderer;
import com.github.elenterius.biomancy.client.render.block.fleshkinchest.FleshkinChestRenderer;
import com.github.elenterius.biomancy.client.render.block.fleshspike.FleshSpikeRenderer;
import com.github.elenterius.biomancy.client.render.block.mawhopper.MawHopperRenderer;
import com.github.elenterius.biomancy.client.render.block.storagesac.StorageSacRenderer;
import com.github.elenterius.biomancy.client.render.block.tongue.TongueRenderer;
Expand Down Expand Up @@ -85,7 +84,6 @@ public static void registerRenderers(final EntityRenderersEvent.RegisterRenderer
event.registerBlockEntityRenderer(ModBlockEntities.FLESHKIN_CHEST.get(), FleshkinChestRenderer::new);
event.registerBlockEntityRenderer(ModBlockEntities.STORAGE_SAC.get(), StorageSacRenderer::new);
event.registerBlockEntityRenderer(ModBlockEntities.MAW_HOPPER.get(), MawHopperRenderer::new);
event.registerBlockEntityRenderer(ModBlockEntities.FLESH_SPIKE.get(), FleshSpikeRenderer::new);

event.registerEntityRenderer(ModEntityTypes.HUNGRY_FLESH_BLOB.get(), FleshBlobRenderer::new);
event.registerEntityRenderer(ModEntityTypes.FLESH_BLOB.get(), FleshBlobRenderer::new);
Expand Down
64 changes: 0 additions & 64 deletions src/main/resources/assets/biomancy/models/block/bone_spike.json

This file was deleted.

0 comments on commit 71f5dfd

Please sign in to comment.