Various smaller updates
This commit is contained in:
parent
fdd61262c5
commit
10a9a81725
64 changed files with 372 additions and 276 deletions
27
Convert.java
27
Convert.java
|
@ -119,10 +119,27 @@ public class Convert {
|
|||
p.setRotationAngle(x, y, z);
|
||||
}
|
||||
public void c (){
|
||||
ModelPart leftWing = new ModelPart(this, 22, 0, "leftWing");
|
||||
leftWing.addBox(-10.0F, 0.0F, 0.0F, 10.0F, 20.0F, 2.0F, 1.0F);
|
||||
ModelPart rightWing = new ModelPart(this, 22, 0, "rightWing");
|
||||
rightWing.mirror = true;
|
||||
rightWing.addBox(0.0F, 0.0F, 0.0F, 10.0F, 20.0F, 2.0F, 1.0F);
|
||||
boolean thinArms = true;
|
||||
float scale = 0;
|
||||
ModelPart body = new ModelPart(this, 16, 16, "body");
|
||||
body.addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale + 0.25F);
|
||||
body.setPos(0.0F, 0.0F, 0.0F);
|
||||
if (thinArms) {
|
||||
ModelPart leftShoulder = new ModelPart(this, 41, 32, "leftShoulder");
|
||||
leftShoulder.addBox(-1.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
|
||||
leftShoulder.setPos(5.0F, 2.5F, 0.0F);
|
||||
leftShoulder.mirror = true;
|
||||
ModelPart rightShoulder = new ModelPart(this, 41, 16, "rightShoulder");
|
||||
rightShoulder.addBox(-2.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
|
||||
rightShoulder.setPos(-5.0F, 2.5F, 10.0F);
|
||||
} else {
|
||||
ModelPart leftShoulder = new ModelPart(this, 40, 32, "leftShoulder");
|
||||
leftShoulder.addBox(-1.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
|
||||
leftShoulder.setPos(5.0F, 2.0F, 0.0F);
|
||||
leftShoulder.mirror = true;
|
||||
ModelPart rightShoulder = new ModelPart(this, 40, 16, "rightShoulder");
|
||||
rightShoulder.addBox(-3.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
|
||||
rightShoulder.setPos(-5.0F, 2.0F, 10.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import ru.betterend.registry.EndItems;
|
|||
public class PedestalItemRenderer<T extends PedestalBlockEntity> implements BlockEntityRenderer<T> {
|
||||
|
||||
public PedestalItemRenderer(BlockEntityRenderDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,9 +23,9 @@ import ru.betterend.integration.Integrations;
|
|||
public class BigEtherTreeFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.world.level.block.Blocks;
|
|||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -35,9 +36,11 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> BRANCH;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
BlockState log = Integrations.BYG.getDefaultState("nightshade_log");
|
||||
|
|
|
@ -38,9 +38,9 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
if (!world.getBlockState(pos.below(4)).is(TagAPI.GEN_TERRAIN))
|
||||
|
|
|
@ -71,6 +71,6 @@ public class ArmoredElytra extends BaseArmorItem implements MultiModelItem, Fall
|
|||
@Environment(EnvType.CLIENT)
|
||||
public void registerModelPredicate() {
|
||||
FabricModelPredicateProviderRegistry.register(this, new ResourceLocation("broken"),
|
||||
(itemStack, clientLevel, livingEntity) -> ElytraItem.isFlyEnabled(itemStack) ? 0.0F : 1.0F);
|
||||
(itemStack, clientLevel, livingEntity, id) -> ElytraItem.isFlyEnabled(itemStack) ? 0.0F : 1.0F);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,6 @@ public class CrystaliteElytra extends CrystaliteArmor implements MultiModelItem,
|
|||
@Override
|
||||
public void registerModelPredicate() {
|
||||
FabricModelPredicateProviderRegistry.register(this, new ResourceLocation("broken"),
|
||||
(itemStack, clientLevel, livingEntity) -> ElytraItem.isFlyEnabled(itemStack) ? 0.0F : 1.0F);
|
||||
(itemStack, clientLevel, livingEntity, i) -> ElytraItem.isFlyEnabled(itemStack) ? 0.0F : 1.0F);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ public class CrystaliteArmorProvider /*implements ModelProvider, TextureProvider
|
|||
private final static ResourceLocation FIRST_LAYER = new ResourceLocation("textures/models/armor/crystalite_layer_1.png");
|
||||
private final static ResourceLocation SECOND_LAYER = new ResourceLocation("textures/models/armor/crystalite_layer_2.png");
|
||||
private final static CrystaliteHelmetModel HELMET_MODEL = new CrystaliteHelmetModel(1.0F);
|
||||
private final static CrystaliteChestplateModel CHEST_MODEL = new CrystaliteChestplateModel(1.0F, false);
|
||||
private final static CrystaliteChestplateModel CHEST_MODEL_SLIM = new CrystaliteChestplateModel(1.0F, true);
|
||||
private final static CrystaliteChestplateModel CHEST_MODEL = CrystaliteChestplateModel.regularModel(null);
|
||||
private final static CrystaliteChestplateModel CHEST_MODEL_SLIM = CrystaliteChestplateModel.thinModel(null);
|
||||
private final static CrystaliteLeggingsModel LEGGINGS_MODEL = new CrystaliteLeggingsModel(1.0F);
|
||||
private final static CrystaliteBootsModel BOOTS_MODEL = new CrystaliteBootsModel(1.0F);
|
||||
|
||||
|
|
|
@ -6,40 +6,85 @@ import com.google.common.collect.Lists;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import net.minecraft.client.model.HumanoidModel;
|
||||
import net.minecraft.client.model.geom.EntityModelSet;
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.model.geom.PartNames;
|
||||
import net.minecraft.client.model.geom.PartPose;
|
||||
import net.minecraft.client.model.geom.builders.*;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.world.entity.HumanoidArm;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import ru.betterend.registry.EndEntitiesRenders;
|
||||
|
||||
public class CrystaliteChestplateModel extends HumanoidModel<LivingEntity> {
|
||||
|
||||
public ModelPart leftShoulder;
|
||||
public ModelPart rightShoulder;
|
||||
private final boolean thinArms;
|
||||
|
||||
public CrystaliteChestplateModel(float scale, boolean thinArms) {
|
||||
super(RenderType::entityTranslucent, scale, 0.0F, 64, 48);
|
||||
this.thinArms = thinArms;
|
||||
this.body = new ModelPart(this, 16, 16);
|
||||
this.body.addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, scale + 0.25F);
|
||||
this.body.setPos(0.0F, 0.0F, 0.0F);
|
||||
|
||||
public static LayerDefinition getRegularTexturedModelData(){
|
||||
return getTexturedModelData(1.0f, false);
|
||||
}
|
||||
|
||||
public static LayerDefinition getThinTexturedModelData(){
|
||||
return getTexturedModelData(1.0f, true);
|
||||
}
|
||||
|
||||
private static LayerDefinition getTexturedModelData(float scale, boolean thinArms) {
|
||||
MeshDefinition modelData = new MeshDefinition();
|
||||
PartDefinition modelPartData = modelData.getRoot();
|
||||
CubeDeformation deformation = new CubeDeformation(scale + 0.25F);
|
||||
PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create()
|
||||
.addBox(-4.0f, 0.0f, -2.0f, 8.0f, 12.0f, 4.0f, deformation)
|
||||
.texOffs(16, 16),
|
||||
PartPose.ZERO);
|
||||
|
||||
if (thinArms) {
|
||||
this.leftShoulder = new ModelPart(this, 41, 32);
|
||||
this.leftShoulder.addBox(-1.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
|
||||
this.leftShoulder.setPos(5.0F, 2.5F, 0.0F);
|
||||
this.leftShoulder.mirror = true;
|
||||
this.rightShoulder = new ModelPart(this, 41, 16);
|
||||
this.rightShoulder.addBox(-2.0F, -2.5F, -2.0F, 3.0F, 12.0F, 4.0F, scale + 0.35F);
|
||||
this.rightShoulder.setPos(-5.0F, 2.5F, 10.0F);
|
||||
deformation = new CubeDeformation(scale + 0.45F);
|
||||
PartDefinition leftShoulder = modelPartData.addOrReplaceChild("leftShoulder", CubeListBuilder.create()
|
||||
.mirror()
|
||||
.addBox(-1.0f, -2.5f, -2.0f, 4.0f, 12.0f, 4.0f, deformation)
|
||||
.texOffs(40, 32),
|
||||
PartPose.offset(5.0f, 2.0f, 0.0f));
|
||||
|
||||
PartDefinition rightShoulder = modelPartData.addOrReplaceChild("rightShoulder", CubeListBuilder.create()
|
||||
.addBox(-3.0f, -2.5f, -2.0f, 4.0f, 12.0f, 4.0f, deformation)
|
||||
.texOffs(40, 16),
|
||||
PartPose.offset(-5.0f, 2.0f, 10.0f));
|
||||
} else {
|
||||
this.leftShoulder = new ModelPart(this, 40, 32);
|
||||
this.leftShoulder.addBox(-1.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
|
||||
this.leftShoulder.setPos(5.0F, 2.0F, 0.0F);
|
||||
this.leftShoulder.mirror = true;
|
||||
this.rightShoulder = new ModelPart(this, 40, 16);
|
||||
this.rightShoulder.addBox(-3.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, scale + 0.45F);
|
||||
this.rightShoulder.setPos(-5.0F, 2.0F, 10.0F);
|
||||
deformation = new CubeDeformation(scale + 0.45F);
|
||||
PartDefinition leftShoulder = modelPartData.addOrReplaceChild("leftShoulder", CubeListBuilder.create()
|
||||
.mirror()
|
||||
.addBox(-1.0f, -2.5f, -2.0f, 4.0f, 12.0f, 4.0f, deformation)
|
||||
.texOffs(40, 32),
|
||||
PartPose.offset(5.0f, 2.0f, 0.0f));
|
||||
|
||||
PartDefinition rightShoulder = modelPartData.addOrReplaceChild("rightShoulder", CubeListBuilder.create()
|
||||
.addBox(-3.0f, -2.5f, -2.0f, 4.0f, 12.0f, 4.0f, deformation)
|
||||
.texOffs(40, 16),
|
||||
PartPose.offset(-5.0f, 2.0f, 10.0f));
|
||||
}
|
||||
return LayerDefinition.create(modelData, 64, 48);
|
||||
}
|
||||
|
||||
final ModelPart localBody;
|
||||
|
||||
public static CrystaliteChestplateModel regularModel(EntityModelSet entityModelSet){
|
||||
if (entityModelSet==null) throw new RuntimeException("Need to get a ModelSet");
|
||||
return new CrystaliteChestplateModel(entityModelSet.bakeLayer(EndEntitiesRenders.CRYSTALITE_CHESTPLATE), false);
|
||||
}
|
||||
|
||||
public static CrystaliteChestplateModel thinModel(EntityModelSet entityModelSet){
|
||||
if (entityModelSet==null) throw new RuntimeException("Need to get a ModelSet");
|
||||
return new CrystaliteChestplateModel(entityModelSet.bakeLayer(EndEntitiesRenders.CRYSTALITE_CHESTPLATE_THIN), true);
|
||||
}
|
||||
|
||||
protected CrystaliteChestplateModel(ModelPart modelPart, boolean thinArms) {
|
||||
super(modelPart, RenderType::entityTranslucent);
|
||||
this.thinArms = thinArms;
|
||||
localBody = modelPart.getChild(PartNames.BODY);
|
||||
leftShoulder = modelPart.getChild("leftShoulder");
|
||||
rightShoulder = modelPart.getChild("rightShoulder");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +101,7 @@ public class CrystaliteChestplateModel extends HumanoidModel<LivingEntity> {
|
|||
|
||||
@Override
|
||||
protected Iterable<ModelPart> bodyParts() {
|
||||
return Lists.newArrayList(body, leftShoulder, rightShoulder);
|
||||
return Lists.newArrayList(localBody, leftShoulder, rightShoulder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,31 +1,33 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.ChorusFlowerBlock;
|
||||
import net.minecraft.world.level.block.PipeBlock;
|
||||
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.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.blocks.VanillaBlockProperties;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.generator.GeneratorOptions;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@Mixin(ChorusPlantFeature.class)
|
||||
public class ChorusPlantFeatureMixin {
|
||||
@Inject(method = "place", at = @At("HEAD"), cancellable = true)
|
||||
private void be_place(WorldGenLevel structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, NoneFeatureConfiguration defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
private void be_place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos blockPos = featureConfig.origin();
|
||||
final WorldGenLevel structureWorldAccess = featureConfig.level();
|
||||
if (structureWorldAccess.isEmptyBlock(blockPos) && structureWorldAccess.getBlockState(blockPos.below()).is(EndBlocks.CHORUS_NYLIUM)) {
|
||||
ChorusFlowerBlock.generatePlant(structureWorldAccess, blockPos, random, MHelper.randRange(8, 16, random));
|
||||
BlockState bottom = structureWorldAccess.getBlockState(blockPos);
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||
import net.minecraft.world.level.levelgen.feature.EndPodiumFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
@ -9,22 +18,13 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||
import net.minecraft.world.level.levelgen.feature.EndPodiumFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
import ru.bclib.api.WorldDataAPI;
|
||||
import ru.bclib.util.StructureHelper;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.world.generator.GeneratorOptions;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@Mixin(EndPodiumFeature.class)
|
||||
public class EndPodiumFeatureMixin {
|
||||
@Final
|
||||
|
@ -32,17 +32,19 @@ public class EndPodiumFeatureMixin {
|
|||
private boolean active;
|
||||
|
||||
@Inject(method = "place", at = @At("HEAD"), cancellable = true)
|
||||
private void be_place(WorldGenLevel world, ChunkGenerator generator, Random random, BlockPos blockPos, NoneFeatureConfiguration config, CallbackInfoReturnable<Boolean> info) {
|
||||
private void be_place(FeaturePlaceContext<NoneFeatureConfiguration> featurePlaceContext, CallbackInfoReturnable<Boolean> info) {
|
||||
if (!GeneratorOptions.hasPortal()) {
|
||||
info.setReturnValue(false);
|
||||
info.cancel();
|
||||
}
|
||||
else if (GeneratorOptions.replacePortal()) {
|
||||
blockPos = be_updatePos(blockPos, world);
|
||||
Random random = featurePlaceContext.random();
|
||||
WorldGenLevel world = featurePlaceContext.level();
|
||||
BlockPos blockPos = be_updatePos(featurePlaceContext.origin(), world);
|
||||
StructureTemplate structure = StructureHelper.readStructure(BetterEnd.makeID(active ? "portal/end_portal_active" : "portal/end_portal_inactive"));
|
||||
BlockPos size = structure.getSize();
|
||||
Vec3i size = structure.getSize();
|
||||
blockPos = blockPos.offset(-(size.getX() >> 1), -1, -(size.getZ() >> 1));
|
||||
structure.placeInWorldChunk(world, blockPos, new StructurePlaceSettings(), random);
|
||||
structure.placeInWorld(world, blockPos, blockPos, new StructurePlaceSettings(), random, 2);
|
||||
info.setReturnValue(true);
|
||||
info.cancel();
|
||||
}
|
||||
|
|
|
@ -22,8 +22,7 @@ public abstract class EntityMixin implements TeleportingEntity {
|
|||
public float yRot;
|
||||
@Shadow
|
||||
public float xRot;
|
||||
@Shadow
|
||||
public boolean removed;
|
||||
|
||||
@Shadow
|
||||
public Level level;
|
||||
|
||||
|
@ -40,11 +39,16 @@ public abstract class EntityMixin implements TeleportingEntity {
|
|||
@Shadow
|
||||
protected abstract PortalInfo findDimensionEntryPoint(ServerLevel destination);
|
||||
|
||||
@Shadow
|
||||
protected abstract void removeAfterChangingDimensions();
|
||||
|
||||
@Shadow public abstract boolean isRemoved();
|
||||
|
||||
private BlockPos exitPos;
|
||||
|
||||
@Inject(method = "changeDimension", at = @At("HEAD"), cancellable = true)
|
||||
public void be_changeDimension(ServerLevel destination, CallbackInfoReturnable<Entity> info) {
|
||||
if (!removed && be_canTeleport() && level instanceof ServerLevel) {
|
||||
if (!isRemoved() && be_canTeleport() && level instanceof ServerLevel) {
|
||||
unRide();
|
||||
level.getProfiler().push("changeDimension");
|
||||
level.getProfiler().push("reposition");
|
||||
|
@ -54,11 +58,14 @@ public abstract class EntityMixin implements TeleportingEntity {
|
|||
Entity entity = getType().create(destination);
|
||||
if (entity != null) {
|
||||
entity.restoreFrom(Entity.class.cast(this));
|
||||
entity.moveTo(teleportTarget.pos.x, teleportTarget.pos.y, teleportTarget.pos.z, teleportTarget.yRot, entity.xRot);
|
||||
entity.moveTo(teleportTarget.pos.x, teleportTarget.pos.y, teleportTarget.pos.z, teleportTarget.yRot, entity.getXRot());
|
||||
entity.setDeltaMovement(teleportTarget.speed);
|
||||
destination.addFromAnotherDimension(entity);
|
||||
//TODO: check if this works as intended in 1.17
|
||||
|
||||
destination.addDuringTeleport(entity);
|
||||
}
|
||||
removed = true;
|
||||
|
||||
this.removeAfterChangingDimensions();
|
||||
level.getProfiler().pop();
|
||||
((ServerLevel) level).resetEmptyTime();
|
||||
destination.resetEmptyTime();
|
||||
|
|
|
@ -15,6 +15,7 @@ import ru.betterend.entity.render.RendererEntityEndSlime;
|
|||
import ru.betterend.entity.render.RendererEntityShadowWalker;
|
||||
import ru.betterend.entity.render.SilkMothEntityRenderer;
|
||||
import ru.betterend.item.model.ArmoredElytraModel;
|
||||
import ru.betterend.item.model.CrystaliteChestplateModel;
|
||||
|
||||
public class EndEntitiesRenders {
|
||||
|
||||
|
@ -27,6 +28,8 @@ public class EndEntitiesRenders {
|
|||
|
||||
//Not sure if this should go to another registry
|
||||
public static final ModelLayerLocation ARMORED_ELYTRA = registerMain("armored_elytra");
|
||||
public static final ModelLayerLocation CRYSTALITE_CHESTPLATE = registerMain("crystalite_chestplate");
|
||||
public static final ModelLayerLocation CRYSTALITE_CHESTPLATE_THIN = registerMain("crystalite_chestplate_thin");
|
||||
|
||||
public static void register() {
|
||||
register(EndEntities.DRAGONFLY, RendererEntityDragonfly.class);
|
||||
|
@ -44,6 +47,8 @@ public class EndEntitiesRenders {
|
|||
EntityModelLayerRegistry.registerModelLayer(SILK_MOTH_MODEL, SilkMothEntityModel::getTexturedModelData);
|
||||
|
||||
EntityModelLayerRegistry.registerModelLayer(ARMORED_ELYTRA, ArmoredElytraModel::getTexturedModelData);
|
||||
EntityModelLayerRegistry.registerModelLayer(CRYSTALITE_CHESTPLATE, CrystaliteChestplateModel::getRegularTexturedModelData);
|
||||
EntityModelLayerRegistry.registerModelLayer(CRYSTALITE_CHESTPLATE_THIN, CrystaliteChestplateModel::getThinTexturedModelData);
|
||||
}
|
||||
|
||||
private static void register(EntityType<?> type, Class<? extends MobRenderer<?, ?>> renderer) {
|
||||
|
|
|
@ -31,8 +31,8 @@ public class BiomeIslandFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
Biome biome = world.getBiome(pos);
|
||||
SurfaceBuilderConfiguration surfaceConfig = biome.getGenerationSettings().getSurfaceBuilderConfig();
|
||||
BlockState topMaterial = surfaceConfig.getTopMaterial();
|
||||
|
|
|
@ -16,9 +16,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class CavePumpkinFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.above()).is(TagAPI.GEN_TERRAIN) || !world.isEmptyBlock(pos)
|
||||
|| !world.isEmptyBlock(pos.below())) {
|
||||
return false;
|
||||
|
|
|
@ -77,9 +77,9 @@ public class CrashedShipFeature extends NBTStructureFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
center = new BlockPos(((center.getX() >> 4) << 4) | 8, 128, ((center.getZ() >> 4) << 4) | 8);
|
||||
center = getGround(world, center);
|
||||
BoundingBox bounds = makeBox(center);
|
||||
|
|
|
@ -28,9 +28,9 @@ public abstract class FullHeightScatterFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos center = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
int maxY = world.getHeight(Heightmap.Types.WORLD_SURFACE_WG, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
for (int y = maxY; y > minY; y--) {
|
||||
|
|
|
@ -28,9 +28,9 @@ public abstract class InvertedScatterFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos center = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
int maxY = world.getHeight(Heightmap.Types.WORLD_SURFACE, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
for (int y = maxY; y > minY; y--) {
|
||||
|
|
|
@ -15,9 +15,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class NeonCactusFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
BlockState ground = world.getBlockState(pos.below());
|
||||
if (!ground.is(EndBlocks.ENDSTONE_DUST) && !ground.is(EndBlocks.END_MOSS)) {
|
||||
return false;
|
||||
|
|
|
@ -58,9 +58,9 @@ public abstract class ScatterFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
center = getCenterGround(world, center);
|
||||
|
||||
if (!canSpawn(world, center)) {
|
||||
|
|
|
@ -36,9 +36,9 @@ public class SilkMothNestFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos center = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
int maxY = world.getHeight(Heightmap.Types.WORLD_SURFACE, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
POS.set(center);
|
||||
|
|
|
@ -28,9 +28,9 @@ public abstract class WallScatterFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos center = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
int maxY = world.getHeight(Heightmap.Types.WORLD_SURFACE, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
if (maxY < 10 || maxY < minY) {
|
||||
|
|
|
@ -37,9 +37,9 @@ public class BushFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)
|
||||
&& !world.getBlockState(pos.above()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
|
|
@ -41,9 +41,9 @@ public class BushWithOuterFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)
|
||||
&& !world.getBlockState(pos.above()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
|
|
@ -21,9 +21,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class LargeAmaranitaFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class Lumecorn extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ public class TenaneaBushFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class BigAuroraCrystalFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
int maxY = pos.getY() + BlocksHelper.upRay(world, pos, 16);
|
||||
int minY = pos.getY() - BlocksHelper.downRay(world, pos, 16);
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ public class DesertLakeFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos blockPos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
double radius = MHelper.randRange(8.0, 15.0, random);
|
||||
double depth = radius * 0.5 * MHelper.randRange(0.8, 1.2, random);
|
||||
int dist = MHelper.floor(radius);
|
||||
|
|
|
@ -27,9 +27,9 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos blockPos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos blockPos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
double radius = MHelper.randRange(10.0, 20.0, random);
|
||||
double depth = radius * 0.5 * MHelper.randRange(0.8, 1.2, random);
|
||||
int dist = MHelper.floor(radius);
|
||||
|
|
|
@ -26,9 +26,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class FallenPillarFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
pos = getPosOnSurface(world,
|
||||
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||
if (!world.getBlockState(pos.below(5)).is(TagAPI.GEN_TERRAIN)) {
|
||||
|
|
|
@ -24,10 +24,10 @@ import ru.betterend.registry.EndFeatures;
|
|||
public class FloatingSpireFeature extends SpireFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
ChunkGenerator chunkGenerator = featureConfig.chunkGenerator();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
final ChunkGenerator chunkGenerator = featureConfig.chunkGenerator();
|
||||
int minY = getYOnSurface(world, pos.getX(), pos.getZ());
|
||||
int y = minY > 57 ? MHelper.floor(MHelper.randRange(minY, minY * 2, random) * 0.5F + 32)
|
||||
: MHelper.randRange(64, 192, random);
|
||||
|
|
|
@ -36,9 +36,9 @@ public class IceStarFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
float size = MHelper.randRange(minSize, maxSize, random);
|
||||
int count = MHelper.randRange(minCount, maxCount, random);
|
||||
List<Vector3f> points = getFibonacciPoints(count);
|
||||
|
|
|
@ -23,9 +23,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class ObsidianBoulderFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
pos = getPosOnSurface(world,
|
||||
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
|
||||
|
|
|
@ -26,9 +26,9 @@ import java.util.Random;
|
|||
public class ObsidianPillarBasementFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
pos = getPosOnSurface(world, new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||
if (!world.getBlockState(pos.below(5)).is(TagAPI.GEN_TERRAIN)) {
|
||||
return false;
|
||||
|
|
|
@ -37,9 +37,9 @@ public class OreLayerFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
float radius = this.radius * 0.5F;
|
||||
int r = MHelper.floor(radius + 1);
|
||||
int posX = MHelper.randRange(Math.max(r - 16, 0), Math.min(31 - r, 15), random) + pos.getX();
|
||||
|
|
|
@ -23,9 +23,9 @@ public class SingleBlockFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class SmaragdantCrystalFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.GEN_TERRAIN)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -34,10 +34,10 @@ public class SpireFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
ChunkGenerator chunkGenerator = featureConfig.chunkGenerator();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
final ChunkGenerator chunkGenerator = featureConfig.chunkGenerator();
|
||||
pos = getPosOnSurfaceWG(world, pos);
|
||||
if (pos.getY() < 10 || !world.getBlockState(pos.below(3)).is(TagAPI.GEN_TERRAIN)
|
||||
|| !world.getBlockState(pos.below(6)).is(TagAPI.GEN_TERRAIN)) {
|
||||
|
|
|
@ -30,9 +30,9 @@ public class StalactiteFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!isGround(world.getBlockState(ceiling ? pos.above() : pos.below()).getBlock())) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@ import ru.betterend.registry.EndBlocks;
|
|||
public class SulphurHillFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
pos = getPosOnSurfaceWG(world, pos);
|
||||
if (pos.getY() < 57 || pos.getY() > 70) {
|
||||
return false;
|
||||
|
|
|
@ -34,9 +34,9 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
|
||||
@Override
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
int radius = MHelper.randRange(10, 30, random);
|
||||
|
||||
int top = world.getHeight(Heightmap.Types.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -23,13 +19,18 @@ import ru.betterend.blocks.SulphurCrystalBlock;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public class SulphuricLakeFeature extends DefaultFeature {
|
||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos blockPos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
blockPos = getPosOnSurfaceWG(world, blockPos);
|
||||
|
||||
if (blockPos.getY() < 57) {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
@ -15,10 +13,14 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.blocks.HydrothermalVentBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SurfaceVentFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
pos = getPosOnSurface(world,
|
||||
new BlockPos(pos.getX() + random.nextInt(16), pos.getY(), pos.getZ() + random.nextInt(16)));
|
||||
if (!world.getBlockState(pos.below(3)).is(TagAPI.GEN_TERRAIN)) {
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
@ -29,7 +30,10 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
Set<BlockPos> floorPositions = Sets.newHashSet();
|
||||
Set<BlockPos> ceilPositions = Sets.newHashSet();
|
||||
int sx = (pos.getX() >> 4) << 4;
|
||||
|
@ -111,7 +115,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getFloorFeature(random);
|
||||
if (feature != null) {
|
||||
feature.place(world, null, random, pos.above(), null);
|
||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -127,7 +131,7 @@ public class CaveChunkPopulatorFeature extends DefaultFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getCeilFeature(random);
|
||||
if (feature != null) {
|
||||
feature.place(world, null, random, pos.below(), null);
|
||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
package ru.betterend.world.features.terrain.caves;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -15,9 +10,9 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -30,6 +25,10 @@ import ru.betterend.registry.EndBiomes;
|
|||
import ru.betterend.util.BlockFixer;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class EndCaveFeature extends DefaultFeature {
|
||||
protected static final BlockState CAVE_AIR = Blocks.CAVE_AIR.defaultBlockState();
|
||||
protected static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
|
||||
|
@ -37,7 +36,10 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
private static final Vec3i[] SPHERE;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (pos.getX() * pos.getX() + pos.getZ() * pos.getZ() <= 2500) {
|
||||
return false;
|
||||
}
|
||||
|
@ -94,7 +96,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getFloorFeature(random);
|
||||
if (feature != null) {
|
||||
feature.place(world, null, random, pos.above(), null);
|
||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -110,7 +112,7 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getCeilFeature(random);
|
||||
if (feature != null) {
|
||||
feature.place(world, null, random, pos.below(), null);
|
||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
package ru.betterend.world.features.terrain.caves;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -17,9 +11,9 @@ import net.minecraft.world.level.biome.Biome;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap.Types;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -29,6 +23,11 @@ import ru.betterend.noise.OpenSimplexNoise;
|
|||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class TunelCaveFeature extends EndCaveFeature {
|
||||
private Set<BlockPos> generate(WorldGenLevel world, BlockPos center, Random random) {
|
||||
int cx = center.getX() >> 4;
|
||||
|
@ -107,7 +106,10 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (pos.getX() * pos.getX() + pos.getZ() * pos.getZ() <= 2500) {
|
||||
return false;
|
||||
}
|
||||
|
@ -189,7 +191,7 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getFloorFeature(random);
|
||||
if (feature != null) {
|
||||
feature.place(world, null, random, pos.above(), null);
|
||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.above(), null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -206,7 +208,7 @@ public class TunelCaveFeature extends EndCaveFeature {
|
|||
if (density > 0 && random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getCeilFeature(random);
|
||||
if (feature != null) {
|
||||
feature.place(world, null, random, pos.below(), null);
|
||||
feature.place(new FeaturePlaceContext<>(world, null, random, pos.below(), null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -42,9 +43,11 @@ public class DragonTreeFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> ROOT;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
float size = MHelper.randRange(10, 25, random);
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.util.Mth;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -33,9 +34,11 @@ public class GiganticAmaranitaFeature extends DefaultFeature {
|
|||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
float size = MHelper.randRange(5, 10, random);
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.util.Mth;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -34,9 +35,11 @@ public class HelixTreeFeature extends DefaultFeature {
|
|||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
BlocksHelper.setWithoutUpdate(world, pos, AIR);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.util.Mth;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -33,9 +34,11 @@ public class JellyshroomFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> ROOT;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
BlockState bark = EndBlocks.JELLYSHROOM.bark.defaultBlockState();
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -35,8 +36,10 @@ public class LacugroveFeature extends DefaultFeature {
|
|||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -1,30 +1,21 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.blocks.BlockProperties;
|
||||
import ru.bclib.blocks.BlockProperties.TripleShape;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.SDFDisplacement;
|
||||
import ru.bclib.sdf.operator.SDFScale;
|
||||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.operator.SDFSubtraction;
|
||||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.operator.*;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -34,6 +25,10 @@ import ru.betterend.blocks.basis.FurBlock;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class LucerniaFeature extends DefaultFeature {
|
||||
private static final Direction[] DIRECTIONS = Direction.values();
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
@ -42,9 +37,12 @@ public class LucerniaFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> ROOT;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
final NoneFeatureConfiguration config = featureConfig.config();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
float size = MHelper.randRange(12, 20, random);
|
||||
|
|
|
@ -1,29 +1,16 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.SDFBinary;
|
||||
import ru.bclib.sdf.operator.SDFCoordModify;
|
||||
import ru.bclib.sdf.operator.SDFFlatWave;
|
||||
import ru.bclib.sdf.operator.SDFScale;
|
||||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.operator.SDFSmoothUnion;
|
||||
import ru.bclib.sdf.operator.SDFSubtraction;
|
||||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.operator.SDFUnion;
|
||||
import ru.bclib.sdf.operator.*;
|
||||
import ru.bclib.sdf.primitive.SDFCappedCone;
|
||||
import ru.bclib.sdf.primitive.SDFPrimitive;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
|
@ -36,6 +23,10 @@ import ru.betterend.blocks.basis.FurBlock;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class MossyGlowshroomFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private static final Vector3f CENTER = new Vector3f();
|
||||
|
@ -49,8 +40,10 @@ public class MossyGlowshroomFeature extends DefaultFeature {
|
|||
private static final SDFPrimitive ROOTS;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos blockPos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
BlockState down = world.getBlockState(blockPos.below());
|
||||
if (!down.is(EndBlocks.END_MYCELIUM) && !down.is(EndBlocks.END_MOSS))
|
||||
return false;
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -30,13 +25,20 @@ import ru.bclib.world.features.DefaultFeature;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class PythadendronTreeFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private static final Function<BlockState, Boolean> IGNORE;
|
||||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (world.getBlockState(pos.below()).getBlock() != EndBlocks.CHORUS_NYLIUM) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,30 +1,21 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.blocks.BlockProperties;
|
||||
import ru.bclib.blocks.BlockProperties.TripleShape;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.SDFDisplacement;
|
||||
import ru.bclib.sdf.operator.SDFScale;
|
||||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.operator.SDFSubtraction;
|
||||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.operator.*;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -34,6 +25,10 @@ import ru.betterend.blocks.basis.FurBlock;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class TenaneaFeature extends DefaultFeature {
|
||||
private static final Direction[] DIRECTIONS = Direction.values();
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
|
@ -41,9 +36,11 @@ public class TenaneaFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> SPLINE;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
float size = MHelper.randRange(7, 10, random);
|
||||
|
|
|
@ -1,30 +1,19 @@
|
|||
package ru.betterend.world.features.trees;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.sdf.SDF;
|
||||
import ru.bclib.sdf.operator.SDFFlatWave;
|
||||
import ru.bclib.sdf.operator.SDFScale;
|
||||
import ru.bclib.sdf.operator.SDFScale3D;
|
||||
import ru.bclib.sdf.operator.SDFSmoothUnion;
|
||||
import ru.bclib.sdf.operator.SDFSubtraction;
|
||||
import ru.bclib.sdf.operator.SDFTranslate;
|
||||
import ru.bclib.sdf.operator.SDFUnion;
|
||||
import ru.bclib.sdf.operator.*;
|
||||
import ru.bclib.sdf.primitive.SDFSphere;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -34,15 +23,22 @@ import ru.betterend.blocks.UmbrellaTreeClusterBlock;
|
|||
import ru.betterend.blocks.UmbrellaTreeMembraneBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class UmbrellaTreeFeature extends DefaultFeature {
|
||||
private static final Function<BlockState, Boolean> REPLACE;
|
||||
private static final List<Vector3f> SPLINE;
|
||||
private static final List<Vector3f> ROOT;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
final Random random = featureConfig.random();
|
||||
final BlockPos pos = featureConfig.origin();
|
||||
final WorldGenLevel world = featureConfig.level();
|
||||
final NoneFeatureConfiguration config = featureConfig.config();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
BlockState wood = EndBlocks.UMBRELLA_TREE.bark.defaultBlockState();
|
||||
|
|
|
@ -33,7 +33,7 @@ public class CavePiece extends BasePiece {
|
|||
makeBoundingBox();
|
||||
}
|
||||
|
||||
public CavePiece(StructureManager manager, CompoundTag tag) {
|
||||
public CavePiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(EndStructures.CAVE_PIECE, tag);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Random;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
|
@ -32,8 +33,8 @@ public class CrystalMountainPiece extends MountainPiece {
|
|||
top = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||
}
|
||||
|
||||
public CrystalMountainPiece(StructureManager manager, CompoundTag tag) {
|
||||
super(EndStructures.MOUNTAIN_PIECE, manager, tag);
|
||||
public CrystalMountainPiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(EndStructures.MOUNTAIN_PIECE, serverLevel, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,7 +59,7 @@ public class LakePiece extends BasePiece {
|
|||
makeBoundingBox();
|
||||
}
|
||||
|
||||
public LakePiece(StructureManager manager, CompoundTag tag) {
|
||||
public LakePiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(EndStructures.LAKE_PIECE, tag);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public abstract class MountainPiece extends BasePiece {
|
|||
makeBoundingBox();
|
||||
}
|
||||
|
||||
public MountainPiece(StructurePieceType type, StructureManager manager, CompoundTag tag) {
|
||||
public MountainPiece(StructurePieceType type, ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(type, tag);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
@ -130,9 +130,11 @@ public abstract class MountainPiece extends BasePiece {
|
|||
|
||||
private void makeBoundingBox() {
|
||||
int minX = MHelper.floor(center.getX() - radius);
|
||||
int minY = MHelper.floor(center.getY() - radius);
|
||||
int minZ = MHelper.floor(center.getZ() - radius);
|
||||
int maxX = MHelper.floor(center.getX() + radius + 1);
|
||||
int maxY = MHelper.floor(center.getY() + radius + 1);
|
||||
int maxZ = MHelper.floor(center.getZ() + radius + 1);
|
||||
this.boundingBox = new BoundingBox(minX, minZ, maxX, maxZ);
|
||||
this.boundingBox = new BoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class NBTPiece extends BasePiece {
|
|||
makeBoundingBox();
|
||||
}
|
||||
|
||||
public NBTPiece(StructureManager manager, CompoundTag tag) {
|
||||
public NBTPiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(EndStructures.NBT_PIECE, tag);
|
||||
makeBoundingBox();
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ public class PaintedMountainPiece extends MountainPiece {
|
|||
this.slises = slises;
|
||||
}
|
||||
|
||||
public PaintedMountainPiece(StructureManager manager, CompoundTag tag) {
|
||||
super(EndStructures.PAINTED_MOUNTAIN_PIECE, manager, tag);
|
||||
public PaintedMountainPiece(ServerLevel serverLevel, CompoundTag tag) {
|
||||
super(EndStructures.PAINTED_MOUNTAIN_PIECE, serverLevel, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,13 +25,13 @@ public class VoxelPiece extends BasePiece {
|
|||
this.boundingBox = world.getBounds();
|
||||
}
|
||||
|
||||
public VoxelPiece(StructureManager manager, CompoundTag tag) {
|
||||
public VoxelPiece(ServerLevel level, CompoundTag tag) {
|
||||
super(EndStructures.VOXEL_PIECE, tag);
|
||||
this.boundingBox = world.getBounds();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag compoundTag) {
|
||||
protected void addAdditionalSaveData(ServerLevel serverLevel, CompoundTag tag) {
|
||||
tag.put("world", world.toBNT());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue