Fixed most compiletime errors

This commit is contained in:
Frank 2023-04-29 11:48:56 +02:00
parent e232184b68
commit a974fab707
58 changed files with 449 additions and 679 deletions

View file

@ -142,7 +142,7 @@ public class CubozoaEntity extends AbstractSchoolingFish {
@Override
public void playerTouch(Player player) {
if (player instanceof ServerPlayer && player.hurt(DamageSource.mobAttack(this), 0.5F)) {
if (player instanceof ServerPlayer && player.hurt(player.damageSources().mobAttack(this), 0.5F)) {
if (!this.isSilent()) {
((ServerPlayer) player).connection.send(new ClientboundGameEventPacket(
ClientboundGameEventPacket.PUFFER_FISH_STING,

View file

@ -150,7 +150,7 @@ public class DragonflyEntity extends DespawnableAnimal implements FlyingAnimal {
public void start() {
Vec3 vec3d = this.getRandomLocation();
if (vec3d != null) {
BlockPos pos = new BlockPos(vec3d);
BlockPos pos = new BlockPos((int) vec3d.x, (int) vec3d.y, (int) vec3d.z);
try {
Path path = DragonflyEntity.this.navigation.createPath(pos, 1);
if (path != null) {
@ -202,7 +202,11 @@ public class DragonflyEntity extends DespawnableAnimal implements FlyingAnimal {
}
private boolean isInVoid(Vec3 pos) {
int h = BlocksHelper.downRay(DragonflyEntity.this.level, new BlockPos(pos), 128);
int h = BlocksHelper.downRay(
DragonflyEntity.this.level,
new BlockPos((int) pos.x, (int) pos.y, (int) pos.z),
128
);
return h > 100;
}
}

View file

@ -11,10 +11,10 @@ import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.DamageTypeTags;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.EntityDamageSource;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.MobSpawnType;
@ -163,10 +163,9 @@ public class EndFishEntity extends AbstractSchoolingFish {
@Override
protected void dropFromLootTable(DamageSource source, boolean causedByPlayer) {
Item item = source.isFire() ? EndItems.END_FISH_COOKED : EndItems.END_FISH_RAW;
if (causedByPlayer && source instanceof EntityDamageSource) {
EntityDamageSource damageSource = (EntityDamageSource) source;
ItemStack handItem = ((Player) damageSource.getEntity()).getItemInHand(InteractionHand.MAIN_HAND);
Item item = source.is(DamageTypeTags.IS_FIRE) ? EndItems.END_FISH_COOKED : EndItems.END_FISH_RAW;
if (causedByPlayer) {
ItemStack handItem = ((Player) source.getEntity()).getItemInHand(InteractionHand.MAIN_HAND);
if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.FIRE_ASPECT, handItem) > 0) {
item = EndItems.END_FISH_COOKED;
}

View file

@ -64,11 +64,16 @@ public class EndSlimeEntity extends Slime {
this.goalSelector.addGoal(5, new MoveGoal());
this.targetSelector.addGoal(
1,
new NearestAttackableTargetGoal<Player>(this, Player.class, 10, true, false, (livingEntity) -> {
return Math.abs(livingEntity.getY() - this.getY()) <= 4.0D;
})
new NearestAttackableTargetGoal<>(
this,
Player.class,
10,
true,
false,
(livingEntity) -> Math.abs(livingEntity.getY() - this.getY()) <= 4.0D
)
);
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<IronGolem>(this, IronGolem.class, true));
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
}
public static AttributeSupplier.Builder createMobAttributes() {
@ -270,7 +275,11 @@ public class EndSlimeEntity extends Slime {
if (speed > 0.1) {
float dx = Mth.sin(-yaw * 0.017453292F);
float dz = Mth.cos(-yaw * 0.017453292F);
BlockPos pos = EndSlimeEntity.this.blockPosition().offset(dx * speed * 4, 0, dz * speed * 4);
BlockPos pos = EndSlimeEntity.this.blockPosition().offset(
(int) (dx * speed * 4),
0,
(int) (dz * speed * 4)
);
int down = BlocksHelper.downRay(EndSlimeEntity.this.level, pos, 16);
return down < 5;
}

View file

@ -220,7 +220,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
if (vec3d != null) {
try {
SilkMothEntity.this.navigation.moveTo(SilkMothEntity.this.navigation.createPath(
new BlockPos(vec3d),
new BlockPos((int) vec3d.x, (int) vec3d.y, (int) vec3d.z),
1
), 1.0D);
} catch (Exception e) {