@@ -3,6 +3,7 @@ package org.bukkit.craftbukkit;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.ImmutableBiMap;
|
||||
import net.minecraft.server.IRegistry;
|
||||
import net.minecraft.server.MinecraftKey;
|
||||
import net.minecraft.server.Paintings;
|
||||
import org.bukkit.Art;
|
||||
@@ -12,8 +13,8 @@ public class CraftArt {
|
||||
|
||||
static {
|
||||
ImmutableBiMap.Builder<Paintings, Art> artworkBuilder = ImmutableBiMap.builder();
|
||||
for (MinecraftKey key : Paintings.a.keySet()) {
|
||||
artworkBuilder.put(Paintings.a.get(key), Art.getByName(key.getKey()));
|
||||
for (MinecraftKey key : IRegistry.MOTIVE.keySet()) {
|
||||
artworkBuilder.put(IRegistry.MOTIVE.get(key), Art.getByName(key.getKey()));
|
||||
}
|
||||
|
||||
artwork = artworkBuilder.build();
|
||||
|
||||
@@ -12,7 +12,6 @@ import net.minecraft.server.IInventory;
|
||||
import net.minecraft.server.LootTable;
|
||||
import net.minecraft.server.LootTableInfo;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
@@ -72,24 +71,24 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
|
||||
Location loc = context.getLocation();
|
||||
WorldServer handle = ((CraftWorld) loc.getWorld()).getHandle();
|
||||
|
||||
LootTableInfo.a builder = new LootTableInfo.a(handle); // PAIL rename Builder
|
||||
builder.a(context.getLuck()); // PAIL rename withLuck, luck
|
||||
LootTableInfo.Builder builder = new LootTableInfo.Builder(handle);
|
||||
builder.luck(context.getLuck());
|
||||
|
||||
if (context.getLootedEntity() != null) {
|
||||
Entity nmsLootedEntity = ((CraftEntity) context.getLootedEntity()).getHandle();
|
||||
builder.a(nmsLootedEntity); // PAIL Rename withLootedEntity, lootedEntity
|
||||
builder.a(DamageSource.GENERIC); // PAIL rename withDamageSource, damageSource
|
||||
builder.a(new BlockPosition(nmsLootedEntity)); // PAIL rename withPosition, position
|
||||
builder.entity(nmsLootedEntity);
|
||||
builder.damageSource(DamageSource.GENERIC);
|
||||
builder.position(new BlockPosition(nmsLootedEntity));
|
||||
}
|
||||
|
||||
if (context.getKiller() != null) {
|
||||
EntityHuman nmsKiller = ((CraftHumanEntity) context.getKiller()).getHandle();
|
||||
builder.a(nmsKiller); // PAIL rename withKiller, killer
|
||||
builder.killer(nmsKiller);
|
||||
// If there is a player killer, damage source should reflect that in case loot tables use that information
|
||||
builder.a(DamageSource.playerAttack(nmsKiller)); // PAIL rename withDamageSource, damageSource
|
||||
builder.damageSource(DamageSource.playerAttack(nmsKiller));
|
||||
}
|
||||
|
||||
return builder.a(); // PAIL rename build
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.DimensionManager;
|
||||
import net.minecraft.server.NBTTagCompound;
|
||||
import net.minecraft.server.WhiteListEntry;
|
||||
import net.minecraft.server.WorldNBTStorage;
|
||||
@@ -32,7 +32,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
protected CraftOfflinePlayer(CraftServer server, GameProfile profile) {
|
||||
this.server = server;
|
||||
this.profile = profile;
|
||||
this.storage = (WorldNBTStorage) (server.console.worlds.get(0).getDataManager());
|
||||
this.storage = (WorldNBTStorage) (server.console.getWorldServer(DimensionManager.OVERWORLD).getDataManager());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.server.IRegistry;
|
||||
import net.minecraft.server.MinecraftKey;
|
||||
import net.minecraft.server.ParticleParam;
|
||||
import net.minecraft.server.ParticleParamBlock;
|
||||
@@ -114,7 +115,7 @@ public enum CraftParticle {
|
||||
canonical = aliases.get(particle);
|
||||
}
|
||||
|
||||
net.minecraft.server.Particle nms = net.minecraft.server.Particle.REGISTRY.get(particles.get(canonical));
|
||||
net.minecraft.server.Particle nms = IRegistry.PARTICLE_TYPE.get(particles.get(canonical));
|
||||
Preconditions.checkArgument(nms != null, "No NMS particle %s", particle);
|
||||
|
||||
if (particle.getDataType().equals(Void.class)) {
|
||||
|
||||
@@ -134,6 +134,7 @@ import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufOutputStream;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import it.unimi.dsi.fastutil.longs.LongIterator;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
@@ -694,8 +695,8 @@ public final class CraftServer implements Server {
|
||||
((DedicatedServer) console).propertyManager = config;
|
||||
|
||||
boolean animals = config.getBoolean("spawn-animals", console.getSpawnAnimals());
|
||||
boolean monsters = config.getBoolean("spawn-monsters", console.worlds.get(0).getDifficulty() != EnumDifficulty.PEACEFUL);
|
||||
EnumDifficulty difficulty = EnumDifficulty.getById(config.getInt("difficulty", console.worlds.get(0).getDifficulty().ordinal()));
|
||||
boolean monsters = config.getBoolean("spawn-monsters", console.getWorldServer(DimensionManager.OVERWORLD).getDifficulty() != EnumDifficulty.PEACEFUL);
|
||||
EnumDifficulty difficulty = EnumDifficulty.getById(config.getInt("difficulty", console.getWorldServer(DimensionManager.OVERWORLD).getDifficulty().ordinal()));
|
||||
|
||||
online.value = config.getBoolean("online-mode", console.getOnlineMode());
|
||||
console.setSpawnAnimals(config.getBoolean("spawn-animals", console.getSpawnAnimals()));
|
||||
@@ -724,7 +725,7 @@ public final class CraftServer implements Server {
|
||||
logger.log(Level.WARNING, "Failed to load banned-players.json, " + ex.getMessage());
|
||||
}
|
||||
|
||||
for (WorldServer world : console.worlds) {
|
||||
for (WorldServer world : console.getWorlds()) {
|
||||
world.worldData.setDifficulty(difficulty);
|
||||
world.setSpawnFlags(monsters, animals);
|
||||
if (this.getTicksPerAnimalSpawns() < 0) {
|
||||
@@ -886,11 +887,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
console.convertWorld(name);
|
||||
|
||||
int dimension = CraftWorld.CUSTOM_DIMENSION_OFFSET + console.worlds.size();
|
||||
int dimension = CraftWorld.CUSTOM_DIMENSION_OFFSET + console.worldServer.size();
|
||||
boolean used = false;
|
||||
do {
|
||||
for (WorldServer server : console.worlds) {
|
||||
used = server.dimension == dimension;
|
||||
for (WorldServer server : console.getWorlds()) {
|
||||
used = server.dimension.getDimensionID() == dimension;
|
||||
if (used) {
|
||||
dimension++;
|
||||
break;
|
||||
@@ -900,6 +901,7 @@ public final class CraftServer implements Server {
|
||||
boolean hardcore = false;
|
||||
|
||||
IDataManager sdm = new ServerNBTManager(getWorldContainer(), name, getServer(), getHandle().getServer().dataConverterManager);
|
||||
PersistentCollection persistentcollection = new PersistentCollection(sdm);
|
||||
WorldData worlddata = sdm.getWorldData();
|
||||
WorldSettings worldSettings = null;
|
||||
if (worlddata == null) {
|
||||
@@ -911,7 +913,9 @@ public final class CraftServer implements Server {
|
||||
worlddata = new WorldData(worldSettings, name);
|
||||
}
|
||||
worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
|
||||
WorldServer internal = (WorldServer) new WorldServer(console, sdm, worlddata, dimension, console.methodProfiler, creator.environment(), generator).b();
|
||||
|
||||
DimensionManager internalDimension = new DimensionManager(dimension, name, name, () -> DimensionManager.a(creator.environment().getId()).e());
|
||||
WorldServer internal = (WorldServer) new WorldServer(console, sdm, persistentcollection, worlddata, internalDimension, console.methodProfiler, creator.environment(), generator).i_();
|
||||
|
||||
if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
|
||||
return null;
|
||||
@@ -925,10 +929,10 @@ public final class CraftServer implements Server {
|
||||
internal.addIWorldAccess(new WorldManager(console, internal));
|
||||
internal.worldData.setDifficulty(EnumDifficulty.EASY);
|
||||
internal.setSpawnFlags(true, true);
|
||||
console.worlds.add(internal);
|
||||
console.worldServer.put(internal.dimension, internal);
|
||||
|
||||
pluginManager.callEvent(new WorldInitEvent(internal.getWorld()));
|
||||
System.out.println("Preparing start region for level " + (console.worlds.size() - 1) + " (Seed: " + internal.getSeed() + ")");
|
||||
System.out.println("Preparing start region for level " + (console.worldServer.size() - 1) + " (Seed: " + internal.getSeed() + ")");
|
||||
|
||||
if (internal.getWorld().getKeepSpawnInMemory()) {
|
||||
short short1 = 196;
|
||||
@@ -950,10 +954,26 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
BlockPosition chunkcoordinates = internal.getSpawn();
|
||||
internal.getChunkProviderServer().getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4);
|
||||
internal.getChunkProviderServer().getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DimensionManager dimensionmanager = internalDimension.e().getDimensionManager();
|
||||
ForcedChunk forcedchunk = (ForcedChunk) persistentcollection.get(dimensionmanager, ForcedChunk::new, "chunks");
|
||||
|
||||
if (forcedchunk != null) {
|
||||
LongIterator longiterator = forcedchunk.a().iterator();
|
||||
|
||||
while (longiterator.hasNext()) {
|
||||
System.out.println("Loading forced chunks for dimension " + dimension + ", " + forcedchunk.a().size() * 100 / 625 + "%");
|
||||
long k = longiterator.nextLong();
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(k);
|
||||
|
||||
internal.getChunkProviderServer().getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
|
||||
return internal.getWorld();
|
||||
}
|
||||
@@ -971,11 +991,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
WorldServer handle = ((CraftWorld) world).getHandle();
|
||||
|
||||
if (!(console.worlds.contains(handle))) {
|
||||
if (!(console.worldServer.containsKey(handle.dimension))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handle.dimension == 0) {
|
||||
if (handle.dimension == DimensionManager.OVERWORLD) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1000,7 +1020,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH));
|
||||
console.worlds.remove(console.worlds.indexOf(handle));
|
||||
console.worldServer.remove(handle.dimension);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1215,8 +1235,8 @@ public final class CraftServer implements Server {
|
||||
@Override
|
||||
@Deprecated
|
||||
public CraftMapView getMap(short id) {
|
||||
PersistentCollection collection = console.worlds.get(0).worldMaps;
|
||||
WorldMap worldmap = (WorldMap) collection.get(WorldMap::new, "map_" + id);
|
||||
PersistentCollection collection = console.getWorldServer(DimensionManager.OVERWORLD).worldMaps;
|
||||
WorldMap worldmap = (WorldMap) collection.get(DimensionManager.OVERWORLD, WorldMap::new, "map_" + id);
|
||||
if (worldmap == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -1388,7 +1408,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public GameMode getDefaultGameMode() {
|
||||
return GameMode.getByValue(console.worlds.get(0).getWorldData().getGameType().getId());
|
||||
return GameMode.getByValue(console.getWorldServer(DimensionManager.OVERWORLD).getWorldData().getGameType().getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1432,7 +1452,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public OfflinePlayer[] getOfflinePlayers() {
|
||||
WorldNBTStorage storage = (WorldNBTStorage) console.worlds.get(0).getDataManager();
|
||||
WorldNBTStorage storage = (WorldNBTStorage) console.getWorldServer(DimensionManager.OVERWORLD).getDataManager();
|
||||
String[] files = storage.getPlayerDir().list(new DatFileFilter());
|
||||
Set<OfflinePlayer> players = new HashSet<OfflinePlayer>();
|
||||
|
||||
@@ -1687,7 +1707,7 @@ public final class CraftServer implements Server {
|
||||
public Entity getEntity(UUID uuid) {
|
||||
Validate.notNull(uuid, "UUID cannot be null");
|
||||
|
||||
for (WorldServer world : getServer().worlds) {
|
||||
for (WorldServer world : getServer().getWorlds()) {
|
||||
net.minecraft.server.Entity entity = world.getEntity(uuid);
|
||||
if (entity != null) {
|
||||
return entity.getBukkitEntity();
|
||||
@@ -1769,8 +1789,8 @@ public final class CraftServer implements Server {
|
||||
public LootTable getLootTable(NamespacedKey key) {
|
||||
Validate.notNull(key, "NamespacedKey cannot be null");
|
||||
|
||||
LootTableRegistry registry = getServer().aP(); // PAIL getLootTableRegistry
|
||||
return new CraftLootTable(key, registry.a(CraftNamespacedKey.toMinecraft(key))); // PAIL rename getLootTable
|
||||
LootTableRegistry registry = getServer().getLootTableRegistry();
|
||||
return new CraftLootTable(key, registry.getLootTable(CraftNamespacedKey.toMinecraft(key)));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.server.IRegistry;
|
||||
import net.minecraft.server.MinecraftKey;
|
||||
import net.minecraft.server.SoundEffect;
|
||||
|
||||
@@ -684,7 +685,7 @@ public enum CraftSound {
|
||||
}
|
||||
|
||||
public static SoundEffect getSoundEffect(String s) {
|
||||
SoundEffect effect = SoundEffect.a.get(new MinecraftKey(s));
|
||||
SoundEffect effect = IRegistry.SOUND_EVENT.get(new MinecraftKey(s));
|
||||
Preconditions.checkArgument(effect != null, "Sound effect %s does not exist", s);
|
||||
|
||||
return effect;
|
||||
|
||||
@@ -11,9 +11,9 @@ import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.ImmutableBiMap;
|
||||
import net.minecraft.server.Block;
|
||||
import net.minecraft.server.EntityTypes;
|
||||
import net.minecraft.server.IRegistry;
|
||||
import net.minecraft.server.Item;
|
||||
import net.minecraft.server.MinecraftKey;
|
||||
import net.minecraft.server.RegistryMaterials;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
|
||||
public enum CraftStatistic {
|
||||
@@ -75,8 +75,14 @@ public enum CraftStatistic {
|
||||
CHEST_OPENED(StatisticList.OPEN_CHEST),
|
||||
SLEEP_IN_BED(StatisticList.SLEEP_IN_BED),
|
||||
SHULKER_BOX_OPENED(StatisticList.OPEN_SHULKER_BOX),
|
||||
TIME_SINCE_REST(StatisticList.n),
|
||||
SWIM_ONE_CM(StatisticList.SWIM_ONE_CM);
|
||||
TIME_SINCE_REST(StatisticList.TIME_SINCE_REST),
|
||||
SWIM_ONE_CM(StatisticList.SWIM_ONE_CM),
|
||||
DAMAGE_DEALT_ABSORBED(StatisticList.DAMAGE_DEALT_ABSORBED),
|
||||
DAMAGE_DEALT_RESISTED(StatisticList.DAMAGE_DEALT_RESISTED),
|
||||
DAMAGE_BLOCKED_BY_SHIELD(StatisticList.DAMAGE_BLOCKED_BY_SHIELD),
|
||||
DAMAGE_ABSORBED(StatisticList.DAMAGE_ABSORBED),
|
||||
DAMAGE_RESISTED(StatisticList.DAMAGE_RESISTED),
|
||||
CLEAN_SHULKER_BOX(StatisticList.CLEAN_SHULKER_BOX);
|
||||
private final MinecraftKey minecraftKey;
|
||||
private final org.bukkit.Statistic bukkit;
|
||||
private static final BiMap<MinecraftKey, org.bukkit.Statistic> statistics;
|
||||
@@ -98,10 +104,10 @@ public enum CraftStatistic {
|
||||
}
|
||||
|
||||
public static org.bukkit.Statistic getBukkitStatistic(net.minecraft.server.Statistic<?> statistic) {
|
||||
RegistryMaterials statRegistry = statistic.a().a();
|
||||
MinecraftKey nmsKey = StatisticList.REGISTRY.b(statistic.a());
|
||||
IRegistry statRegistry = statistic.a().a();
|
||||
MinecraftKey nmsKey = IRegistry.STATS.getKey(statistic.a());
|
||||
|
||||
if (statRegistry == StatisticList.REGISTRY_CUSTOM) {
|
||||
if (statRegistry == IRegistry.CUSTOM_STAT) {
|
||||
nmsKey = (MinecraftKey) statistic.b();
|
||||
}
|
||||
|
||||
@@ -145,7 +151,7 @@ public enum CraftStatistic {
|
||||
|
||||
public static net.minecraft.server.Statistic getEntityStatistic(org.bukkit.Statistic stat, EntityType entity) {
|
||||
if (entity.getName() != null) {
|
||||
EntityTypes<?> nmsEntity = EntityTypes.REGISTRY.get(new MinecraftKey(entity.getName()));
|
||||
EntityTypes<?> nmsEntity = IRegistry.ENTITY_TYPE.get(new MinecraftKey(entity.getName()));
|
||||
|
||||
if (stat == org.bukkit.Statistic.KILL_ENTITY) {
|
||||
return net.minecraft.server.StatisticList.ENTITY_KILLED.b(nmsEntity);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.DimensionManager;
|
||||
import net.minecraft.server.PortalTravelAgent;
|
||||
import net.minecraft.server.WorldServer;
|
||||
|
||||
@@ -17,7 +18,7 @@ public class CraftTravelAgent extends PortalTravelAgent implements TravelAgent {
|
||||
|
||||
public CraftTravelAgent(WorldServer worldserver) {
|
||||
super(worldserver);
|
||||
if (DEFAULT == null && worldserver.dimension == 0) {
|
||||
if (DEFAULT == null && worldserver.dimension == DimensionManager.OVERWORLD) {
|
||||
DEFAULT = this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public Chunk getChunkAt(int x, int z) {
|
||||
return this.world.getChunkProviderServer().getChunkAt(x, z).bukkitChunk;
|
||||
return this.world.getChunkProviderServer().getChunkAt(x, z, true, true).bukkitChunk;
|
||||
}
|
||||
|
||||
public Chunk getChunkAt(Block block) {
|
||||
@@ -182,7 +182,7 @@ public class CraftWorld implements World {
|
||||
return false;
|
||||
}
|
||||
|
||||
net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getLoadedChunkAt(x, z);
|
||||
net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkAt(x, z, false, false);
|
||||
if (chunk != null) {
|
||||
world.getChunkProviderServer().unload(chunk);
|
||||
}
|
||||
@@ -199,7 +199,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
private boolean unloadChunk0(int x, int z, boolean save) {
|
||||
net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkIfLoaded(x, z);
|
||||
net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkAt(x, z, false, false);
|
||||
if (chunk == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -216,9 +216,7 @@ public class CraftWorld implements World {
|
||||
final long chunkKey = ChunkCoordIntPair.a(x, z);
|
||||
world.getChunkProviderServer().unloadQueue.remove(chunkKey);
|
||||
|
||||
net.minecraft.server.Chunk chunk = null;
|
||||
|
||||
chunk = Futures.getUnchecked(world.getChunkProviderServer().generateChunk(x, z, true));
|
||||
net.minecraft.server.Chunk chunk = world.getChunkProviderServer().generateChunk(x, z);
|
||||
PlayerChunk playerChunk = world.getPlayerChunkMap().getChunk(x, z);
|
||||
if (playerChunk != null) {
|
||||
playerChunk.chunk = chunk;
|
||||
@@ -252,17 +250,12 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public boolean isChunkInUse(int x, int z) {
|
||||
return world.getPlayerChunkMap().isChunkInUse(x, z);
|
||||
return world.getPlayerChunkMap().isChunkInUse(x, z) || world.f(x, z);
|
||||
}
|
||||
|
||||
public boolean loadChunk(int x, int z, boolean generate) {
|
||||
chunkLoadCount++;
|
||||
if (generate) {
|
||||
// Use the default variant of loadChunk when generate == true.
|
||||
return world.getChunkProviderServer().getChunkAt(x, z) != null;
|
||||
}
|
||||
|
||||
return world.getChunkProviderServer().getOrLoadChunkAt(x, z) != null;
|
||||
return world.getChunkProviderServer().getChunkAt(x, z, true, generate) != null;
|
||||
}
|
||||
|
||||
public boolean isChunkLoaded(Chunk chunk) {
|
||||
@@ -1497,13 +1490,13 @@ public class CraftWorld implements World {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (value.e()) {
|
||||
switch (value.getType()) {
|
||||
case BOOLEAN_VALUE:
|
||||
return rule.getType().cast(value.b());
|
||||
case NUMERICAL_VALUE:
|
||||
return rule.getType().cast(value.c());
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid GameRule type (" + value.e() + ") for GameRule " + rule.getName());
|
||||
throw new IllegalArgumentException("Invalid GameRule type (" + value.getType() + ") for GameRule " + rule.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ public class Main {
|
||||
useConsole = false;
|
||||
}
|
||||
|
||||
if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
|
||||
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
|
||||
Date buildDate = new SimpleDateFormat("yyyyMMdd-HHmm").parse(Main.class.getPackage().getImplementationVendor());
|
||||
|
||||
Calendar deadline = Calendar.getInstance();
|
||||
@@ -190,8 +190,7 @@ public class Main {
|
||||
}
|
||||
}
|
||||
|
||||
System.err.println("*** WARNING: This build is obsolete. It contains severe bugs that may damage your world. All users are recommended to update to 1.13.1");
|
||||
System.err.println("*** Please see https://www.spigotmc.org/ for more information about updating.");
|
||||
System.err.println("*** WARNING: This is a development build. It is not meant for production server usage! Please keep backups and update frequently.");
|
||||
|
||||
System.out.println("Loading libraries, please wait...");
|
||||
MinecraftServer.main(options);
|
||||
|
||||
@@ -416,7 +416,7 @@ public class CraftBlock implements Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Biome.valueOf(BiomeBase.REGISTRY_ID.b(base).getKey().toUpperCase(java.util.Locale.ENGLISH));
|
||||
return Biome.valueOf(IRegistry.BIOME.getKey(base).getKey().toUpperCase(java.util.Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public static BiomeBase biomeToBiomeBase(Biome bio) {
|
||||
@@ -424,7 +424,7 @@ public class CraftBlock implements Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
return BiomeBase.REGISTRY_ID.get(new MinecraftKey(bio.name().toLowerCase(java.util.Locale.ENGLISH)));
|
||||
return IRegistry.BIOME.get(new MinecraftKey(bio.name().toLowerCase(java.util.Locale.ENGLISH)));
|
||||
}
|
||||
|
||||
public double getTemperature() {
|
||||
@@ -479,12 +479,12 @@ public class CraftBlock implements Block {
|
||||
int x = getX();
|
||||
int y = getY();
|
||||
int z = getZ();
|
||||
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y - 1, z), EnumDirection.DOWN)) power = wire.getPower(world, new BlockPosition(x, y - 1, z), power);
|
||||
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y + 1, z), EnumDirection.UP)) power = wire.getPower(world, new BlockPosition(x, y + 1, z), power);
|
||||
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x + 1, y, z), EnumDirection.EAST)) power = wire.getPower(world, new BlockPosition(x + 1, y, z), power);
|
||||
if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x - 1, y, z), EnumDirection.WEST)) power = wire.getPower(world, new BlockPosition(x - 1, y, z), power);
|
||||
if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y, z - 1), EnumDirection.NORTH)) power = wire.getPower(world, new BlockPosition(x, y, z - 1), power);
|
||||
if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y, z + 1), EnumDirection.SOUTH)) power = wire.getPower(world, new BlockPosition(x, y, z - 1), power);
|
||||
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y - 1, z), EnumDirection.DOWN)) power = wire.getPower(power, world.getType(new BlockPosition(x, y - 1, z)));
|
||||
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y + 1, z), EnumDirection.UP)) power = wire.getPower(power, world.getType(new BlockPosition(x, y + 1, z)));
|
||||
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x + 1, y, z), EnumDirection.EAST)) power = wire.getPower(power, world.getType(new BlockPosition(x + 1, y, z)));
|
||||
if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x - 1, y, z), EnumDirection.WEST)) power = wire.getPower(power, world.getType(new BlockPosition(x - 1, y, z)));
|
||||
if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y, z - 1), EnumDirection.NORTH)) power = wire.getPower(power, world.getType(new BlockPosition(x, y, z - 1)));
|
||||
if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y, z + 1), EnumDirection.SOUTH)) power = wire.getPower(power, world.getType(new BlockPosition(x, y, z + 1)));
|
||||
return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,18 +39,18 @@ public abstract class CraftLootable<T extends TileEntityLootable> extends CraftC
|
||||
if (!this.getSnapshot().hasCustomName()) {
|
||||
lootable.setCustomName(null);
|
||||
}
|
||||
if (this.getSnapshot().Q_() == null) {
|
||||
lootable.a((MinecraftKey) null, 0L); // PAIL rename setLootTable
|
||||
if (this.getSnapshot().getLootTable()== null) {
|
||||
lootable.setLootTable((MinecraftKey) null, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LootTable getLootTable() {
|
||||
if (getSnapshot().Q_() == null) {
|
||||
if (getSnapshot().getLootTable() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MinecraftKey key = getSnapshot().Q_();
|
||||
MinecraftKey key = getSnapshot().getLootTable();
|
||||
return Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(key));
|
||||
}
|
||||
|
||||
@@ -71,6 +71,6 @@ public abstract class CraftLootable<T extends TileEntityLootable> extends CraftC
|
||||
|
||||
private void setLootTable(LootTable table, long seed) {
|
||||
MinecraftKey key = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
|
||||
getSnapshot().a(key, seed); // PAIL setLootTable
|
||||
getSnapshot().setLootTable(key, seed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.server.EnumDirection;
|
||||
import net.minecraft.server.IBlockData;
|
||||
import net.minecraft.server.IBlockState;
|
||||
import net.minecraft.server.INamable;
|
||||
import net.minecraft.server.IRegistry;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
@@ -310,7 +311,7 @@ public class CraftBlockData implements BlockData {
|
||||
private static IBlockState<?> getState(Class<? extends Block> block, String name, boolean optional) {
|
||||
IBlockState<?> state = null;
|
||||
|
||||
for (Block instance : (Iterable<Block>) Block.REGISTRY) { // Eclipse fail
|
||||
for (Block instance : (Iterable<Block>) IRegistry.BLOCK) { // Eclipse fail
|
||||
if (instance.getClass() == block) {
|
||||
if (state == null) {
|
||||
state = instance.getStates().a(name);
|
||||
@@ -369,10 +370,13 @@ public class CraftBlockData implements BlockData {
|
||||
register(net.minecraft.server.BlockCobbleWall.class, org.bukkit.craftbukkit.block.impl.CraftCobbleWall::new);
|
||||
register(net.minecraft.server.BlockCocoa.class, org.bukkit.craftbukkit.block.impl.CraftCocoa::new);
|
||||
register(net.minecraft.server.BlockCommand.class, org.bukkit.craftbukkit.block.impl.CraftCommand::new);
|
||||
register(net.minecraft.server.BlockConduit.class, org.bukkit.craftbukkit.block.impl.CraftConduit::new);
|
||||
register(net.minecraft.server.BlockCoralDead.class, org.bukkit.craftbukkit.block.impl.CraftCoralDead::new);
|
||||
register(net.minecraft.server.BlockCoralFan.class, org.bukkit.craftbukkit.block.impl.CraftCoralFan::new);
|
||||
register(net.minecraft.server.BlockCoralFanAbstract.class, org.bukkit.craftbukkit.block.impl.CraftCoralFanAbstract::new);
|
||||
register(net.minecraft.server.BlockCoralFanWall.class, org.bukkit.craftbukkit.block.impl.CraftCoralFanWall::new);
|
||||
register(net.minecraft.server.BlockCoralFanWallAbstract.class, org.bukkit.craftbukkit.block.impl.CraftCoralFanWallAbstract::new);
|
||||
register(net.minecraft.server.BlockCoralPlant.class, org.bukkit.craftbukkit.block.impl.CraftCoralPlant::new);
|
||||
register(net.minecraft.server.BlockCrops.class, org.bukkit.craftbukkit.block.impl.CraftCrops::new);
|
||||
register(net.minecraft.server.BlockDaylightDetector.class, org.bukkit.craftbukkit.block.impl.CraftDaylightDetector::new);
|
||||
register(net.minecraft.server.BlockDirtSnow.class, org.bukkit.craftbukkit.block.impl.CraftDirtSnow::new);
|
||||
@@ -442,6 +446,7 @@ public class CraftBlockData implements BlockData {
|
||||
register(net.minecraft.server.BlockStepAbstract.class, org.bukkit.craftbukkit.block.impl.CraftStepAbstract::new);
|
||||
register(net.minecraft.server.BlockStoneButton.class, org.bukkit.craftbukkit.block.impl.CraftStoneButton::new);
|
||||
register(net.minecraft.server.BlockStructure.class, org.bukkit.craftbukkit.block.impl.CraftStructure::new);
|
||||
register(net.minecraft.server.BlockTNT.class, org.bukkit.craftbukkit.block.impl.CraftTNT::new);
|
||||
register(net.minecraft.server.BlockTallPlantFlower.class, org.bukkit.craftbukkit.block.impl.CraftTallPlantFlower::new);
|
||||
register(net.minecraft.server.BlockTallPlantShearable.class, org.bukkit.craftbukkit.block.impl.CraftTallPlantShearable::new);
|
||||
register(net.minecraft.server.BlockTallSeaGrass.class, org.bukkit.craftbukkit.block.impl.CraftTallSeaGrass::new);
|
||||
@@ -473,7 +478,7 @@ public class CraftBlockData implements BlockData {
|
||||
try {
|
||||
// Material provided, force that material in
|
||||
if (block != null) {
|
||||
data = Block.REGISTRY.b(block) + data;
|
||||
data = IRegistry.BLOCK.getKey(block) + data;
|
||||
}
|
||||
|
||||
StringReader reader = new StringReader(data);
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.bukkit.craftbukkit.block.data.type;
|
||||
|
||||
import org.bukkit.block.data.type.TNT;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
|
||||
public abstract class CraftTNT extends CraftBlockData implements TNT {
|
||||
|
||||
private static final net.minecraft.server.BlockStateBoolean UNSTABLE = getBoolean("unstable");
|
||||
|
||||
@Override
|
||||
public boolean isUnstable() {
|
||||
return get(UNSTABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUnstable(boolean unstable) {
|
||||
set(UNSTABLE, unstable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Automatically generated file, changes will be lost.
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftConduit extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Waterlogged {
|
||||
|
||||
public CraftConduit() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CraftConduit(net.minecraft.server.IBlockData state) {
|
||||
super(state);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
|
||||
|
||||
private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockConduit.class, "waterlogged");
|
||||
|
||||
@Override
|
||||
public boolean isWaterlogged() {
|
||||
return get(WATERLOGGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWaterlogged(boolean waterlogged) {
|
||||
set(WATERLOGGED, waterlogged);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Automatically generated file, changes will be lost.
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftCoralDead extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Waterlogged {
|
||||
|
||||
public CraftCoralDead() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CraftCoralDead(net.minecraft.server.IBlockData state) {
|
||||
super(state);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
|
||||
|
||||
private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockCoralDead.class, "waterlogged");
|
||||
|
||||
@Override
|
||||
public boolean isWaterlogged() {
|
||||
return get(WATERLOGGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWaterlogged(boolean waterlogged) {
|
||||
set(WATERLOGGED, waterlogged);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Automatically generated file, changes will be lost.
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftCoralPlant extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Waterlogged {
|
||||
|
||||
public CraftCoralPlant() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CraftCoralPlant(net.minecraft.server.IBlockData state) {
|
||||
super(state);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
|
||||
|
||||
private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockCoralPlant.class, "waterlogged");
|
||||
|
||||
@Override
|
||||
public boolean isWaterlogged() {
|
||||
return get(WATERLOGGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWaterlogged(boolean waterlogged) {
|
||||
set(WATERLOGGED, waterlogged);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Automatically generated file, changes will be lost.
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftTNT extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.TNT {
|
||||
|
||||
public CraftTNT() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CraftTNT(net.minecraft.server.IBlockData state) {
|
||||
super(state);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.type.CraftTNT
|
||||
|
||||
private static final net.minecraft.server.BlockStateBoolean UNSTABLE = getBoolean(net.minecraft.server.BlockTNT.class, "unstable");
|
||||
|
||||
@Override
|
||||
public boolean isUnstable() {
|
||||
return get(UNSTABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUnstable(boolean unstable) {
|
||||
set(UNSTABLE, unstable);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package org.bukkit.craftbukkit.command;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.mojang.brigadier.ParseResults;
|
||||
import com.mojang.brigadier.suggestion.Suggestion;
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -12,7 +11,6 @@ import net.minecraft.server.CommandListenerWrapper;
|
||||
import net.minecraft.server.DedicatedServer;
|
||||
import net.minecraft.server.EntityMinecartCommandBlock;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.BlockCommandSender;
|
||||
@@ -65,35 +63,6 @@ public final class VanillaCommandWrapper extends BukkitCommand {
|
||||
return results;
|
||||
}
|
||||
|
||||
public static class WorldRescueContext {
|
||||
|
||||
private WorldServer[] prev;
|
||||
|
||||
public WorldRescueContext start(WorldServer def) {
|
||||
// Some commands use the worldserver variable but we leave it full of null values,
|
||||
// so we must temporarily populate it with the world of the commandsender
|
||||
prev = MinecraftServer.getServer().worldServer;
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
server.worldServer = new WorldServer[server.worlds.size()];
|
||||
server.worldServer[0] = def;
|
||||
int bpos = 0;
|
||||
for (int pos = 1; pos < server.worldServer.length; pos++) {
|
||||
WorldServer world = server.worlds.get(bpos++);
|
||||
if (server.worldServer[0] == world) {
|
||||
pos--;
|
||||
continue;
|
||||
}
|
||||
server.worldServer[pos] = world;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void end() {
|
||||
MinecraftServer.getServer().worldServer = prev;
|
||||
}
|
||||
}
|
||||
|
||||
private CommandListenerWrapper getListener(CommandSender sender) {
|
||||
if (sender instanceof Player) {
|
||||
return ((CraftPlayer) sender).getHandle().getCommandListener();
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.enchantments;
|
||||
|
||||
import net.minecraft.server.EnchantmentBinding;
|
||||
import net.minecraft.server.EnchantmentVanishing;
|
||||
import net.minecraft.server.IRegistry;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@@ -13,7 +14,7 @@ public class CraftEnchantment extends Enchantment {
|
||||
private final net.minecraft.server.Enchantment target;
|
||||
|
||||
public CraftEnchantment(net.minecraft.server.Enchantment target) {
|
||||
super(CraftNamespacedKey.fromMinecraft(net.minecraft.server.Enchantment.enchantments.b(target)));
|
||||
super(CraftNamespacedKey.fromMinecraft(IRegistry.ENCHANTMENT.getKey(target)));
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@@ -79,7 +80,7 @@ public class CraftEnchantment extends Enchantment {
|
||||
@Override
|
||||
public String getName() {
|
||||
// PAIL: migration paths
|
||||
switch (net.minecraft.server.Enchantment.enchantments.a(target)) {
|
||||
switch (IRegistry.ENCHANTMENT.a(target)) {
|
||||
case 0:
|
||||
return "PROTECTION_ENVIRONMENTAL";
|
||||
case 1:
|
||||
|
||||
@@ -7,8 +7,8 @@ import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
public class CraftArrow extends AbstractProjectile implements Arrow {
|
||||
@@ -39,10 +39,10 @@ public class CraftArrow extends AbstractProjectile implements Arrow {
|
||||
}
|
||||
|
||||
public void setShooter(ProjectileSource shooter) {
|
||||
if (shooter instanceof LivingEntity) {
|
||||
getHandle().shooter = ((CraftLivingEntity) shooter).getHandle();
|
||||
if (shooter instanceof Entity) {
|
||||
getHandle().setShooter(((CraftEntity) shooter).getHandle());
|
||||
} else {
|
||||
getHandle().shooter = null;
|
||||
getHandle().setShooter(null);
|
||||
}
|
||||
getHandle().projectileSource = shooter;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
if (iinventory instanceof ITileInventory) {
|
||||
if (iinventory instanceof TileEntity) {
|
||||
TileEntity te = (TileEntity) iinventory;
|
||||
if (!te.u()) { // PAIL rename hasWorld
|
||||
if (!te.hasWorld()) {
|
||||
te.setWorld(getHandle().world);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
|
||||
@Override
|
||||
public boolean isRiptiding() {
|
||||
return getHandle().cO();
|
||||
return getHandle().isRiptiding();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo
|
||||
|
||||
@Override
|
||||
public LootTable getLootTable() {
|
||||
MinecraftKey nmsTable = getHandle().Q_(); // PAIL getLootTable
|
||||
MinecraftKey nmsTable = getHandle().getLootTable();
|
||||
if (nmsTable == null) {
|
||||
return null; // return empty loot table?
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo
|
||||
|
||||
@Override
|
||||
public long getSeed() {
|
||||
return getHandle().d; // PAIL rename lootTableSeed
|
||||
return getHandle().lootTableSeed;
|
||||
}
|
||||
|
||||
private void setLootTable(LootTable table, long seed) {
|
||||
|
||||
@@ -43,26 +43,26 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
||||
|
||||
@Override
|
||||
public void setLootTable(LootTable table) {
|
||||
getHandle().bI = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey()); // PAIL rename lootTableKey
|
||||
getHandle().lootTableKey = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public LootTable getLootTable() {
|
||||
if (getHandle().bI == null) {
|
||||
getHandle().bI = getHandle().getLootTable(); // Restore to entity default
|
||||
if (getHandle().lootTableKey == null) {
|
||||
getHandle().lootTableKey = getHandle().getLootTable();
|
||||
}
|
||||
|
||||
NamespacedKey key = CraftNamespacedKey.fromMinecraft(getHandle().bI); // PAIL rename lootTableKey
|
||||
NamespacedKey key = CraftNamespacedKey.fromMinecraft(getHandle().lootTableKey);
|
||||
return Bukkit.getLootTable(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSeed(long seed) {
|
||||
getHandle().bJ = seed; // PAIL rename lootTableSeed
|
||||
getHandle().lootTableSeed = seed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSeed() {
|
||||
return getHandle().bJ; // PAIL rename lootTableSeed
|
||||
return getHandle().lootTableSeed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,8 +266,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
if (getHandle().playerConnection == null) return;
|
||||
|
||||
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
|
||||
packet.a = (this.playerListHeader == null) ? new ChatComponentText("") : this.playerListHeader;
|
||||
packet.b = (this.playerListFooter == null) ? new ChatComponentText("") : this.playerListFooter;
|
||||
packet.header = (this.playerListHeader == null) ? new ChatComponentText("") : this.playerListHeader;
|
||||
packet.footer = (this.playerListFooter == null) ? new ChatComponentText("") : this.playerListFooter;
|
||||
getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class CraftEventFactory {
|
||||
WorldServer worldServer = world.getHandle();
|
||||
int spawnSize = Bukkit.getServer().getSpawnRadius();
|
||||
|
||||
if (world.getHandle().dimension != 0) return true;
|
||||
if (world.getHandle().dimension != DimensionManager.OVERWORLD) return true;
|
||||
if (spawnSize <= 0) return true;
|
||||
if (((CraftServer) Bukkit.getServer()).getHandle().getOPs().isEmpty()) return true;
|
||||
if (player.isOp()) return true;
|
||||
@@ -889,12 +889,11 @@ public class CraftEventFactory {
|
||||
human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity());
|
||||
}
|
||||
|
||||
public static void handleEditBookEvent(EntityPlayer player, ItemStack newBookItem) {
|
||||
int itemInHandIndex = player.inventory.itemInHandIndex;
|
||||
public static ItemStack handleEditBookEvent(EntityPlayer player, EnumItemSlot slot, ItemStack itemInHand, ItemStack newBookItem) {
|
||||
int itemInHandIndex = (slot == EnumItemSlot.MAINHAND) ? player.inventory.itemInHandIndex : -1;
|
||||
|
||||
PlayerEditBookEvent editBookEvent = new PlayerEditBookEvent(player.getBukkitEntity(), player.inventory.itemInHandIndex, (BookMeta) CraftItemStack.getItemMeta(player.inventory.getItemInHand()), (BookMeta) CraftItemStack.getItemMeta(newBookItem), newBookItem.getItem() == Items.WRITTEN_BOOK);
|
||||
PlayerEditBookEvent editBookEvent = new PlayerEditBookEvent(player.getBukkitEntity(), itemInHandIndex, (BookMeta) CraftItemStack.getItemMeta(itemInHand), (BookMeta) CraftItemStack.getItemMeta(newBookItem), newBookItem.getItem() == Items.WRITTEN_BOOK);
|
||||
player.world.getServer().getPluginManager().callEvent(editBookEvent);
|
||||
ItemStack itemInHand = player.inventory.getItem(itemInHandIndex);
|
||||
|
||||
// If they've got the same item in their hand, it'll need to be updated.
|
||||
if (itemInHand != null && itemInHand.getItem() == Items.WRITABLE_BOOK) {
|
||||
@@ -909,11 +908,9 @@ public class CraftEventFactory {
|
||||
}
|
||||
CraftItemStack.setItemMeta(itemInHand, meta);
|
||||
}
|
||||
|
||||
// Client will have updated its idea of the book item; we need to overwrite that
|
||||
Slot slot = player.activeContainer.getSlot(player.inventory, itemInHandIndex);
|
||||
player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, slot.rawSlotIndex, itemInHand));
|
||||
}
|
||||
|
||||
return itemInHand;
|
||||
}
|
||||
|
||||
private static IChatBaseComponent stripEvents(IChatBaseComponent c) {
|
||||
@@ -925,7 +922,7 @@ public class CraftEventFactory {
|
||||
c.setChatModifier(modi);
|
||||
if (c instanceof ChatMessage) {
|
||||
ChatMessage cm = (ChatMessage) c;
|
||||
Object[] oo = cm.i();
|
||||
Object[] oo = cm.l();
|
||||
for (int i = 0; i < oo.length; i++) {
|
||||
Object o = oo[i];
|
||||
if (o instanceof IChatBaseComponent) {
|
||||
|
||||
@@ -114,8 +114,8 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPosition findNearestMapFeature(World world, String type, BlockPosition position, int i) {
|
||||
return "Stronghold".equals(type) && this.strongholdGen != null ? this.strongholdGen.getNearestGeneratedFeature(world, this, position, i) : null;
|
||||
public BlockPosition findNearestMapFeature(World world, String type, BlockPosition position, int i, boolean flag) {
|
||||
return "Stronghold".equals(type) && this.strongholdGen != null ? this.strongholdGen.getNearestGeneratedFeature(world, this, position, i, flag) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,8 +38,8 @@ public class NormalChunkGenerator<C extends GeneratorSettings> extends InternalC
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPosition findNearestMapFeature(World world, String s, BlockPosition blockPosition, int i) {
|
||||
return generator.findNearestMapFeature(world, s, blockPosition, i);
|
||||
public BlockPosition findNearestMapFeature(World world, String s, BlockPosition blockPosition, int i, boolean flag) {
|
||||
return generator.findNearestMapFeature(world, s, blockPosition, i, flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.craftbukkit.inventory.util;
|
||||
|
||||
import net.minecraft.server.DimensionManager;
|
||||
import net.minecraft.server.ITileInventory;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.TileEntityBeacon;
|
||||
@@ -46,7 +47,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
|
||||
@Override
|
||||
public ITileInventory getTileEntity() {
|
||||
TileEntityFurnace furnace = new TileEntityFurnace();
|
||||
furnace.setWorld(MinecraftServer.getServer().getWorldServer(0)); // TODO: customize this if required
|
||||
furnace.setWorld(MinecraftServer.getServer().getWorldServer(DimensionManager.OVERWORLD)); // TODO: customize this if required
|
||||
return furnace;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.server.DimensionManager;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.WorldMap;
|
||||
import net.minecraft.server.WorldServer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
@@ -55,17 +58,14 @@ public final class CraftMapView implements MapView {
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
byte dimension = worldMap.map;
|
||||
for (World world : Bukkit.getServer().getWorlds()) {
|
||||
if (((CraftWorld) world).getHandle().dimension == dimension) {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
DimensionManager dimension = worldMap.map;
|
||||
WorldServer world = MinecraftServer.getServer().getWorldServer(dimension);
|
||||
|
||||
return (world == null) ? null : world.getWorld();
|
||||
}
|
||||
|
||||
public void setWorld(World world) {
|
||||
worldMap.map = (byte) ((CraftWorld) world).getHandle().dimension;
|
||||
worldMap.map = ((CraftWorld) world).getHandle().dimension;
|
||||
}
|
||||
|
||||
public int getCenterX() {
|
||||
|
||||
@@ -197,7 +197,7 @@ public final class CraftChatMessage {
|
||||
private static IChatBaseComponent fixComponent(IChatBaseComponent component, Matcher matcher) {
|
||||
if (component instanceof ChatComponentText) {
|
||||
ChatComponentText text = ((ChatComponentText) component);
|
||||
String msg = text.f();
|
||||
String msg = text.getText();
|
||||
if (matcher.reset(msg).find()) {
|
||||
matcher.reset();
|
||||
|
||||
@@ -248,7 +248,7 @@ public final class CraftChatMessage {
|
||||
}
|
||||
|
||||
if (component instanceof ChatMessage) {
|
||||
Object[] subs = ((ChatMessage) component).i();
|
||||
Object[] subs = ((ChatMessage) component).l();
|
||||
for (int i = 0; i < subs.length; i++) {
|
||||
Object comp = subs[i];
|
||||
if (comp instanceof IChatBaseComponent) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.server.DispenserRegistry;
|
||||
import net.minecraft.server.DynamicOpsNBT;
|
||||
import net.minecraft.server.IBlockData;
|
||||
import net.minecraft.server.IBlockState;
|
||||
import net.minecraft.server.IRegistry;
|
||||
import net.minecraft.server.Item;
|
||||
import net.minecraft.server.Items;
|
||||
import net.minecraft.server.MinecraftKey;
|
||||
@@ -333,7 +334,10 @@ public class CraftLegacy {
|
||||
name = "minecraft:nether_portal";
|
||||
}
|
||||
|
||||
Block block = Block.REGISTRY.get(new MinecraftKey(name));
|
||||
Block block = IRegistry.BLOCK.get(new MinecraftKey(name));
|
||||
if (block == null) {
|
||||
continue;
|
||||
}
|
||||
IBlockData blockData = block.getBlockData();
|
||||
BlockStateList states = block.getStates();
|
||||
|
||||
@@ -405,7 +409,7 @@ public class CraftLegacy {
|
||||
}
|
||||
|
||||
// Preconditions.checkState(newId.contains("minecraft:"), "Unknown new material for " + matData);
|
||||
Item newMaterial = Item.REGISTRY.get(new MinecraftKey(newId));
|
||||
Item newMaterial = IRegistry.ITEM.get(new MinecraftKey(newId));
|
||||
|
||||
if (newMaterial == Items.AIR) {
|
||||
continue;
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.server.AdvancementDataWorld;
|
||||
import net.minecraft.server.Block;
|
||||
import net.minecraft.server.ChatDeserializer;
|
||||
import net.minecraft.server.IBlockData;
|
||||
import net.minecraft.server.IRegistry;
|
||||
import net.minecraft.server.Item;
|
||||
import net.minecraft.server.MinecraftKey;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
@@ -74,19 +75,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
private static final Map<Material, Block> MATERIAL_BLOCK = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (Block block : (Iterable<Block>) Block.REGISTRY) { // Eclipse fail
|
||||
BLOCK_MATERIAL.put(block, Material.getMaterial(Block.REGISTRY.b(block).getKey().toUpperCase(Locale.ROOT)));
|
||||
for (Block block : (Iterable<Block>) IRegistry.BLOCK) { // Eclipse fail
|
||||
BLOCK_MATERIAL.put(block, Material.getMaterial(IRegistry.BLOCK.getKey(block).getKey().toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
for (Item item : (Iterable<Item>) Item.REGISTRY) { // Eclipse fail
|
||||
ITEM_MATERIAL.put(item, Material.getMaterial(Item.REGISTRY.b(item).getKey().toUpperCase(Locale.ROOT)));
|
||||
for (Item item : (Iterable<Item>) IRegistry.ITEM) { // Eclipse fail
|
||||
ITEM_MATERIAL.put(item, Material.getMaterial(IRegistry.ITEM.getKey(item).getKey().toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
for (Material material : Material.values()) {
|
||||
MinecraftKey key = key(material);
|
||||
// TODO: only register if block/item?
|
||||
MATERIAL_ITEM.put(material, Item.REGISTRY.get(key));
|
||||
MATERIAL_BLOCK.put(material, Block.REGISTRY.get(key));
|
||||
MATERIAL_ITEM.put(material, IRegistry.ITEM.get(key));
|
||||
MATERIAL_BLOCK.put(material, IRegistry.BLOCK.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
return CraftBlockData.fromData(getBlock(material, data));
|
||||
}
|
||||
|
||||
public static final int DATA_VERSION = 1519;
|
||||
public static final int DATA_VERSION = 1628;
|
||||
|
||||
@Override
|
||||
public int getDataVersion() {
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package org.bukkit.craftbukkit.util;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import net.minecraft.server.AxisAlignedBB;
|
||||
import net.minecraft.server.BiomeBase;
|
||||
import net.minecraft.server.Block;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
@@ -22,7 +19,6 @@ import net.minecraft.server.IChunkAccess;
|
||||
import net.minecraft.server.IChunkProvider;
|
||||
import net.minecraft.server.IDataManager;
|
||||
import net.minecraft.server.ParticleParam;
|
||||
import net.minecraft.server.PersistentBase;
|
||||
import net.minecraft.server.PersistentCollection;
|
||||
import net.minecraft.server.SoundCategory;
|
||||
import net.minecraft.server.SoundEffect;
|
||||
@@ -48,17 +44,17 @@ public class DummyGeneratorAccess implements GeneratorAccess {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickList<Block> I() {
|
||||
public TickList<Block> J() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickList<FluidType> H() {
|
||||
public TickList<FluidType> I() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChunkAccess c(int i, int i1) {
|
||||
public IChunkAccess b(int i, int i1) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@@ -77,16 +73,6 @@ public class DummyGeneratorAccess implements GeneratorAccess {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends PersistentBase> T a(Function<String, T> fnctn, String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistentCollection s_() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChunkProvider getChunkProvider() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -177,11 +163,6 @@ public class DummyGeneratorAccess implements GeneratorAccess {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entity> getEntities(Entity entity, AxisAlignedBB aabb) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int a(BlockPosition bp, EnumDirection ed) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -217,6 +198,11 @@ public class DummyGeneratorAccess implements GeneratorAccess {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistentCollection h() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user