Added chitin spikes

This commit is contained in:
Sollace 2023-10-14 01:43:46 +01:00
parent 3f27c2e920
commit 602e9b7059
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
39 changed files with 316 additions and 21 deletions

View file

@ -0,0 +1,85 @@
package com.minelittlepony.unicopia.block;
import org.joml.Vector3f;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.SideShapeType;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
public class SpikesBlock extends OrientedBlock {
public SpikesBlock(Settings settings) {
super(settings);
}
@Deprecated
@Override
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
if (!(entity instanceof LivingEntity) || entity.getType() == EntityType.FOX || entity.getType() == EntityType.BEE) {
return;
}
if (!world.isClient) {
Vec3d vel = entity.getVelocity().add(entity.getX() - entity.lastRenderX, entity.getY() - entity.lastRenderY, entity.getZ() - entity.lastRenderZ);
Vector3f normVel = state.get(FACING).getUnitVector().mul(vel.toVector3f());
if ((normVel.x + normVel.y + normVel.z) < -0.08F) {
float damage = (float)vel.lengthSquared() * 26;
entity.damage(world.getDamageSources().cactus(), damage);
}
}
}
@Deprecated
@Override
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) {
if (!world.isClient && !oldState.isOf(this)) {
for (Entity e : world.getOtherEntities(null, new Box(pos))) {
if (!(e instanceof LivingEntity) || e.getType() == EntityType.FOX || e.getType() == EntityType.BEE) {
continue;
}
e.damage(world.getDamageSources().cactus(), 6);
}
}
}
@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
Direction facing = state.get(FACING);
pos = pos.offset(facing.getOpposite());
state = world.getBlockState(pos);
return state.isReplaceable() || state.isSideSolid(world, pos, facing, SideShapeType.FULL);
}
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
Direction side = ctx.getWorld().getBlockState(ctx.getBlockPos().offset(ctx.getSide().getOpposite())).isReplaceable() ? Direction.UP : ctx.getSide();
return getDefaultState().with(FACING, side);
}
@Deprecated
@Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
if (direction == state.get(FACING).getOpposite() && !neighborState.isSideSolid(world, neighborPos, direction, SideShapeType.FULL)) {
if (!(neighborState.isOf(Blocks.STICKY_PISTON)
|| neighborState.isOf(Blocks.PISTON)
|| neighborState.isOf(Blocks.PISTON_HEAD)
|| neighborState.isOf(Blocks.MOVING_PISTON))) {
return Blocks.AIR.getDefaultState();
}
}
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
}
}

View file

@ -1,6 +1,7 @@
package com.minelittlepony.unicopia.block;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.minelittlepony.unicopia.Unicopia;
@ -115,6 +116,7 @@ public interface UBlocks {
Block CHITIN = register("chitin", new SnowyBlock(Settings.create().mapColor(MapColor.PALE_PURPLE).hardness(5).requiresTool().ticksRandomly()), ItemGroups.NATURAL);
Block SURFACE_CHITIN = register("surface_chitin", new GrowableBlock(Settings.copy(CHITIN), () -> CHITIN), ItemGroups.NATURAL);
Block CHITIN_SPIKES = register("chitin_spikes", new SpikesBlock(Settings.copy(CHITIN).noCollision().nonOpaque()), ItemGroups.NATURAL);
Block CHISELLED_CHITIN = register("chiselled_chitin", new Block(Settings.create().mapColor(MapColor.PALE_PURPLE).hardness(5).requiresTool()), ItemGroups.BUILDING_BLOCKS);
Block CHISELLED_CHITIN_SLAB = register("chiselled_chitin_slab", new SlabBlock(Settings.copy(CHISELLED_CHITIN)), ItemGroups.BUILDING_BLOCKS);
Block CHISELLED_CHITIN_STAIRS = register("chiselled_chitin_stairs", new StairsBlock(CHISELLED_CHITIN.getDefaultState(), Settings.copy(CHISELLED_CHITIN)), ItemGroups.BUILDING_BLOCKS);
@ -155,7 +157,7 @@ public interface UBlocks {
StrippableBlockRegistry.register(PALM_LOG, STRIPPED_PALM_LOG);
StrippableBlockRegistry.register(ZAP_WOOD, STRIPPED_ZAP_WOOD);
StrippableBlockRegistry.register(PALM_WOOD, STRIPPED_PALM_WOOD);
TRANSLUCENT_BLOCKS.add(WEATHER_VANE);
Collections.addAll(TRANSLUCENT_BLOCKS, WEATHER_VANE, CHITIN_SPIKES);
TintedBlock.REGISTRY.add(PALM_LEAVES);
FlammableBlockRegistry.getDefaultInstance().add(GREEN_APPLE_LEAVES, 30, 60);

View file

@ -0,0 +1,10 @@
{
"variants": {
"facing=up": { "model": "unicopia:block/chitin_spikes" },
"facing=down": { "model": "unicopia:block/chitin_spikes", "x": 180 },
"facing=north": { "model": "unicopia:block/chitin_spikes", "x": 90 },
"facing=south": { "model": "unicopia:block/chitin_spikes", "x": -90 },
"facing=east": { "model": "unicopia:block/chitin_spikes", "x": 90, "y": 90 },
"facing=west": { "model": "unicopia:block/chitin_spikes", "x": 90, "y": -90 }
}
}

View file

@ -208,6 +208,7 @@
"block.unicopia.surface_chitin": "Surface Chitin",
"block.unicopia.chitin": "Chitin",
"block.unicopia.chitin_spikes": "Chitin Spikes",
"block.unicopia.chiselled_chitin": "Chiselled Chitin",
"block.unicopia.chiselled_chitin_hull": "Chiselled Chitin Hull",
"block.unicopia.chiselled_chitin_slab": "Chiselled Chitin Slab",

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "unicopia:block/chitin_spikes"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "unicopia:block/chitin_spikes"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View file

@ -4,12 +4,24 @@
"max_distance_from_center": 112,
"project_start_to_heightmap": "WORLD_SURFACE_WG",
"size": 7,
"spawn_overrides": {},
"spawn_overrides": {
"monster": {
"bounding_box": "piece",
"spawns": [
{
"type": "minecraft:slime",
"weight": 3,
"minCount": 2,
"maxCount": 8
}
]
}
},
"start_height": {
"absolute": -6
"absolute": -7
},
"start_pool": "unicopia:changeling_hive/start",
"step": "underground_decoration",
"terrain_adaptation": "beard_box",
"terrain_adaptation": "none",
"use_expansion_hack": false
}

View file

@ -3,7 +3,7 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_chamber1",
"location": "unicopia:changeling_hive/chamber1",
"processors": {
"processors": []
},
@ -14,7 +14,7 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_chamber2",
"location": "unicopia:changeling_hive/chamber2",
"processors": {
"processors": []
},
@ -25,7 +25,40 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_chamber3",
"location": "unicopia:changeling_hive/chamber3",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/chamber1",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/chamber2",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/chamber3",
"processors": {
"processors": []
},

View file

@ -3,7 +3,7 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_shaft1",
"location": "unicopia:changeling_hive/shaft1",
"processors": {
"processors": []
},
@ -14,7 +14,7 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_shaft2",
"location": "unicopia:changeling_hive/shaft2",
"processors": {
"processors": []
},
@ -25,13 +25,46 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_shaft_bottom",
"location": "unicopia:changeling_hive/shaft_bottom",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 9
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/shaft1",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/shaft2",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/shaft_bottom",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 3
}
],
"fallback": "minecraft:empty"

View file

@ -3,18 +3,18 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_offshoot1",
"location": "unicopia:changeling_hive/offshoot1",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 9
"weight": 3
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_offshoot_elbow",
"location": "unicopia:changeling_hive/offshoot_elbow",
"processors": {
"processors": []
},
@ -25,7 +25,7 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_offshoot_elbow2",
"location": "unicopia:changeling_hive/offshoot_elbow2",
"processors": {
"processors": []
},
@ -36,7 +36,7 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_chamber1",
"location": "unicopia:changeling_hive/chamber1",
"processors": {
"processors": []
},
@ -47,7 +47,7 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_chamber2",
"location": "unicopia:changeling_hive/chamber2",
"processors": {
"processors": []
},
@ -58,7 +58,73 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_chamber3",
"location": "unicopia:changeling_hive/chamber3",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/offshoot1",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 3
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/offshoot_elbow",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 2
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/offshoot_elbow2",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 2
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/chamber1",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/chamber2",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/chamber3",
"processors": {
"processors": []
},

View file

@ -3,7 +3,18 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive",
"location": "unicopia:changeling_hive/entrance",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/entrance",
"processors": {
"processors": []
},

View file

@ -3,7 +3,7 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_tunnel_termination1",
"location": "unicopia:changeling_hive/termination1",
"processors": {
"processors": []
},
@ -14,7 +14,7 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_offshoot_transition",
"location": "unicopia:changeling_hive/offshoot_transition",
"processors": {
"processors": []
},
@ -25,7 +25,40 @@
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:abandoned_changeling_hive_descent1",
"location": "unicopia:changeling_hive/descent1",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/termination1",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 1
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/offshoot_transition",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 2
},
{
"element": {
"element_type": "minecraft:single_pool_element",
"location": "unicopia:changeling_hive/spiked/descent1",
"processors": {
"processors": []
},