#1209: Clean up various patches
By: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
This commit is contained in:
@@ -3,6 +3,8 @@ package org.bukkit.craftbukkit.entity;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.MinecraftKey;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectList;
|
||||
import net.minecraft.world.entity.EntityAreaEffectCloud;
|
||||
@@ -152,14 +154,14 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
|
||||
getHandle().effects.remove(existing);
|
||||
}
|
||||
getHandle().addEffect(CraftPotionUtil.fromBukkit(effect));
|
||||
getHandle().refreshEffects();
|
||||
getHandle().updateColor();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCustomEffects() {
|
||||
getHandle().effects.clear();
|
||||
getHandle().refreshEffects();
|
||||
getHandle().updateColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -199,19 +201,19 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
|
||||
return false;
|
||||
}
|
||||
getHandle().effects.remove(existing);
|
||||
getHandle().refreshEffects();
|
||||
getHandle().updateColor();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBasePotionData(PotionData data) {
|
||||
Preconditions.checkArgument(data != null, "PotionData cannot be null");
|
||||
getHandle().setPotionType(CraftPotionUtil.fromBukkit(data));
|
||||
getHandle().setPotion(BuiltInRegistries.POTION.get(new MinecraftKey(CraftPotionUtil.fromBukkit(data))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PotionData getBasePotionData() {
|
||||
return CraftPotionUtil.toBukkit(getHandle().getPotionType());
|
||||
return CraftPotionUtil.toBukkit((BuiltInRegistries.POTION.getKey(getHandle().potion)).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,6 +56,7 @@ import org.bukkit.craftbukkit.inventory.CraftEntityEquipment;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
|
||||
import org.bukkit.entity.AbstractArrow;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.DragonFireball;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
@@ -434,7 +435,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
} else if (AbstractArrow.class.isAssignableFrom(projectile)) {
|
||||
if (TippedArrow.class.isAssignableFrom(projectile)) {
|
||||
launch = new EntityTippedArrow(world, getHandle());
|
||||
((EntityTippedArrow) launch).setPotionType(CraftPotionUtil.fromBukkit(new PotionData(PotionType.WATER, false, false)));
|
||||
((Arrow) launch.getBukkitEntity()).setBasePotionData(new PotionData(PotionType.WATER, false, false));
|
||||
} else if (SpectralArrow.class.isAssignableFrom(projectile)) {
|
||||
launch = new EntitySpectralArrow(world, getHandle());
|
||||
} else if (Trident.class.isAssignableFrom(projectile)) {
|
||||
|
||||
@@ -37,16 +37,6 @@ public class CraftRabbit extends CraftAnimals implements Rabbit {
|
||||
|
||||
@Override
|
||||
public void setRabbitType(Type type) {
|
||||
EntityRabbit entity = getHandle();
|
||||
if (getRabbitType() == Type.THE_KILLER_BUNNY) {
|
||||
// Reset goals and target finders.
|
||||
World world = ((CraftWorld) this.getWorld()).getHandle();
|
||||
entity.goalSelector = new PathfinderGoalSelector(world.getProfilerSupplier());
|
||||
entity.targetSelector = new PathfinderGoalSelector(world.getProfilerSupplier());
|
||||
entity.registerGoals();
|
||||
entity.initializePathFinderGoals();
|
||||
}
|
||||
|
||||
entity.setVariant(EntityRabbit.Variant.values()[type.ordinal()]);
|
||||
getHandle().setVariant(EntityRabbit.Variant.values()[type.ordinal()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.bukkit.craftbukkit.entity;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.MinecraftKey;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectList;
|
||||
import net.minecraft.world.entity.projectile.EntityTippedArrow;
|
||||
@@ -52,14 +54,14 @@ public class CraftTippedArrow extends CraftArrow implements Arrow {
|
||||
getHandle().effects.remove(existing);
|
||||
}
|
||||
getHandle().addEffect(CraftPotionUtil.fromBukkit(effect));
|
||||
getHandle().refreshEffects();
|
||||
getHandle().updateColor();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCustomEffects() {
|
||||
getHandle().effects.clear();
|
||||
getHandle().refreshEffects();
|
||||
getHandle().updateColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,19 +101,19 @@ public class CraftTippedArrow extends CraftArrow implements Arrow {
|
||||
return false;
|
||||
}
|
||||
getHandle().effects.remove(existing);
|
||||
getHandle().refreshEffects();
|
||||
getHandle().updateColor();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBasePotionData(PotionData data) {
|
||||
Preconditions.checkArgument(data != null, "PotionData cannot be null");
|
||||
getHandle().setPotionType(CraftPotionUtil.fromBukkit(data));
|
||||
this.getHandle().potion = BuiltInRegistries.POTION.get(new MinecraftKey(CraftPotionUtil.fromBukkit(data)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PotionData getBasePotionData() {
|
||||
return CraftPotionUtil.toBukkit(getHandle().getPotionType());
|
||||
return CraftPotionUtil.toBukkit(BuiltInRegistries.POTION.getKey(this.getHandle().potion).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user