Chorus models & fixes
This commit is contained in:
parent
9731063f95
commit
53ad813110
13 changed files with 513 additions and 210 deletions
|
@ -1,18 +1,34 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ChorusFlowerBlock;
|
||||
import net.minecraft.block.ChorusPlantBlock;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.registry.BlockRegistry;
|
||||
import ru.betterend.registry.BlockTagRegistry;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
@Mixin(ChorusFlowerBlock.class)
|
||||
public class ChorusFlowerBlockMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private ChorusPlantBlock plantBlock;
|
||||
|
||||
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
|
||||
private void canPlace(BlockState state, WorldView world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
if (world.getBlockState(pos.down()).isOf(BlockRegistry.CHORUS_NYLIUM)) {
|
||||
|
@ -20,4 +36,28 @@ public class ChorusFlowerBlockMixin {
|
|||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "randomTick", at = @At("HEAD"), cancellable = true)
|
||||
private void onTick(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo info) {
|
||||
if (world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
|
||||
BlockPos up = pos.up();
|
||||
if (world.isAir(up) && up.getY() < 256) {
|
||||
int i = state.get(ChorusFlowerBlock.AGE);
|
||||
if (i < 5) {
|
||||
this.grow(world, up, i + 1);
|
||||
BlocksHelper.setWithoutUpdate(world, pos, plantBlock.getDefaultState().with(ChorusPlantBlock.UP, true).with(ChorusPlantBlock.DOWN, true).with(BlocksHelper.ROOTS, true));
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Shadow
|
||||
private static boolean isSurroundedByAir(WorldView world, BlockPos pos, @Nullable Direction exceptDirection) { return false; }
|
||||
|
||||
@Shadow
|
||||
private void grow(World world, BlockPos pos, int age) {}
|
||||
|
||||
@Shadow
|
||||
private void die(World world, BlockPos pos) {}
|
||||
}
|
||||
|
|
|
@ -18,14 +18,13 @@ import net.minecraft.world.BlockView;
|
|||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.registry.BlockRegistry;
|
||||
import ru.betterend.registry.BlockTagRegistry;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
@Mixin(ChorusPlantBlock.class)
|
||||
public class ChorusPlantBlockMixin {
|
||||
private static final BooleanProperty ROOTS = BooleanProperty.of("roots");
|
||||
|
||||
@Inject(method = "appendProperties", at = @At("TAIL"))
|
||||
private void addProperties(StateManager.Builder<Block, BlockState> builder, CallbackInfo info) {
|
||||
builder.add(ROOTS);
|
||||
builder.add(BlocksHelper.ROOTS);
|
||||
}
|
||||
|
||||
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
|
||||
|
@ -41,10 +40,10 @@ public class ChorusPlantBlockMixin {
|
|||
BlockState plant = info.getReturnValue();
|
||||
if (plant.isOf(Blocks.CHORUS_PLANT)) {
|
||||
if (!plant.get(Properties.DOWN) && world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
|
||||
info.setReturnValue(plant.with(Properties.DOWN, true).with(ROOTS, true));
|
||||
info.setReturnValue(plant.with(Properties.DOWN, true).with(BlocksHelper.ROOTS, true));
|
||||
}
|
||||
else {
|
||||
info.setReturnValue(plant.with(ROOTS, false));
|
||||
info.setReturnValue(plant.with(BlocksHelper.ROOTS, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,205 +1,208 @@
|
|||
package ru.betterend.util;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FallingBlock;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.util.BlockMirror;
|
||||
import net.minecraft.util.BlockRotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos.Mutable;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import ru.betterend.blocks.BlockBlueVine;
|
||||
import ru.betterend.blocks.basis.BlockDoublePlant;
|
||||
import ru.betterend.blocks.basis.BlockGlowingFur;
|
||||
import ru.betterend.registry.BlockTagRegistry;
|
||||
|
||||
public class BlocksHelper {
|
||||
public static final int FLAG_UPDATE_BLOCK = 1;
|
||||
public static final int FLAG_SEND_CLIENT_CHANGES = 2;
|
||||
public static final int FLAG_NO_RERENDER = 4;
|
||||
public static final int FORSE_RERENDER = 8;
|
||||
public static final int FLAG_IGNORE_OBSERVERS = 16;
|
||||
|
||||
public static final int SET_SILENT = FLAG_UPDATE_BLOCK | FLAG_IGNORE_OBSERVERS | FLAG_SEND_CLIENT_CHANGES;
|
||||
public static final Direction[] HORIZONTAL = makeHorizontal();
|
||||
|
||||
private static final Mutable POS = new Mutable();
|
||||
protected static final BlockState AIR = Blocks.AIR.getDefaultState();
|
||||
|
||||
private static final Vec3i[] OFFSETS = new Vec3i[] {
|
||||
new Vec3i(-1, -1, -1), new Vec3i(-1, -1, 0), new Vec3i(-1, -1, 1),
|
||||
new Vec3i(-1, 0, -1), new Vec3i(-1, 0, 0), new Vec3i(-1, 0, 1),
|
||||
new Vec3i(-1, 1, -1), new Vec3i(-1, 1, 0), new Vec3i(-1, 1, 1),
|
||||
|
||||
new Vec3i(0, -1, -1), new Vec3i(0, -1, 0), new Vec3i(0, -1, 1),
|
||||
new Vec3i(0, 0, -1), new Vec3i(0, 0, 0), new Vec3i(0, 0, 1),
|
||||
new Vec3i(0, 1, -1), new Vec3i(0, 1, 0), new Vec3i(0, 1, 1),
|
||||
|
||||
new Vec3i(1, -1, -1), new Vec3i(1, -1, 0), new Vec3i(1, -1, 1),
|
||||
new Vec3i(1, 0, -1), new Vec3i(1, 0, 0), new Vec3i(1, 0, 1),
|
||||
new Vec3i(1, 1, -1), new Vec3i(1, 1, 0), new Vec3i(1, 1, 1)
|
||||
};
|
||||
|
||||
public static void setWithoutUpdate(WorldAccess world, BlockPos pos, BlockState state) {
|
||||
world.setBlockState(pos, state, SET_SILENT);
|
||||
}
|
||||
|
||||
public static void setWithoutUpdate(WorldAccess world, BlockPos pos, Block block) {
|
||||
world.setBlockState(pos, block.getDefaultState(), SET_SILENT);
|
||||
}
|
||||
|
||||
public static int upRay(WorldAccess world, BlockPos pos, int maxDist) {
|
||||
int length = 0;
|
||||
for (int j = 1; j < maxDist && (world.isAir(pos.up(j))); j++)
|
||||
length++;
|
||||
return length;
|
||||
}
|
||||
|
||||
public static int downRay(WorldAccess world, BlockPos pos, int maxDist) {
|
||||
int length = 0;
|
||||
for (int j = 1; j < maxDist && (world.isAir(pos.down(j))); j++)
|
||||
length++;
|
||||
return length;
|
||||
}
|
||||
|
||||
public static int downRayRep(WorldAccess world, BlockPos pos, int maxDist) {
|
||||
POS.set(pos);
|
||||
for (int j = 1; j < maxDist && (world.getBlockState(POS)).getMaterial().isReplaceable(); j++)
|
||||
{
|
||||
POS.setY(POS.getY() - 1);
|
||||
}
|
||||
return pos.getY() - POS.getY();
|
||||
}
|
||||
|
||||
public static BlockState rotateHorizontal(BlockState state, BlockRotation rotation, Property<Direction> facing) {
|
||||
return (BlockState) state.with(facing, rotation.rotate((Direction) state.get(facing)));
|
||||
}
|
||||
|
||||
public static BlockState mirrorHorizontal(BlockState state, BlockMirror mirror, Property<Direction> facing) {
|
||||
return state.rotate(mirror.getRotation((Direction) state.get(facing)));
|
||||
}
|
||||
|
||||
public static int getLengthDown(WorldAccess world, BlockPos pos, Block block) {
|
||||
int count = 1;
|
||||
while (world.getBlockState(pos.down(count)).getBlock() == block)
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
public static void cover(WorldAccess world, BlockPos center, Block ground, BlockState cover, int radius, Random random) {
|
||||
HashSet<BlockPos> points = new HashSet<BlockPos>();
|
||||
HashSet<BlockPos> points2 = new HashSet<BlockPos>();
|
||||
if (world.getBlockState(center).getBlock() == ground) {
|
||||
points.add(center);
|
||||
points2.add(center);
|
||||
for (int i = 0; i < radius; i++) {
|
||||
Iterator<BlockPos> iterator = points.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BlockPos pos = iterator.next();
|
||||
for (Vec3i offset : OFFSETS) {
|
||||
if (random.nextBoolean()) {
|
||||
BlockPos pos2 = pos.add(offset);
|
||||
if (random.nextBoolean() && world.getBlockState(pos2).getBlock() == ground
|
||||
&& !points.contains(pos2))
|
||||
points2.add(pos2);
|
||||
}
|
||||
}
|
||||
}
|
||||
points.addAll(points2);
|
||||
points2.clear();
|
||||
}
|
||||
Iterator<BlockPos> iterator = points.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BlockPos pos = iterator.next();
|
||||
BlocksHelper.setWithoutUpdate(world, pos, cover);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void fixBlocks(WorldAccess world, BlockPos start, BlockPos end) {
|
||||
BlockState state;
|
||||
for (int x = start.getX(); x <= end.getX(); x++) {
|
||||
POS.setX(x);
|
||||
for (int z = start.getZ(); z <= end.getZ(); z++) {
|
||||
POS.setZ(z);
|
||||
for (int y = start.getY(); y <= end.getY(); y++) {
|
||||
POS.setY(y);
|
||||
state = world.getBlockState(POS);
|
||||
// Falling blocks
|
||||
if (state.getBlock() instanceof FallingBlock) {
|
||||
BlockState falling = state;
|
||||
|
||||
POS.setY(POS.getY() - 1);
|
||||
state = world.getBlockState(POS);
|
||||
|
||||
int ray = downRayRep(world, POS.toImmutable(), 64);
|
||||
if (ray > 32) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, Blocks.END_STONE.getDefaultState());
|
||||
if (world.getRandom().nextBoolean()) {
|
||||
POS.setY(POS.getY() - 1);
|
||||
state = world.getBlockState(POS);
|
||||
BlocksHelper.setWithoutUpdate(world, POS, Blocks.END_STONE.getDefaultState());
|
||||
}
|
||||
}
|
||||
else {
|
||||
POS.setY(y);
|
||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
||||
|
||||
POS.setY(y - ray);
|
||||
BlocksHelper.setWithoutUpdate(world, POS, falling);
|
||||
}
|
||||
}
|
||||
// Blocks without support
|
||||
else if (!state.canPlaceAt(world, POS)) {
|
||||
// Blue Vine
|
||||
if (state.getBlock() instanceof BlockBlueVine) {
|
||||
while (!state.canPlaceAt(world, POS)) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
||||
for (Direction dir : HORIZONTAL) {
|
||||
BlockPos p = POS.offset(dir).up();
|
||||
state = world.getBlockState(p);
|
||||
if (state.getBlock() instanceof BlockGlowingFur) {
|
||||
BlocksHelper.setWithoutUpdate(world, p, AIR);
|
||||
}
|
||||
}
|
||||
POS.setY(POS.getY() + 1);
|
||||
state = world.getBlockState(POS);
|
||||
}
|
||||
}
|
||||
// Double plants
|
||||
if (state.getBlock() instanceof BlockDoublePlant) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
||||
POS.setY(POS.getY() + 1);
|
||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
||||
}
|
||||
// Other blocks
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isEndNylium(Block block) {
|
||||
return block.isIn(BlockTags.NYLIUM) && block.isIn(BlockTagRegistry.END_GROUND);
|
||||
}
|
||||
|
||||
public static boolean isEndNylium(BlockState state) {
|
||||
return isEndNylium(state.getBlock());
|
||||
}
|
||||
|
||||
public static Direction[] makeHorizontal() {
|
||||
return new Direction[] { Direction.NORTH, Direction.SOUTH, Direction.EAST, Direction.WEST };
|
||||
}
|
||||
}
|
||||
package ru.betterend.util;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FallingBlock;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.util.BlockMirror;
|
||||
import net.minecraft.util.BlockRotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos.Mutable;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import ru.betterend.blocks.BlockBlueVine;
|
||||
import ru.betterend.blocks.basis.BlockDoublePlant;
|
||||
import ru.betterend.blocks.basis.BlockGlowingFur;
|
||||
import ru.betterend.registry.BlockTagRegistry;
|
||||
|
||||
public class BlocksHelper {
|
||||
public static final BooleanProperty ROOTS = BooleanProperty.of("roots");
|
||||
|
||||
public static final int FLAG_UPDATE_BLOCK = 1;
|
||||
public static final int FLAG_SEND_CLIENT_CHANGES = 2;
|
||||
public static final int FLAG_NO_RERENDER = 4;
|
||||
public static final int FORSE_RERENDER = 8;
|
||||
public static final int FLAG_IGNORE_OBSERVERS = 16;
|
||||
|
||||
public static final int SET_SILENT = FLAG_UPDATE_BLOCK | FLAG_IGNORE_OBSERVERS | FLAG_SEND_CLIENT_CHANGES;
|
||||
public static final Direction[] HORIZONTAL = makeHorizontal();
|
||||
|
||||
private static final Mutable POS = new Mutable();
|
||||
protected static final BlockState AIR = Blocks.AIR.getDefaultState();
|
||||
|
||||
private static final Vec3i[] OFFSETS = new Vec3i[] {
|
||||
new Vec3i(-1, -1, -1), new Vec3i(-1, -1, 0), new Vec3i(-1, -1, 1),
|
||||
new Vec3i(-1, 0, -1), new Vec3i(-1, 0, 0), new Vec3i(-1, 0, 1),
|
||||
new Vec3i(-1, 1, -1), new Vec3i(-1, 1, 0), new Vec3i(-1, 1, 1),
|
||||
|
||||
new Vec3i(0, -1, -1), new Vec3i(0, -1, 0), new Vec3i(0, -1, 1),
|
||||
new Vec3i(0, 0, -1), new Vec3i(0, 0, 0), new Vec3i(0, 0, 1),
|
||||
new Vec3i(0, 1, -1), new Vec3i(0, 1, 0), new Vec3i(0, 1, 1),
|
||||
|
||||
new Vec3i(1, -1, -1), new Vec3i(1, -1, 0), new Vec3i(1, -1, 1),
|
||||
new Vec3i(1, 0, -1), new Vec3i(1, 0, 0), new Vec3i(1, 0, 1),
|
||||
new Vec3i(1, 1, -1), new Vec3i(1, 1, 0), new Vec3i(1, 1, 1)
|
||||
};
|
||||
|
||||
public static void setWithoutUpdate(WorldAccess world, BlockPos pos, BlockState state) {
|
||||
world.setBlockState(pos, state, SET_SILENT);
|
||||
}
|
||||
|
||||
public static void setWithoutUpdate(WorldAccess world, BlockPos pos, Block block) {
|
||||
world.setBlockState(pos, block.getDefaultState(), SET_SILENT);
|
||||
}
|
||||
|
||||
public static int upRay(WorldAccess world, BlockPos pos, int maxDist) {
|
||||
int length = 0;
|
||||
for (int j = 1; j < maxDist && (world.isAir(pos.up(j))); j++)
|
||||
length++;
|
||||
return length;
|
||||
}
|
||||
|
||||
public static int downRay(WorldAccess world, BlockPos pos, int maxDist) {
|
||||
int length = 0;
|
||||
for (int j = 1; j < maxDist && (world.isAir(pos.down(j))); j++)
|
||||
length++;
|
||||
return length;
|
||||
}
|
||||
|
||||
public static int downRayRep(WorldAccess world, BlockPos pos, int maxDist) {
|
||||
POS.set(pos);
|
||||
for (int j = 1; j < maxDist && (world.getBlockState(POS)).getMaterial().isReplaceable(); j++)
|
||||
{
|
||||
POS.setY(POS.getY() - 1);
|
||||
}
|
||||
return pos.getY() - POS.getY();
|
||||
}
|
||||
|
||||
public static BlockState rotateHorizontal(BlockState state, BlockRotation rotation, Property<Direction> facing) {
|
||||
return (BlockState) state.with(facing, rotation.rotate((Direction) state.get(facing)));
|
||||
}
|
||||
|
||||
public static BlockState mirrorHorizontal(BlockState state, BlockMirror mirror, Property<Direction> facing) {
|
||||
return state.rotate(mirror.getRotation((Direction) state.get(facing)));
|
||||
}
|
||||
|
||||
public static int getLengthDown(WorldAccess world, BlockPos pos, Block block) {
|
||||
int count = 1;
|
||||
while (world.getBlockState(pos.down(count)).getBlock() == block)
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
public static void cover(WorldAccess world, BlockPos center, Block ground, BlockState cover, int radius, Random random) {
|
||||
HashSet<BlockPos> points = new HashSet<BlockPos>();
|
||||
HashSet<BlockPos> points2 = new HashSet<BlockPos>();
|
||||
if (world.getBlockState(center).getBlock() == ground) {
|
||||
points.add(center);
|
||||
points2.add(center);
|
||||
for (int i = 0; i < radius; i++) {
|
||||
Iterator<BlockPos> iterator = points.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BlockPos pos = iterator.next();
|
||||
for (Vec3i offset : OFFSETS) {
|
||||
if (random.nextBoolean()) {
|
||||
BlockPos pos2 = pos.add(offset);
|
||||
if (random.nextBoolean() && world.getBlockState(pos2).getBlock() == ground
|
||||
&& !points.contains(pos2))
|
||||
points2.add(pos2);
|
||||
}
|
||||
}
|
||||
}
|
||||
points.addAll(points2);
|
||||
points2.clear();
|
||||
}
|
||||
Iterator<BlockPos> iterator = points.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BlockPos pos = iterator.next();
|
||||
BlocksHelper.setWithoutUpdate(world, pos, cover);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void fixBlocks(WorldAccess world, BlockPos start, BlockPos end) {
|
||||
BlockState state;
|
||||
for (int x = start.getX(); x <= end.getX(); x++) {
|
||||
POS.setX(x);
|
||||
for (int z = start.getZ(); z <= end.getZ(); z++) {
|
||||
POS.setZ(z);
|
||||
for (int y = start.getY(); y <= end.getY(); y++) {
|
||||
POS.setY(y);
|
||||
state = world.getBlockState(POS);
|
||||
// Falling blocks
|
||||
if (state.getBlock() instanceof FallingBlock) {
|
||||
BlockState falling = state;
|
||||
|
||||
POS.setY(POS.getY() - 1);
|
||||
state = world.getBlockState(POS);
|
||||
|
||||
int ray = downRayRep(world, POS.toImmutable(), 64);
|
||||
if (ray > 32) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, Blocks.END_STONE.getDefaultState());
|
||||
if (world.getRandom().nextBoolean()) {
|
||||
POS.setY(POS.getY() - 1);
|
||||
state = world.getBlockState(POS);
|
||||
BlocksHelper.setWithoutUpdate(world, POS, Blocks.END_STONE.getDefaultState());
|
||||
}
|
||||
}
|
||||
else {
|
||||
POS.setY(y);
|
||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
||||
|
||||
POS.setY(y - ray);
|
||||
BlocksHelper.setWithoutUpdate(world, POS, falling);
|
||||
}
|
||||
}
|
||||
// Blocks without support
|
||||
else if (!state.canPlaceAt(world, POS)) {
|
||||
// Blue Vine
|
||||
if (state.getBlock() instanceof BlockBlueVine) {
|
||||
while (!state.canPlaceAt(world, POS)) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
||||
for (Direction dir : HORIZONTAL) {
|
||||
BlockPos p = POS.offset(dir).up();
|
||||
state = world.getBlockState(p);
|
||||
if (state.getBlock() instanceof BlockGlowingFur) {
|
||||
BlocksHelper.setWithoutUpdate(world, p, AIR);
|
||||
}
|
||||
}
|
||||
POS.setY(POS.getY() + 1);
|
||||
state = world.getBlockState(POS);
|
||||
}
|
||||
}
|
||||
// Double plants
|
||||
if (state.getBlock() instanceof BlockDoublePlant) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
||||
POS.setY(POS.getY() + 1);
|
||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
||||
}
|
||||
// Other blocks
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isEndNylium(Block block) {
|
||||
return block.isIn(BlockTags.NYLIUM) && block.isIn(BlockTagRegistry.END_GROUND);
|
||||
}
|
||||
|
||||
public static boolean isEndNylium(BlockState state) {
|
||||
return isEndNylium(state.getBlock());
|
||||
}
|
||||
|
||||
public static Direction[] makeHorizontal() {
|
||||
return new Direction[] { Direction.NORTH, Direction.SOUTH, Direction.EAST, Direction.WEST };
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue