Code style changes, entities fixes
This commit is contained in:
parent
9d604b2d25
commit
44962e18b6
377 changed files with 5038 additions and 4914 deletions
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
|
||||
|
@ -35,6 +32,9 @@ import ru.bclib.api.BiomeAPI;
|
|||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndItems;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class CubozoaEntity extends AbstractSchoolingFish {
|
||||
public static final int VARIANTS = 2;
|
||||
private static final EntityDataAccessor<Byte> VARIANT = SynchedEntityData.defineId(CubozoaEntity.class, EntityDataSerializers.BYTE);
|
||||
|
@ -47,11 +47,11 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
|||
@Override
|
||||
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
|
||||
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
|
||||
|
||||
|
||||
if (BiomeAPI.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
|
||||
this.entityData.set(VARIANT, (byte) 1);
|
||||
}
|
||||
|
||||
|
||||
if (entityTag != null) {
|
||||
if (entityTag.contains("Variant")) {
|
||||
this.entityData.set(VARIANT, entityTag.getByte("Variant"));
|
||||
|
@ -60,7 +60,7 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
|||
this.entityData.set(SCALE, entityTag.getByte("Scale"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.refreshDimensions();
|
||||
return data;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
|||
this.entityData.set(SCALE, tag.getByte("Scale"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getBucketItemStack() {
|
||||
ItemStack bucket = EndItems.BUCKET_CUBOZOA.getDefaultInstance();
|
||||
|
@ -109,7 +109,7 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
|||
public int getVariant() {
|
||||
return (int) this.entityData.get(VARIANT);
|
||||
}
|
||||
|
||||
|
||||
public byte getByteScale() {
|
||||
return this.entityData.get(SCALE);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
|||
protected float getStandingEyeHeight(Pose pose, EntityDimensions dimensions) {
|
||||
return dimensions.height * 0.5F;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void dropFromLootTable(DamageSource source, boolean causedByPlayer) {
|
||||
int count = random.nextInt(3);
|
||||
|
@ -143,7 +143,7 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
|||
protected SoundEvent getFlopSound() {
|
||||
return SoundEvents.SALMON_FLOP;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void playerTouch(Player player) {
|
||||
if (player instanceof ServerPlayer && player.hurt(DamageSource.mobAttack(this), 0.5F)) {
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package ru.betterend.entity;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.*;
|
||||
import net.minecraft.world.entity.AgeableMob;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
|
||||
|
@ -36,6 +38,9 @@ import ru.bclib.util.MHelper;
|
|||
import ru.betterend.registry.EndEntities;
|
||||
import ru.betterend.registry.EndSounds;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
public class DragonflyEntity extends Animal implements FlyingAnimal {
|
||||
public DragonflyEntity(EntityType<DragonflyEntity> entityType, Level world) {
|
||||
super(entityType, world);
|
||||
|
@ -53,7 +58,7 @@ public class DragonflyEntity extends Animal implements FlyingAnimal {
|
|||
.add(Attributes.FLYING_SPEED, 1.0D)
|
||||
.add(Attributes.MOVEMENT_SPEED, 0.1D);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canBeLeashed(Player player) {
|
||||
return false;
|
||||
|
@ -158,7 +163,8 @@ public class DragonflyEntity extends Animal implements FlyingAnimal {
|
|||
DragonflyEntity.this.navigation.moveTo(path, 1.0D);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
super.start();
|
||||
}
|
||||
|
@ -195,7 +201,7 @@ public class DragonflyEntity extends Animal implements FlyingAnimal {
|
|||
public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) {
|
||||
return EndEntities.DRAGONFLY.create(world);
|
||||
}
|
||||
|
||||
|
||||
public static boolean canSpawn(EntityType<DragonflyEntity> type, ServerLevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
|
||||
int y = world.getChunk(pos).getHeight(Types.WORLD_SURFACE, pos.getX() & 15, pos.getY() & 15);
|
||||
return y > 0 && pos.getY() >= y;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -30,25 +27,28 @@ import ru.bclib.api.BiomeAPI;
|
|||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndItems;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class EndFishEntity extends AbstractSchoolingFish {
|
||||
public static final int VARIANTS_NORMAL = 5;
|
||||
public static final int VARIANTS_SULPHUR = 3;
|
||||
public static final int VARIANTS = VARIANTS_NORMAL + VARIANTS_SULPHUR;
|
||||
private static final EntityDataAccessor<Byte> VARIANT = SynchedEntityData.defineId(EndFishEntity.class, EntityDataSerializers.BYTE);
|
||||
private static final EntityDataAccessor<Byte> SCALE = SynchedEntityData.defineId(EndFishEntity.class, EntityDataSerializers.BYTE);
|
||||
|
||||
|
||||
public EndFishEntity(EntityType<EndFishEntity> entityType, Level world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
|
||||
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
|
||||
|
||||
|
||||
if (BiomeAPI.getFromBiome(world.getBiome(blockPosition())) == EndBiomes.SULPHUR_SPRINGS) {
|
||||
this.entityData.set(VARIANT, (byte) (random.nextInt(VARIANTS_SULPHUR) + VARIANTS_NORMAL));
|
||||
}
|
||||
|
||||
|
||||
if (entityTag != null) {
|
||||
if (entityTag.contains("Variant")) {
|
||||
this.entityData.set(VARIANT, entityTag.getByte("variant"));
|
||||
|
@ -57,18 +57,18 @@ public class EndFishEntity extends AbstractSchoolingFish {
|
|||
this.entityData.set(SCALE, entityTag.getByte("scale"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.refreshDimensions();
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData() {
|
||||
super.defineSynchedData();
|
||||
this.entityData.define(VARIANT, (byte) this.getRandom().nextInt(VARIANTS_NORMAL));
|
||||
this.entityData.define(SCALE, (byte) this.getRandom().nextInt(16));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag tag) {
|
||||
super.addAdditionalSaveData(tag);
|
||||
|
@ -115,7 +115,7 @@ public class EndFishEntity extends AbstractSchoolingFish {
|
|||
protected SoundEvent getHurtSound(DamageSource source) {
|
||||
return SoundEvents.SALMON_HURT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
@ -126,32 +126,34 @@ public class EndFishEntity extends AbstractSchoolingFish {
|
|||
level.addParticle(ParticleTypes.BUBBLE, x, y, z, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static AttributeSupplier.Builder createMobAttributes() {
|
||||
return LivingEntity.createLivingAttributes()
|
||||
.add(Attributes.MAX_HEALTH, 2.0)
|
||||
.add(Attributes.FOLLOW_RANGE, 16.0)
|
||||
.add(Attributes.MOVEMENT_SPEED, 0.75);
|
||||
}
|
||||
|
||||
|
||||
public int getVariant() {
|
||||
return (int) this.entityData.get(VARIANT);
|
||||
}
|
||||
|
||||
|
||||
public byte getByteScale() {
|
||||
return this.entityData.get(SCALE);
|
||||
}
|
||||
|
||||
|
||||
public float getScale() {
|
||||
return getByteScale() / 32F + 0.75F;
|
||||
}
|
||||
|
||||
|
||||
public static boolean canSpawn(EntityType<EndFishEntity> type, ServerLevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
|
||||
AABB box = new AABB(pos).inflate(16);
|
||||
List<EndFishEntity> list = world.getEntitiesOfClass(EndFishEntity.class, box, (entity) -> { return true; });
|
||||
List<EndFishEntity> list = world.getEntitiesOfClass(EndFishEntity.class, box, (entity) -> {
|
||||
return true;
|
||||
});
|
||||
return list.size() < 9;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void dropFromLootTable(DamageSource source, boolean causedByPlayer) {
|
||||
ItemEntity drop = new ItemEntity(level, getX(), getY(), getZ(), new ItemStack(EndItems.END_FISH_RAW));
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package ru.betterend.entity;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
|
@ -45,15 +41,19 @@ import ru.bclib.world.biomes.BCLBiome;
|
|||
import ru.betterend.interfaces.ISlime;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class EndSlimeEntity extends Slime {
|
||||
private static final EntityDataAccessor<Byte> VARIANT = SynchedEntityData.defineId(EndSlimeEntity.class, EntityDataSerializers.BYTE);
|
||||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
||||
|
||||
public EndSlimeEntity(EntityType<EndSlimeEntity> entityType, Level world) {
|
||||
super(entityType, world);
|
||||
this.moveControl = new EndSlimeMoveControl(this);
|
||||
}
|
||||
|
||||
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(1, new SwimmingGoal());
|
||||
this.goalSelector.addGoal(2, new FaceTowardTargetGoal());
|
||||
|
@ -64,7 +64,7 @@ public class EndSlimeEntity extends Slime {
|
|||
}));
|
||||
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<IronGolem>(this, IronGolem.class, true));
|
||||
}
|
||||
|
||||
|
||||
public static AttributeSupplier.Builder createMobAttributes() {
|
||||
return LivingEntity.createLivingAttributes()
|
||||
.add(Attributes.MAX_HEALTH, 1.0D)
|
||||
|
@ -72,7 +72,7 @@ public class EndSlimeEntity extends Slime {
|
|||
.add(Attributes.FOLLOW_RANGE, 16.0D)
|
||||
.add(Attributes.MOVEMENT_SPEED, 0.15D);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData, CompoundTag entityTag) {
|
||||
SpawnGroupData data = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag);
|
||||
|
@ -95,7 +95,7 @@ public class EndSlimeEntity extends Slime {
|
|||
super.defineSynchedData();
|
||||
this.entityData.define(VARIANT, (byte) 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag tag) {
|
||||
super.addAdditionalSaveData(tag);
|
||||
|
@ -114,7 +114,7 @@ public class EndSlimeEntity extends Slime {
|
|||
protected ParticleOptions getParticleType() {
|
||||
return ParticleTypes.PORTAL;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void remove(RemovalReason reason) {
|
||||
int i = this.getSize();
|
||||
|
@ -125,7 +125,7 @@ public class EndSlimeEntity extends Slime {
|
|||
int j = i / 2;
|
||||
int k = 2 + this.random.nextInt(3);
|
||||
int type = this.getSlimeType();
|
||||
|
||||
|
||||
for (int l = 0; l < k; ++l) {
|
||||
float g = ((float) (l % 2) - 0.5F) * f;
|
||||
float h = ((float) (l / 2) - 0.5F) * f;
|
||||
|
@ -145,9 +145,9 @@ public class EndSlimeEntity extends Slime {
|
|||
}
|
||||
}
|
||||
|
||||
((ISlime)this).entityRemove(reason);
|
||||
((ISlime) this).entityRemove(reason);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void dropFromLootTable(DamageSource source, boolean causedByPlayer) {
|
||||
int maxCount = this.getSize();
|
||||
|
@ -163,15 +163,15 @@ public class EndSlimeEntity extends Slime {
|
|||
ItemEntity drop = new ItemEntity(level, getX(), getY(), getZ(), new ItemStack(Items.SLIME_BALL, count));
|
||||
this.level.addFreshEntity(drop);
|
||||
}
|
||||
|
||||
|
||||
public int getSlimeType() {
|
||||
return this.entityData.get(VARIANT).intValue();
|
||||
}
|
||||
|
||||
|
||||
public void setSlimeType(int value) {
|
||||
this.entityData.set(VARIANT, (byte) value);
|
||||
}
|
||||
|
||||
|
||||
protected void setMossy() {
|
||||
setSlimeType(1);
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class EndSlimeEntity extends Slime {
|
|||
public boolean isMossy() {
|
||||
return getSlimeType() == 1;
|
||||
}
|
||||
|
||||
|
||||
protected void setLake() {
|
||||
setSlimeType(2);
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ public class EndSlimeEntity extends Slime {
|
|||
public boolean isLake() {
|
||||
return getSlimeType() == 2;
|
||||
}
|
||||
|
||||
|
||||
protected void setAmber(boolean mossy) {
|
||||
this.entityData.set(VARIANT, (byte) 3);
|
||||
}
|
||||
|
@ -195,26 +195,28 @@ public class EndSlimeEntity extends Slime {
|
|||
public boolean isAmber() {
|
||||
return this.entityData.get(VARIANT) == 3;
|
||||
}
|
||||
|
||||
|
||||
public boolean isChorus() {
|
||||
return this.entityData.get(VARIANT) == 0;
|
||||
}
|
||||
|
||||
|
||||
public static boolean canSpawn(EntityType<EndSlimeEntity> type, ServerLevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
|
||||
return random.nextInt(16) == 0 || isPermanentBiome(world, pos) || (notManyEntities(world, pos, 32, 3) && isWaterNear(world, pos, 32, 8));
|
||||
}
|
||||
|
||||
|
||||
private static boolean isPermanentBiome(ServerLevelAccessor world, BlockPos pos) {
|
||||
Biome biome = world.getBiome(pos);
|
||||
return BiomeAPI.getFromBiome(biome) == EndBiomes.CHORUS_FOREST;
|
||||
}
|
||||
|
||||
|
||||
private static boolean notManyEntities(ServerLevelAccessor world, BlockPos pos, int radius, int maxCount) {
|
||||
AABB box = new AABB(pos).inflate(radius);
|
||||
List<EndSlimeEntity> list = world.getEntitiesOfClass(EndSlimeEntity.class, box, (entity) -> { return true; });
|
||||
List<EndSlimeEntity> list = world.getEntitiesOfClass(EndSlimeEntity.class, box, (entity) -> {
|
||||
return true;
|
||||
});
|
||||
return list.size() <= maxCount;
|
||||
}
|
||||
|
||||
|
||||
private static boolean isWaterNear(ServerLevelAccessor world, BlockPos pos, int radius, int radius2) {
|
||||
for (int x = pos.getX() - radius; x <= pos.getX() + radius; x++) {
|
||||
POS.setX(x);
|
||||
|
@ -230,7 +232,7 @@ public class EndSlimeEntity extends Slime {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
class MoveGoal extends Goal {
|
||||
public MoveGoal() {
|
||||
this.setFlags(EnumSet.of(Goal.Flag.JUMP, Goal.Flag.MOVE));
|
||||
|
@ -240,7 +242,7 @@ public class EndSlimeEntity extends Slime {
|
|||
if (EndSlimeEntity.this.isPassenger()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
float yaw = EndSlimeEntity.this.getYHeadRot();
|
||||
float speed = EndSlimeEntity.this.getSpeed();
|
||||
if (speed > 0.1) {
|
||||
|
@ -250,7 +252,7 @@ public class EndSlimeEntity extends Slime {
|
|||
int down = BlocksHelper.downRay(EndSlimeEntity.this.level, pos, 16);
|
||||
return down < 5;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -291,9 +293,9 @@ public class EndSlimeEntity extends Slime {
|
|||
public boolean canUse() {
|
||||
return EndSlimeEntity.this.getTarget() == null
|
||||
&& (EndSlimeEntity.this.onGround
|
||||
|| EndSlimeEntity.this.isInWater()
|
||||
|| EndSlimeEntity.this.isInLava()
|
||||
|| EndSlimeEntity.this.hasEffect(MobEffects.LEVITATION))
|
||||
|| EndSlimeEntity.this.isInWater()
|
||||
|| EndSlimeEntity.this.isInLava()
|
||||
|| EndSlimeEntity.this.hasEffect(MobEffects.LEVITATION))
|
||||
&& EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package ru.betterend.entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
|
@ -29,11 +26,14 @@ import net.minecraft.world.phys.AABB;
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.registry.EndSounds;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class ShadowWalkerEntity extends Monster {
|
||||
public ShadowWalkerEntity(EntityType<ShadowWalkerEntity> entityType, Level world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(2, new AttackGoal(this, 1.0D, false));
|
||||
|
@ -51,7 +51,7 @@ public class ShadowWalkerEntity extends Monster {
|
|||
.add(Attributes.ARMOR, 2.0)
|
||||
.add(Attributes.SPAWN_REINFORCEMENTS_CHANCE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
@ -71,7 +71,7 @@ public class ShadowWalkerEntity extends Monster {
|
|||
getZ() + random.nextGaussian() * 0.2,
|
||||
0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound() {
|
||||
return EndSounds.ENTITY_SHADOW_WALKER;
|
||||
|
@ -88,18 +88,19 @@ public class ShadowWalkerEntity extends Monster {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void playStepSound(BlockPos pos, BlockState state) {}
|
||||
|
||||
protected void playStepSound(BlockPos pos, BlockState state) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getSoundVolume() {
|
||||
return MHelper.randRange(0.25F, 0.5F, random);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getVoicePitch() {
|
||||
return MHelper.randRange(0.75F, 1.25F, random);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean doHurtTarget(Entity target) {
|
||||
boolean attack = super.doHurtTarget(target);
|
||||
|
@ -111,24 +112,26 @@ public class ShadowWalkerEntity extends Monster {
|
|||
}
|
||||
return attack;
|
||||
}
|
||||
|
||||
|
||||
public static boolean canSpawn(EntityType<ShadowWalkerEntity> type, ServerLevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
|
||||
if (Monster.checkMonsterSpawnRules(type, world, spawnReason, pos, random)) {
|
||||
AABB box = new AABB(pos).inflate(16);
|
||||
List<ShadowWalkerEntity> entities = world.getEntitiesOfClass(ShadowWalkerEntity.class, box, (entity) -> { return true; });
|
||||
List<ShadowWalkerEntity> entities = world.getEntitiesOfClass(ShadowWalkerEntity.class, box, (entity) -> {
|
||||
return true;
|
||||
});
|
||||
return entities.size() < 6;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private final class AttackGoal extends MeleeAttackGoal {
|
||||
private final ShadowWalkerEntity walker;
|
||||
private int ticks;
|
||||
|
||||
public AttackGoal(ShadowWalkerEntity walker, double speed, boolean pauseWhenMobIdle) {
|
||||
super(walker, speed, pauseWhenMobIdle);
|
||||
this.walker = walker;
|
||||
}
|
||||
super(walker, speed, pauseWhenMobIdle);
|
||||
this.walker = walker;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
super.start();
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
package ru.betterend.entity;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.entity.*;
|
||||
import net.minecraft.world.entity.ai.util.AirAndWaterRandomPos;
|
||||
import net.minecraft.world.entity.ai.util.HoverRandomPos;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -19,6 +10,12 @@ import net.minecraft.server.level.ServerLevel;
|
|||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.AgeableMob;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
|
||||
|
@ -29,7 +26,8 @@ import net.minecraft.world.entity.ai.goal.FollowParentGoal;
|
|||
import net.minecraft.world.entity.ai.goal.Goal;
|
||||
import net.minecraft.world.entity.ai.navigation.FlyingPathNavigation;
|
||||
import net.minecraft.world.entity.ai.navigation.PathNavigation;
|
||||
import net.minecraft.world.entity.ai.util.RandomPos;
|
||||
import net.minecraft.world.entity.ai.util.AirAndWaterRandomPos;
|
||||
import net.minecraft.world.entity.ai.util.HoverRandomPos;
|
||||
import net.minecraft.world.entity.animal.Animal;
|
||||
import net.minecraft.world.entity.animal.FlyingAnimal;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
|
@ -44,6 +42,7 @@ import net.minecraft.world.level.levelgen.Heightmap.Types;
|
|||
import net.minecraft.world.level.pathfinder.BlockPathTypes;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.BetterEnd;
|
||||
|
@ -52,11 +51,15 @@ import ru.betterend.registry.EndBlocks;
|
|||
import ru.betterend.registry.EndEntities;
|
||||
import ru.betterend.registry.EndItems;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class SilkMothEntity extends Animal implements FlyingAnimal {
|
||||
private BlockPos hivePos;
|
||||
private BlockPos entrance;
|
||||
private Level hiveWorld;
|
||||
|
||||
|
||||
public SilkMothEntity(EntityType<? extends SilkMothEntity> entityType, Level world) {
|
||||
super(entityType, world);
|
||||
this.moveControl = new FlyingMoveControl(this, 20, true);
|
||||
|
@ -65,7 +68,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, -1.0F);
|
||||
this.xpReward = 1;
|
||||
}
|
||||
|
||||
|
||||
public static AttributeSupplier.Builder createMobAttributes() {
|
||||
return LivingEntity.createLivingAttributes()
|
||||
.add(Attributes.MAX_HEALTH, 2.0D)
|
||||
|
@ -73,17 +76,17 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
.add(Attributes.FLYING_SPEED, 0.4D)
|
||||
.add(Attributes.MOVEMENT_SPEED, 0.1D);
|
||||
}
|
||||
|
||||
|
||||
public void setHive(Level world, BlockPos hive) {
|
||||
this.hivePos = hive;
|
||||
this.hiveWorld = world;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canBeLeashed(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag tag) {
|
||||
if (hivePos != null) {
|
||||
|
@ -91,7 +94,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
tag.putString("HiveWorld", hiveWorld.dimension().location().toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag tag) {
|
||||
if (tag.contains("HivePos")) {
|
||||
|
@ -115,7 +118,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
this.goalSelector.addGoal(8, new WanderAroundGoal());
|
||||
this.goalSelector.addGoal(9, new FloatGoal(this));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected PathNavigation createNavigation(Level world) {
|
||||
FlyingPathNavigation birdNavigation = new FlyingPathNavigation(this, world) {
|
||||
|
@ -163,7 +166,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) {
|
||||
return EndEntities.SILK_MOTH.create(world);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void dropFromLootTable(DamageSource source, boolean causedByPlayer) {
|
||||
int minCount = 0;
|
||||
|
@ -180,18 +183,18 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
ItemEntity drop = new ItemEntity(level, getX(), getY(), getZ(), new ItemStack(EndItems.SILK_FIBER, count));
|
||||
this.level.addFreshEntity(drop);
|
||||
}
|
||||
|
||||
|
||||
public static boolean canSpawn(EntityType<SilkMothEntity> type, ServerLevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
|
||||
int y = world.getChunk(pos).getHeight(Types.WORLD_SURFACE, pos.getX() & 15, pos.getY() & 15);
|
||||
return y > 0 && pos.getY() >= y && notManyEntities(world, pos, 32, 1);
|
||||
}
|
||||
|
||||
|
||||
private static boolean notManyEntities(ServerLevelAccessor world, BlockPos pos, int radius, int maxCount) {
|
||||
AABB box = new AABB(pos).inflate(radius);
|
||||
List<SilkMothEntity> list = world.getEntitiesOfClass(SilkMothEntity.class, box, (entity) -> true);
|
||||
return list.size() <= maxCount;
|
||||
}
|
||||
|
||||
|
||||
class MothLookControl extends LookControl {
|
||||
MothLookControl(Mob entity) {
|
||||
super(entity);
|
||||
|
@ -230,7 +233,8 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
try {
|
||||
SilkMothEntity.this.navigation.moveTo(SilkMothEntity.this.navigation.createPath(new BlockPos(vec3d), 1), 1.0D);
|
||||
}
|
||||
catch (Exception e) {}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,12 +245,12 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
return vec3d4 != null ? vec3d4 : AirAndWaterRandomPos.getPos(SilkMothEntity.this, 8, 4, -2, vec3d3.x, vec3d3.z, 1.5707963705062866D);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ReturnToHiveGoal extends Goal {
|
||||
ReturnToHiveGoal() {
|
||||
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
return SilkMothEntity.this.hivePos != null
|
||||
|
@ -255,12 +259,12 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
&& SilkMothEntity.this.random.nextInt(16) == 0
|
||||
&& SilkMothEntity.this.position().distanceToSqr(SilkMothEntity.this.hivePos.getX(), SilkMothEntity.this.hivePos.getY(), SilkMothEntity.this.hivePos.getZ()) < 64;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canContinueToUse() {
|
||||
return SilkMothEntity.this.navigation.isInProgress() && level.getBlockState(entrance).isAir() && (level.getBlockState(hivePos).is(EndBlocks.SILK_MOTH_NEST) || level.getBlockState(hivePos).is(EndBlocks.SILK_MOTH_HIVE));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
BlockState state = SilkMothEntity.this.level.getBlockState(SilkMothEntity.this.hivePos);
|
||||
|
@ -272,9 +276,10 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
SilkMothEntity.this.entrance = SilkMothEntity.this.hivePos.relative(state.getValue(BlockStateProperties.HORIZONTAL_FACING));
|
||||
SilkMothEntity.this.navigation.moveTo(SilkMothEntity.this.navigation.createPath(entrance, 1), 1.0D);
|
||||
}
|
||||
catch (Exception e) {}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
package ru.betterend.entity.model;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.client.model.EntityModel;
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public abstract class BlockBenchModel<T extends Entity> extends EntityModel<T> {
|
||||
public BlockBenchModel() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
public BlockBenchModel(Function<ResourceLocation, RenderType> function) {
|
||||
super(function);
|
||||
}
|
||||
|
||||
|
||||
protected void setRotationAngle(ModelPart modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.xRot = x;
|
||||
modelRenderer.yRot = y;
|
||||
|
|
|
@ -14,124 +14,77 @@ import net.minecraft.util.Mth;
|
|||
import ru.betterend.entity.CubozoaEntity;
|
||||
|
||||
public class CubozoaEntityModel extends BlockBenchModel<CubozoaEntity> {
|
||||
private final static int TENTACLE_COUNT = 4;
|
||||
private final static int TENTACLE_COUNT = 4;
|
||||
|
||||
private final ModelPart model;
|
||||
private final ModelPart[] tentacle_center;
|
||||
private final ModelPart[] tentacle;
|
||||
private float scaleY;
|
||||
private float scaleXZ;
|
||||
private final ModelPart model;
|
||||
private final ModelPart[] tentacle_center;
|
||||
private final ModelPart[] tentacle;
|
||||
private float scaleY;
|
||||
private float scaleXZ;
|
||||
|
||||
public static LayerDefinition getTexturedModelData() {
|
||||
MeshDefinition modelData = new MeshDefinition();
|
||||
PartDefinition modelPartData = modelData.getRoot();
|
||||
public static LayerDefinition getTexturedModelData() {
|
||||
MeshDefinition modelData = new MeshDefinition();
|
||||
PartDefinition modelPartData = modelData.getRoot();
|
||||
|
||||
PartDefinition bodyPart = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create()
|
||||
.texOffs(0, 17)
|
||||
.addBox(-2.0F, -12.5F, -2.0F, 4.0F, 4.0F, 4.0F), PartPose.offset(0.0F, 24.0F, 0.0F));
|
||||
/*model = new ModelPart(this);
|
||||
model.setPos(0.0F, 24.0F, 0.0F);
|
||||
model.texOffs(0, 17).addBox(-2.0F, -12.5F, -2.0F, 4.0F, 4.0F, 4.0F, 0.0F);*/
|
||||
PartDefinition bodyPart = modelPartData.addOrReplaceChild(PartNames.BODY,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 17)
|
||||
.addBox(-2.0F, -12.5F, -2.0F, 4.0F, 4.0F, 4.0F),
|
||||
PartPose.offset(0.0F, 24.0F, 0.0F)
|
||||
);
|
||||
|
||||
bodyPart.addOrReplaceChild("main_cube_r1", CubeListBuilder.create()
|
||||
.texOffs(0, 0)
|
||||
.addBox(-5.0F, -7.0F, -5.0F, 10.0F, 7.0F, 10.0F), PartPose.offsetAndRotation(0.0F, -14.0F, 0.0F, 0.0F, 0.0F, -3.1416F));
|
||||
bodyPart.addOrReplaceChild("main_cube_r1", CubeListBuilder.create()
|
||||
.texOffs(0, 0)
|
||||
.addBox(-5.0F, -7.0F, -5.0F, 10.0F, 7.0F, 10.0F), PartPose.offsetAndRotation(0.0F, -14.0F, 0.0F, 0.0F, 0.0F, -3.1416F));
|
||||
|
||||
/*main_cube_r1 = new ModelPart(this);
|
||||
main_cube_r1.setPos(0.0F, -14.0F, 0.0F);
|
||||
model.addChild(main_cube_r1);
|
||||
setRotationAngle(main_cube_r1, 0.0F, 0.0F, -3.1416F);
|
||||
main_cube_r1.texOffs(0, 0).addBox(-5.0F, -7.0F, -5.0F, 10.0F, 7.0F, 10.0F, 0.0F);*/
|
||||
float[] angles = {0, (float)Math.PI/-2, (float)Math.PI, (float)Math.PI/2};
|
||||
for (int i = 1; i <= TENTACLE_COUNT; i++) {
|
||||
PartDefinition tentaclePart = bodyPart
|
||||
.addOrReplaceChild("tentacle_center_" + i,
|
||||
CubeListBuilder.create(),
|
||||
PartPose.offsetAndRotation(
|
||||
0.0F, 0.0F, 0.0F,
|
||||
0.0F, i * 1.5708F, 0.0F
|
||||
)
|
||||
);
|
||||
|
||||
for (int i=1; i<=TENTACLE_COUNT; i++){
|
||||
PartDefinition tentaclePart = bodyPart
|
||||
.addOrReplaceChild("tentacle_center_"+i,
|
||||
CubeListBuilder.create(),
|
||||
PartPose.offsetAndRotation(
|
||||
0.0F, 0.0F, 0.0F,
|
||||
0.0F, -1.5708F, 0.0F
|
||||
)
|
||||
);
|
||||
tentaclePart.addOrReplaceChild("tentacle_" + i, CubeListBuilder.create()
|
||||
.texOffs(16, 17)
|
||||
.addBox(-4.0F, 0.0F, 0.0F, 8.0F, 7.0F, 0.0F),
|
||||
PartPose.offset(0.0F, -7.0F, 4.5F));
|
||||
}
|
||||
|
||||
tentaclePart.addOrReplaceChild("tentacle_"+i, CubeListBuilder.create()
|
||||
.texOffs(16, 17)
|
||||
.addBox(-4.0F, 0.0F, 0.0F, 8.0F, 7.0F, 0.0F),
|
||||
PartPose.offset(0.0F, -7.0F, 4.5F));
|
||||
}
|
||||
/*tentacle_center_1 = new ModelPart(this);
|
||||
tentacle_center_1.setPos(0.0F, 0.0F, 0.0F);
|
||||
model.addChild(tentacle_center_1);
|
||||
return LayerDefinition.create(modelData, 48, 48);
|
||||
}
|
||||
|
||||
tentacle_1 = new ModelPart(this);
|
||||
tentacle_1.setPos(0.0F, -7.0F, 4.5F);
|
||||
tentacle_center_1.addChild(tentacle_1);
|
||||
tentacle_1.texOffs(16, 17).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 7.0F, 0.0F, 0.0F);
|
||||
public CubozoaEntityModel(ModelPart modelPart) {
|
||||
super(RenderType::entityTranslucent);
|
||||
tentacle = new ModelPart[TENTACLE_COUNT];
|
||||
tentacle_center = new ModelPart[TENTACLE_COUNT];
|
||||
|
||||
tentacle_center_2 = new ModelPart(this);
|
||||
tentacle_center_2.setPos(0.0F, 0.0F, 0.0F);
|
||||
model.addChild(tentacle_center_2);
|
||||
setRotationAngle(tentacle_center_2, 0.0F, -1.5708F, 0.0F);
|
||||
model = modelPart.getChild(PartNames.BODY);
|
||||
for (int i = 1; i <= TENTACLE_COUNT; i++) {
|
||||
tentacle_center[i - 1] = model.getChild("tentacle_center_" + i);
|
||||
tentacle[i - 1] = tentacle_center[i - 1].getChild("tentacle_" + i);
|
||||
}
|
||||
}
|
||||
|
||||
tentacle_2 = new ModelPart(this);
|
||||
tentacle_2.setPos(0.0F, -7.0F, 4.5F);
|
||||
tentacle_center_2.addChild(tentacle_2);
|
||||
tentacle_2.texOffs(16, 17).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 7.0F, 0.0F, 0.0F);
|
||||
@Override
|
||||
public void setupAnim(CubozoaEntity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) {
|
||||
float sin = Mth.sin(animationProgress * 0.13F);
|
||||
scaleY = sin * 0.1F + 0.9F;
|
||||
scaleXZ = Mth.sin(animationProgress * 0.13F + 3.14F) * 0.1F + 0.9F;
|
||||
|
||||
tentacle_center_3 = new ModelPart(this);
|
||||
tentacle_center_3.setPos(0.0F, 0.0F, 0.0F);
|
||||
model.addChild(tentacle_center_3);
|
||||
setRotationAngle(tentacle_center_3, 0.0F, 3.1416F, 0.0F);
|
||||
for (int i = 0; i < TENTACLE_COUNT; i++) {
|
||||
tentacle[i].xRot = sin * 0.15f;
|
||||
}
|
||||
}
|
||||
|
||||
tentacle_3 = new ModelPart(this);
|
||||
tentacle_3.setPos(0.0F, -7.0F, 4.5F);
|
||||
tentacle_center_3.addChild(tentacle_3);
|
||||
tentacle_3.texOffs(16, 17).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 7.0F, 0.0F, 0.0F);
|
||||
|
||||
tentacle_center_4 = new ModelPart(this);
|
||||
tentacle_center_4.setPos(0.0F, 0.0F, 0.0F);
|
||||
model.addChild(tentacle_center_4);
|
||||
setRotationAngle(tentacle_center_4, 0.0F, 1.5708F, 0.0F);
|
||||
|
||||
|
||||
tentacle_4 = new ModelPart(this);
|
||||
tentacle_4.setPos(0.0F, -7.0F, 4.5F);
|
||||
tentacle_center_4.addChild(tentacle_4);
|
||||
tentacle_4.texOffs(16, 17).addBox(-4.0F, 0.0F, 0.0F, 8.0F, 7.0F, 0.0F, 0.0F);*/
|
||||
|
||||
/* texWidth = 48;
|
||||
texHeight = 48; */
|
||||
return LayerDefinition.create(modelData, 48, 48);
|
||||
}
|
||||
|
||||
public CubozoaEntityModel(ModelPart modelPart) {
|
||||
super(RenderType::entityTranslucent);
|
||||
tentacle = new ModelPart[TENTACLE_COUNT];
|
||||
tentacle_center = new ModelPart[TENTACLE_COUNT];
|
||||
|
||||
model = modelPart.getChild(PartNames.BODY);
|
||||
for (int i=1; i<=TENTACLE_COUNT; i++){
|
||||
tentacle_center[i-1] = model.getChild("tentacle_center_"+i);
|
||||
tentacle[i-1] = tentacle_center[i-1].getChild("tentacle_"+i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupAnim(CubozoaEntity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) {
|
||||
float sin = Mth.sin(animationProgress * 0.13F);
|
||||
scaleY = sin * 0.1F + 0.9F;
|
||||
scaleXZ = Mth.sin(animationProgress * 0.13F + 3.14F) * 0.1F + 0.9F;
|
||||
|
||||
for (int i=0; i<TENTACLE_COUNT; i++){
|
||||
tentacle[i].xRot = sin * 0.15f;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderToBuffer(PoseStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||
matrices.pushPose();
|
||||
matrices.scale(scaleXZ, scaleY, scaleXZ);
|
||||
model.render(matrices, vertices, light, overlay);
|
||||
matrices.popPose();
|
||||
}
|
||||
@Override
|
||||
public void renderToBuffer(PoseStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||
matrices.pushPose();
|
||||
matrices.scale(scaleXZ, scaleY, scaleXZ);
|
||||
model.render(matrices, vertices, light, overlay);
|
||||
matrices.popPose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package ru.betterend.entity.model;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.model.geom.PartNames;
|
||||
import net.minecraft.client.model.geom.PartPose;
|
||||
|
@ -14,169 +13,140 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import ru.betterend.entity.DragonflyEntity;
|
||||
|
||||
public class DragonflyEntityModel extends BlockBenchModel<DragonflyEntity> {
|
||||
private final ModelPart model;
|
||||
private final ModelPart head;
|
||||
private final ModelPart tail;
|
||||
private final ModelPart tail_2;
|
||||
private final ModelPart wing_1;
|
||||
private final ModelPart wing_2;
|
||||
private final ModelPart wing_3;
|
||||
private final ModelPart wing_4;
|
||||
private final ModelPart legs_1;
|
||||
private final ModelPart legs_2;
|
||||
private final ModelPart model;
|
||||
private final ModelPart head;
|
||||
private final ModelPart tail;
|
||||
private final ModelPart tail_2;
|
||||
private final ModelPart wing_1;
|
||||
private final ModelPart wing_2;
|
||||
private final ModelPart wing_3;
|
||||
private final ModelPart wing_4;
|
||||
private final ModelPart legs_1;
|
||||
private final ModelPart legs_2;
|
||||
|
||||
public static LayerDefinition getTexturedModelData() {
|
||||
MeshDefinition modelData = new MeshDefinition();
|
||||
PartDefinition modelPartData = modelData.getRoot();
|
||||
public static LayerDefinition getTexturedModelData() {
|
||||
MeshDefinition modelData = new MeshDefinition();
|
||||
PartDefinition modelPartData = modelData.getRoot();
|
||||
|
||||
PartDefinition bodyPart = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create()
|
||||
.texOffs(0, 0)
|
||||
.addBox(-4.0F, -4.0F, 0.0F, 4.0F, 4.0F, 9.0F),
|
||||
PartPose.offset(2.0F, 21.5F, -4.0F));
|
||||
/*model = new ModelPart(this);
|
||||
model.setPos(2.0F, 21.5F, -4.0F);
|
||||
model.texOffs(0, 0).addBox(-4.0F, -4.0F, 0.0F, 4.0F, 4.0F, 9.0F, 0.0F);*/
|
||||
PartDefinition bodyPart = modelPartData.addOrReplaceChild(PartNames.BODY,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 0)
|
||||
.addBox(-4.0F, -4.0F, 0.0F, 4.0F, 4.0F, 9.0F),
|
||||
PartPose.offset(2.0F, 21.5F, -4.0F)
|
||||
);
|
||||
|
||||
bodyPart.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create()
|
||||
.texOffs(17, 0)
|
||||
.addBox(-1.5F, -1.5F, -2.5F, 3.0F, 3.0F, 3.0F),
|
||||
PartPose.offsetAndRotation(-2.0F, -2.0F, 0.0F,
|
||||
0.3491F, 0.0F, 0.0F));
|
||||
/*head = new ModelPart(this);
|
||||
head.setPos(-2.0F, -2.0F, 0.0F);
|
||||
model.addChild(head);
|
||||
setRotationAngle(head, 0.3491F, 0.0F, 0.0F);
|
||||
head.texOffs(17, 0).addBox(-1.5F, -1.5F, -2.5F, 3.0F, 3.0F, 3.0F, 0.0F);*/
|
||||
bodyPart.addOrReplaceChild(PartNames.HEAD,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(17, 0)
|
||||
.addBox(-1.5F, -1.5F, -2.5F, 3.0F, 3.0F, 3.0F),
|
||||
PartPose.offsetAndRotation(-2.0F, -2.0F, 0.0F, 0.3491F, 0.0F, 0.0F)
|
||||
);
|
||||
|
||||
PartDefinition tailPart = bodyPart.addOrReplaceChild(PartNames.TAIL, CubeListBuilder.create()
|
||||
.texOffs(26, 0)
|
||||
.addBox(-1.5F, -1.5F, 0.0F, 3.0F, 3.0F, 7.0F),
|
||||
PartPose.offset(-2.0F, -2.0F, 9.0F));
|
||||
/*
|
||||
tail = new ModelPart(this);
|
||||
tail.setPos(-2.0F, -2.0F, 9.0F);
|
||||
model.addChild(tail);
|
||||
tail.texOffs(26, 0).addBox(-1.5F, -1.5F, 0.0F, 3.0F, 3.0F, 7.0F, 0.0F);
|
||||
*/
|
||||
PartDefinition tailPart = bodyPart.addOrReplaceChild(PartNames.TAIL,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(26, 0)
|
||||
.addBox(-1.5F, -1.5F, 0.0F, 3.0F, 3.0F, 7.0F),
|
||||
PartPose.offset(-2.0F, -2.0F, 9.0F)
|
||||
);
|
||||
|
||||
tailPart.addOrReplaceChild(PartNames.TAIL_FIN, CubeListBuilder.create()
|
||||
.texOffs(36, 0)
|
||||
.addBox(-1.0F, -1.0F, 0.0F, 2.0F, 2.0F, 10.0F),
|
||||
PartPose.offset(0.0F, 0.0F, 7.0F));
|
||||
tailPart.addOrReplaceChild(PartNames.TAIL_FIN,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(36, 0)
|
||||
.addBox(-1.0F, -1.0F, 0.0F, 2.0F, 2.0F, 10.0F),
|
||||
PartPose.offset(0.0F, 0.0F, 7.0F)
|
||||
);
|
||||
|
||||
/*
|
||||
tail_2 = new ModelPart(this);
|
||||
tail_2.setPos(0.0F, 0.0F, 7.0F);
|
||||
tail.addChild(tail_2);
|
||||
tail_2.texOffs(36, 0).addBox(-1.0F, -1.0F, 0.0F, 2.0F, 2.0F, 10.0F, 0.0F);
|
||||
*/
|
||||
bodyPart.addOrReplaceChild(PartNames.LEFT_WING,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 13)
|
||||
.addBox(-15.0F, 0.0F, -3.0F, 15.0F, 0.0F, 4.0F),
|
||||
PartPose.offset(-2.0F, -4.0F, 4.0F)
|
||||
);
|
||||
|
||||
bodyPart.addOrReplaceChild(PartNames.LEFT_WING, CubeListBuilder.create()
|
||||
.texOffs(0, 13)
|
||||
.addBox(-15.0F, 0.0F, -3.0F, 15.0F, 0.0F, 4.0F),
|
||||
PartPose.offset(-2.0F, -4.0F, 4.0F));
|
||||
bodyPart.addOrReplaceChild(PartNames.RIGHT_WING,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.mirror()
|
||||
.texOffs(0, 13)
|
||||
.addBox(0.0F, 0.0F, -3.0F, 15.0F, 0.0F, 4.0F),
|
||||
PartPose.offset(-2.0F, -4.0F, 4.0F)
|
||||
);
|
||||
|
||||
/*wing_1 = new ModelPart(this);
|
||||
wing_1.setPos(-2.0F, -4.0F, 4.0F);
|
||||
model.addChild(wing_1);
|
||||
wing_1.texOffs(0, 13).addBox(-15.0F, 0.0F, -3.0F, 15.0F, 0.0F, 4.0F, 0.0F);*/
|
||||
bodyPart.addOrReplaceChild(PartNames.LEFT_WING_BASE,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(4, 17)
|
||||
.addBox(-12.0F, 0.0F, -2.5F, 12.0F, 0.0F, 3.0F),
|
||||
PartPose.offset(-2.0F, -4.0F, 8.0F)
|
||||
);
|
||||
|
||||
bodyPart.addOrReplaceChild(PartNames.RIGHT_WING, CubeListBuilder.create()
|
||||
.mirror()
|
||||
.texOffs(0, 13)
|
||||
.addBox(0.0F, 0.0F, -3.0F, 15.0F, 0.0F, 4.0F),
|
||||
PartPose.offset(-2.0F, -4.0F, 4.0F));
|
||||
/*wing_2 = new ModelPart(this);
|
||||
wing_2.setPos(-2.0F, -4.0F, 4.0F);
|
||||
model.addChild(wing_2);
|
||||
wing_2.mirror = true;
|
||||
wing_2.texOffs(0, 13).addBox(0.0F, 0.0F, -3.0F, 15.0F, 0.0F, 4.0F, 0.0F);*/
|
||||
bodyPart.addOrReplaceChild(PartNames.RIGHT_WING_BASE,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.mirror()
|
||||
.texOffs(4, 17)
|
||||
.addBox(0.0F, 0.0F, -2.5F, 12.0F, 0.0F, 3.0F),
|
||||
PartPose.offset(-2.0F, -4.0F, 8.0F)
|
||||
);
|
||||
|
||||
bodyPart.addOrReplaceChild(PartNames.LEFT_WING_BASE, CubeListBuilder.create()
|
||||
.texOffs(4, 17)
|
||||
.addBox(-12.0F, 0.0F, -2.5F, 12.0F, 0.0F, 3.0F),
|
||||
PartPose.offset(-2.0F, -4.0F, 8.0F));
|
||||
/*wing_3 = new ModelPart(this);
|
||||
wing_3.setPos(-2.0F, -4.0F, 8.0F);
|
||||
model.addChild(wing_3);
|
||||
wing_3.texOffs(4, 17).addBox(-12.0F, 0.0F, -2.5F, 12.0F, 0.0F, 3.0F, 0.0F);*/
|
||||
bodyPart.addOrReplaceChild(PartNames.LEFT_LEG,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(50, 1)
|
||||
.addBox(0.0F, 0.0F, 0.0F, 0.0F, 3.0F, 6.0F),
|
||||
PartPose.offsetAndRotation(-1.0F, 0.0F, 1.0F, 0.0F, 0.0F, -0.5236F)
|
||||
);
|
||||
|
||||
bodyPart.addOrReplaceChild(PartNames.RIGHT_WING_BASE, CubeListBuilder.create()
|
||||
.mirror()
|
||||
.texOffs(4, 17)
|
||||
.addBox(0.0F, 0.0F, -2.5F, 12.0F, 0.0F, 3.0F),
|
||||
PartPose.offset(-2.0F, -4.0F, 8.0F));
|
||||
/*wing_4 = new ModelPart(this);
|
||||
wing_4.setPos(-2.0F, -4.0F, 8.0F);
|
||||
model.addChild(wing_4);
|
||||
wing_4.mirror = true;
|
||||
wing_4.texOffs(4, 17).addBox(0.0F, 0.0F, -2.5F, 12.0F, 0.0F, 3.0F, 0.0F);*/
|
||||
bodyPart.addOrReplaceChild(PartNames.RIGHT_LEG,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(50, 1)
|
||||
.addBox(0.0F, 0.0F, 0.0F, 0.0F, 3.0F, 6.0F),
|
||||
PartPose.offsetAndRotation(-3.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.5236F)
|
||||
);
|
||||
|
||||
bodyPart.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create()
|
||||
.texOffs(50, 1)
|
||||
.addBox(0.0F, 0.0F, 0.0F, 0.0F, 3.0F, 6.0F),
|
||||
PartPose.offsetAndRotation(-1.0F, 0.0F, 1.0F,
|
||||
0.0F, 0.0F, -0.5236F));
|
||||
/*legs_1 = new ModelPart(this);
|
||||
legs_1.setPos(-1.0F, 0.0F, 1.0F);
|
||||
model.addChild(legs_1);
|
||||
setRotationAngle(legs_1, 0.0F, 0.0F, -0.5236F);
|
||||
legs_1.texOffs(50, 1).addBox(0.0F, 0.0F, 0.0F, 0.0F, 3.0F, 6.0F, 0.0F);*/
|
||||
return LayerDefinition.create(modelData, 64, 64);
|
||||
}
|
||||
|
||||
bodyPart.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create()
|
||||
.texOffs(50, 1)
|
||||
.addBox(0.0F, 0.0F, 0.0F, 0.0F, 3.0F, 6.0F),
|
||||
PartPose.offsetAndRotation(-3.0F, 0.0F, 1.0F,
|
||||
0.0F, 0.0F, 0.5236F));
|
||||
/*legs_2 = new ModelPart(this);
|
||||
legs_2.setPos(-3.0F, 0.0F, 1.0F);
|
||||
model.addChild(legs_2);
|
||||
setRotationAngle(legs_2, 0.0F, 0.0F, 0.5236F);
|
||||
legs_2.texOffs(50, 1).addBox(0.0F, 0.0F, 0.0F, 0.0F, 3.0F, 6.0F, 0.0F);*/
|
||||
public DragonflyEntityModel(ModelPart modelPart) {
|
||||
super(RenderType::entityCutout);
|
||||
|
||||
/*
|
||||
texWidth = 64;
|
||||
texHeight = 64;
|
||||
*/
|
||||
return LayerDefinition.create(modelData, 64, 64);
|
||||
}
|
||||
model = modelPart.getChild(PartNames.BODY);
|
||||
head = model.getChild(PartNames.HEAD);
|
||||
tail = model.getChild(PartNames.TAIL);
|
||||
tail_2 = tail.getChild(PartNames.TAIL_FIN);
|
||||
wing_1 = model.getChild(PartNames.LEFT_WING);
|
||||
wing_2 = model.getChild(PartNames.RIGHT_WING);
|
||||
wing_3 = model.getChild(PartNames.LEFT_WING_BASE);
|
||||
wing_4 = model.getChild(PartNames.RIGHT_WING_BASE);
|
||||
legs_1 = model.getChild(PartNames.LEFT_LEG);
|
||||
legs_2 = model.getChild(PartNames.RIGHT_LEG);
|
||||
}
|
||||
|
||||
public DragonflyEntityModel(ModelPart modelPart) {
|
||||
super(RenderType::entityCutout);
|
||||
@Override
|
||||
public void setupAnim(DragonflyEntity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) {
|
||||
float progress = animationProgress * 2F;
|
||||
|
||||
model = modelPart.getChild(PartNames.BODY);
|
||||
head = model.getChild(PartNames.HEAD);
|
||||
tail = model.getChild(PartNames.TAIL);
|
||||
tail_2 = tail.getChild(PartNames.TAIL_FIN);
|
||||
wing_1 = model.getChild(PartNames.LEFT_WING);
|
||||
wing_2 = model.getChild(PartNames.RIGHT_WING);
|
||||
wing_3 = model.getChild(PartNames.LEFT_WING_BASE);
|
||||
wing_4 = model.getChild(PartNames.RIGHT_WING_BASE);
|
||||
legs_1 = model.getChild(PartNames.LEFT_LEG);
|
||||
legs_2 = model.getChild(PartNames.RIGHT_LEG);
|
||||
}
|
||||
wing_1.zRot = 0.3491F + (float) Math.sin(progress) * 0.3491F;
|
||||
wing_2.zRot = -wing_1.zRot;
|
||||
|
||||
@Override
|
||||
public void setupAnim(DragonflyEntity entity, float limbAngle, float limbDistance, float animationProgress,
|
||||
float headYaw, float headPitch) {
|
||||
float progress = animationProgress * 2F;
|
||||
wing_3.zRot = 0.3491F + (float) Math.cos(progress) * 0.3491F;
|
||||
wing_4.zRot = -wing_3.zRot;
|
||||
|
||||
wing_1.zRot = 0.3491F + (float) Math.sin(progress) * 0.3491F;
|
||||
wing_2.zRot = -wing_1.zRot;
|
||||
progress = animationProgress * 0.05F;
|
||||
|
||||
wing_3.zRot = 0.3491F + (float) Math.cos(progress) * 0.3491F;
|
||||
wing_4.zRot = -wing_3.zRot;
|
||||
head.xRot = 0.3491F + (float) Math.sin(progress * 0.7F) * 0.1F;
|
||||
tail.xRot = (float) Math.cos(progress) * 0.05F - 0.05F;
|
||||
tail_2.xRot = -tail.xRot * 1.5F;
|
||||
}
|
||||
|
||||
progress = animationProgress * 0.05F;
|
||||
|
||||
head.xRot = 0.3491F + (float) Math.sin(progress * 0.7F) * 0.1F;
|
||||
tail.xRot = (float) Math.cos(progress) * 0.05F - 0.05F;
|
||||
tail_2.xRot = -tail.xRot * 1.5F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderToBuffer(PoseStack matrices, VertexConsumer vertices, int light, int overlay, float red,
|
||||
float green, float blue, float alpha) {
|
||||
model.render(matrices, vertices, light, overlay);
|
||||
}
|
||||
@Override
|
||||
public void renderToBuffer(PoseStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||
model.render(matrices, vertices, light, overlay);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package ru.betterend.entity.model;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.model.geom.PartNames;
|
||||
import net.minecraft.client.model.geom.PartPose;
|
||||
|
@ -25,74 +24,55 @@ public class EndFishEntityModel extends BlockBenchModel<EndFishEntity> {
|
|||
MeshDefinition modelData = new MeshDefinition();
|
||||
PartDefinition modelPartData = modelData.getRoot();
|
||||
|
||||
PartDefinition bodyPart = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create()
|
||||
PartDefinition bodyPart = modelPartData.addOrReplaceChild(PartNames.BODY,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 0)
|
||||
.addBox(-1.0F, -2.0F, -4.0F, 2.0F, 4.0F, 8.0F),
|
||||
PartPose.offset(0.0F, 20.0F, 0.0F));
|
||||
/*model = new ModelPart(this);
|
||||
model.setPos(0.0F, 20.0F, 0.0F);
|
||||
model.texOffs(0, 0).addBox(-1.0F, -2.0F, -4.0F, 2.0F, 4.0F, 8.0F, 0.0F);*/
|
||||
PartPose.offset(0.0F, 20.0F, 0.0F)
|
||||
);
|
||||
|
||||
modelPartData.addOrReplaceChild(PartNames.TOP_FIN, CubeListBuilder.create()
|
||||
bodyPart.addOrReplaceChild(PartNames.TOP_FIN,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 6)
|
||||
.addBox(0.0F, -8.0F, 0.0F, 0.0F, 8.0F, 6.0F),
|
||||
PartPose.offsetAndRotation(0.0F, -2.0F, -4.0F,
|
||||
-0.6981F, 0.0F, 0.0F));
|
||||
/*fin_top.setPos(0.0F, -2.0F, -4.0F);
|
||||
model.addChild(fin_top);
|
||||
setRotationAngle(fin_top, -0.6981F, 0.0F, 0.0F);
|
||||
fin_top.texOffs(0, 6).addBox(0.0F, -8.0F, 0.0F, 0.0F, 8.0F, 6.0F, 0.0F);*
|
||||
*/
|
||||
PartPose.offsetAndRotation(0.0F, -2.0F, -4.0F, -0.6981F, 0.0F, 0.0F)
|
||||
);
|
||||
|
||||
modelPartData.addOrReplaceChild(PartNames.BOTTOM_FIN, CubeListBuilder.create()
|
||||
bodyPart.addOrReplaceChild(PartNames.BOTTOM_FIN,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 6)
|
||||
.addBox(0.0F, 0.0F, 0.0F, 0.0F, 8.0F, 6.0F),
|
||||
PartPose.offsetAndRotation(0.0F, 2.0F, -4.0F,
|
||||
0.6981F, 0.0F, 0.0F));
|
||||
/*fin_bottom = new ModelPart(this);
|
||||
fin_bottom.setPos(0.0F, 2.0F, -4.0F);
|
||||
model.addChild(fin_bottom);
|
||||
setRotationAngle(fin_bottom, 0.6981F, 0.0F, 0.0F);
|
||||
fin_bottom.texOffs(0, 6).addBox(0.0F, 0.0F, 0.0F, 0.0F, 8.0F, 6.0F, 0.0F);*/
|
||||
PartPose.offsetAndRotation(0.0F, 2.0F, -4.0F, 0.6981F, 0.0F, 0.0F)
|
||||
);
|
||||
|
||||
modelPartData.addOrReplaceChild(PartNames.TAIL_FIN, CubeListBuilder.create()
|
||||
bodyPart.addOrReplaceChild(PartNames.TAIL_FIN,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 15)
|
||||
.addBox(0.0F, -5.0F, 0.0F, 0.0F, 5.0F, 5.0F),
|
||||
PartPose.offsetAndRotation(0.0F, 0.0F, 2.0F,
|
||||
-0.7854F, 0.0F, 0.0F));
|
||||
/*flipper = new ModelPart(this);
|
||||
flipper.setPos(0.0F, 0.0F, 2.0F);
|
||||
model.addChild(flipper);
|
||||
setRotationAngle(flipper, -0.7854F, 0.0F, 0.0F);
|
||||
flipper.texOffs(0, 15).addBox(0.0F, -5.0F, 0.0F, 0.0F, 5.0F, 5.0F, 0.0F);*/
|
||||
PartPose.offsetAndRotation(0.0F, 0.0F, 2.0F, -0.7854F, 0.0F, 0.0F)
|
||||
);
|
||||
|
||||
modelPartData.addOrReplaceChild(PartNames.RIGHT_FIN, CubeListBuilder.create()
|
||||
bodyPart.addOrReplaceChild(PartNames.RIGHT_FIN,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 25)
|
||||
.addBox(-3.7071F, 0.7071F, -1.5F, 3.0F, 0.0F, 3.0F),
|
||||
PartPose.offsetAndRotation(-1.0F, 0.0F, -1.0F,
|
||||
1.5708F, 0.7854F, 0.0F));
|
||||
/*fin_right = new ModelPart(this);
|
||||
fin_right.setPos(-1.0F, 0.0F, -1.0F);
|
||||
model.addChild(fin_right);
|
||||
setRotationAngle(fin_right, 1.5708F, 0.7854F, 0.0F);
|
||||
fin_right.texOffs(0, 25).addBox(-3.7071F, 0.7071F, -1.5F, 3.0F, 0.0F, 3.0F, 0.0F);*/
|
||||
PartPose.offsetAndRotation(-1.0F, 0.0F, -1.0F, 1.5708F, 0.7854F, 0.0F)
|
||||
);
|
||||
|
||||
modelPartData.addOrReplaceChild(PartNames.LEFT_FIN, CubeListBuilder.create()
|
||||
bodyPart.addOrReplaceChild(PartNames.LEFT_FIN,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.mirror()
|
||||
.texOffs(0, 25)
|
||||
.addBox(0.7071F, 0.7071F, -1.5F, 3.0F, 0.0F, 3.0F),
|
||||
PartPose.offsetAndRotation(-1.0F, 0.0F, -1.0F,
|
||||
1.5708F, -0.7854F, 0.0F));
|
||||
/*fin_left = new ModelPart(this);
|
||||
fin_left.setPos(1.0F, 0.0F, -1.0F);
|
||||
model.addChild(fin_left);
|
||||
setRotationAngle(fin_left, 1.5708F, -0.7854F, 0.0F);
|
||||
fin_left.texOffs(0, 25).addBox(0.7071F, 0.7071F, -1.5F, 3.0F, 0.0F, 3.0F, 0.0F, true);*/
|
||||
PartPose.offsetAndRotation(-1.0F, 0.0F, -1.0F, 1.5708F, -0.7854F, 0.0F)
|
||||
);
|
||||
|
||||
/*
|
||||
texWidth = 32;
|
||||
texHeight = 32;
|
||||
*/
|
||||
return LayerDefinition.create(modelData, 32, 32);
|
||||
}
|
||||
|
||||
|
@ -100,15 +80,15 @@ public class EndFishEntityModel extends BlockBenchModel<EndFishEntity> {
|
|||
super(RenderType::entityCutout);
|
||||
|
||||
model = modelPart.getChild(PartNames.BODY);
|
||||
fin_top = modelPart.getChild(PartNames.TOP_FIN);
|
||||
fin_bottom = modelPart.getChild(PartNames.BOTTOM_FIN);
|
||||
flipper = modelPart.getChild(PartNames.TAIL_FIN);
|
||||
fin_right = modelPart.getChild(PartNames.RIGHT_FIN);
|
||||
fin_left = modelPart.getChild(PartNames.LEFT_FIN);}
|
||||
fin_top = model.getChild(PartNames.TOP_FIN);
|
||||
fin_bottom = model.getChild(PartNames.BOTTOM_FIN);
|
||||
flipper = model.getChild(PartNames.TAIL_FIN);
|
||||
fin_right = model.getChild(PartNames.RIGHT_FIN);
|
||||
fin_left = model.getChild(PartNames.LEFT_FIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupAnim(EndFishEntity entity, float limbAngle, float limbDistance, float animationProgress,
|
||||
float headYaw, float headPitch) {
|
||||
public void setupAnim(EndFishEntity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) {
|
||||
float s1 = (float) Math.sin(animationProgress * 0.1);
|
||||
float s2 = (float) Math.sin(animationProgress * 0.05);
|
||||
flipper.yRot = s1 * 0.3F;
|
||||
|
@ -119,8 +99,7 @@ public class EndFishEntityModel extends BlockBenchModel<EndFishEntity> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderToBuffer(PoseStack matrices, VertexConsumer vertices, int light, int overlay, float red,
|
||||
float green, float blue, float alpha) {
|
||||
public void renderToBuffer(PoseStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||
model.render(matrices, vertices, light, overlay);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,8 @@ package ru.betterend.entity.model;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
|
||||
import net.minecraft.client.model.ListModel;
|
||||
import net.minecraft.client.model.geom.EntityModelSet;
|
||||
import net.minecraft.client.model.geom.ModelLayers;
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.model.geom.PartNames;
|
||||
import net.minecraft.client.model.geom.PartPose;
|
||||
|
@ -30,6 +28,7 @@ public class EndSlimeEntityModel<T extends EndSlimeEntity> extends ListModel<T>
|
|||
public static LayerDefinition getShellOnlyTexturedModelData() {
|
||||
return getTexturedModelData(true);
|
||||
}
|
||||
|
||||
public static LayerDefinition getCompleteTexturedModelData() {
|
||||
return getTexturedModelData(false);
|
||||
}
|
||||
|
@ -38,92 +37,74 @@ public class EndSlimeEntityModel<T extends EndSlimeEntity> extends ListModel<T>
|
|||
MeshDefinition modelData = new MeshDefinition();
|
||||
PartDefinition modelPartData = modelData.getRoot();
|
||||
|
||||
//this.innerCube = new ModelPart(this, 0, 16);
|
||||
if (onlyShell) {
|
||||
modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create()
|
||||
modelPartData.addOrReplaceChild(PartNames.BODY,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 0)
|
||||
.addBox(-4.0F, 16.0F, -4.0F, 8.0F, 8.0F, 8.0F),
|
||||
PartPose.ZERO);
|
||||
/* this.innerCube.texOffs(0, 0);
|
||||
this.innerCube.addBox(-4.0F, 16.0F, -4.0F, 8.0F, 8.0F, 8.0F);*/
|
||||
} else {
|
||||
modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create()
|
||||
PartPose.ZERO
|
||||
);
|
||||
}
|
||||
else {
|
||||
modelPartData.addOrReplaceChild(PartNames.BODY,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 16)
|
||||
.addBox(-3.0F, 17.0F, -3.0F, 6.0F, 6.0F, 6.0F),
|
||||
PartPose.ZERO);
|
||||
//this.innerCube.addBox(-3.0F, 17.0F, -3.0F, 6.0F, 6.0F, 6.0F);
|
||||
PartPose.ZERO
|
||||
);
|
||||
|
||||
modelPartData.addOrReplaceChild(PartNames.RIGHT_EYE, CubeListBuilder.create()
|
||||
modelPartData.addOrReplaceChild(PartNames.RIGHT_EYE,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(32, 0)
|
||||
.addBox(-3.25F, 18.0F, -3.5F, 2.0F, 2.0F, 2.0F),
|
||||
PartPose.ZERO);
|
||||
//this.rightEye = new ModelPart(this, 32, 0);
|
||||
//this.rightEye.addBox(-3.25F, 18.0F, -3.5F, 2.0F, 2.0F, 2.0F);
|
||||
PartPose.ZERO
|
||||
);
|
||||
|
||||
modelPartData.addOrReplaceChild(PartNames.LEFT_EYE, CubeListBuilder.create()
|
||||
modelPartData.addOrReplaceChild(PartNames.LEFT_EYE,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(32, 4)
|
||||
.addBox(1.25F, 18.0F, -3.5F, 2.0F, 2.0F, 2.0F),
|
||||
PartPose.ZERO);
|
||||
//this.leftEye = new ModelPart(this, 32, 4);
|
||||
//this.leftEye.addBox(1.25F, 18.0F, -3.5F, 2.0F, 2.0F, 2.0F);
|
||||
PartPose.ZERO
|
||||
);
|
||||
|
||||
modelPartData.addOrReplaceChild(PartNames.MOUTH, CubeListBuilder.create()
|
||||
modelPartData.addOrReplaceChild(PartNames.MOUTH,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(32, 8)
|
||||
.addBox(0.0F, 21.0F, -3.5F, 1.0F, 1.0F, 1.0F),
|
||||
PartPose.ZERO);
|
||||
//this.mouth = new ModelPart(this, 32, 8);
|
||||
//this.mouth.addBox(0.0F, 21.0F, -3.5F, 1.0F, 1.0F, 1.0F);
|
||||
PartPose.ZERO
|
||||
);
|
||||
|
||||
PartDefinition flowerPart = modelPartData.addOrReplaceChild("flower", CubeListBuilder.create(), PartPose.ZERO);
|
||||
PartDefinition cropPart = modelPartData.addOrReplaceChild("crop", CubeListBuilder.create(), PartPose.ZERO);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
final PartDefinition parent = i<4?flowerPart:cropPart;
|
||||
final float rot = MHelper.degreesToRadians( i<4 ? (i * 45F) : ((i-4) * 90F + 45F) );
|
||||
final PartDefinition parent = i < 4 ? flowerPart : cropPart;
|
||||
final float rot = MHelper.degreesToRadians(i < 4 ? (i * 45F) : ((i - 4) * 90F + 45F));
|
||||
|
||||
PartDefinition petalRotPart = parent.addOrReplaceChild("petalRot_"+i,
|
||||
PartDefinition petalRotPart = parent.addOrReplaceChild("petalRot_" + i,
|
||||
CubeListBuilder.create(),
|
||||
PartPose.offsetAndRotation(0,0,0,0,rot, 0));
|
||||
PartPose.offsetAndRotation(0, 0, 0, 0, rot, 0));
|
||||
|
||||
|
||||
petalRotPart.addOrReplaceChild("petal_"+i,
|
||||
CubeListBuilder.create()
|
||||
petalRotPart.addOrReplaceChild("petal_" + i,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(40, 0)
|
||||
.addBox(0.0F, 0.0F, 0.0F, 8.0F, 8.0F, 0.0F),
|
||||
PartPose.offset(-4, 8, 0));
|
||||
PartPose.offset(-4, 8, 0)
|
||||
);
|
||||
}
|
||||
/* this.flower = new ModelPart(this);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ModelPart petalRot = new ModelPart(this);
|
||||
petalRot.yRot = MHelper.degreesToRadians(i * 45F);
|
||||
|
||||
ModelPart petal = new ModelPart(this, 40, 0);
|
||||
petal.setPos(-4, 8, 0);
|
||||
petal.addBox(0.0F, 0.0F, 0.0F, 8.0F, 8.0F, 0.0F, 0.0F);
|
||||
|
||||
this.flower.addChild(petalRot);
|
||||
petalRot.addChild(petal);
|
||||
}
|
||||
this.crop = new ModelPart(this);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
ModelPart petalRot = new ModelPart(this);
|
||||
petalRot.yRot = MHelper.degreesToRadians(i * 90F + 45F);
|
||||
|
||||
ModelPart petal = new ModelPart(this, 40, 0);
|
||||
petal.setPos(-4, 8, 0);
|
||||
petal.addBox(0.0F, 0.0F, 0.0F, 8.0F, 8.0F, 0.0F, 0.0F);
|
||||
|
||||
this.crop.addChild(petalRot);
|
||||
petalRot.addChild(petal);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return LayerDefinition.create(modelData, 64, 32);
|
||||
}
|
||||
|
||||
public EndSlimeEntityModel(EntityModelSet modelSet, boolean onlyShell){
|
||||
public EndSlimeEntityModel(EntityModelSet modelSet, boolean onlyShell) {
|
||||
super(RenderType::entityCutout);
|
||||
|
||||
ModelPart modelPart = modelSet.bakeLayer(onlyShell ? EndEntitiesRenders.END_SLIME_SHELL_MODEL : EndEntitiesRenders.END_SLIME_MODEL);
|
||||
|
@ -135,7 +116,8 @@ public class EndSlimeEntityModel<T extends EndSlimeEntity> extends ListModel<T>
|
|||
mouth = modelPart.getChild(PartNames.MOUTH);
|
||||
flower = modelPart.getChild("flower");
|
||||
crop = modelPart.getChild("crop");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rightEye = null;
|
||||
leftEye = null;
|
||||
mouth = null;
|
||||
|
@ -145,8 +127,7 @@ public class EndSlimeEntityModel<T extends EndSlimeEntity> extends ListModel<T>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setupAnim(T entity, float limbAngle, float limbDistance, float animationProgress, float headYaw,
|
||||
float headPitch) {
|
||||
public void setupAnim(T entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) {
|
||||
}
|
||||
|
||||
public void renderFlower(PoseStack matrices, VertexConsumer vertices, int light, int overlay) {
|
||||
|
@ -157,15 +138,16 @@ public class EndSlimeEntityModel<T extends EndSlimeEntity> extends ListModel<T>
|
|||
crop.render(matrices, vertices, light, overlay);
|
||||
}
|
||||
|
||||
private boolean isOnlyShell(){
|
||||
return rightEye==null;
|
||||
private boolean isOnlyShell() {
|
||||
return rightEye == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<ModelPart> parts() {
|
||||
if (isOnlyShell()) {
|
||||
return ImmutableList.of(this.innerCube);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return ImmutableList.of(this.innerCube, this.rightEye, this.leftEye, this.mouth);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package ru.betterend.entity.model;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.model.geom.PartNames;
|
||||
import net.minecraft.client.model.geom.PartPose;
|
||||
|
@ -15,240 +14,185 @@ import net.minecraft.util.Mth;
|
|||
import ru.betterend.entity.SilkMothEntity;
|
||||
|
||||
public class SilkMothEntityModel extends BlockBenchModel<SilkMothEntity> {
|
||||
private final ModelPart legsL;
|
||||
private final ModelPart cube_r1;
|
||||
private final ModelPart cube_r2;
|
||||
private final ModelPart cube_r3;
|
||||
private final ModelPart legsR;
|
||||
private final ModelPart cube_r4;
|
||||
private final ModelPart cube_r5;
|
||||
private final ModelPart cube_r6;
|
||||
private final ModelPart head_pivot;
|
||||
private final ModelPart tendril_r_r1;
|
||||
private final ModelPart tendril_r_r2;
|
||||
private final ModelPart bb_main;
|
||||
private final ModelPart wingR_r1;
|
||||
private final ModelPart wingL_r1;
|
||||
private final ModelPart abdomen_r1;
|
||||
private final ModelPart legsL;
|
||||
private final ModelPart cube_r1;
|
||||
private final ModelPart cube_r2;
|
||||
private final ModelPart cube_r3;
|
||||
private final ModelPart legsR;
|
||||
private final ModelPart cube_r4;
|
||||
private final ModelPart cube_r5;
|
||||
private final ModelPart cube_r6;
|
||||
private final ModelPart head_pivot;
|
||||
private final ModelPart tendril_r_r1;
|
||||
private final ModelPart tendril_r_r2;
|
||||
private final ModelPart bb_main;
|
||||
private final ModelPart wingR_r1;
|
||||
private final ModelPart wingL_r1;
|
||||
private final ModelPart abdomen_r1;
|
||||
|
||||
public static LayerDefinition getTexturedModelData() {
|
||||
MeshDefinition modelData = new MeshDefinition();
|
||||
PartDefinition modelPartData = modelData.getRoot();
|
||||
public static LayerDefinition getTexturedModelData() {
|
||||
MeshDefinition modelData = new MeshDefinition();
|
||||
PartDefinition modelPartData = modelData.getRoot();
|
||||
|
||||
PartDefinition legsL = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create()
|
||||
.texOffs(0, 0),
|
||||
PartPose.offsetAndRotation(1.5f, 19.9f, -0.45f,
|
||||
0.0f, 0.0f, 0.6981f));
|
||||
PartDefinition legsL = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 0),
|
||||
PartPose.offsetAndRotation(1.5f, 19.9f, -0.45f, 0.0f, 0.0f, 0.6981f)
|
||||
);
|
||||
|
||||
legsL.addOrReplaceChild("cube_r1", CubeListBuilder.create()
|
||||
.texOffs(0, 13)
|
||||
.addBox(0.0216f, 0.0f, -0.5976f, 3.0f, 0.0f, 1.0f),
|
||||
PartPose.offsetAndRotation(0.0f, 0.0f, -1.0f,
|
||||
0.0f, 0.2182f, 0.3927f));
|
||||
legsL.addOrReplaceChild("cube_r1",
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 13)
|
||||
.addBox(0.0216f, 0.0f, -0.5976f, 3.0f, 0.0f, 1.0f),
|
||||
PartPose.offsetAndRotation(0.0f, 0.0f, -1.0f, 0.0f, 0.2182f, 0.3927f)
|
||||
);
|
||||
|
||||
legsL.addOrReplaceChild("cube_r2", CubeListBuilder.create()
|
||||
.texOffs(0, 15)
|
||||
.addBox(0.0f, 0.0f, -0.6f, 3.0f, 0.0f, 1.0f),
|
||||
PartPose.offsetAndRotation(0.5f, 0.1f, -0.05f,
|
||||
0.0f, 0.0f, 0.3927f));
|
||||
legsL.addOrReplaceChild("cube_r2",
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 15)
|
||||
.addBox(0.0f, 0.0f, -0.6f, 3.0f, 0.0f, 1.0f),
|
||||
PartPose.offsetAndRotation(0.5f, 0.1f, -0.05f, 0.0f, 0.0f, 0.3927f)
|
||||
);
|
||||
|
||||
legsL.addOrReplaceChild("cube_r3", CubeListBuilder.create()
|
||||
.texOffs(0, 14)
|
||||
.addBox(0.0f, 0.0f, -0.5f, 3.0f, 0.0f, 1.0f),
|
||||
PartPose.offsetAndRotation(0.0f, 0.0f, 0.9f,
|
||||
0.0f, -0.2182f, 0.3927f));
|
||||
legsL.addOrReplaceChild("cube_r3",
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 14)
|
||||
.addBox(0.0f, 0.0f, -0.5f, 3.0f, 0.0f, 1.0f),
|
||||
PartPose.offsetAndRotation(0.0f, 0.0f, 0.9f, 0.0f, -0.2182f, 0.3927f)
|
||||
);
|
||||
|
||||
PartDefinition legsR = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create()
|
||||
.texOffs(0, 0),
|
||||
PartPose.offsetAndRotation(-1.5f, 19.9f, -0.55f,
|
||||
0.0f, 3.1416f, -0.6545f));
|
||||
PartDefinition legsR = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 0),
|
||||
PartPose.offsetAndRotation(-1.5f, 19.9f, -0.55f, 0.0f, 3.1416f, -0.6545f)
|
||||
);
|
||||
|
||||
legsR.addOrReplaceChild("cube_r4", CubeListBuilder.create()
|
||||
.texOffs(0, 10)
|
||||
.addBox(0.0f, 0.0f, -0.5f, 3.0f, 0.0f, 1.0f),
|
||||
PartPose.offsetAndRotation(0.0f, 0.0f, -1.0f,
|
||||
0.0f, 0.2182f, 0.3927f));
|
||||
legsR.addOrReplaceChild("cube_r4",
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 10)
|
||||
.addBox(0.0f, 0.0f, -0.5f, 3.0f, 0.0f, 1.0f),
|
||||
PartPose.offsetAndRotation(0.0f, 0.0f, -1.0f, 0.0f, 0.2182f, 0.3927f)
|
||||
);
|
||||
|
||||
legsR.addOrReplaceChild("cube_r5", CubeListBuilder.create()
|
||||
.texOffs(0, 11)
|
||||
.addBox(0.0f, 0.0f, -0.4f, 3.0f, 0.0f, 1.0f),
|
||||
PartPose.offsetAndRotation(0.5f, 0.1f, -0.05f,
|
||||
0.0f, 0.0f, 0.3927f));
|
||||
legsR.addOrReplaceChild("cube_r5",
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 11)
|
||||
.addBox(0.0f, 0.0f, -0.4f, 3.0f, 0.0f, 1.0f),
|
||||
PartPose.offsetAndRotation(0.5f, 0.1f, -0.05f, 0.0f, 0.0f, 0.3927f)
|
||||
);
|
||||
|
||||
legsR.addOrReplaceChild("cube_r6", CubeListBuilder.create()
|
||||
.texOffs(0, 12)
|
||||
.addBox(0.0216f, 0.0f, -0.4024f, 3.0f, 0.0f, 1.0f),
|
||||
PartPose.offsetAndRotation(0.0f, 0.0f, 0.9f,
|
||||
0.0f, -0.2182f, 0.3927f));
|
||||
legsR.addOrReplaceChild("cube_r6",
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 12)
|
||||
.addBox(0.0216f, 0.0f, -0.4024f, 3.0f, 0.0f, 1.0f),
|
||||
PartPose.offsetAndRotation(0.0f, 0.0f, 0.9f, 0.0f, -0.2182f, 0.3927f)
|
||||
);
|
||||
|
||||
PartDefinition head_pivot = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create()
|
||||
.texOffs(15, 10)
|
||||
.addBox(-1.5f, -1.5f, -2.0f, 3.0f, 3.0f, 3.0f),
|
||||
PartPose.offset(0.0f, 18.0f, -3.0f));
|
||||
PartDefinition head_pivot = modelPartData.addOrReplaceChild(PartNames.HEAD,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(15, 10)
|
||||
.addBox(-1.5f, -1.5f, -2.0f, 3.0f, 3.0f, 3.0f),
|
||||
PartPose.offset(0.0f, 18.0f, -3.0f)
|
||||
);
|
||||
|
||||
head_pivot.addOrReplaceChild("tendril_r_r1", CubeListBuilder.create()
|
||||
.mirror()
|
||||
.texOffs(23, 0)
|
||||
.addBox(-1.5f, -5.0f, 0.0f, 3.0f, 5.0f, 0.0f),
|
||||
PartPose.offsetAndRotation(1.0f, -1.15f, -1.0f,
|
||||
0.0f, 0.0f, 0.3927f));
|
||||
head_pivot.addOrReplaceChild("tendril_r_r1",
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.mirror()
|
||||
.texOffs(23, 0)
|
||||
.addBox(-1.5f, -5.0f, 0.0f, 3.0f, 5.0f, 0.0f),
|
||||
PartPose.offsetAndRotation(1.0f, -1.15f, -1.0f, 0.0f, 0.0f, 0.3927f)
|
||||
);
|
||||
|
||||
head_pivot.addOrReplaceChild("tendril_r_r2", CubeListBuilder.create()
|
||||
.texOffs(23, 0)
|
||||
.addBox(-1.5f, -5.0f, 0.0f, 3.0f, 5.0f, 0.0f),
|
||||
PartPose.offsetAndRotation(-1.0f, -1.15f, -1.0f,
|
||||
0.0f, 0.0f, -0.3927f));
|
||||
head_pivot.addOrReplaceChild("tendril_r_r2",
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(23, 0)
|
||||
.addBox(-1.5f, -5.0f, 0.0f, 3.0f, 5.0f, 0.0f),
|
||||
PartPose.offsetAndRotation(-1.0f, -1.15f, -1.0f, 0.0f, 0.0f, -0.3927f)
|
||||
);
|
||||
|
||||
PartDefinition bb_main = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create()
|
||||
.texOffs(19, 19)
|
||||
.addBox(-2.5f, -8.5f, -3.0f, 5.0f, 5.0f, 3.0f),
|
||||
PartPose.offset(0.0f, 24.0f, 0.0f));
|
||||
PartDefinition bb_main = modelPartData.addOrReplaceChild(PartNames.BODY,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(19, 19)
|
||||
.addBox(-2.5f, -8.5f, -3.0f, 5.0f, 5.0f, 3.0f),
|
||||
PartPose.offset(0.0f, 24.0f, 0.0f)
|
||||
);
|
||||
|
||||
bb_main.addOrReplaceChild(PartNames.RIGHT_WING, CubeListBuilder.create()
|
||||
.mirror()
|
||||
.texOffs(0, 5)
|
||||
.addBox(-7.0f, 0.0f, -3.0f, 9.0f, 0.0f, 5.0f),
|
||||
PartPose.offsetAndRotation(-1.5f, -6.5f, 0.5f,
|
||||
0.0f, 0.0f, 0.3927f));
|
||||
bb_main.addOrReplaceChild(PartNames.RIGHT_WING,
|
||||
CubeListBuilder.create()
|
||||
.mirror()
|
||||
.texOffs(0, 5)
|
||||
.addBox(-7.0f, 0.0f, -3.0f, 9.0f, 0.0f, 5.0f),
|
||||
PartPose.offsetAndRotation(-1.5f, -6.5f, 0.5f, 0.0f, 0.0f, 0.3927f)
|
||||
);
|
||||
|
||||
bb_main.addOrReplaceChild(PartNames.LEFT_WING, CubeListBuilder.create()
|
||||
.texOffs(0, 5)
|
||||
.addBox(-2.0f, 0.0f, -3.0f, 9.0f, 0.0f, 5.0f),
|
||||
PartPose.offsetAndRotation(1.5f, -6.5f, 0.5f,
|
||||
0.0f, 0.0f, -0.3927f));
|
||||
bb_main.addOrReplaceChild(PartNames.LEFT_WING,
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 5)
|
||||
.addBox(-2.0f, 0.0f, -3.0f, 9.0f, 0.0f, 5.0f),
|
||||
PartPose.offsetAndRotation(1.5f, -6.5f, 0.5f, 0.0f, 0.0f, -0.3927f)
|
||||
);
|
||||
|
||||
bb_main.addOrReplaceChild("abdomen_r1", CubeListBuilder.create()
|
||||
.texOffs(0, 10)
|
||||
.addBox(-3.0f, -4.0f, -1.0f, 4.0f, 4.0f, 7.0f),
|
||||
PartPose.offsetAndRotation(1.0f, -3.9f, 0.0f,
|
||||
-0.3927f, 0.0f, 0.0f));
|
||||
bb_main.addOrReplaceChild("abdomen_r1",
|
||||
CubeListBuilder
|
||||
.create()
|
||||
.texOffs(0, 10)
|
||||
.addBox(-3.0f, -4.0f, -1.0f, 4.0f, 4.0f, 7.0f),
|
||||
PartPose.offsetAndRotation(1.0f, -3.9f, 0.0f, -0.3927f, 0.0f, 0.0f)
|
||||
);
|
||||
|
||||
/*texWidth = 64;
|
||||
texHeight = 64;*/
|
||||
return LayerDefinition.create(modelData, 64, 64);
|
||||
}
|
||||
return LayerDefinition.create(modelData, 64, 64);
|
||||
}
|
||||
|
||||
public SilkMothEntityModel(ModelPart modelPart) {
|
||||
super(RenderType::entityCutout);
|
||||
public SilkMothEntityModel(ModelPart modelPart) {
|
||||
super(RenderType::entityCutout);
|
||||
|
||||
legsL = modelPart.getChild(PartNames.LEFT_LEG);
|
||||
cube_r1 = legsL.getChild("cube_r1");
|
||||
cube_r2 = legsL.getChild("cube_r2");
|
||||
cube_r3 = legsL.getChild("cube_r3");
|
||||
legsR = modelPart.getChild(PartNames.RIGHT_LEG);
|
||||
cube_r4 = legsR.getChild("cube_r4");
|
||||
cube_r5 = legsR.getChild("cube_r5");
|
||||
cube_r6 = legsR.getChild("cube_r6");
|
||||
head_pivot = modelPart.getChild(PartNames.HEAD);
|
||||
tendril_r_r1 = head_pivot.getChild("tendril_r_r1");
|
||||
tendril_r_r2 = head_pivot.getChild("tendril_r_r2");
|
||||
bb_main = modelPart.getChild(PartNames.BODY);
|
||||
wingR_r1 = bb_main.getChild(PartNames.RIGHT_WING);
|
||||
wingL_r1 = bb_main.getChild(PartNames.LEFT_WING);
|
||||
abdomen_r1 = bb_main.getChild("abdomen_r1");
|
||||
legsL = modelPart.getChild(PartNames.LEFT_LEG);
|
||||
cube_r1 = legsL.getChild("cube_r1");
|
||||
cube_r2 = legsL.getChild("cube_r2");
|
||||
cube_r3 = legsL.getChild("cube_r3");
|
||||
legsR = modelPart.getChild(PartNames.RIGHT_LEG);
|
||||
cube_r4 = legsR.getChild("cube_r4");
|
||||
cube_r5 = legsR.getChild("cube_r5");
|
||||
cube_r6 = legsR.getChild("cube_r6");
|
||||
head_pivot = modelPart.getChild(PartNames.HEAD);
|
||||
tendril_r_r1 = head_pivot.getChild("tendril_r_r1");
|
||||
tendril_r_r2 = head_pivot.getChild("tendril_r_r2");
|
||||
bb_main = modelPart.getChild(PartNames.BODY);
|
||||
wingR_r1 = bb_main.getChild(PartNames.RIGHT_WING);
|
||||
wingL_r1 = bb_main.getChild(PartNames.LEFT_WING);
|
||||
abdomen_r1 = bb_main.getChild("abdomen_r1");
|
||||
}
|
||||
|
||||
/*legsL = new ModelPart(this);
|
||||
legsL.setPos(1.5F, 19.9F, -0.45F);
|
||||
setRotationAngle(legsL, 0.0F, 0.0F, 0.6981F);
|
||||
@Override
|
||||
public void setupAnim(SilkMothEntity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) {
|
||||
wingR_r1.zRot = Mth.sin(animationProgress * 2F) * 0.4F + 0.3927F;
|
||||
wingL_r1.zRot = -wingR_r1.zRot;
|
||||
head_pivot.xRot = Mth.sin(animationProgress * 0.03F) * 0.1F;
|
||||
tendril_r_r1.zRot = Mth.sin(animationProgress * 0.07F) * 0.2F + 0.3927F;
|
||||
tendril_r_r2.zRot = -tendril_r_r1.zRot;
|
||||
abdomen_r1.xRot = Mth.sin(animationProgress * 0.05F) * 0.1F - 0.3927F;
|
||||
legsR.zRot = Mth.sin(animationProgress * 0.07F) * 0.1F - 0.6545F;
|
||||
legsL.zRot = -legsR.zRot;
|
||||
}
|
||||
|
||||
cube_r1 = new ModelPart(this);
|
||||
cube_r1.setPos(0.0F, 0.0F, -1.0F);
|
||||
legsL.addChild(cube_r1);
|
||||
setRotationAngle(cube_r1, 0.0F, 0.2182F, 0.3927F);
|
||||
cube_r1.texOffs(0, 13).addBox(0.0216F, 0.0F, -0.5976F, 3.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
cube_r2 = new ModelPart(this);
|
||||
cube_r2.setPos(0.5F, 0.1F, -0.05F);
|
||||
legsL.addChild(cube_r2);
|
||||
setRotationAngle(cube_r2, 0.0F, 0.0F, 0.3927F);
|
||||
cube_r2.texOffs(0, 15).addBox(0.0F, 0.0F, -0.6F, 3.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
cube_r3 = new ModelPart(this);
|
||||
cube_r3.setPos(0.0F, 0.0F, 0.9F);
|
||||
legsL.addChild(cube_r3);
|
||||
setRotationAngle(cube_r3, 0.0F, -0.2182F, 0.3927F);
|
||||
cube_r3.texOffs(0, 14).addBox(0.0F, 0.0F, -0.5F, 3.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
legsR = new ModelPart(this);
|
||||
legsR.setPos(-1.5F, 19.9F, -0.55F);
|
||||
setRotationAngle(legsR, 0.0F, 3.1416F, -0.6545F);
|
||||
|
||||
cube_r4 = new ModelPart(this);
|
||||
cube_r4.setPos(0.0F, 0.0F, -1.0F);
|
||||
legsR.addChild(cube_r4);
|
||||
setRotationAngle(cube_r4, 0.0F, 0.2182F, 0.3927F);
|
||||
cube_r4.texOffs(0, 10).addBox(0.0F, 0.0F, -0.5F, 3.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
cube_r5 = new ModelPart(this);
|
||||
cube_r5.setPos(0.5F, 0.1F, -0.05F);
|
||||
legsR.addChild(cube_r5);
|
||||
setRotationAngle(cube_r5, 0.0F, 0.0F, 0.3927F);
|
||||
cube_r5.texOffs(0, 11).addBox(0.0F, 0.0F, -0.4F, 3.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
cube_r6 = new ModelPart(this);
|
||||
cube_r6.setPos(0.0F, 0.0F, 0.9F);
|
||||
legsR.addChild(cube_r6);
|
||||
setRotationAngle(cube_r6, 0.0F, -0.2182F, 0.3927F);
|
||||
cube_r6.texOffs(0, 12).addBox(0.0216F, 0.0F, -0.4024F, 3.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
head_pivot = new ModelPart(this);
|
||||
head_pivot.setPos(0.0F, 18.0F, -3.0F);
|
||||
head_pivot.texOffs(15, 10).addBox(-1.5F, -1.5F, -2.0F, 3.0F, 3.0F, 3.0F, 0.0F);
|
||||
|
||||
tendril_r_r1 = new ModelPart(this);
|
||||
tendril_r_r1.setPos(1.0F, -1.15F, -1.0F);
|
||||
head_pivot.addChild(tendril_r_r1);
|
||||
setRotationAngle(tendril_r_r1, 0.0F, 0.0F, 0.3927F);
|
||||
tendril_r_r1.texOffs(23, 0).addBox(-1.5F, -5.0F, 0.0F, 3.0F, 5.0F, 0.0F, 0.0F, true);
|
||||
|
||||
tendril_r_r2 = new ModelPart(this);
|
||||
tendril_r_r2.setPos(-1.0F, -1.15F, -1.0F);
|
||||
head_pivot.addChild(tendril_r_r2);
|
||||
setRotationAngle(tendril_r_r2, 0.0F, 0.0F, -0.3927F);
|
||||
tendril_r_r2.texOffs(23, 0).addBox(-1.5F, -5.0F, 0.0F, 3.0F, 5.0F, 0.0F, 0.0F);
|
||||
|
||||
bb_main = new ModelPart(this);
|
||||
bb_main.setPos(0.0F, 24.0F, 0.0F);
|
||||
bb_main.texOffs(19, 19).addBox(-2.5F, -8.5F, -3.0F, 5.0F, 5.0F, 3.0F, 0.0F);
|
||||
|
||||
wingR_r1 = new ModelPart(this);
|
||||
wingR_r1.setPos(-1.5F, -6.5F, 0.5F);
|
||||
bb_main.addChild(wingR_r1);
|
||||
setRotationAngle(wingR_r1, 0.0F, 0.0F, 0.3927F);
|
||||
wingR_r1.texOffs(0, 5).addBox(-7.0F, 0.0F, -3.0F, 9.0F, 0.0F, 5.0F, 0.0F, true);
|
||||
|
||||
wingL_r1 = new ModelPart(this);
|
||||
wingL_r1.setPos(1.5F, -6.5F, 0.5F);
|
||||
bb_main.addChild(wingL_r1);
|
||||
setRotationAngle(wingL_r1, 0.0F, 0.0F, -0.3927F);
|
||||
wingL_r1.texOffs(0, 5).addBox(-2.0F, 0.0F, -3.0F, 9.0F, 0.0F, 5.0F, 0.0F);
|
||||
|
||||
abdomen_r1 = new ModelPart(this);
|
||||
abdomen_r1.setPos(1.0F, -3.9F, 0.0F);
|
||||
bb_main.addChild(abdomen_r1);
|
||||
setRotationAngle(abdomen_r1, -0.3927F, 0.0F, 0.0F);
|
||||
abdomen_r1.texOffs(0, 10).addBox(-3.0F, -4.0F, -1.0F, 4.0F, 4.0F, 7.0F, 0.0F);*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupAnim(SilkMothEntity entity, float limbAngle, float limbDistance, float animationProgress,
|
||||
float headYaw, float headPitch) {
|
||||
wingR_r1.zRot = Mth.sin(animationProgress * 2F) * 0.4F + 0.3927F;
|
||||
wingL_r1.zRot = -wingR_r1.zRot;
|
||||
head_pivot.xRot = Mth.sin(animationProgress * 0.03F) * 0.1F;
|
||||
tendril_r_r1.zRot = Mth.sin(animationProgress * 0.07F) * 0.2F + 0.3927F;
|
||||
tendril_r_r2.zRot = -tendril_r_r1.zRot;
|
||||
abdomen_r1.xRot = Mth.sin(animationProgress * 0.05F) * 0.1F - 0.3927F;
|
||||
legsR.zRot = Mth.sin(animationProgress * 0.07F) * 0.1F - 0.6545F;
|
||||
legsL.zRot = -legsR.zRot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderToBuffer(PoseStack matrices, VertexConsumer vertices, int light, int overlay, float red,
|
||||
float green, float blue, float alpha) {
|
||||
bb_main.render(matrices, vertices, light, overlay);
|
||||
head_pivot.render(matrices, vertices, light, overlay);
|
||||
legsL.render(matrices, vertices, light, overlay);
|
||||
legsR.render(matrices, vertices, light, overlay);
|
||||
}
|
||||
@Override
|
||||
public void renderToBuffer(PoseStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||
bb_main.render(matrices, vertices, light, overlay);
|
||||
head_pivot.render(matrices, vertices, light, overlay);
|
||||
legsL.render(matrices, vertices, light, overlay);
|
||||
legsR.render(matrices, vertices, light, overlay);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package ru.betterend.entity.render;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
|
@ -32,7 +31,7 @@ public class RendererEntityCubozoa extends MobRenderer<CubozoaEntity, CubozoaEnt
|
|||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(GLOW[entity.getVariant()]);
|
||||
this.getParentModel().renderToBuffer(matrices, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,11 +44,11 @@ public class RendererEntityCubozoa extends MobRenderer<CubozoaEntity, CubozoaEnt
|
|||
public ResourceLocation getTextureLocation(CubozoaEntity entity) {
|
||||
return TEXTURE[entity.getVariant()];
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
TEXTURE[0] = BetterEnd.makeID("textures/entity/cubozoa/cubozoa.png");
|
||||
TEXTURE[1] = BetterEnd.makeID("textures/entity/cubozoa/cubozoa_sulphur.png");
|
||||
|
||||
|
||||
GLOW[0] = RenderType.eyes(BetterEnd.makeID("textures/entity/cubozoa/cubozoa_glow.png"));
|
||||
GLOW[1] = RenderType.eyes(BetterEnd.makeID("textures/entity/cubozoa/cubozoa_sulphur_glow.png"));
|
||||
}
|
||||
|
|
|
@ -1,33 +1,31 @@
|
|||
package ru.betterend.entity.render;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.MobRenderer;
|
||||
import net.minecraft.client.renderer.entity.layers.EyesLayer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.entity.DragonflyEntity;
|
||||
import ru.betterend.entity.model.CubozoaEntityModel;
|
||||
import ru.betterend.entity.model.DragonflyEntityModel;
|
||||
import ru.betterend.registry.EndEntitiesRenders;
|
||||
|
||||
public class RendererEntityDragonfly extends MobRenderer<DragonflyEntity, DragonflyEntityModel> {
|
||||
private static final ResourceLocation TEXTURE = BetterEnd.makeID("textures/entity/dragonfly.png");
|
||||
private static final RenderType GLOW = RenderType.eyes(BetterEnd.makeID("textures/entity/dragonfly_glow.png"));
|
||||
private static final ResourceLocation TEXTURE = BetterEnd.makeID("textures/entity/dragonfly.png");
|
||||
private static final RenderType GLOW = RenderType.eyes(BetterEnd.makeID("textures/entity/dragonfly_glow.png"));
|
||||
|
||||
public RendererEntityDragonfly(EntityRendererProvider.Context ctx) {
|
||||
super(ctx, new DragonflyEntityModel(ctx.bakeLayer(EndEntitiesRenders.DRAGONFLY_MODEL)), 0.5f);
|
||||
this.addLayer(new EyesLayer<DragonflyEntity, DragonflyEntityModel>(this) {
|
||||
@Override
|
||||
public RenderType renderType() {
|
||||
return GLOW;
|
||||
}
|
||||
});
|
||||
}
|
||||
public RendererEntityDragonfly(EntityRendererProvider.Context ctx) {
|
||||
super(ctx, new DragonflyEntityModel(ctx.bakeLayer(EndEntitiesRenders.DRAGONFLY_MODEL)), 0.5f);
|
||||
this.addLayer(new EyesLayer<DragonflyEntity, DragonflyEntityModel>(this) {
|
||||
@Override
|
||||
public RenderType renderType() {
|
||||
return GLOW;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureLocation(DragonflyEntity entity) {
|
||||
return TEXTURE;
|
||||
}
|
||||
@Override
|
||||
public ResourceLocation getTextureLocation(DragonflyEntity entity) {
|
||||
return TEXTURE;
|
||||
}
|
||||
}
|
|
@ -2,10 +2,8 @@ package ru.betterend.entity.render;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.MobRenderer;
|
||||
import net.minecraft.client.renderer.entity.layers.EyesLayer;
|
||||
|
@ -13,7 +11,6 @@ import net.minecraft.client.renderer.texture.OverlayTexture;
|
|||
import net.minecraft.resources.ResourceLocation;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.entity.EndFishEntity;
|
||||
import ru.betterend.entity.model.DragonflyEntityModel;
|
||||
import ru.betterend.entity.model.EndFishEntityModel;
|
||||
import ru.betterend.registry.EndEntitiesRenders;
|
||||
|
||||
|
@ -31,8 +28,8 @@ public class RendererEntityEndFish extends MobRenderer<EndFishEntity, EndFishEnt
|
|||
|
||||
@Override
|
||||
public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, EndFishEntity entity,
|
||||
float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw,
|
||||
float headPitch) {
|
||||
float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw,
|
||||
float headPitch) {
|
||||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(GLOW[entity.getVariant()]);
|
||||
this.getParentModel().renderToBuffer(matrices, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY,
|
||||
1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
|
|
@ -2,10 +2,12 @@ package ru.betterend.entity.render;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.entity.*;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.MobRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderLayerParent;
|
||||
import net.minecraft.client.renderer.entity.layers.EyesLayer;
|
||||
import net.minecraft.client.renderer.entity.layers.RenderLayer;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
|
@ -13,9 +15,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.util.Mth;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.entity.EndSlimeEntity;
|
||||
import ru.betterend.entity.model.CubozoaEntityModel;
|
||||
import ru.betterend.entity.model.EndSlimeEntityModel;
|
||||
import ru.betterend.registry.EndEntitiesRenders;
|
||||
|
||||
public class RendererEntityEndSlime extends MobRenderer<EndSlimeEntity, EndSlimeEntityModel<EndSlimeEntity>> {
|
||||
private static final ResourceLocation TEXTURE[] = new ResourceLocation[4];
|
||||
|
@ -32,8 +32,8 @@ public class RendererEntityEndSlime extends MobRenderer<EndSlimeEntity, EndSlime
|
|||
|
||||
@Override
|
||||
public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, EndSlimeEntity entity,
|
||||
float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw,
|
||||
float headPitch) {
|
||||
float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw,
|
||||
float headPitch) {
|
||||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(GLOW[entity.getSlimeType()]);
|
||||
this.getParentModel().renderToBuffer(matrices, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY,
|
||||
1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
@ -51,7 +51,7 @@ public class RendererEntityEndSlime extends MobRenderer<EndSlimeEntity, EndSlime
|
|||
|
||||
@Override
|
||||
public void render(EndSlimeEntity slimeEntity, float f, float g, PoseStack matrixStack,
|
||||
MultiBufferSource vertexConsumerProvider, int i) {
|
||||
MultiBufferSource vertexConsumerProvider, int i) {
|
||||
this.shadowRadius = 0.25F * (float) slimeEntity.getSize();
|
||||
super.render(slimeEntity, f, g, matrixStack, vertexConsumerProvider, i);
|
||||
}
|
||||
|
@ -78,14 +78,15 @@ public class RendererEntityEndSlime extends MobRenderer<EndSlimeEntity, EndSlime
|
|||
}
|
||||
|
||||
public void render(PoseStack matrixStack, MultiBufferSource vertexConsumerProvider, int i, T livingEntity,
|
||||
float f, float g, float h, float j, float k, float l) {
|
||||
float f, float g, float h, float j, float k, float l) {
|
||||
if (!livingEntity.isInvisible()) {
|
||||
if (livingEntity.isLake()) {
|
||||
VertexConsumer vertexConsumer = vertexConsumerProvider
|
||||
.getBuffer(RenderType.entityCutout(this.getTextureLocation(livingEntity)));
|
||||
this.getParentModel().renderFlower(matrixStack, vertexConsumer, i,
|
||||
LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F));
|
||||
} else if (livingEntity.isAmber() || livingEntity.isChorus()) {
|
||||
}
|
||||
else if (livingEntity.isAmber() || livingEntity.isChorus()) {
|
||||
VertexConsumer vertexConsumer = vertexConsumerProvider
|
||||
.getBuffer(RenderType.entityCutout(this.getTextureLocation(livingEntity)));
|
||||
this.getParentModel().renderCrop(matrixStack, vertexConsumer, i,
|
||||
|
|
|
@ -2,7 +2,6 @@ package ru.betterend.entity.render;
|
|||
|
||||
import net.minecraft.client.model.PlayerModel;
|
||||
import net.minecraft.client.model.geom.ModelLayers;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.HumanoidMobRenderer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
package ru.betterend.entity.render;
|
||||
|
||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.MobRenderer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.entity.SilkMothEntity;
|
||||
import ru.betterend.entity.model.CubozoaEntityModel;
|
||||
import ru.betterend.entity.model.SilkMothEntityModel;
|
||||
import ru.betterend.registry.EndEntitiesRenders;
|
||||
|
||||
public class SilkMothEntityRenderer extends MobRenderer<SilkMothEntity, SilkMothEntityModel> {
|
||||
private static final ResourceLocation TEXTURE = BetterEnd.makeID("textures/entity/silk_moth.png");
|
||||
private static final ResourceLocation TEXTURE = BetterEnd.makeID("textures/entity/silk_moth.png");
|
||||
|
||||
public SilkMothEntityRenderer(EntityRendererProvider.Context ctx) {
|
||||
super(ctx, new SilkMothEntityModel(ctx.bakeLayer(EndEntitiesRenders.SILK_MOTH_MODEL)), 0.5f);
|
||||
}
|
||||
public SilkMothEntityRenderer(EntityRendererProvider.Context ctx) {
|
||||
super(ctx, new SilkMothEntityModel(ctx.bakeLayer(EndEntitiesRenders.SILK_MOTH_MODEL)), 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureLocation(SilkMothEntity entity) {
|
||||
return TEXTURE;
|
||||
}
|
||||
@Override
|
||||
public ResourceLocation getTextureLocation(SilkMothEntity entity) {
|
||||
return TEXTURE;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue