This Rocks 1.3.0

Fixes #5, #7, #9, #11, #13
Make rotations random
Starfish is now a json model!
This commit is contained in:
Motschen
2021-02-08 14:06:01 +01:00
parent b1b8962ec0
commit 5616e19b21
37 changed files with 1489 additions and 306 deletions

View File

@@ -1,14 +0,0 @@
package eu.midnightdust.motschen.rocks;
import eu.midnightdust.motschen.rocks.block.blockentity.BlockEntityInit;
import eu.midnightdust.motschen.rocks.block.render.StarfishBlockEntityRenderer;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry;
public class RocksClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
BlockEntityRendererRegistry.INSTANCE.register(BlockEntityInit.STARFISH_BE, StarfishBlockEntityRenderer::new);
}
}

View File

@@ -7,6 +7,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
public class Pinecone extends Block {
@@ -31,4 +32,7 @@ public class Pinecone extends Block {
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
return world.getBlockState(pos.down()).isSideSolidFullSquare(world,pos,Direction.UP);
}
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom);
}
}

View File

@@ -17,6 +17,7 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
public class Rock extends Block {
@@ -70,4 +71,7 @@ public class Rock extends Block {
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
return world.getBlockState(pos.down()).isSideSolidFullSquare(world,pos,Direction.UP);
}
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom);
}
}

View File

@@ -21,6 +21,7 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
public class Seashell extends Block implements Waterloggable {
@@ -79,4 +80,7 @@ public class Seashell extends Block implements Waterloggable {
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
return world.getBlockState(pos.down()).isSideSolidFullSquare(world,pos,Direction.UP);
}
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom);
}
}

View File

@@ -1,11 +1,9 @@
package eu.midnightdust.motschen.rocks.block;
import eu.midnightdust.motschen.rocks.RocksMain;
import eu.midnightdust.motschen.rocks.block.blockentity.StarfishBlockEntity;
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
@@ -23,9 +21,10 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
public class Starfish extends Block implements BlockEntityProvider, Waterloggable {
public class Starfish extends Block implements Waterloggable {
private static final VoxelShape SHAPE;
private static final EnumProperty<StarfishVariation> STARFISH_VARIATION = RocksMain.STARFISH_VARIATION;
@@ -41,11 +40,6 @@ public class Starfish extends Block implements BlockEntityProvider, Waterloggabl
return blockState_1.get(WATERLOGGED) ? Fluids.WATER.getStill(true) : super.getFluidState(blockState_1);
}
@Override
public BlockEntity createBlockEntity(BlockView view) {
return new StarfishBlockEntity();
}
@Override
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
FluidState fluidState = itemPlacementContext.getWorld().getFluidState(itemPlacementContext.getBlockPos());
@@ -86,4 +80,7 @@ public class Starfish extends Block implements BlockEntityProvider, Waterloggabl
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
return world.getBlockState(pos.down()).isSideSolidFullSquare(world,pos,Direction.UP);
}
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom);
}
}

View File

@@ -17,6 +17,7 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
public class Stick extends Block {
@@ -67,4 +68,7 @@ public class Stick extends Block {
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
return world.getBlockState(pos.down()).isSideSolidFullSquare(world,pos,Direction.UP);
}
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom);
}
}

View File

@@ -6,12 +6,10 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class BlockEntityInit {
public static BlockEntityType<StarfishBlockEntity> STARFISH_BE;
public static BlockEntityType<OverworldGeyserBlockEntity> OVERWORLD_GEYSER_BE;
public static BlockEntityType<NetherGeyserBlockEntity> NETHER_GEYSER_BE;
public static void init() {
STARFISH_BE = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(RocksMain.MOD_ID,"starfish_blockentity"), BlockEntityType.Builder.create(StarfishBlockEntity::new, RocksMain.Starfish).build(null));
OVERWORLD_GEYSER_BE = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(RocksMain.MOD_ID,"overworld_geyser_blockentity"), BlockEntityType.Builder.create(OverworldGeyserBlockEntity::new, RocksMain.Geyser).build(null));
NETHER_GEYSER_BE = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(RocksMain.MOD_ID,"nether_geyser_blockentity"), BlockEntityType.Builder.create(NetherGeyserBlockEntity::new, RocksMain.NetherGeyser).build(null));
}

View File

@@ -1,5 +1,6 @@
package eu.midnightdust.motschen.rocks.block.blockentity;
import eu.midnightdust.motschen.rocks.RocksMain;
import eu.midnightdust.motschen.rocks.block.NetherGeyser;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
@@ -18,32 +19,33 @@ public class NetherGeyserBlockEntity extends BlockEntity implements Tickable {
@Override
public void tick() {
BlockPos pos = this.pos;
PlayerEntity player = this.world.getClosestPlayer(pos.getX()+0.5,pos.getY()+0.5, pos.getZ()+0.5,3,true);
PlayerEntity player2 = this.world.getClosestPlayer(pos.getX()+0.5,pos.getY()+0.5, pos.getZ()+0.5,1,true);
BlockState state = this.world.getBlockState(pos);
if (world.getBlockState(pos).getBlock() == RocksMain.NetherGeyser) {
PlayerEntity player = this.world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 3, true);
PlayerEntity player2 = this.world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 1, true);
BlockState state = this.getCachedState();
if (player != null) {
world.setBlockState(pos, state.with(NetherGeyser.ACTIVE, true));
player.damage(DamageSource.ON_FIRE,1);
if (player2 != null) {
player2.damage(DamageSource.ON_FIRE,4);
}
countdown = 1000;
}
else {
if (countdown > 0) {
countdown = countdown - 1;
}
if (countdown == 0) {
world.setBlockState(pos, state.with(NetherGeyser.ACTIVE, false));
}
}
if (player != null) {
world.setBlockState(pos, state.with(NetherGeyser.ACTIVE, true));
if (Boolean.TRUE.equals(state.get(NetherGeyser.ACTIVE))) {
world.addParticle(ParticleTypes.LAVA,pos.getX()+0.5,pos.getY()+0.1,pos.getZ()+0.5,1,1.5,1);
world.addParticle(ParticleTypes.LAVA,pos.getX()+0.5,pos.getY()+1.0,pos.getZ()+0.5,1,1.5,1);
world.addParticle(ParticleTypes.SMOKE,pos.getX()+0.5,pos.getY()+0.1,pos.getZ()+0.5,0,0.3,0);
player.damage(DamageSource.ON_FIRE, 1);
if (player2 != null) {
player2.damage(DamageSource.ON_FIRE, 4);
}
countdown = 1000;
} else {
if (countdown > 0) {
countdown = countdown - 1;
}
if (countdown == 0) {
world.setBlockState(pos, state.with(NetherGeyser.ACTIVE, false));
}
}
if (Boolean.TRUE.equals(state.get(NetherGeyser.ACTIVE))) {
world.addParticle(ParticleTypes.LAVA, pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, 1, 1.5, 1);
world.addParticle(ParticleTypes.LAVA, pos.getX() + 0.5, pos.getY() + 1.0, pos.getZ() + 0.5, 1, 1.5, 1);
world.addParticle(ParticleTypes.SMOKE, pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, 0, 0.3, 0);
}
}
}
}

View File

@@ -1,5 +1,6 @@
package eu.midnightdust.motschen.rocks.block.blockentity;
import eu.midnightdust.motschen.rocks.RocksMain;
import eu.midnightdust.motschen.rocks.block.OverworldGeyser;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
@@ -19,36 +20,37 @@ public class OverworldGeyserBlockEntity extends BlockEntity implements Tickable
@Override
public void tick() {
BlockPos pos = this.pos;
PlayerEntity player = this.world.getClosestPlayer(pos.getX()+0.5,pos.getY()+0.5, pos.getZ()+0.5,3,true);
PlayerEntity player2 = this.world.getClosestPlayer(pos.getX()+0.5,pos.getY()+0.5, pos.getZ()+0.5,8,true);
PlayerEntity player3 = null;
if (world.getBlockState(pos).getBlock() == RocksMain.Geyser) {
PlayerEntity player = this.world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 3, true);
PlayerEntity player2 = this.world.getClosestPlayer(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 8, true);
PlayerEntity player3 = null;
if (player2 != null && player2.getY() >= pos.getY() && (pos.getX() <= player2.getX() && pos.getX()+1 >= player2.getX()) && (pos.getZ() <= player2.getZ() && pos.getZ()+1 >= player2.getZ())) {
player3 = player2;
}
BlockState state = this.world.getBlockState(pos);
if (player2 != null && player2.getY() >= pos.getY() && (pos.getX() <= player2.getX() && pos.getX() + 1 >= player2.getX()) && (pos.getZ() <= player2.getZ() && pos.getZ() + 1 >= player2.getZ())) {
player3 = player2;
}
BlockState state = this.getCachedState();
if (player != null) {
world.setBlockState(pos, state.with(OverworldGeyser.ACTIVE, true));
if (player3 != null) {
player3.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, 2, 12, true, false, false));
}
countdown = 1000;
}
else {
if (countdown > 0) {
countdown = countdown - 1;
}
if (countdown == 0) {
world.setBlockState(pos, state.with(OverworldGeyser.ACTIVE, false));
}
}
if (player != null) {
world.setBlockState(pos, state.with(OverworldGeyser.ACTIVE, true));
if (world != null && state.get(OverworldGeyser.ACTIVE) == true) {
world.addParticle(ParticleTypes.SPIT,pos.getX()+0.5,pos.getY()+0.1,pos.getZ()+0.5,0,1.0,0);
world.addParticle(ParticleTypes.SPIT,pos.getX()+0.5,pos.getY()+0.3,pos.getZ()+0.5,0,1.0,0);
world.addParticle(ParticleTypes.SPLASH,pos.getX()+0.5,pos.getY()+1.0,pos.getZ()+0.5,-0.01,1.5,-0.01);
if (player3 != null) {
player3.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, 2, 12, true, false, false));
}
countdown = 1000;
} else {
if (countdown > 0) {
countdown = countdown - 1;
}
if (countdown == 0) {
world.setBlockState(pos, state.with(OverworldGeyser.ACTIVE, false));
}
}
if (world != null && state.get(OverworldGeyser.ACTIVE) == true) {
world.addParticle(ParticleTypes.SPIT, pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, 0, 1.0, 0);
world.addParticle(ParticleTypes.SPIT, pos.getX() + 0.5, pos.getY() + 0.3, pos.getZ() + 0.5, 0, 1.0, 0);
world.addParticle(ParticleTypes.SPLASH, pos.getX() + 0.5, pos.getY() + 1.0, pos.getZ() + 0.5, -0.01, 1.5, -0.01);
}
}
}
}

View File

@@ -1,17 +0,0 @@
package eu.midnightdust.motschen.rocks.block.blockentity;
import eu.midnightdust.motschen.rocks.RocksMain;
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
import net.minecraft.block.entity.BlockEntity;
public class StarfishBlockEntity extends BlockEntity {
public StarfishBlockEntity() {
super(BlockEntityInit.STARFISH_BE);
}
public StarfishVariation getVariation() {
return this.world.getBlockState(pos).get(RocksMain.STARFISH_VARIATION);
}
}

View File

@@ -1,125 +0,0 @@
package eu.midnightdust.motschen.rocks.block.render;
import eu.midnightdust.motschen.rocks.block.blockentity.StarfishBlockEntity;
import eu.midnightdust.motschen.rocks.blockstates.StarfishVariation;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.Identifier;
@Environment(EnvType.CLIENT)
public class StarfishBlockEntityRenderer extends BlockEntityRenderer<StarfishBlockEntity> {
private static final ModelPart side1;
private static final ModelPart side2;
private static final ModelPart side3;
private static final ModelPart side4;
private static final ModelPart side5;
private static final ModelPart bb_main;
static {
side1 = new ModelPart(16, 16, 0, 0);
side1.setPivot(0.0F, 24.0F, 0.0F);
side1.setTextureOffset(0, 0).addCuboid(-0.5F, -1.0F, 1.0F, 1.0F, 1.0F, 4.0F, 0.0F, false);
side1.setTextureOffset(1, 1).addCuboid(-0.75F, -1.02F, 1.0F, 1.0F, 1.0F, 3.0F, 0.0F, false);
side1.setTextureOffset(1, 2).addCuboid(-1.0F, -0.99F, 1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
side1.setTextureOffset(1, 1).addCuboid(-0.25F, -1.01F, 1.0F, 1.0F, 1.0F, 3.0F, 0.0F, false);
side2 = new ModelPart(16, 16, 0, 0);
side2.setPivot(0.0F, 24.0F, 0.0F);
setRotationAngle(side2, 0.0F, -1.2654F, 0.0F);
side2.setTextureOffset(0, 0).addCuboid(-0.5F, -1.0F, 1.0F, 1.0F, 1.0F, 4.0F, 0.0F, false);
side2.setTextureOffset(1, 1).addCuboid(-0.75F, -1.02F, 1.0F, 1.0F, 1.0F, 3.0F, 0.0F, false);
side2.setTextureOffset(1, 1).addCuboid(-0.25F, -1.01F, 1.0F, 1.0F, 1.0F, 3.0F, 0.0F, false);
side2.setTextureOffset(1, 2).addCuboid(-1.0F, -0.99F, 1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
side3 = new ModelPart(16, 16, 0, 0);
side3.setPivot(0.0F, 24.0F, 0.0F);
setRotationAngle(side3, 0.0F, 1.2654F, 0.0F);
side3.setTextureOffset(0, 0).addCuboid(-0.5F, -1.0F, 1.0F, 1.0F, 1.0F, 4.0F, 0.0F, false);
side3.setTextureOffset(1, 1).addCuboid(-0.75F, -1.02F, 1.0F, 1.0F, 1.0F, 3.0F, 0.0F, false);
side3.setTextureOffset(1, 1).addCuboid(-0.25F, -1.01F, 1.0F, 1.0F, 1.0F, 3.0F, 0.0F, false);
side3.setTextureOffset(1, 2).addCuboid(-1.0F, -0.99F, 1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
side4 = new ModelPart(16, 16, 0, 0);
side4.setPivot(0.0F, 24.0F, 0.0F);
setRotationAngle(side4, 0.0F, 2.5307F, 0.0F);
side4.setTextureOffset(0, 0).addCuboid(-0.5F, -1.0F, 1.0F, 1.0F, 1.0F, 4.0F, 0.0F, false);
side4.setTextureOffset(1, 1).addCuboid(-0.75F, -1.02F, 1.0F, 1.0F, 1.0F, 3.0F, 0.0F, false);
side4.setTextureOffset(1, 1).addCuboid(-0.25F, -1.01F, 1.0F, 1.0F, 1.0F, 3.0F, 0.0F, false);
side4.setTextureOffset(1, 2).addCuboid(-1.0F, -0.99F, 1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
side5 = new ModelPart(16, 16, 0, 0);
side5.setPivot(0.0F, 24.0F, 0.0F);
setRotationAngle(side5, 0.0F, -2.5307F, 0.0F);
side5.setTextureOffset(0, 0).addCuboid(-0.5F, -1.0F, 1.0F, 1.0F, 1.0F, 4.0F, 0.0F, false);
side5.setTextureOffset(1, 1).addCuboid(-0.75F, -1.02F, 1.0F, 1.0F, 1.0F, 3.0F, 0.0F, false);
side5.setTextureOffset(1, 1).addCuboid(-0.25F, -1.01F, 1.0F, 1.0F, 1.0F, 3.0F, 0.0F, false);
side5.setTextureOffset(1, 2).addCuboid(-1.0F, -0.99F, 1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
bb_main = new ModelPart(16, 16, 0, 0);
bb_main.setPivot(0.0F, 24.0F, 0.0F);
bb_main.setTextureOffset(1, 2).addCuboid(-1.0F, -1.005F, -1.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
bb_main.setTextureOffset(1, 2).addCuboid(-0.8F, -1.0F, -1.25F, 2.0F, 1.0F, 2.0F, 0.0F, false);
bb_main.setTextureOffset(2, 2).addCuboid(-1.2F, -1.0F, -1.25F, 1.0F, 1.0F, 2.0F, 0.0F, false);
}
public StarfishBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
super(blockEntityRenderDispatcher);
}
@Override
public void render(StarfishBlockEntity blockEntity, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumers, int light, int overlay) {
if (blockEntity.getVariation().equals(StarfishVariation.RED)) {
matrixStack.push();
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(new Identifier("rocks:textures/block/starfish_red.png")));
matrixStack.translate(0.4, -1.44, 0.6);
side1.render(matrixStack, vertexConsumer, light, overlay);
side2.render(matrixStack, vertexConsumer, light, overlay);
side3.render(matrixStack, vertexConsumer, light, overlay);
side4.render(matrixStack, vertexConsumer, light, overlay);
side5.render(matrixStack, vertexConsumer, light, overlay);
bb_main.render(matrixStack, vertexConsumer, light, overlay);
matrixStack.pop();
}
else if (blockEntity.getVariation().equals(StarfishVariation.PINK)) {
matrixStack.push();
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(new Identifier("rocks:textures/block/starfish_pink.png")));
matrixStack.translate(0.4, -1.44, 0.4);
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(90));
side1.render(matrixStack, vertexConsumer, light, overlay);
side2.render(matrixStack, vertexConsumer, light, overlay);
side3.render(matrixStack, vertexConsumer, light, overlay);
side4.render(matrixStack, vertexConsumer, light, overlay);
side5.render(matrixStack, vertexConsumer, light, overlay);
bb_main.render(matrixStack, vertexConsumer, light, overlay);
matrixStack.pop();
}
else {
matrixStack.push();
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(new Identifier("rocks:textures/block/starfish_orange.png")));
matrixStack.translate(0.65, -1.44, 0.65);
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(123));
side1.render(matrixStack, vertexConsumer, light, overlay);
side2.render(matrixStack, vertexConsumer, light, overlay);
side3.render(matrixStack, vertexConsumer, light, overlay);
side4.render(matrixStack, vertexConsumer, light, overlay);
side5.render(matrixStack, vertexConsumer, light, overlay);
bb_main.render(matrixStack, vertexConsumer, light, overlay);
matrixStack.pop();
}
}
public static void setRotationAngle(ModelPart bone, float x, float y, float z) {
bone.pitch = x;
bone.yaw = y;
bone.roll = z;
}
}

View File

@@ -0,0 +1,22 @@
package eu.midnightdust.motschen.rocks.mixin;
import com.google.gson.JsonObject;
import net.minecraft.client.render.model.json.ModelElement;
import net.minecraft.util.JsonHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(value = ModelElement.Deserializer.class, priority = 2000)
public class MixinModelElementDeserializer {
/**
* @author Motschen
* @reason Not cancellable
* Unlimited rotation angles for starfish
* Inspired by https://github.com/CottonMC/ModelsUnlocked/blob/master/src/main/java/io/github/cottonmc/modelsunlocked/mixin/ModelElementDeserializerMixin.java
*/
@Overwrite
private float deserializeRotationAngle(JsonObject json) {
return (JsonHelper.getFloat(json, "angle"));
}
}