Removed color provider

This commit is contained in:
paulevsGitch 2021-07-10 16:25:34 +03:00
parent 2c8862a37b
commit 4040597a6d
475 changed files with 5411 additions and 7521 deletions

View file

@ -39,19 +39,19 @@ public class CubozoaEntity extends AbstractSchoolingFish {
public static final int VARIANTS = 2;
private static final EntityDataAccessor<Byte> VARIANT = SynchedEntityData.defineId(CubozoaEntity.class, EntityDataSerializers.BYTE);
private static final EntityDataAccessor<Byte> SCALE = SynchedEntityData.defineId(CubozoaEntity.class, EntityDataSerializers.BYTE);
public CubozoaEntity(EntityType<CubozoaEntity> 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) 1);
}
if (entityTag != null) {
if (entityTag.contains("Variant")) {
this.entityData.set(VARIANT, entityTag.getByte("Variant"));
@ -60,25 +60,25 @@ public class CubozoaEntity extends AbstractSchoolingFish {
this.entityData.set(SCALE, entityTag.getByte("Scale"));
}
}
this.refreshDimensions();
return data;
}
@Override
protected void defineSynchedData() {
super.defineSynchedData();
this.entityData.define(VARIANT, (byte) 0);
this.entityData.define(SCALE, (byte) this.getRandom().nextInt(16));
}
@Override
public void addAdditionalSaveData(CompoundTag tag) {
super.addAdditionalSaveData(tag);
tag.putByte("Variant", (byte) getVariant());
tag.putByte("Scale", getByteScale());
}
@Override
public void readAdditionalSaveData(CompoundTag tag) {
super.readAdditionalSaveData(tag);
@ -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();
@ -98,26 +98,23 @@ public class CubozoaEntity extends AbstractSchoolingFish {
tag.putByte("Scale", entityData.get(SCALE));
return bucket;
}
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.5);
return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 2.0).add(Attributes.FOLLOW_RANGE, 16.0).add(Attributes.MOVEMENT_SPEED, 0.5);
}
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<CubozoaEntity> type, ServerLevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
AABB box = new AABB(pos).inflate(16);
List<CubozoaEntity> list = world.getEntitiesOfClass(CubozoaEntity.class, box, (entity) -> {
@ -125,11 +122,11 @@ public class CubozoaEntity extends AbstractSchoolingFish {
});
return list.size() < 9;
}
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);
@ -138,12 +135,12 @@ public class CubozoaEntity extends AbstractSchoolingFish {
this.level.addFreshEntity(drop);
}
}
@Override
protected SoundEvent getFlopSound() {
return SoundEvents.SALMON_FLOP;
}
@Override
public void playerTouch(Player player) {
if (player instanceof ServerPlayer && player.hurt(DamageSource.mobAttack(this), 0.5F)) {

View file

@ -50,20 +50,16 @@ public class DragonflyEntity 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, 8.0D)
.add(Attributes.FOLLOW_RANGE, 16.0D)
.add(Attributes.FLYING_SPEED, 1.0D)
.add(Attributes.MOVEMENT_SPEED, 0.1D);
return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 8.0D).add(Attributes.FOLLOW_RANGE, 16.0D).add(Attributes.FLYING_SPEED, 1.0D).add(Attributes.MOVEMENT_SPEED, 0.1D);
}
@Override
public boolean canBeLeashed(Player player) {
return false;
}
@Override
protected PathNavigation createNavigation(Level world) {
FlyingPathNavigation birdNavigation = new FlyingPathNavigation(this, world) {
@ -71,7 +67,7 @@ public class DragonflyEntity extends Animal implements FlyingAnimal {
BlockState state = this.level.getBlockState(pos);
return state.isAir() || !state.getMaterial().blocksMotion();
}
public void tick() {
super.tick();
}
@ -81,12 +77,12 @@ public class DragonflyEntity extends Animal implements FlyingAnimal {
birdNavigation.setCanPassDoors(true);
return birdNavigation;
}
@Override
public float getWalkTargetValue(BlockPos pos, LevelReader world) {
return world.getBlockState(pos).isAir() ? 10.0F : 0.0F;
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new FloatGoal(this));
@ -94,65 +90,65 @@ public class DragonflyEntity extends Animal implements FlyingAnimal {
this.goalSelector.addGoal(3, new FollowParentGoal(this, 1.0D));
this.goalSelector.addGoal(4, new WanderAroundGoal());
}
@Override
public boolean isPushable() {
return false;
}
@Override
public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) {
return false;
}
@Override
protected Entity.MovementEmission getMovementEmission() {
return Entity.MovementEmission.EVENTS;
}
@Override
public boolean isFlying() {
return !this.onGround;
}
@Override
public boolean isNoGravity() {
return true;
}
@Override
public SoundEvent getAmbientSound() {
return EndSounds.ENTITY_DRAGONFLY;
}
@Override
protected float getSoundVolume() {
return MHelper.randRange(0.25F, 0.5F, random);
}
class DragonflyLookControl extends LookControl {
DragonflyLookControl(Mob entity) {
super(entity);
}
protected boolean resetXRotOnTick() {
return true;
}
}
class WanderAroundGoal extends Goal {
WanderAroundGoal() {
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
}
public boolean canUse() {
return DragonflyEntity.this.navigation.isDone() && DragonflyEntity.this.random.nextInt(10) == 0;
}
public boolean canContinueToUse() {
return DragonflyEntity.this.navigation.isInProgress();
}
public void start() {
Vec3 vec3d = this.getRandomLocation();
if (vec3d != null) {
@ -168,7 +164,7 @@ public class DragonflyEntity extends Animal implements FlyingAnimal {
}
super.start();
}
private Vec3 getRandomLocation() {
int h = BlocksHelper.downRay(DragonflyEntity.this.level, DragonflyEntity.this.blockPosition(), 16);
Vec3 rotation = DragonflyEntity.this.getViewVector(0.0F);
@ -190,18 +186,18 @@ public class DragonflyEntity extends Animal implements FlyingAnimal {
}
return AirAndWaterRandomPos.getPos(DragonflyEntity.this, 8, 4, -2, rotation.x, rotation.z, 1.5707963705062866D);
}
private boolean isInVoid(Vec3 pos) {
int h = BlocksHelper.downRay(DragonflyEntity.this.level, new BlockPos(pos), 128);
return h > 100;
}
}
@Override
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;

View file

@ -36,19 +36,19 @@ public class EndFishEntity extends AbstractSchoolingFish {
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,25 +57,25 @@ 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);
tag.putByte("Variant", (byte) getVariant());
tag.putByte("Scale", getByteScale());
}
@Override
public void readAdditionalSaveData(CompoundTag tag) {
super.readAdditionalSaveData(tag);
@ -86,7 +86,7 @@ public class EndFishEntity extends AbstractSchoolingFish {
this.entityData.set(SCALE, tag.getByte("Scale"));
}
}
@Override
public ItemStack getBucketItemStack() {
ItemStack bucket = EndItems.BUCKET_END_FISH.getDefaultInstance();
@ -95,27 +95,27 @@ public class EndFishEntity extends AbstractSchoolingFish {
tag.putByte("scale", entityData.get(SCALE));
return bucket;
}
@Override
protected SoundEvent getFlopSound() {
return SoundEvents.TROPICAL_FISH_FLOP;
}
@Override
protected SoundEvent getAmbientSound() {
return SoundEvents.SALMON_AMBIENT;
}
@Override
protected SoundEvent getDeathSound() {
return SoundEvents.SALMON_DEATH;
}
@Override
protected SoundEvent getHurtSound(DamageSource source) {
return SoundEvents.SALMON_HURT;
}
@Override
public void tick() {
super.tick();
@ -126,26 +126,23 @@ 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);
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) -> {
@ -153,7 +150,7 @@ public class EndFishEntity extends AbstractSchoolingFish {
});
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));

View file

@ -48,12 +48,12 @@ 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,15 +64,11 @@ 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)
.add(Attributes.ATTACK_DAMAGE, 1.0D)
.add(Attributes.FOLLOW_RANGE, 16.0D)
.add(Attributes.MOVEMENT_SPEED, 0.15D);
return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 1.0D).add(Attributes.ATTACK_DAMAGE, 1.0D).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);
@ -89,19 +85,19 @@ public class EndSlimeEntity extends Slime {
this.refreshDimensions();
return data;
}
@Override
protected void defineSynchedData() {
super.defineSynchedData();
this.entityData.define(VARIANT, (byte) 0);
}
@Override
public void addAdditionalSaveData(CompoundTag tag) {
super.addAdditionalSaveData(tag);
tag.putByte("Variant", (byte) getSlimeType());
}
@Override
public void readAdditionalSaveData(CompoundTag tag) {
super.readAdditionalSaveData(tag);
@ -109,12 +105,12 @@ public class EndSlimeEntity extends Slime {
this.entityData.set(VARIANT, tag.getByte("Variant"));
}
}
@Override
protected ParticleOptions getParticleType() {
return ParticleTypes.PORTAL;
}
@Override
public void remove(RemovalReason reason) {
int i = this.getSize();
@ -125,7 +121,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;
@ -133,7 +129,7 @@ public class EndSlimeEntity extends Slime {
if (this.isPersistenceRequired()) {
slimeEntity.setPersistenceRequired();
}
slimeEntity.setSlimeType(type);
slimeEntity.setCustomName(text);
slimeEntity.setNoAi(bl);
@ -144,10 +140,10 @@ public class EndSlimeEntity extends Slime {
this.level.addFreshEntity(slimeEntity);
}
}
((ISlime) this).entityRemove(reason);
}
@Override
protected void dropFromLootTable(DamageSource source, boolean causedByPlayer) {
int maxCount = this.getSize();
@ -163,52 +159,52 @@ 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);
}
public boolean isMossy() {
return getSlimeType() == 1;
}
protected void setLake() {
setSlimeType(2);
}
public boolean isLake() {
return getSlimeType() == 2;
}
protected void setAmber(boolean mossy) {
this.entityData.set(VARIANT, (byte) 3);
}
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) -> {
@ -216,7 +212,7 @@ public class EndSlimeEntity extends Slime {
});
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);
@ -232,17 +228,17 @@ public class EndSlimeEntity extends Slime {
}
return false;
}
class MoveGoal extends Goal {
public MoveGoal() {
this.setFlags(EnumSet.of(Goal.Flag.JUMP, Goal.Flag.MOVE));
}
public boolean canUse() {
if (EndSlimeEntity.this.isPassenger()) {
return false;
}
float yaw = EndSlimeEntity.this.getYHeadRot();
float speed = EndSlimeEntity.this.getSpeed();
if (speed > 0.1) {
@ -252,70 +248,63 @@ public class EndSlimeEntity extends Slime {
int down = BlocksHelper.downRay(EndSlimeEntity.this.level, pos, 16);
return down < 5;
}
return true;
}
public void tick() {
((EndSlimeMoveControl) EndSlimeEntity.this.getMoveControl()).move(1.0D);
}
}
class SwimmingGoal extends Goal {
public SwimmingGoal() {
this.setFlags(EnumSet.of(Goal.Flag.JUMP, Goal.Flag.MOVE));
EndSlimeEntity.this.getNavigation().setCanFloat(true);
}
public boolean canUse() {
return (EndSlimeEntity.this.isInWater()
|| EndSlimeEntity.this.isInLava())
&& EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
return (EndSlimeEntity.this.isInWater() || EndSlimeEntity.this.isInLava()) && EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
}
public void tick() {
if (EndSlimeEntity.this.getRandom().nextFloat() < 0.8F) {
EndSlimeEntity.this.getJumpControl().jump();
}
((EndSlimeMoveControl) EndSlimeEntity.this.getMoveControl()).move(1.2D);
}
}
class RandomLookGoal extends Goal {
private float targetYaw;
private int timer;
public RandomLookGoal() {
this.setFlags(EnumSet.of(Goal.Flag.LOOK));
}
public boolean canUse() {
return EndSlimeEntity.this.getTarget() == null
&& (EndSlimeEntity.this.onGround
|| EndSlimeEntity.this.isInWater()
|| EndSlimeEntity.this.isInLava()
|| EndSlimeEntity.this.hasEffect(MobEffects.LEVITATION))
&& EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
return EndSlimeEntity.this.getTarget() == null && (EndSlimeEntity.this.onGround || EndSlimeEntity.this.isInWater() || EndSlimeEntity.this.isInLava() || EndSlimeEntity.this.hasEffect(MobEffects.LEVITATION)) && EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
}
public void tick() {
if (--this.timer <= 0) {
this.timer = 40 + EndSlimeEntity.this.getRandom().nextInt(60);
this.targetYaw = (float) EndSlimeEntity.this.getRandom().nextInt(360);
}
((EndSlimeMoveControl) EndSlimeEntity.this.getMoveControl()).look(this.targetYaw, false);
}
}
class FaceTowardTargetGoal extends Goal {
private int ticksLeft;
public FaceTowardTargetGoal() {
this.setFlags(EnumSet.of(Goal.Flag.LOOK));
}
public boolean canUse() {
LivingEntity livingEntity = EndSlimeEntity.this.getTarget();
if (livingEntity == null) {
@ -328,12 +317,12 @@ public class EndSlimeEntity extends Slime {
return livingEntity instanceof Player && ((Player) livingEntity).getAbilities().invulnerable ? false : EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
}
}
public void start() {
this.ticksLeft = 300;
super.start();
}
public boolean canContinueToUse() {
LivingEntity livingEntity = EndSlimeEntity.this.getTarget();
if (livingEntity == null) {
@ -349,33 +338,33 @@ public class EndSlimeEntity extends Slime {
return --this.ticksLeft > 0;
}
}
public void tick() {
EndSlimeEntity.this.lookAt(EndSlimeEntity.this.getTarget(), 10.0F, 10.0F);
((EndSlimeMoveControl) EndSlimeEntity.this.getMoveControl()).look(EndSlimeEntity.this.getYRot(), EndSlimeEntity.this.isDealsDamage());
}
}
class EndSlimeMoveControl extends MoveControl {
private float targetYaw;
private int ticksUntilJump;
private boolean jumpOften;
public EndSlimeMoveControl(EndSlimeEntity slime) {
super(slime);
this.targetYaw = 180.0F * slime.getYRot() / 3.1415927F;
}
public void look(float targetYaw, boolean jumpOften) {
this.targetYaw = targetYaw;
this.jumpOften = jumpOften;
}
public void move(double speed) {
this.speedModifier = speed;
this.operation = MoveControl.Operation.MOVE_TO;
}
public void tick() {
this.mob.setYRot(this.rotlerp(this.mob.getYRot(), this.targetYaw, 90.0F));
this.mob.yHeadRot = this.mob.getYRot();
@ -392,7 +381,7 @@ public class EndSlimeEntity extends Slime {
if (this.jumpOften) {
this.ticksUntilJump /= 3;
}
EndSlimeEntity.this.getJumpControl().jump();
if (EndSlimeEntity.this.doPlayJumpSound()) {
EndSlimeEntity.this.playSound(EndSlimeEntity.this.getJumpSound(), EndSlimeEntity.this.getSoundVolume(), getJumpSoundPitch());
@ -407,10 +396,10 @@ public class EndSlimeEntity extends Slime {
else {
this.mob.setSpeed((float) (this.speedModifier * this.mob.getAttributeValue(Attributes.MOVEMENT_SPEED)));
}
}
}
private float getJumpSoundPitch() {
float f = EndSlimeEntity.this.isTiny() ? 1.4F : 0.8F;
return ((EndSlimeEntity.this.random.nextFloat() - EndSlimeEntity.this.random.nextFloat()) * 0.2F + 1.0F) * f;

View file

@ -33,7 +33,7 @@ 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));
@ -42,65 +42,48 @@ public class ShadowWalkerEntity extends Monster {
this.goalSelector.addGoal(8, new RandomLookAroundGoal(this));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<Player>(this, Player.class, true));
}
public static AttributeSupplier.Builder createMobAttributes() {
return Monster.createMonsterAttributes()
.add(Attributes.FOLLOW_RANGE, 35.0)
.add(Attributes.MOVEMENT_SPEED, 0.15)
.add(Attributes.ATTACK_DAMAGE, 4.5)
.add(Attributes.ARMOR, 2.0)
.add(Attributes.SPAWN_REINFORCEMENTS_CHANCE);
return Monster.createMonsterAttributes().add(Attributes.FOLLOW_RANGE, 35.0).add(Attributes.MOVEMENT_SPEED, 0.15).add(Attributes.ATTACK_DAMAGE, 4.5).add(Attributes.ARMOR, 2.0).add(Attributes.SPAWN_REINFORCEMENTS_CHANCE);
}
@Override
public void tick() {
super.tick();
level.addParticle(ParticleTypes.ASH,
getX() + random.nextGaussian() * 0.2,
getY() + random.nextGaussian() * 0.5 + 1,
getZ() + random.nextGaussian() * 0.2,
0, 0, 0);
level.addParticle(ParticleTypes.SMOKE,
getX() + random.nextGaussian() * 0.2,
getY() + random.nextGaussian() * 0.5 + 1,
getZ() + random.nextGaussian() * 0.2,
0, 0, 0);
level.addParticle(ParticleTypes.ENTITY_EFFECT,
getX() + random.nextGaussian() * 0.2,
getY() + random.nextGaussian() * 0.5 + 1,
getZ() + random.nextGaussian() * 0.2,
0, 0, 0);
level.addParticle(ParticleTypes.ASH, getX() + random.nextGaussian() * 0.2, getY() + random.nextGaussian() * 0.5 + 1, getZ() + random.nextGaussian() * 0.2, 0, 0, 0);
level.addParticle(ParticleTypes.SMOKE, getX() + random.nextGaussian() * 0.2, getY() + random.nextGaussian() * 0.5 + 1, getZ() + random.nextGaussian() * 0.2, 0, 0, 0);
level.addParticle(ParticleTypes.ENTITY_EFFECT, getX() + random.nextGaussian() * 0.2, getY() + random.nextGaussian() * 0.5 + 1, getZ() + random.nextGaussian() * 0.2, 0, 0, 0);
}
@Override
protected SoundEvent getAmbientSound() {
return EndSounds.ENTITY_SHADOW_WALKER;
}
@Override
protected SoundEvent getHurtSound(DamageSource source) {
return EndSounds.ENTITY_SHADOW_WALKER_DAMAGE;
}
@Override
protected SoundEvent getDeathSound() {
return EndSounds.ENTITY_SHADOW_WALKER_DEATH;
}
@Override
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);
@ -112,7 +95,7 @@ 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);
@ -123,26 +106,26 @@ public class ShadowWalkerEntity extends Monster {
}
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;
}
public void start() {
super.start();
this.ticks = 0;
}
public void stop() {
super.stop();
this.walker.setAggressive(false);
}
public void tick() {
super.tick();
++this.ticks;

View file

@ -59,7 +59,7 @@ 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);
@ -68,25 +68,21 @@ 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)
.add(Attributes.FOLLOW_RANGE, 16.0D)
.add(Attributes.FLYING_SPEED, 0.4D)
.add(Attributes.MOVEMENT_SPEED, 0.1D);
return LivingEntity.createLivingAttributes().add(Attributes.MAX_HEALTH, 2.0D).add(Attributes.FOLLOW_RANGE, 16.0D).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) {
@ -94,7 +90,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")) {
@ -109,7 +105,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
}
}
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new ReturnToHiveGoal());
@ -118,7 +114,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) {
@ -126,7 +122,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
BlockState state = this.level.getBlockState(pos);
return state.isAir() || !state.getMaterial().blocksMotion();
}
public void tick() {
super.tick();
}
@ -136,37 +132,37 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
birdNavigation.setCanPassDoors(true);
return birdNavigation;
}
@Override
public boolean isPushable() {
return false;
}
@Override
public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) {
return false;
}
@Override
protected Entity.MovementEmission getMovementEmission() {
return Entity.MovementEmission.EVENTS;
}
@Override
public boolean isFlying() {
return !this.onGround;
}
@Override
public boolean isNoGravity() {
return true;
}
@Override
public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) {
return EndEntities.SILK_MOTH.create(world);
}
@Override
protected void dropFromLootTable(DamageSource source, boolean causedByPlayer) {
int minCount = 0;
@ -183,43 +179,43 @@ 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);
}
protected boolean resetXRotOnTick() {
return true;
}
}
class WanderAroundGoal extends Goal {
WanderAroundGoal() {
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
}
@Override
public boolean canUse() {
return SilkMothEntity.this.navigation.isDone() && SilkMothEntity.this.random.nextInt(10) == 0;
}
@Override
public boolean canContinueToUse() {
return SilkMothEntity.this.navigation.isInProgress();
}
@Override
public void start() {
Vec3 vec3d = null;
@ -237,7 +233,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
}
}
}
@Nullable
private Vec3 getRandomLocation() {
Vec3 vec3d3 = SilkMothEntity.this.getViewVector(0.0F);
@ -245,26 +241,22 @@ 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
&& SilkMothEntity.this.hiveWorld == SilkMothEntity.this.level
&& SilkMothEntity.this.navigation.isDone()
&& SilkMothEntity.this.random.nextInt(16) == 0
&& SilkMothEntity.this.position().distanceToSqr(SilkMothEntity.this.hivePos.getX(), SilkMothEntity.this.hivePos.getY(), SilkMothEntity.this.hivePos.getZ()) < 64;
return SilkMothEntity.this.hivePos != null && SilkMothEntity.this.hiveWorld == SilkMothEntity.this.level && SilkMothEntity.this.navigation.isDone() && 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);
@ -279,7 +271,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
catch (Exception e) {
}
}
@Override
public void tick() {
super.tick();

View file

@ -12,11 +12,11 @@ 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;

View file

@ -15,71 +15,53 @@ import ru.betterend.entity.CubozoaEntity;
public class CubozoaEntityModel extends BlockBenchModel<CubozoaEntity> {
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;
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)
);
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));
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));
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
)
);
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));
PartDefinition tentaclePart = bodyPart.addOrReplaceChild("tentacle_center_" + i, CubeListBuilder.create(), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, i * 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));
}
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();

View file

@ -23,99 +23,37 @@ public class DragonflyEntityModel extends BlockBenchModel<DragonflyEntity> {
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();
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)
);
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)
);
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)
);
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_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_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_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)
);
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));
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));
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));
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_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_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_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));
return LayerDefinition.create(modelData, 64, 64);
}
public DragonflyEntityModel(ModelPart modelPart) {
super(RenderType::entityCutout);
model = modelPart.getChild(PartNames.BODY);
head = model.getChild(PartNames.HEAD);
tail = model.getChild(PartNames.TAIL);
@ -127,24 +65,24 @@ public class DragonflyEntityModel extends BlockBenchModel<DragonflyEntity> {
legs_1 = model.getChild(PartNames.LEFT_LEG);
legs_2 = model.getChild(PartNames.RIGHT_LEG);
}
@Override
public void setupAnim(DragonflyEntity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) {
float progress = animationProgress * 2F;
wing_1.zRot = 0.3491F + (float) Math.sin(progress) * 0.3491F;
wing_2.zRot = -wing_1.zRot;
wing_3.zRot = 0.3491F + (float) Math.cos(progress) * 0.3491F;
wing_4.zRot = -wing_3.zRot;
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);

View file

@ -19,66 +19,29 @@ public class EndFishEntityModel extends BlockBenchModel<EndFishEntity> {
private final ModelPart flipper;
private final ModelPart fin_right;
private final ModelPart fin_left;
public static LayerDefinition getTexturedModelData() {
MeshDefinition modelData = new MeshDefinition();
PartDefinition modelPartData = modelData.getRoot();
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)
);
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)
);
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)
);
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)
);
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)
);
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)
);
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));
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));
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));
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));
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));
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));
return LayerDefinition.create(modelData, 32, 32);
}
public EndFishEntityModel(ModelPart modelPart) {
super(RenderType::entityCutout);
model = modelPart.getChild(PartNames.BODY);
fin_top = model.getChild(PartNames.TOP_FIN);
fin_bottom = model.getChild(PartNames.BOTTOM_FIN);
@ -86,7 +49,7 @@ public class EndFishEntityModel extends BlockBenchModel<EndFishEntity> {
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) {
float s1 = (float) Math.sin(animationProgress * 0.1);
@ -97,7 +60,7 @@ public class EndFishEntityModel extends BlockBenchModel<EndFishEntity> {
fin_left.yRot = s1 * 0.3F - 0.7854F;
fin_right.yRot = 0.7854F - s1 * 0.3F;
}
@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);

View file

@ -24,91 +24,53 @@ public class EndSlimeEntityModel<T extends EndSlimeEntity> extends ListModel<T>
private final ModelPart mouth;
private final ModelPart flower;
private final ModelPart crop;
public static LayerDefinition getShellOnlyTexturedModelData() {
return getTexturedModelData(true);
}
public static LayerDefinition getCompleteTexturedModelData() {
return getTexturedModelData(false);
}
private static LayerDefinition getTexturedModelData(boolean onlyShell) {
MeshDefinition modelData = new MeshDefinition();
PartDefinition modelPartData = modelData.getRoot();
if (onlyShell) {
modelPartData.addOrReplaceChild(PartNames.BODY,
CubeListBuilder
.create()
.texOffs(0, 0)
.addBox(-4.0F, 16.0F, -4.0F, 8.0F, 8.0F, 8.0F),
PartPose.ZERO
);
modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, 16.0F, -4.0F, 8.0F, 8.0F, 8.0F), 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
);
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
);
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
);
modelPartData.addOrReplaceChild(PartNames.MOUTH,
CubeListBuilder
.create()
.texOffs(32, 8)
.addBox(0.0F, 21.0F, -3.5F, 1.0F, 1.0F, 1.0F),
PartPose.ZERO
);
modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create().texOffs(0, 16).addBox(-3.0F, 17.0F, -3.0F, 6.0F, 6.0F, 6.0F), PartPose.ZERO);
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);
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);
modelPartData.addOrReplaceChild(PartNames.MOUTH, CubeListBuilder.create().texOffs(32, 8).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));
PartDefinition petalRotPart = parent.addOrReplaceChild("petalRot_" + i,
CubeListBuilder.create(),
PartPose.offsetAndRotation(0, 0, 0, 0, rot, 0));
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)
);
PartDefinition petalRotPart = parent.addOrReplaceChild("petalRot_" + i, CubeListBuilder.create(), PartPose.offsetAndRotation(0, 0, 0, 0, rot, 0));
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));
}
}
return LayerDefinition.create(modelData, 64, 32);
}
public EndSlimeEntityModel(EntityModelSet modelSet, boolean onlyShell) {
super(RenderType::entityCutout);
ModelPart modelPart = modelSet.bakeLayer(onlyShell ? EndEntitiesRenders.END_SLIME_SHELL_MODEL : EndEntitiesRenders.END_SLIME_MODEL);
innerCube = modelPart.getChild(PartNames.BODY);
if (!onlyShell) {
rightEye = modelPart.getChild(PartNames.RIGHT_EYE);
@ -125,23 +87,23 @@ public class EndSlimeEntityModel<T extends EndSlimeEntity> extends ListModel<T>
crop = null;
}
}
@Override
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) {
flower.render(matrices, vertices, light, overlay);
}
public void renderCrop(PoseStack matrices, VertexConsumer vertices, int light, int overlay) {
crop.render(matrices, vertices, light, overlay);
}
private boolean isOnlyShell() {
return rightEye == null;
}
@Override
public Iterable<ModelPart> parts() {
if (isOnlyShell()) {

View file

@ -29,136 +29,47 @@ public class SilkMothEntityModel extends BlockBenchModel<SilkMothEntity> {
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();
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_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)
);
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_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)
);
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_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)
);
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("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)
);
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_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));
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_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));
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_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));
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("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));
return LayerDefinition.create(modelData, 64, 64);
}
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");
@ -175,7 +86,7 @@ public class SilkMothEntityModel extends BlockBenchModel<SilkMothEntity> {
wingL_r1 = bb_main.getChild(PartNames.LEFT_WING);
abdomen_r1 = bb_main.getChild("abdomen_r1");
}
@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;
@ -187,7 +98,7 @@ public class SilkMothEntityModel extends BlockBenchModel<SilkMothEntity> {
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);

View file

@ -17,7 +17,7 @@ import ru.betterend.registry.EndEntitiesRenders;
public class RendererEntityCubozoa extends MobRenderer<CubozoaEntity, CubozoaEntityModel> {
private static final ResourceLocation[] TEXTURE = new ResourceLocation[2];
private static final RenderType[] GLOW = new RenderType[2];
public RendererEntityCubozoa(EntityRendererProvider.Context ctx) {
super(ctx, new CubozoaEntityModel(ctx.bakeLayer(EndEntitiesRenders.CUBOZOA_MODEL)), 0.5f);
this.addLayer(new EyesLayer<CubozoaEntity, CubozoaEntityModel>(this) {
@ -25,7 +25,7 @@ public class RendererEntityCubozoa extends MobRenderer<CubozoaEntity, CubozoaEnt
public RenderType renderType() {
return GLOW[0];
}
@Override
public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, CubozoaEntity entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(GLOW[entity.getVariant()]);
@ -33,22 +33,22 @@ public class RendererEntityCubozoa extends MobRenderer<CubozoaEntity, CubozoaEnt
}
});
}
@Override
protected void scale(CubozoaEntity entity, PoseStack matrixStack, float f) {
float scale = entity.getScale();
matrixStack.scale(scale, scale, scale);
}
@Override
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"));
}

View file

@ -13,7 +13,7 @@ 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"));
public RendererEntityDragonfly(EntityRendererProvider.Context ctx) {
super(ctx, new DragonflyEntityModel(ctx.bakeLayer(EndEntitiesRenders.DRAGONFLY_MODEL)), 0.5f);
this.addLayer(new EyesLayer<DragonflyEntity, DragonflyEntityModel>(this) {
@ -23,7 +23,7 @@ public class RendererEntityDragonfly extends MobRenderer<DragonflyEntity, Dragon
}
});
}
@Override
public ResourceLocation getTextureLocation(DragonflyEntity entity) {
return TEXTURE;

View file

@ -17,7 +17,7 @@ import ru.betterend.registry.EndEntitiesRenders;
public class RendererEntityEndFish extends MobRenderer<EndFishEntity, EndFishEntityModel> {
private static final ResourceLocation[] TEXTURE = new ResourceLocation[EndFishEntity.VARIANTS];
private static final RenderType[] GLOW = new RenderType[EndFishEntity.VARIANTS];
public RendererEntityEndFish(EntityRendererProvider.Context ctx) {
super(ctx, new EndFishEntityModel(ctx.bakeLayer(EndEntitiesRenders.END_FISH_MODEL)), 0.5f);
this.addLayer(new EyesLayer<EndFishEntity, EndFishEntityModel>(this) {
@ -25,29 +25,26 @@ public class RendererEntityEndFish extends MobRenderer<EndFishEntity, EndFishEnt
public RenderType renderType() {
return GLOW[0];
}
@Override
public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, EndFishEntity entity,
float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw,
float headPitch) {
public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, EndFishEntity entity, 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);
this.getParentModel().renderToBuffer(matrices, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
}
});
}
@Override
protected void scale(EndFishEntity entity, PoseStack matrixStack, float f) {
float scale = entity.getScale();
matrixStack.scale(scale, scale, scale);
}
@Override
public ResourceLocation getTextureLocation(EndFishEntity entity) {
return TEXTURE[entity.getVariant()];
}
static {
for (int i = 0; i < EndFishEntity.VARIANTS; i++) {
TEXTURE[i] = BetterEnd.makeID("textures/entity/end_fish/end_fish_" + i + ".png");

View file

@ -20,7 +20,7 @@ import ru.betterend.entity.model.EndSlimeEntityModel;
public class RendererEntityEndSlime extends MobRenderer<EndSlimeEntity, EndSlimeEntityModel<EndSlimeEntity>> {
private static final ResourceLocation TEXTURE[] = new ResourceLocation[4];
private static final RenderType GLOW[] = new RenderType[4];
public RendererEntityEndSlime(EntityRendererProvider.Context ctx) {
super(ctx, new EndSlimeEntityModel<>(ctx.getModelSet(), false), 0.25f);
this.addLayer(new OverlayFeatureRenderer<EndSlimeEntity>(this, ctx));
@ -29,33 +29,29 @@ public class RendererEntityEndSlime extends MobRenderer<EndSlimeEntity, EndSlime
public RenderType renderType() {
return GLOW[0];
}
@Override
public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, EndSlimeEntity entity,
float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw,
float headPitch) {
public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, EndSlimeEntity entity, 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);
this.getParentModel().renderToBuffer(matrices, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
if (entity.isLake()) {
this.getParentModel().renderFlower(matrices, vertexConsumer, 15728640, OverlayTexture.NO_OVERLAY);
}
}
});
}
@Override
public ResourceLocation getTextureLocation(EndSlimeEntity entity) {
return TEXTURE[entity.getSlimeType()];
}
@Override
public void render(EndSlimeEntity slimeEntity, float f, float g, PoseStack matrixStack,
MultiBufferSource vertexConsumerProvider, int i) {
public void render(EndSlimeEntity slimeEntity, float f, float g, PoseStack matrixStack, MultiBufferSource vertexConsumerProvider, int i) {
this.shadowRadius = 0.25F * (float) slimeEntity.getSize();
super.render(slimeEntity, f, g, matrixStack, vertexConsumerProvider, i);
}
@Override
protected void scale(EndSlimeEntity slimeEntity, PoseStack matrixStack, float f) {
matrixStack.scale(0.999F, 0.999F, 0.999F);
@ -65,46 +61,38 @@ public class RendererEntityEndSlime extends MobRenderer<EndSlimeEntity, EndSlime
float j = 1.0F / (i + 1.0F);
matrixStack.scale(j * h, 1.0F / j * h, j * h);
}
private final class OverlayFeatureRenderer<T extends EndSlimeEntity>
extends RenderLayer<T, EndSlimeEntityModel<T>> {
private final class OverlayFeatureRenderer<T extends EndSlimeEntity> extends RenderLayer<T, EndSlimeEntityModel<T>> {
private final EndSlimeEntityModel<T> modelOrdinal;
private final EndSlimeEntityModel<T> modelLake;
public OverlayFeatureRenderer(RenderLayerParent<T, EndSlimeEntityModel<T>> featureRendererContext, EntityRendererProvider.Context ctx) {
super(featureRendererContext);
modelOrdinal = new EndSlimeEntityModel<>(ctx.getModelSet(), true);
modelLake = new EndSlimeEntityModel<>(ctx.getModelSet(), true);
}
public void render(PoseStack matrixStack, MultiBufferSource vertexConsumerProvider, int i, T livingEntity,
float f, float g, float h, float j, float k, float l) {
public void render(PoseStack matrixStack, MultiBufferSource vertexConsumerProvider, int i, T livingEntity, 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));
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()) {
VertexConsumer vertexConsumer = vertexConsumerProvider
.getBuffer(RenderType.entityCutout(this.getTextureLocation(livingEntity)));
this.getParentModel().renderCrop(matrixStack, vertexConsumer, i,
LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F));
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderType.entityCutout(this.getTextureLocation(livingEntity)));
this.getParentModel().renderCrop(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F));
}
EndSlimeEntityModel<T> model = livingEntity.getSlimeType() == 1 ? modelLake : modelOrdinal;
this.getParentModel().copyPropertiesTo(model);
model.prepareMobModel(livingEntity, f, g, h);
model.setupAnim(livingEntity, f, g, j, k, l);
VertexConsumer vertexConsumer = vertexConsumerProvider
.getBuffer(RenderType.entityTranslucent(this.getTextureLocation(livingEntity)));
model.renderToBuffer(matrixStack, vertexConsumer, i,
LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F), 1.0F, 1.0F, 1.0F, 1.0F);
VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderType.entityTranslucent(this.getTextureLocation(livingEntity)));
model.renderToBuffer(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F), 1.0F, 1.0F, 1.0F, 1.0F);
}
}
}
static {
TEXTURE[0] = BetterEnd.makeID("textures/entity/end_slime/end_slime.png");
TEXTURE[1] = BetterEnd.makeID("textures/entity/end_slime/end_slime_mossy.png");

View file

@ -8,15 +8,14 @@ import net.minecraft.resources.ResourceLocation;
import ru.betterend.BetterEnd;
import ru.betterend.entity.ShadowWalkerEntity;
public class RendererEntityShadowWalker
extends HumanoidMobRenderer<ShadowWalkerEntity, PlayerModel<ShadowWalkerEntity>> {
public class RendererEntityShadowWalker extends HumanoidMobRenderer<ShadowWalkerEntity, PlayerModel<ShadowWalkerEntity>> {
private static final ResourceLocation TEXTURE = BetterEnd.makeID("textures/entity/shadow_walker.png");
public RendererEntityShadowWalker(EntityRendererProvider.Context ctx) {
super(ctx, new PlayerModel<ShadowWalkerEntity>(ctx.bakeLayer(ModelLayers.PLAYER), false), 0.5F);
//super(entityRenderDispatcher, new PlayerModel<ShadowWalkerEntity>(0.0F, false), 0.5F);
}
@Override
public ResourceLocation getTextureLocation(ShadowWalkerEntity zombieEntity) {
return TEXTURE;

View file

@ -10,11 +10,11 @@ import ru.betterend.registry.EndEntitiesRenders;
public class SilkMothEntityRenderer extends MobRenderer<SilkMothEntity, SilkMothEntityModel> {
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);
}
@Override
public ResourceLocation getTextureLocation(SilkMothEntity entity) {
return TEXTURE;