Code style changes, entities fixes
This commit is contained in:
parent
9d604b2d25
commit
44962e18b6
377 changed files with 5038 additions and 4914 deletions
|
@ -1,16 +1,5 @@
|
|||
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.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
|
@ -26,17 +15,27 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
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 ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.betterend.blocks.VanillaBlockProperties;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.generator.GeneratorOptions;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@Mixin(value = ChorusFlowerBlock.class, priority = 100)
|
||||
public abstract class ChorusFlowerBlockMixin extends Block {
|
||||
private static final VoxelShape SHAPE_FULL = Block.box(0, 0, 0, 16, 16, 16);
|
||||
private static final VoxelShape SHAPE_HALF = Block.box(0, 0, 0, 16, 4, 16);
|
||||
|
||||
|
||||
public ChorusFlowerBlockMixin(Properties settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
@ -44,7 +43,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
@Final
|
||||
@Shadow
|
||||
private ChorusPlantBlock plant;
|
||||
|
||||
|
||||
@Inject(method = "canSurvive", at = @At("HEAD"), cancellable = true)
|
||||
private void be_canSurvive(BlockState state, LevelReader world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||
if (world.getBlockState(pos.below()).is(EndBlocks.CHORUS_NYLIUM)) {
|
||||
|
@ -52,7 +51,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
info.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "randomTick", at = @At("HEAD"), cancellable = true)
|
||||
private void be_randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random, CallbackInfo info) {
|
||||
if (world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
|
||||
|
@ -72,7 +71,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "generatePlant", at = @At("RETURN"), cancellable = true)
|
||||
private static void be_generatePlant(LevelAccessor world, BlockPos pos, Random random, int size, CallbackInfo info) {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
|
@ -80,16 +79,20 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
BlocksHelper.setWithoutUpdate(world, pos, state.setValue(VanillaBlockProperties.ROOTS, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Shadow
|
||||
private static boolean allNeighborsEmpty(LevelReader world, BlockPos pos, @Nullable Direction exceptDirection) { return false; }
|
||||
|
||||
private static boolean allNeighborsEmpty(LevelReader world, BlockPos pos, @Nullable Direction exceptDirection) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Shadow
|
||||
private void placeGrownFlower(Level world, BlockPos pos, int age) {}
|
||||
|
||||
private void placeGrownFlower(Level world, BlockPos pos, int age) {
|
||||
}
|
||||
|
||||
@Shadow
|
||||
private void placeDeadFlower(Level world, BlockPos pos) {}
|
||||
|
||||
private void placeDeadFlower(Level world, BlockPos pos) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue