Continue migration

This commit is contained in:
Aleksey 2021-04-14 09:31:07 +03:00
parent f03fd03bd0
commit de3bc706bd
11 changed files with 56 additions and 56 deletions

View file

@ -28,7 +28,7 @@ public class BoneMealItemMixin {
private static final Direction[] DIR = BlocksHelper.makeHorizontal();
private static final MutableBlockPos POS = new MutableBlockPos();
@Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true)
@Inject(method = "useOn", at = @At("HEAD"), cancellable = true)
private void be_onUse(UseOnContext context, CallbackInfoReturnable<InteractionResult> info) {
Level world = context.getLevel();
BlockPos blockPos = context.getClickedPos();
@ -39,7 +39,7 @@ public class BoneMealItemMixin {
if (world.getBlockState(blockPos).is(EndTags.END_GROUND)) {
boolean consume = false;
if (world.getBlockState(blockPos).is(Blocks.END_STONE)) {
BlockState nylium = beGetNylium(world, blockPos);
BlockState nylium = be_getNylium(world, blockPos);
if (nylium != null) {
BlocksHelper.setWithoutUpdate(world, blockPos, nylium);
consume = true;
@ -48,11 +48,11 @@ public class BoneMealItemMixin {
else {
if (!world.getFluidState(offseted).isEmpty() && endBiome) {
if (world.getBlockState(offseted).getBlock().equals(Blocks.WATER)) {
consume = beGrowWaterGrass(world, blockPos);
consume = be_growWaterGrass(world, blockPos);
}
}
else {
consume = beGrowGrass(world, blockPos);
consume = be_growGrass(world, blockPos);
}
}
if (consume) {
@ -73,7 +73,7 @@ public class BoneMealItemMixin {
}
}
private boolean beGrowGrass(Level world, BlockPos pos) {
private boolean be_growGrass(Level world, BlockPos pos) {
int y1 = pos.getY() + 3;
int y2 = pos.getY() - 3;
boolean result = false;
@ -86,7 +86,7 @@ public class BoneMealItemMixin {
POS.setY(y);
BlockPos down = POS.below();
if (world.isEmptyBlock(POS) && !world.isEmptyBlock(down)) {
BlockState grass = beGetGrassState(world, down);
BlockState grass = be_getGrassState(world, down);
if (grass != null) {
BlocksHelper.setWithoutUpdate(world, POS, grass);
result = true;
@ -98,7 +98,7 @@ public class BoneMealItemMixin {
return result;
}
private boolean beGrowWaterGrass(Level world, BlockPos pos) {
private boolean be_growWaterGrass(Level world, BlockPos pos) {
int y1 = pos.getY() + 3;
int y2 = pos.getY() - 3;
boolean result = false;
@ -111,7 +111,7 @@ public class BoneMealItemMixin {
POS.setY(y);
BlockPos down = POS.below();
if (world.getBlockState(POS).is(Blocks.WATER) && world.getBlockState(down).is(EndTags.END_GROUND)) {
BlockState grass = beGetWaterGrassState(world, down);
BlockState grass = be_getWaterGrassState(world, down);
if (grass != null) {
BlocksHelper.setWithoutUpdate(world, POS, grass);
result = true;
@ -123,14 +123,14 @@ public class BoneMealItemMixin {
return result;
}
private BlockState beGetGrassState(Level world, BlockPos pos) {
private BlockState be_getGrassState(Level world, BlockPos pos) {
BlockState state = world.getBlockState(pos);
Block block = state.getBlock();
block = BonemealUtil.getGrass(EndBiomes.getBiomeID(world.getBiome(pos)), block, world.getRandom());
return block == null ? null : block.defaultBlockState();
}
private BlockState beGetWaterGrassState(Level world, BlockPos pos) {
private BlockState be_getWaterGrassState(Level world, BlockPos pos) {
EndBiome biome = EndBiomes.getFromBiome(world.getBiome(pos));
if (world.random.nextInt(16) == 0) {
return EndBlocks.CHARNIA_RED.defaultBlockState();
@ -147,7 +147,7 @@ public class BoneMealItemMixin {
return null;
}
private void beShuffle(Random random) {
private void be_shuffle(Random random) {
for (int i = 0; i < 4; i++) {
int j = random.nextInt(4);
Direction d = DIR[i];
@ -156,8 +156,8 @@ public class BoneMealItemMixin {
}
}
private BlockState beGetNylium(Level world, BlockPos pos) {
beShuffle(world.random);
private BlockState be_getNylium(Level world, BlockPos pos) {
be_shuffle(world.random);
for (Direction dir : DIR) {
BlockState state = world.getBlockState(pos.relative(dir));
if (BlocksHelper.isEndNylium(state))