Start migration

This commit is contained in:
Aleksey 2021-04-08 21:55:07 +03:00
parent 6630ce0cab
commit 47ed597358
491 changed files with 12045 additions and 11953 deletions

View file

@ -3,34 +3,34 @@ package ru.betterend.entity;
import java.util.EnumSet;
import java.util.Random;
import net.minecraft.block.BlockState;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.Flutterer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.ai.TargetFinder;
import net.minecraft.entity.ai.control.FlightMoveControl;
import net.minecraft.entity.ai.control.LookControl;
import net.minecraft.entity.ai.goal.AnimalMateGoal;
import net.minecraft.entity.ai.goal.FollowParentGoal;
import net.minecraft.entity.ai.goal.Goal;
import net.minecraft.entity.ai.goal.SwimGoal;
import net.minecraft.entity.ai.pathing.BirdNavigation;
import net.minecraft.entity.ai.pathing.EntityNavigation;
import net.minecraft.entity.ai.pathing.Path;
import net.minecraft.entity.ai.pathing.PathNodeType;
import net.minecraft.entity.attribute.DefaultAttributeContainer;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.PassiveEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Flutterer;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.SpawnReason;
import net.minecraft.world.entity.ai.TargetFinder;
import net.minecraft.world.entity.ai.control.FlightMoveControl;
import net.minecraft.world.entity.ai.control.LookControl;
import net.minecraft.world.entity.ai.goal.AnimalMateGoal;
import net.minecraft.world.entity.ai.goal.FollowParentGoal;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.ai.goal.SwimGoal;
import net.minecraft.world.entity.ai.pathing.BirdNavigation;
import net.minecraft.world.entity.ai.pathing.EntityNavigation;
import net.minecraft.world.entity.ai.pathing.Path;
import net.minecraft.world.entity.ai.pathing.PathNodeType;
import net.minecraft.world.entity.attribute.DefaultAttributeContainer;
import net.minecraft.world.entity.attribute.EntityAttributes;
import net.minecraft.world.entity.mob.MobEntity;
import net.minecraft.world.entity.passive.AnimalEntity;
import net.minecraft.world.entity.passive.PassiveEntity;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.core.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Heightmap.Type;
import net.minecraft.world.ServerWorldAccess;
import net.minecraft.world.World;
import net.minecraft.world.level.Level;
import net.minecraft.world.WorldView;
import ru.betterend.registry.EndEntities;
import ru.betterend.registry.EndSounds;
@ -38,7 +38,7 @@ import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
public class DragonflyEntity extends AnimalEntity implements Flutterer {
public DragonflyEntity(EntityType<DragonflyEntity> entityType, World world) {
public DragonflyEntity(EntityType<DragonflyEntity> entityType, Level world) {
super(entityType, world);
this.moveControl = new FlightMoveControl(this, 20, true);
this.lookControl = new DragonflyLookControl(this);
@ -48,15 +48,13 @@ public class DragonflyEntity extends AnimalEntity implements Flutterer {
}
public static DefaultAttributeContainer.Builder createMobAttributes() {
return LivingEntity.createLivingAttributes()
.add(EntityAttributes.GENERIC_MAX_HEALTH, 8.0D)
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 16.0D)
.add(EntityAttributes.GENERIC_FLYING_SPEED, 1.0D)
return LivingEntity.createLivingAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 8.0D)
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 16.0D).add(EntityAttributes.GENERIC_FLYING_SPEED, 1.0D)
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.1D);
}
@Override
protected EntityNavigation createNavigation(World world) {
protected EntityNavigation createNavigation(Level world) {
BirdNavigation birdNavigation = new BirdNavigation(this, world) {
public boolean isValidPosition(BlockPos pos) {
BlockState state = this.world.getBlockState(pos);
@ -153,8 +151,8 @@ public class DragonflyEntity extends AnimalEntity implements Flutterer {
if (path != null) {
DragonflyEntity.this.navigation.startMovingAlong(path, 1.0D);
}
} catch (Exception e) {
}
catch (Exception e) {}
}
super.start();
}
@ -188,11 +186,12 @@ public class DragonflyEntity extends AnimalEntity implements Flutterer {
}
@Override
public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) {
public PassiveEntity createChild(ServerLevel world, PassiveEntity entity) {
return EndEntities.DRAGONFLY.create(world);
}
public static boolean canSpawn(EntityType<DragonflyEntity> type, ServerWorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) {
public static boolean canSpawn(EntityType<DragonflyEntity> type, ServerWorldAccess world, SpawnReason spawnReason,
BlockPos pos, Random random) {
int y = world.getChunk(pos).sampleHeightmap(Type.WORLD_SURFACE, pos.getX() & 15, pos.getY() & 15);
return y > 0 && pos.getY() >= y;
}