Chorus forest slimes & math fixes
This commit is contained in:
parent
56d7a2b7c3
commit
e09d1d2235
7 changed files with 14 additions and 6 deletions
|
@ -190,6 +190,10 @@ public class EntityEndSlime extends SlimeEntity {
|
||||||
return this.dataTracker.get(VARIANT) == 3;
|
return this.dataTracker.get(VARIANT) == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isChorus() {
|
||||||
|
return this.dataTracker.get(VARIANT) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean canSpawn(EntityType<EntityEndSlime> type, ServerWorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) {
|
public static boolean canSpawn(EntityType<EntityEndSlime> type, ServerWorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) {
|
||||||
return random.nextInt(64) == 0 || isPermanentBiome(world, pos) || (notManyEntities(world, pos, 32, 3) && isWaterNear(world, pos, 32, 8));
|
return random.nextInt(64) == 0 || isPermanentBiome(world, pos) || (notManyEntities(world, pos, 32, 3) && isWaterNear(world, pos, 32, 8));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.render.entity.model.CompositeEntityModel;
|
import net.minecraft.client.render.entity.model.CompositeEntityModel;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import ru.betterend.entity.EntityEndSlime;
|
import ru.betterend.entity.EntityEndSlime;
|
||||||
|
import ru.betterend.util.MHelper;
|
||||||
|
|
||||||
public class EndSlimeEntityModel<T extends EntityEndSlime> extends CompositeEntityModel<T> {
|
public class EndSlimeEntityModel<T extends EntityEndSlime> extends CompositeEntityModel<T> {
|
||||||
private final ModelPart flower;
|
private final ModelPart flower;
|
||||||
|
@ -39,7 +40,7 @@ public class EndSlimeEntityModel<T extends EntityEndSlime> extends CompositeEnti
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
ModelPart petalRot = new ModelPart(this);
|
ModelPart petalRot = new ModelPart(this);
|
||||||
petalRot.yaw = i * 45F;
|
petalRot.yaw = MHelper.degreesToRadians(i * 45F);
|
||||||
|
|
||||||
ModelPart petal = new ModelPart(this, 40, 0);
|
ModelPart petal = new ModelPart(this, 40, 0);
|
||||||
petal.setPivot(-4, 8, 0);
|
petal.setPivot(-4, 8, 0);
|
||||||
|
@ -51,7 +52,7 @@ public class EndSlimeEntityModel<T extends EntityEndSlime> extends CompositeEnti
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
ModelPart petalRot = new ModelPart(this);
|
ModelPart petalRot = new ModelPart(this);
|
||||||
petalRot.yaw = i * 90F + 45F;
|
petalRot.yaw = MHelper.degreesToRadians(i * 90F + 45F);
|
||||||
|
|
||||||
ModelPart petal = new ModelPart(this, 40, 0);
|
ModelPart petal = new ModelPart(this, 40, 0);
|
||||||
petal.setPivot(-4, 8, 0);
|
petal.setPivot(-4, 8, 0);
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class RendererEntityEndSlime extends MobEntityRenderer<EntityEndSlime, En
|
||||||
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityCutout(this.getTexture(livingEntity)));
|
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityCutout(this.getTexture(livingEntity)));
|
||||||
this.getContextModel().renderFlower(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlay(livingEntity, 0.0F));
|
this.getContextModel().renderFlower(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlay(livingEntity, 0.0F));
|
||||||
}
|
}
|
||||||
else if (livingEntity.isAmber()) {
|
else if (livingEntity.isAmber() || livingEntity.isChorus()) {
|
||||||
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityCutout(this.getTexture(livingEntity)));
|
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityCutout(this.getTexture(livingEntity)));
|
||||||
this.getContextModel().renderCrop(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlay(livingEntity, 0.0F));
|
this.getContextModel().renderCrop(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlay(livingEntity, 0.0F));
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,6 @@ public class EndFeatures {
|
||||||
|
|
||||||
// Wall Plants //
|
// Wall Plants //
|
||||||
public static final EndFeature PURPLE_POLYPORE = new EndFeature("purple_polypore", new WallPlantOnLogFeature(EndBlocks.PURPLE_POLYPORE, 3), 5);
|
public static final EndFeature PURPLE_POLYPORE = new EndFeature("purple_polypore", new WallPlantOnLogFeature(EndBlocks.PURPLE_POLYPORE, 3), 5);
|
||||||
public static final EndFeature PURPLE_POLYPORE_DENSE = new EndFeature("purple_polypore_dense", new WallPlantOnLogFeature(EndBlocks.PURPLE_POLYPORE, 5), 15);
|
|
||||||
public static final EndFeature TAIL_MOSS = new EndFeature("tail_moss", new WallPlantFeature(EndBlocks.TAIL_MOSS, 3), 15);
|
public static final EndFeature TAIL_MOSS = new EndFeature("tail_moss", new WallPlantFeature(EndBlocks.TAIL_MOSS, 3), 15);
|
||||||
public static final EndFeature CYAN_MOSS = new EndFeature("cyan_moss", new WallPlantFeature(EndBlocks.CYAN_MOSS, 3), 15);
|
public static final EndFeature CYAN_MOSS = new EndFeature("cyan_moss", new WallPlantFeature(EndBlocks.CYAN_MOSS, 3), 15);
|
||||||
public static final EndFeature TAIL_MOSS_WOOD = new EndFeature("tail_moss_wood", new WallPlantOnLogFeature(EndBlocks.TAIL_MOSS, 4), 25);
|
public static final EndFeature TAIL_MOSS_WOOD = new EndFeature("tail_moss_wood", new WallPlantOnLogFeature(EndBlocks.TAIL_MOSS, 4), 25);
|
||||||
|
|
|
@ -297,10 +297,14 @@ public class MHelper {
|
||||||
return new Vec3d(hue, saturation, brightness);
|
return new Vec3d(hue, saturation, brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final float radiandToDegrees(float value) {
|
public static final float radiansToDegrees(float value) {
|
||||||
return value * RAD_TO_DEG;
|
return value * RAD_TO_DEG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final float degreesToRadians(float value) {
|
||||||
|
return value / RAD_TO_DEG;
|
||||||
|
}
|
||||||
|
|
||||||
public static Vector3f cross(Vector3f vec1, Vector3f vec2)
|
public static Vector3f cross(Vector3f vec1, Vector3f vec2)
|
||||||
{
|
{
|
||||||
float cx = vec1.getY() * vec2.getZ() - vec1.getZ() * vec2.getY();
|
float cx = vec1.getY() * vec2.getZ() - vec1.getZ() * vec2.getY();
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class BiomeChorusForest extends EndBiome {
|
||||||
.addFeature(EndFeatures.END_LAKE_RARE)
|
.addFeature(EndFeatures.END_LAKE_RARE)
|
||||||
.addFeature(EndFeatures.PYTHADENDRON_TREE)
|
.addFeature(EndFeatures.PYTHADENDRON_TREE)
|
||||||
.addFeature(EndFeatures.PYTHADENDRON_BUSH)
|
.addFeature(EndFeatures.PYTHADENDRON_BUSH)
|
||||||
.addFeature(EndFeatures.PURPLE_POLYPORE_DENSE)
|
.addFeature(EndFeatures.PURPLE_POLYPORE)
|
||||||
.addFeature(Feature.VEGETAL_DECORATION, ConfiguredFeatures.CHORUS_PLANT)
|
.addFeature(Feature.VEGETAL_DECORATION, ConfiguredFeatures.CHORUS_PLANT)
|
||||||
.addFeature(Feature.VEGETAL_DECORATION, ConfiguredFeatures.CHORUS_PLANT)
|
.addFeature(Feature.VEGETAL_DECORATION, ConfiguredFeatures.CHORUS_PLANT)
|
||||||
.addFeature(EndFeatures.CHORUS_GRASS)
|
.addFeature(EndFeatures.CHORUS_GRASS)
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 4.9 KiB |
Loading…
Add table
Add a link
Reference in a new issue