BlockUtil replacement

This commit is contained in:
paulevsGitch 2021-06-06 11:54:11 +03:00
parent c8cef8e055
commit 0b336febd8
114 changed files with 421 additions and 546 deletions

View file

@ -14,10 +14,10 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockAndTintGetter;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.ColorUtil;
import ru.betterend.client.ClientOptions;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
@Mixin(BiomeColors.class)
public class BiomeColorsMixin {

View file

@ -1,10 +1,11 @@
package ru.betterend.mixin.client;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.resources.ResourceLocation;
import ru.betterend.world.generator.GeneratorOptions;
@Mixin(ModelBakery.class)

View file

@ -27,8 +27,9 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.api.TagAPI;
import ru.bclib.util.BlocksHelper;
import ru.betterend.blocks.BlockProperties;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.generator.GeneratorOptions;
@Mixin(value = ChorusFlowerBlock.class, priority = 100)
@ -61,7 +62,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
if (i < 5) {
this.placeGrownFlower(world, up, i + 1);
if (GeneratorOptions.changeChorusPlant()) {
BlocksHelper.setWithoutUpdate(world, pos, plant.defaultBlockState().setValue(ChorusPlantBlock.UP, true).setValue(ChorusPlantBlock.DOWN, true).setValue(BlocksHelper.ROOTS, true));
BlocksHelper.setWithoutUpdate(world, pos, plant.defaultBlockState().setValue(ChorusPlantBlock.UP, true).setValue(ChorusPlantBlock.DOWN, true).setValue(BlockProperties.ROOTS, true));
}
else {
BlocksHelper.setWithoutUpdate(world, pos, plant.defaultBlockState().setValue(ChorusPlantBlock.UP, true).setValue(ChorusPlantBlock.DOWN, true));
@ -76,7 +77,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
private static void be_generatePlant(LevelAccessor world, BlockPos pos, Random random, int size, CallbackInfo info) {
BlockState state = world.getBlockState(pos);
if (GeneratorOptions.changeChorusPlant() && state.is(Blocks.CHORUS_PLANT)) {
BlocksHelper.setWithoutUpdate(world, pos, state.setValue(BlocksHelper.ROOTS, true));
BlocksHelper.setWithoutUpdate(world, pos, state.setValue(BlockProperties.ROOTS, true));
}
}

View file

@ -21,8 +21,8 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import ru.bclib.api.TagAPI;
import ru.betterend.blocks.BlockProperties;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.generator.GeneratorOptions;
@Mixin(value = ChorusPlantBlock.class, priority = 100)
@ -34,7 +34,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
@Inject(method = "<init>*", at = @At("TAIL"))
private void beOnInit(BlockBehaviour.Properties settings, CallbackInfo info) {
if (GeneratorOptions.changeChorusPlant()) {
this.registerDefaultState(this.defaultBlockState().setValue(BlocksHelper.ROOTS, false));
this.registerDefaultState(this.defaultBlockState().setValue(BlockProperties.ROOTS, false));
}
}
@ -42,7 +42,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
private void be_createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder, CallbackInfo info) {
GeneratorOptions.init();
if (GeneratorOptions.changeChorusPlant()) {
builder.add(BlocksHelper.ROOTS);
builder.add(BlockProperties.ROOTS);
}
}
@ -53,7 +53,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
BlockState plant = info.getReturnValue();
if (ctx.canPlace() && plant.is(Blocks.CHORUS_PLANT) && world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
if (GeneratorOptions.changeChorusPlant()) {
info.setReturnValue(plant.setValue(BlocksHelper.ROOTS, true).setValue(BlockStateProperties.DOWN, true));
info.setReturnValue(plant.setValue(BlockProperties.ROOTS, true).setValue(BlockStateProperties.DOWN, true));
}
else {
info.setReturnValue(plant.setValue(BlockStateProperties.DOWN, true));
@ -71,7 +71,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
if (plant.is(Blocks.CHORUS_PLANT)) {
if (blockGetter.getBlockState(blockPos.below()).is(TagAPI.END_GROUND)) {
if (GeneratorOptions.changeChorusPlant()) {
info.setReturnValue(plant.setValue(BlockStateProperties.DOWN, true).setValue(BlocksHelper.ROOTS, true));
info.setReturnValue(plant.setValue(BlockStateProperties.DOWN, true).setValue(BlockProperties.ROOTS, true));
}
else {
info.setReturnValue(plant.setValue(BlockStateProperties.DOWN, true));
@ -80,7 +80,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
}
else {
if (GeneratorOptions.changeChorusPlant()) {
info.setReturnValue(plant.setValue(BlocksHelper.ROOTS, false));
info.setReturnValue(plant.setValue(BlockProperties.ROOTS, false));
}
info.cancel();
}
@ -102,7 +102,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
if (plant.is(Blocks.CHORUS_PLANT)) {
if (world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
if (GeneratorOptions.changeChorusPlant()) {
plant = plant.setValue(BlockStateProperties.DOWN, true).setValue(BlocksHelper.ROOTS, true);
plant = plant.setValue(BlockStateProperties.DOWN, true).setValue(BlockProperties.ROOTS, true);
}
else {
plant = plant.setValue(BlockStateProperties.DOWN, true);
@ -111,7 +111,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
}
else {
if (GeneratorOptions.changeChorusPlant()) {
plant = plant.setValue(BlocksHelper.ROOTS, false);
plant = plant.setValue(BlockProperties.ROOTS, false);
}
info.cancel();
}

View file

@ -16,9 +16,10 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.ChorusPlantFeature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;
import ru.betterend.blocks.BlockProperties;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.generator.GeneratorOptions;
@Mixin(ChorusPlantFeature.class)
@ -30,7 +31,7 @@ public class ChorusPlantFeatureMixin {
BlockState bottom = structureWorldAccess.getBlockState(blockPos);
if (bottom.is(Blocks.CHORUS_PLANT)) {
if ((GeneratorOptions.changeChorusPlant())) {
BlocksHelper.setWithoutUpdate(structureWorldAccess, blockPos, bottom.setValue(BlocksHelper.ROOTS, true).setValue(PipeBlock.DOWN, true));
BlocksHelper.setWithoutUpdate(structureWorldAccess, blockPos, bottom.setValue(BlockProperties.ROOTS, true).setValue(PipeBlock.DOWN, true));
}
else {
BlocksHelper.setWithoutUpdate(structureWorldAccess, blockPos, bottom.setValue(PipeBlock.DOWN, true));

View file

@ -21,7 +21,7 @@ import net.minecraft.world.level.block.state.pattern.BlockPattern;
import net.minecraft.world.level.dimension.end.DragonRespawnAnimation;
import net.minecraft.world.level.dimension.end.EndDragonFight;
import net.minecraft.world.phys.AABB;
import ru.betterend.util.BlocksHelper;
import ru.bclib.util.BlocksHelper;
import ru.betterend.world.generator.GeneratorOptions;
@Mixin(EndDragonFight.class)

View file

@ -20,12 +20,12 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;
import ru.betterend.blocks.BlockProperties;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.item.ArmoredElytra;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
@Mixin(Player.class)
public abstract class PlayerMixin extends LivingEntity {

View file

@ -25,9 +25,9 @@ import net.minecraft.world.level.levelgen.feature.SpikeFeature;
import net.minecraft.world.level.levelgen.feature.configurations.SpikeConfiguration;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.StructureHelper;
import ru.betterend.BetterEnd;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.WorldDataUtil;
import ru.betterend.world.generator.GeneratorOptions;