mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Various minor
Add entity registry Re-add AbstractLoggingExtent Fill in missing nbt on entity load
This commit is contained in:
@ -21,6 +21,7 @@ package com.boydti.fawe.bukkit.adapter;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.sk89q.jnbt.ByteArrayTag;
|
||||
@ -132,7 +133,11 @@ public final class Spigot_v1_13_R1 implements BukkitImplAdapter<NBTBase> {
|
||||
* @param tag the tag
|
||||
*/
|
||||
private static void readTagIntoTileEntity(NBTTagCompound tag, TileEntity tileEntity) {
|
||||
tileEntity.load(tag);
|
||||
try {
|
||||
tileEntity.load(tag);
|
||||
} catch (Throwable e) {
|
||||
Fawe.debug("Invalid tag " + tag + " | " + tileEntity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -305,6 +310,7 @@ public final class Spigot_v1_13_R1 implements BukkitImplAdapter<NBTBase> {
|
||||
worldServer.addEntity(createdEntity, SpawnReason.CUSTOM);
|
||||
return createdEntity.getBukkitEntity();
|
||||
} else {
|
||||
Fawe.debug("Invalid entity " + state.getType().getId());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public class BukkitChunk_All extends IntFaweChunk<Chunk, BukkitQueue_All> {
|
||||
float pitch = rotTag.getFloat(1);
|
||||
Location loc = new Location(world, x, y, z, yaw, pitch);
|
||||
Entity created = adapter.createEntity(loc, new BaseEntity(EntityTypes.get(id), tag));
|
||||
if (previous != null) {
|
||||
if (created != null) {
|
||||
UUID uuid = created.getUniqueId();
|
||||
Map<String, Tag> map = ReflectionUtils.getMap(tag.getValue());
|
||||
map.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits()));
|
||||
@ -220,7 +220,6 @@ public class BukkitChunk_All extends IntFaweChunk<Chunk, BukkitQueue_All> {
|
||||
Location mutableLoc = new Location(world, 0, 0, 0);
|
||||
|
||||
if (!checkTime) {
|
||||
System.out.println("Set " + layer);
|
||||
int index = 0;
|
||||
for (int y = 0; y < 16; y++) {
|
||||
int yy = (layer << 4) + y;
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.sk89q.worldedit.world.registry.EntityRegistry;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class BukkitEntityRegistry implements EntityRegistry {
|
||||
@Override
|
||||
public Collection<String> registerEntities() {
|
||||
List<String> types = new ArrayList<>();
|
||||
for (EntityType type : EntityType.values()) {
|
||||
String name = type.getName();
|
||||
if (name != null) {
|
||||
if (name.indexOf(':') == -1) name = "minecraft:" + name;
|
||||
types.add(name);
|
||||
}
|
||||
}
|
||||
return types;
|
||||
}
|
||||
}
|
@ -19,10 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
||||
import com.sk89q.worldedit.world.registry.BundledRegistries;
|
||||
import com.sk89q.worldedit.world.registry.ItemRegistry;
|
||||
import com.sk89q.worldedit.world.registry.*;
|
||||
|
||||
/**
|
||||
* World data for the Bukkit platform.
|
||||
@ -33,6 +30,7 @@ class BukkitRegistries extends BundledRegistries {
|
||||
private final BlockRegistry blockRegistry = new BukkitBlockRegistry();
|
||||
private final ItemRegistry itemRegistry = new BukkitItemRegistry();
|
||||
private final BiomeRegistry biomeRegistry = new BukkitBiomeRegistry();
|
||||
private final EntityRegistry entityRegistry = new BukkitEntityRegistry();
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -55,6 +53,11 @@ class BukkitRegistries extends BundledRegistries {
|
||||
return itemRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRegistry getEntityRegistry() {
|
||||
return entityRegistry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a static instance.
|
||||
*
|
||||
|
Reference in New Issue
Block a user