Replaced deprecated CreatureType with EntityType and removed the spider-jump feature
This commit is contained in:
parent
1dccd1deb5
commit
62079ec6cc
@ -109,8 +109,6 @@ public class BloodMoon extends JavaPlugin {
|
||||
this.manager.registerEvents(new FireArrowsListener(), this);
|
||||
}
|
||||
|
||||
// spider-jump is handled in BloodMoonEntitySpider
|
||||
|
||||
if (BloodMoon.config.getBoolean("features.double-health.enabled")){
|
||||
this.manager.registerEvents(new DoubleHealthListener(), this);
|
||||
}
|
||||
|
@ -30,9 +30,6 @@ public class BloodMoonConfig {
|
||||
this.configDefaults.put("features.fire-arrows.enabled", true);
|
||||
this.configDefaults.put("features.fire-arrows.ignight-target", true);
|
||||
|
||||
this.configDefaults.put("features.spider-jump.enabled", true);
|
||||
this.configDefaults.put("features.spider-jump.multiplier", 2.0D);
|
||||
|
||||
this.configDefaults.put("features.break-blocks.enabled", true);
|
||||
this.configDefaults.put("features.break-blocks.realistic-drop", false);
|
||||
this.configDefaults.put("features.break-blocks.mobs", Arrays.asList("ZOMBIE", "SKELETON", "SPIDER", "CREEPER", "ENDERMAN"));
|
||||
|
@ -3,53 +3,16 @@ package uk.co.jacekk.bukkit.bloodmoon.entities;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Spider;
|
||||
|
||||
import uk.co.jacekk.bukkit.bloodmoon.BloodMoon;
|
||||
import uk.co.jacekk.bukkit.bloodmoon.events.SpiderMoveEvent;
|
||||
|
||||
import net.minecraft.server.Entity;
|
||||
import net.minecraft.server.MathHelper;
|
||||
import net.minecraft.server.World;
|
||||
|
||||
public class BloodMoonEntitySpider extends net.minecraft.server.EntitySpider {
|
||||
|
||||
private boolean bloodMoonState;
|
||||
|
||||
public BloodMoonEntitySpider(World world){
|
||||
super(world);
|
||||
|
||||
this.bloodMoonState = BloodMoon.bloodMoonWorlds.contains(world.worldData.name);
|
||||
}
|
||||
/*
|
||||
protected void a(Entity entity, float f){
|
||||
float f1 = this.a(1.0F);
|
||||
|
||||
if (f1 > 0.5F && this.random.nextInt(100) == 0){
|
||||
this.target = null;
|
||||
}else{
|
||||
double multiplier = BloodMoon.config.getDouble("features.spider-jump.multiplier");
|
||||
|
||||
if (f > 2.0F * multiplier && f < 6.0D * multiplier && this.random.nextInt(10) == 0){
|
||||
if (this.onGround){
|
||||
double d0 = entity.locX - this.locX;
|
||||
double d1 = entity.locZ - this.locZ;
|
||||
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1);
|
||||
|
||||
if (this.bloodMoonState && BloodMoon.config.getBoolean("features.spider-jump.enabled")){
|
||||
this.motX = multiplier * (d0 / (double) f2 * 0.5D * 0.800000011920929D + this.motX * 0.20000000298023224D);
|
||||
this.motZ = multiplier * (d1 / (double) f2 * 0.5D * 0.800000011920929D + this.motZ * 0.20000000298023224D);
|
||||
this.motY = multiplier * 0.5 * 0.4000000059604645D;
|
||||
}else{
|
||||
this.motX = d0 / (double) f2 * 0.5D * 0.800000011920929D + this.motX * 0.20000000298023224D;
|
||||
this.motZ = d1 / (double) f2 * 0.5D * 0.800000011920929D + this.motZ * 0.20000000298023224D;
|
||||
this.motY = 0.4000000059604645D;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
super.a(entity, f);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void d_(){
|
||||
Spider spider = (Spider) this.getBukkitEntity();
|
||||
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -26,15 +26,15 @@ public class MoreSpawningListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event){
|
||||
if (event.isCancelled() || event.getSpawnReason() != SpawnReason.NATURAL) return;
|
||||
|
||||
CreatureType type = event.getCreatureType();
|
||||
EntityType type = event.getEntityType();
|
||||
Location location = event.getLocation();
|
||||
World world = location.getWorld();
|
||||
|
||||
List<CreatureType> types = Arrays.asList(CreatureType.CREEPER, CreatureType.ENDERMAN, CreatureType.SKELETON, CreatureType.ZOMBIE, CreatureType.SPIDER);
|
||||
List<EntityType> types = Arrays.asList(EntityType.CREEPER, EntityType.ENDERMAN, EntityType.SKELETON, EntityType.ZOMBIE, EntityType.SPIDER);
|
||||
|
||||
if (BloodMoon.bloodMoonWorlds.contains(world.getName()) && types.contains(type)){
|
||||
for (int i = 0; i < this.multiplier; ++i){
|
||||
|
@ -5,8 +5,8 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -45,7 +45,7 @@ public class SpawnOnKillListener implements Listener {
|
||||
if (target instanceof Player && causes.contains(entity.getLastDamageCause().getCause()) && BloodMoon.config.isCreatureOnMobList("features.spawn-on-kill.mobs", creature)){
|
||||
if (plugin.rand.nextInt(100) <= BloodMoon.config.getInt("features.spawn-on-kill.chance")){
|
||||
String mobName = BloodMoon.config.getRandomStringFromList("features.spawn-on-kill.spawn");
|
||||
CreatureType creatureType = CreatureType.fromName(Character.toUpperCase(mobName.charAt(0)) + mobName.toLowerCase().substring(1));
|
||||
EntityType creatureType = EntityType.fromName(Character.toUpperCase(mobName.charAt(0)) + mobName.toLowerCase().substring(1));
|
||||
|
||||
if (creatureType != null){
|
||||
world.spawnCreature(creature.getLocation(), creatureType);
|
||||
|
@ -2,7 +2,7 @@ package uk.co.jacekk.bukkit.bloodmoon.featurelisteners;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -23,7 +23,7 @@ public class SpawnOnSleepListener implements Listener {
|
||||
|
||||
if (BloodMoon.bloodMoonWorlds.contains(world.getName())){
|
||||
String mobName = BloodMoon.config.getRandomStringFromList("features.spawn-on-sleep.spawn");
|
||||
CreatureType creatureType = CreatureType.fromName(Character.toUpperCase(mobName.charAt(0)) + mobName.toLowerCase().substring(1));
|
||||
EntityType creatureType = EntityType.fromName(Character.toUpperCase(mobName.charAt(0)) + mobName.toLowerCase().substring(1));
|
||||
|
||||
if (creatureType != null){
|
||||
world.spawnCreature(location, creatureType);
|
||||
|
Loading…
Reference in New Issue
Block a user