mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
New API method, more 1.13 entity support, and cleanup.
Signed-off-by: matt <4009945+MattBDev@users.noreply.github.com>
This commit is contained in:
@ -30,6 +30,7 @@ import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
@ -287,244 +288,248 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
|
||||
@Override @SuppressWarnings("deprecation") public void runEntityTask() {
|
||||
PlotSquared.log(C.PREFIX + "KillAllEntities started.");
|
||||
TaskManager
|
||||
.runTaskRepeat(() -> PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
@Override public void run(PlotArea plotArea) {
|
||||
final World world = Bukkit.getWorld(plotArea.worldname);
|
||||
try {
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
List<Entity> entities = world.getEntities();
|
||||
Iterator<Entity> iterator = entities.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = iterator.next();
|
||||
switch (entity.getType()) {
|
||||
case EGG:
|
||||
case COMPLEX_PART:
|
||||
case FISHING_HOOK:
|
||||
case ENDER_SIGNAL:
|
||||
case LINGERING_POTION:
|
||||
case AREA_EFFECT_CLOUD:
|
||||
case EXPERIENCE_ORB:
|
||||
case LEASH_HITCH:
|
||||
case FIREWORK:
|
||||
case WEATHER:
|
||||
case LIGHTNING:
|
||||
case WITHER_SKULL:
|
||||
case UNKNOWN:
|
||||
case PLAYER:
|
||||
// non moving / unmovable
|
||||
TaskManager.runTaskRepeat(() -> PlotSquared.get().forEachPlotArea(plotArea -> {
|
||||
final World world = Bukkit.getWorld(plotArea.worldname);
|
||||
try {
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
List<Entity> entities = world.getEntities();
|
||||
Iterator<Entity> iterator = entities.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = iterator.next();
|
||||
switch (entity.getType()) {
|
||||
case EGG:
|
||||
case COMPLEX_PART:
|
||||
case FISHING_HOOK:
|
||||
case ENDER_SIGNAL:
|
||||
case LINGERING_POTION:
|
||||
case AREA_EFFECT_CLOUD:
|
||||
case EXPERIENCE_ORB:
|
||||
case LEASH_HITCH:
|
||||
case FIREWORK:
|
||||
case WEATHER:
|
||||
case LIGHTNING:
|
||||
case WITHER_SKULL:
|
||||
case UNKNOWN:
|
||||
case PLAYER:
|
||||
// non moving / unmovable
|
||||
continue;
|
||||
case THROWN_EXP_BOTTLE:
|
||||
case SPLASH_POTION:
|
||||
case SNOWBALL:
|
||||
case SHULKER_BULLET:
|
||||
case SPECTRAL_ARROW:
|
||||
case TIPPED_ARROW:
|
||||
case ENDER_PEARL:
|
||||
case ARROW:
|
||||
case LLAMA_SPIT:
|
||||
case TRIDENT:
|
||||
// managed elsewhere | projectile
|
||||
continue;
|
||||
case ITEM_FRAME:
|
||||
case PAINTING:
|
||||
// Not vehicles
|
||||
continue;
|
||||
case ARMOR_STAND:
|
||||
// Temporarily classify as vehicle
|
||||
case MINECART:
|
||||
case MINECART_CHEST:
|
||||
case MINECART_COMMAND:
|
||||
case MINECART_FURNACE:
|
||||
case MINECART_HOPPER:
|
||||
case MINECART_MOB_SPAWNER:
|
||||
case ENDER_CRYSTAL:
|
||||
case MINECART_TNT:
|
||||
case BOAT:
|
||||
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location
|
||||
location = BukkitUtil.getLocation(entity.getLocation());
|
||||
Plot plot = location.getPlot();
|
||||
if (plot == null) {
|
||||
if (location.isPlotArea()) {
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
}
|
||||
continue;
|
||||
case THROWN_EXP_BOTTLE:
|
||||
case SPLASH_POTION:
|
||||
case SNOWBALL:
|
||||
case SHULKER_BULLET:
|
||||
case SPECTRAL_ARROW:
|
||||
case TIPPED_ARROW:
|
||||
case ENDER_PEARL:
|
||||
case ARROW:
|
||||
case LLAMA_SPIT:
|
||||
case TRIDENT:
|
||||
// managed elsewhere | projectile
|
||||
}
|
||||
List<MetadataValue> meta = entity.getMetadata("plot");
|
||||
if (meta.isEmpty()) {
|
||||
continue;
|
||||
case ITEM_FRAME:
|
||||
case PAINTING:
|
||||
// Not vehicles
|
||||
continue;
|
||||
case ARMOR_STAND:
|
||||
// Temporarily classify as vehicle
|
||||
case MINECART:
|
||||
case MINECART_CHEST:
|
||||
case MINECART_COMMAND:
|
||||
case MINECART_FURNACE:
|
||||
case MINECART_HOPPER:
|
||||
case MINECART_MOB_SPAWNER:
|
||||
case ENDER_CRYSTAL:
|
||||
case MINECART_TNT:
|
||||
case BOAT:
|
||||
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
||||
}
|
||||
Plot origin = (Plot) meta.get(0).value();
|
||||
if (!plot.equals(origin.getBasePlot(false))) {
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
continue;
|
||||
case SMALL_FIREBALL:
|
||||
case FIREBALL:
|
||||
case DRAGON_FIREBALL:
|
||||
case DROPPED_ITEM:
|
||||
if (Settings.Enabled_Components.KILL_ROAD_ITEMS && plotArea
|
||||
.getOwnedPlotAbs(BukkitUtil.getLocation(entity.getLocation()))
|
||||
== null) {
|
||||
entity.remove();
|
||||
}
|
||||
// dropped item
|
||||
continue;
|
||||
case PRIMED_TNT:
|
||||
case FALLING_BLOCK:
|
||||
// managed elsewhere
|
||||
continue;
|
||||
case SHULKER:
|
||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
||||
LivingEntity livingEntity = (LivingEntity) entity;
|
||||
List<MetadataValue> meta = entity.getMetadata("plot");
|
||||
if (meta != null && !meta.isEmpty()) {
|
||||
if (livingEntity.isLeashed()) {
|
||||
continue;
|
||||
}
|
||||
List<MetadataValue> keep = entity.getMetadata("keep");
|
||||
if (keep != null && !keep.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PlotId originalPlotId = (PlotId) meta.get(0).value();
|
||||
if (originalPlotId != null) {
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location
|
||||
location = BukkitUtil.getLocation(entity.getLocation());
|
||||
Plot plot = location.getPlot();
|
||||
if (plot == null) {
|
||||
if (location.isPlotArea()) {
|
||||
pLoc = BukkitUtil.getLocation(entity.getLocation());
|
||||
PlotArea area = pLoc.getPlotArea();
|
||||
if (area != null) {
|
||||
PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc));
|
||||
if (!originalPlotId.equals(currentPlotId) && (
|
||||
currentPlotId == null || !area
|
||||
.getPlot(originalPlotId)
|
||||
.equals(area.getPlot(currentPlotId)))) {
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
List<MetadataValue> meta = entity.getMetadata("plot");
|
||||
if (meta.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location
|
||||
pLoc = BukkitUtil.getLocation(entity.getLocation());
|
||||
PlotArea area = pLoc.getPlotArea();
|
||||
if (area != null) {
|
||||
PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc));
|
||||
if (currentPlotId != null) {
|
||||
entity.setMetadata("plot", new FixedMetadataValue(
|
||||
(Plugin) PlotSquared.get().IMP, currentPlotId));
|
||||
}
|
||||
Plot origin = (Plot) meta.get(0).value();
|
||||
if (!plot.equals(origin.getBasePlot(false))) {
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
case LLAMA:
|
||||
case DONKEY:
|
||||
case MULE:
|
||||
case ZOMBIE_HORSE:
|
||||
case SKELETON_HORSE:
|
||||
case HUSK:
|
||||
case ELDER_GUARDIAN:
|
||||
case WITHER_SKELETON:
|
||||
case STRAY:
|
||||
case ZOMBIE_VILLAGER:
|
||||
case EVOKER:
|
||||
case EVOKER_FANGS:
|
||||
case VEX:
|
||||
case VINDICATOR:
|
||||
case POLAR_BEAR:
|
||||
case BAT:
|
||||
case BLAZE:
|
||||
case CAVE_SPIDER:
|
||||
case CHICKEN:
|
||||
case COW:
|
||||
case CREEPER:
|
||||
case ENDERMAN:
|
||||
case ENDERMITE:
|
||||
case ENDER_DRAGON:
|
||||
case GHAST:
|
||||
case GIANT:
|
||||
case GUARDIAN:
|
||||
case HORSE:
|
||||
case IRON_GOLEM:
|
||||
case MAGMA_CUBE:
|
||||
case MUSHROOM_COW:
|
||||
case OCELOT:
|
||||
case PIG:
|
||||
case PIG_ZOMBIE:
|
||||
case RABBIT:
|
||||
case SHEEP:
|
||||
case SILVERFISH:
|
||||
case SKELETON:
|
||||
case SLIME:
|
||||
case SNOWMAN:
|
||||
case SPIDER:
|
||||
case SQUID:
|
||||
case VILLAGER:
|
||||
case WITCH:
|
||||
case WITHER:
|
||||
case WOLF:
|
||||
case ZOMBIE:
|
||||
case PARROT:
|
||||
case SALMON:
|
||||
case DOLPHIN:
|
||||
case TROPICAL_FISH:
|
||||
case DROWNED:
|
||||
case COD:
|
||||
case TURTLE:
|
||||
case PUFFERFISH:
|
||||
case PHANTOM:
|
||||
case ILLUSIONER:
|
||||
default: {
|
||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
||||
Location location = entity.getLocation();
|
||||
if (BukkitUtil.getLocation(location).isPlotRoad()) {
|
||||
if (entity instanceof LivingEntity) {
|
||||
LivingEntity livingEntity = (LivingEntity) entity;
|
||||
if (!livingEntity.isLeashed() || !entity
|
||||
.hasMetadata("keep")) {
|
||||
Entity passenger = entity.getPassenger();
|
||||
if (!(passenger instanceof Player) && entity
|
||||
.getMetadata("keep").isEmpty()) {
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Entity passenger = entity.getPassenger();
|
||||
if (!(passenger instanceof Player) && entity
|
||||
.getMetadata("keep").isEmpty()) {
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
case SMALL_FIREBALL:
|
||||
case FIREBALL:
|
||||
case DRAGON_FIREBALL:
|
||||
case DROPPED_ITEM:
|
||||
if (Settings.Enabled_Components.KILL_ROAD_ITEMS && plotArea
|
||||
.getOwnedPlotAbs(
|
||||
BukkitUtil.getLocation(entity.getLocation())) == null) {
|
||||
entity.remove();
|
||||
}
|
||||
// dropped item
|
||||
continue;
|
||||
case PRIMED_TNT:
|
||||
case FALLING_BLOCK:
|
||||
// managed elsewhere
|
||||
continue;
|
||||
case SHULKER:
|
||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
||||
LivingEntity livingEntity = (LivingEntity) entity;
|
||||
List<MetadataValue> meta = entity.getMetadata("plot");
|
||||
if (meta != null && !meta.isEmpty()) {
|
||||
if (livingEntity.isLeashed())
|
||||
continue;
|
||||
List<MetadataValue> keep = entity.getMetadata("keep");
|
||||
if (keep != null && !keep.isEmpty())
|
||||
continue;
|
||||
|
||||
PlotId originalPlotId = (PlotId) meta.get(0).value();
|
||||
if (originalPlotId != null) {
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location
|
||||
pLoc =
|
||||
BukkitUtil.getLocation(entity.getLocation());
|
||||
PlotArea area = pLoc.getPlotArea();
|
||||
if (area != null) {
|
||||
PlotId currentPlotId =
|
||||
PlotId.of(area.getPlotAbs(pLoc));
|
||||
if (!originalPlotId.equals(currentPlotId) && (
|
||||
currentPlotId == null || !area
|
||||
.getPlot(originalPlotId)
|
||||
.equals(area.getPlot(currentPlotId)))) {
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
|
||||
com.github.intellectualsites.plotsquared.plot.object.Location
|
||||
pLoc = BukkitUtil.getLocation(entity.getLocation());
|
||||
PlotArea area = pLoc.getPlotArea();
|
||||
if (area != null) {
|
||||
PlotId currentPlotId =
|
||||
PlotId.of(area.getPlotAbs(pLoc));
|
||||
if (currentPlotId != null) {
|
||||
entity.setMetadata("plot",
|
||||
new FixedMetadataValue(
|
||||
(Plugin) PlotSquared.get().IMP,
|
||||
currentPlotId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
case LLAMA:
|
||||
case DONKEY:
|
||||
case MULE:
|
||||
case ZOMBIE_HORSE:
|
||||
case SKELETON_HORSE:
|
||||
case HUSK:
|
||||
case ELDER_GUARDIAN:
|
||||
case WITHER_SKELETON:
|
||||
case STRAY:
|
||||
case ZOMBIE_VILLAGER:
|
||||
case EVOKER:
|
||||
case EVOKER_FANGS:
|
||||
case VEX:
|
||||
case VINDICATOR:
|
||||
case POLAR_BEAR:
|
||||
case BAT:
|
||||
case BLAZE:
|
||||
case CAVE_SPIDER:
|
||||
case CHICKEN:
|
||||
case COW:
|
||||
case CREEPER:
|
||||
case ENDERMAN:
|
||||
case ENDERMITE:
|
||||
case ENDER_DRAGON:
|
||||
case GHAST:
|
||||
case GIANT:
|
||||
case GUARDIAN:
|
||||
case HORSE:
|
||||
case IRON_GOLEM:
|
||||
case MAGMA_CUBE:
|
||||
case MUSHROOM_COW:
|
||||
case OCELOT:
|
||||
case PIG:
|
||||
case PIG_ZOMBIE:
|
||||
case RABBIT:
|
||||
case SHEEP:
|
||||
case SILVERFISH:
|
||||
case SKELETON:
|
||||
case SLIME:
|
||||
case SNOWMAN:
|
||||
case SPIDER:
|
||||
case SQUID:
|
||||
case VILLAGER:
|
||||
case WITCH:
|
||||
case WITHER:
|
||||
case WOLF:
|
||||
case ZOMBIE:
|
||||
default: {
|
||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
||||
Location location = entity.getLocation();
|
||||
if (BukkitUtil.getLocation(location).isPlotRoad()) {
|
||||
if (entity instanceof LivingEntity) {
|
||||
LivingEntity livingEntity = (LivingEntity) entity;
|
||||
if (!livingEntity.isLeashed() || !entity
|
||||
.hasMetadata("keep")) {
|
||||
Entity passenger = entity.getPassenger();
|
||||
if (!(passenger instanceof Player) && entity
|
||||
.getMetadata("keep").isEmpty()) {
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Entity passenger = entity.getPassenger();
|
||||
if (!(passenger instanceof Player) && entity
|
||||
.getMetadata("keep").isEmpty()) {
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}), 20);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}), 20);
|
||||
}
|
||||
|
||||
@Override @Nullable
|
||||
@ -701,7 +706,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
System.setProperty("bstats.relocatecheck",
|
||||
"false"); // We do not want to relocate the package...
|
||||
new org.bstats.bukkit.Metrics(this); // bstats
|
||||
Metrics metrics = new Metrics(this);// bstats
|
||||
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
||||
this.metricsStarted = true;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
result.setBiome(x, z, biome.name());
|
||||
}
|
||||
|
||||
@Override public Biome getBiome(int arg0, int arg1) {
|
||||
@Override public Biome getBiome(int x, int z) {
|
||||
return Biome.FOREST;
|
||||
}
|
||||
};
|
||||
@ -142,7 +142,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
}
|
||||
/* TODO: Redo this
|
||||
// Populator spillage
|
||||
short[][] tmp = cg.generateExtBlockSections(w, r, cx, cz, grid);
|
||||
short[][] tmp = cg.generateExtBlockSections(w, r, cx, cz, biomeGrid);
|
||||
if (tmp != null) {
|
||||
for (int i = 0; i < tmp.length; i++) {
|
||||
short[] section = tmp[i];
|
||||
@ -235,30 +235,30 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkData generateChunkData(World world, Random random, int cx, int cz, BiomeGrid grid) {
|
||||
public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome) {
|
||||
GenChunk result = this.chunkSetter;
|
||||
if (this.getPlotGenerator() instanceof SingleWorldGenerator) {
|
||||
if (result.getCd() != null) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
grid.setBiome(x, z, Biome.PLAINS);
|
||||
for (int cx = 0; cx < 16; cx++) {
|
||||
for (int cz = 0; cz < 16; cz++) {
|
||||
biome.setBiome(cx, cz, Biome.PLAINS);
|
||||
}
|
||||
}
|
||||
return result.getCd();
|
||||
}
|
||||
}
|
||||
// Set the chunk location
|
||||
result.setChunk(new ChunkWrapper(world.getName(), cx, cz));
|
||||
result.setChunk(new ChunkWrapper(world.getName(), x, z));
|
||||
// Set the result data
|
||||
result.setCd(createChunkData(world));
|
||||
result.grid = grid;
|
||||
result.biomeGrid = biome;
|
||||
result.result = null;
|
||||
|
||||
// Catch any exceptions (as exceptions usually thrown)
|
||||
try {
|
||||
// Fill the result data if necessary
|
||||
if (this.platformGenerator != this) {
|
||||
return this.platformGenerator.generateChunkData(world, random, cx, cz, grid);
|
||||
return this.platformGenerator.generateChunkData(world, random, x, z, biome);
|
||||
} else {
|
||||
generate(world, result);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
private final int hash;
|
||||
private final EntityBaseStats base = new EntityBaseStats();
|
||||
|
||||
public ItemStack[] inventory;
|
||||
private ItemStack[] inventory;
|
||||
// Extended
|
||||
private ItemStack stack;
|
||||
private byte dataByte;
|
||||
@ -94,6 +94,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
case DRAGON_FIREBALL:
|
||||
case LINGERING_POTION:
|
||||
case AREA_EFFECT_CLOUD:
|
||||
case TRIDENT:
|
||||
case LLAMA_SPIT:
|
||||
// Do this stuff later
|
||||
return;
|
||||
// MISC //
|
||||
@ -132,13 +134,21 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
// START AGEABLE //
|
||||
// START TAMEABLE //
|
||||
case HORSE:
|
||||
Horse horse = (Horse) entity;
|
||||
case DONKEY:
|
||||
case LLAMA:
|
||||
case MULE:
|
||||
case SKELETON_HORSE:
|
||||
AbstractHorse horse = (AbstractHorse) entity;
|
||||
this.horse = new HorseStats();
|
||||
this.horse.jump = horse.getJumpStrength();
|
||||
this.horse.chest = horse.isCarryingChest();
|
||||
this.horse.variant = horse.getVariant();
|
||||
this.horse.style = horse.getStyle();
|
||||
this.horse.color = horse.getColor();
|
||||
if (horse instanceof ChestedHorse) {
|
||||
ChestedHorse horse1 = (ChestedHorse) horse;
|
||||
this.horse.chest = horse1.isCarryingChest();
|
||||
}
|
||||
//todo these horse feeatures need fixing
|
||||
//this.horse.variant = horse.getVariant();
|
||||
//this.horse.style = horse.getStyle();
|
||||
//this.horse.color = horse.getColor();
|
||||
storeTameable(horse);
|
||||
storeAgeable(horse);
|
||||
storeLiving(horse);
|
||||
@ -164,6 +174,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
case COW:
|
||||
case MUSHROOM_COW:
|
||||
case PIG:
|
||||
case TURTLE:
|
||||
case POLAR_BEAR:
|
||||
storeAgeable((Ageable) entity);
|
||||
storeLiving((LivingEntity) entity);
|
||||
@ -174,16 +185,6 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
// END AGEABLE //
|
||||
//todo this needs to be fixed
|
||||
case GUARDIAN:
|
||||
case ELDER_GUARDIAN:
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
//todo this needs to be fixed
|
||||
case SKELETON:
|
||||
case WITHER_SKELETON:
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
case ARMOR_STAND:
|
||||
ArmorStand stand = (ArmorStand) entity;
|
||||
this.inventory =
|
||||
@ -249,6 +250,10 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
EnderDragon entity1 = (EnderDragon) entity;
|
||||
this.dataByte = (byte) entity1.getPhase().ordinal();
|
||||
return;
|
||||
case SKELETON:
|
||||
case WITHER_SKELETON:
|
||||
case GUARDIAN:
|
||||
case ELDER_GUARDIAN:
|
||||
case GHAST:
|
||||
case MAGMA_CUBE:
|
||||
case SQUID:
|
||||
@ -487,6 +492,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
case DRAGON_FIREBALL:
|
||||
case WITHER_SKULL:
|
||||
case MINECART_FURNACE:
|
||||
case LLAMA_SPIT:
|
||||
case TRIDENT:
|
||||
case UNKNOWN:
|
||||
// Do this stuff later
|
||||
return entity;
|
||||
@ -510,14 +517,20 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
// START LIVING ENTITY //
|
||||
// START AGEABLE //
|
||||
// START TAMEABLE //
|
||||
//todo this needs to be fixed
|
||||
case HORSE:
|
||||
Horse horse = (Horse) entity;
|
||||
case LLAMA:
|
||||
case SKELETON_HORSE:
|
||||
case DONKEY:
|
||||
case MULE:
|
||||
AbstractHorse horse = (AbstractHorse) entity;
|
||||
horse.setJumpStrength(this.horse.jump);
|
||||
horse.setCarryingChest(this.horse.chest);
|
||||
horse.setVariant(this.horse.variant);
|
||||
horse.setStyle(this.horse.style);
|
||||
horse.setColor(this.horse.color);
|
||||
if (horse instanceof ChestedHorse) {
|
||||
((ChestedHorse) horse).setCarryingChest(this.horse.chest);
|
||||
}
|
||||
//todo broken as of 1.13
|
||||
//horse.setVariant(this.horse.variant);
|
||||
//horse.setStyle(this.horse.style);
|
||||
//horse.setColor(this.horse.color);
|
||||
restoreTameable(horse);
|
||||
restoreAgeable(horse);
|
||||
restoreLiving(horse);
|
||||
@ -545,6 +558,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
case VILLAGER:
|
||||
case CHICKEN:
|
||||
case COW:
|
||||
case TURTLE:
|
||||
case POLAR_BEAR:
|
||||
case MUSHROOM_COW:
|
||||
case PIG:
|
||||
|
@ -154,7 +154,7 @@ public class NbtFactory {
|
||||
* @return The decoded NBT compound.
|
||||
* @throws IOException If anything went wrong.
|
||||
*/
|
||||
public static NbtCompound fromStream(InputStream input, StreamOptions option)
|
||||
@SuppressWarnings({"IOResourceOpenedButNotSafelyClosed", "resource"}) public static NbtCompound fromStream(InputStream input, StreamOptions option)
|
||||
throws IOException {
|
||||
DataInputStream data = null;
|
||||
boolean suppress = true;
|
||||
@ -189,24 +189,11 @@ public class NbtFactory {
|
||||
*/
|
||||
public static void saveStream(NbtCompound source, ByteSink stream, StreamOptions option)
|
||||
throws IOException {
|
||||
OutputStream output = null;
|
||||
DataOutputStream data = null;
|
||||
boolean suppress = true;
|
||||
|
||||
try {
|
||||
output = stream.openStream();
|
||||
data = new DataOutputStream(
|
||||
option == StreamOptions.GZIP_COMPRESSION ? new GZIPOutputStream(output) : output);
|
||||
|
||||
try (OutputStream output = stream.openStream();
|
||||
DataOutputStream data = new DataOutputStream(
|
||||
option == StreamOptions.GZIP_COMPRESSION ? new GZIPOutputStream(output) : output)) {
|
||||
invokeMethod(get().SAVE_COMPOUND, null, source.getHandle(), data);
|
||||
suppress = false;
|
||||
|
||||
} finally {
|
||||
if (data != null) {
|
||||
Closeables.close(data, suppress);
|
||||
} else if (output != null) {
|
||||
Closeables.close(output, suppress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -540,9 +527,7 @@ public class NbtFactory {
|
||||
*
|
||||
* @author Kristian
|
||||
*/
|
||||
public enum StreamOptions {
|
||||
NO_COMPRESSION, GZIP_COMPRESSION,
|
||||
}
|
||||
public enum StreamOptions {NO_COMPRESSION, GZIP_COMPRESSION,}
|
||||
|
||||
|
||||
private enum NbtType {
|
||||
|
@ -23,7 +23,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
||||
|
||||
public final Biome[] biomes;
|
||||
public PlotBlock[][] result;
|
||||
public BiomeGrid grid;
|
||||
public BiomeGrid biomeGrid;
|
||||
public Chunk chunk;
|
||||
public String world;
|
||||
public int cx;
|
||||
@ -57,13 +57,13 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
||||
}
|
||||
|
||||
@Override public void fillBiome(String biomeName) {
|
||||
if (grid == null) {
|
||||
if (biomeGrid == null) {
|
||||
return;
|
||||
}
|
||||
Biome biome = Biome.valueOf(biomeName.toUpperCase());
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
this.grid.setBiome(x, z, biome);
|
||||
this.biomeGrid.setBiome(x, z, biome);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,8 +96,8 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
||||
}
|
||||
|
||||
public boolean setBiome(int x, int z, Biome biome) {
|
||||
if (this.grid != null) {
|
||||
this.grid.setBiome(x, z, biome);
|
||||
if (this.biomeGrid != null) {
|
||||
this.biomeGrid.setBiome(x, z, biome);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user