@@ -1,9 +1,11 @@
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Predicates;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.function.Predicate;
|
||||
import net.minecraft.server.BiomeStorage;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.Blocks;
|
||||
@@ -218,7 +220,7 @@ public class CraftChunk implements Chunk {
|
||||
public boolean contains(BlockData block) {
|
||||
Preconditions.checkArgument(block != null, "Block cannot be null");
|
||||
|
||||
IBlockData nms = ((CraftBlockData) block).getState();
|
||||
Predicate<IBlockData> nms = Predicates.equalTo(((CraftBlockData) block).getState());
|
||||
for (ChunkSection section : getHandle().getSections()) {
|
||||
if (section != null && section.getBlocks().contains(nms)) {
|
||||
return true;
|
||||
@@ -253,7 +255,7 @@ public class CraftChunk implements Chunk {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
cs[i].getBlocks().a(data, "Palette", "BlockStates");
|
||||
|
||||
DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection
|
||||
DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection
|
||||
blockids.a(data.getList("Palette", CraftMagicNumbers.NBT.TAG_COMPOUND), data.getLongArray("BlockStates"));
|
||||
|
||||
sectionBlockIDs[i] = blockids;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Predicates;
|
||||
import java.util.function.Predicate;
|
||||
import net.minecraft.server.BiomeStorage;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.DataPaletteBlock;
|
||||
@@ -61,7 +63,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
public boolean contains(BlockData block) {
|
||||
Preconditions.checkArgument(block != null, "Block cannot be null");
|
||||
|
||||
IBlockData nms = ((CraftBlockData) block).getState();
|
||||
Predicate<IBlockData> nms = Predicates.equalTo(((CraftBlockData) block).getState());
|
||||
for (DataPaletteBlock<IBlockData> palette : blockids) {
|
||||
if (palette.contains(nms)) {
|
||||
return true;
|
||||
|
||||
@@ -82,7 +82,7 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
|
||||
Entity nmsLootedEntity = ((CraftEntity) context.getLootedEntity()).getHandle();
|
||||
builder.set(LootContextParameters.THIS_ENTITY, nmsLootedEntity);
|
||||
builder.set(LootContextParameters.DAMAGE_SOURCE, DamageSource.GENERIC);
|
||||
builder.set(LootContextParameters.POSITION, new BlockPosition(nmsLootedEntity));
|
||||
builder.set(LootContextParameters.POSITION, nmsLootedEntity.getChunkCoordinates());
|
||||
}
|
||||
|
||||
if (context.getKiller() != null) {
|
||||
@@ -100,23 +100,23 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
|
||||
}
|
||||
|
||||
// SPIGOT-5603 - Avoid IllegalArgumentException in LootTableInfo#build()
|
||||
LootContextParameterSet.a nmsBuilder = new LootContextParameterSet.a(); // PAIL rename Builder
|
||||
for (LootContextParameter<?> param : getHandle().getLootContextParameterSet().a()) { // PAIL rename required
|
||||
nmsBuilder.a(param); // PAIL rename addRequired
|
||||
LootContextParameterSet.Builder nmsBuilder = new LootContextParameterSet.Builder();
|
||||
for (LootContextParameter<?> param : getHandle().getLootContextParameterSet().getRequired()) {
|
||||
nmsBuilder.addRequired(param);
|
||||
}
|
||||
for (LootContextParameter<?> param : getHandle().getLootContextParameterSet().b()) { // PAIL rename optional
|
||||
if (!getHandle().getLootContextParameterSet().a().contains(param)) { // PAIL rename required
|
||||
nmsBuilder.b(param); // PAIL rename addOptional
|
||||
for (LootContextParameter<?> param : getHandle().getLootContextParameterSet().getOptional()) {
|
||||
if (!getHandle().getLootContextParameterSet().getRequired().contains(param)) {
|
||||
nmsBuilder.addOptional(param);
|
||||
}
|
||||
}
|
||||
nmsBuilder.b(LootContextParameters.LOOTING_MOD); // PAIL rename addOptional
|
||||
nmsBuilder.addOptional(LootContextParameters.LOOTING_MOD);
|
||||
|
||||
return builder.build(nmsBuilder.a()); // PAIL rename build
|
||||
return builder.build(nmsBuilder.build());
|
||||
}
|
||||
|
||||
public static LootContext convertContext(LootTableInfo info) {
|
||||
BlockPosition position = info.getContextParameter(LootContextParameters.POSITION);
|
||||
Location location = new Location(info.c().getWorld(), position.getX(), position.getY(), position.getZ()); // PAIL rename getWorld
|
||||
Location location = new Location(info.getWorld().getWorld(), position.getX(), position.getY(), position.getZ());
|
||||
LootContext.Builder contextBuilder = new LootContext.Builder(location);
|
||||
|
||||
if (info.hasContextParameter(LootContextParameters.KILLER_ENTITY)) {
|
||||
@@ -134,7 +134,7 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
|
||||
contextBuilder.lootingModifier(info.getContextParameter(LootContextParameters.LOOTING_MOD));
|
||||
}
|
||||
|
||||
contextBuilder.luck(info.b()); // PAIL rename getLuck
|
||||
contextBuilder.luck(info.getLuck());
|
||||
return contextBuilder.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import net.minecraft.server.DimensionManager;
|
||||
import net.minecraft.server.NBTTagCompound;
|
||||
import net.minecraft.server.ServerStatisticManager;
|
||||
import net.minecraft.server.WhiteListEntry;
|
||||
@@ -34,7 +33,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
protected CraftOfflinePlayer(CraftServer server, GameProfile profile) {
|
||||
this.server = server;
|
||||
this.profile = profile;
|
||||
this.storage = (WorldNBTStorage) (server.console.getWorldServer(DimensionManager.OVERWORLD).getDataManager());
|
||||
this.storage = server.console.worldNBTStorage;
|
||||
|
||||
}
|
||||
|
||||
@@ -287,7 +286,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.incrementStatistic(manager, statistic);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +297,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.decrementStatistic(manager, statistic);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +317,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.incrementStatistic(manager, statistic, amount);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,7 +328,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.decrementStatistic(manager, statistic, amount);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +339,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.setStatistic(manager, statistic, newValue);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,7 +350,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.incrementStatistic(manager, statistic, material);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,7 +361,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.decrementStatistic(manager, statistic, material);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,7 +381,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.incrementStatistic(manager, statistic, material, amount);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +392,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.decrementStatistic(manager, statistic, material, amount);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,7 +403,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.setStatistic(manager, statistic, material, newValue);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,7 +414,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.incrementStatistic(manager, statistic, entityType);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,7 +425,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.decrementStatistic(manager, statistic, entityType);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,7 +445,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.incrementStatistic(manager, statistic, entityType, amount);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,7 +456,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.decrementStatistic(manager, statistic, entityType, amount);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,7 +467,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
} else {
|
||||
ServerStatisticManager manager = getStatisticManager();
|
||||
CraftStatistic.setStatistic(manager, statistic, entityType, newValue);
|
||||
manager.a();
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,16 @@ public enum CraftParticle {
|
||||
FALLING_HONEY("falling_honey"),
|
||||
LANDING_HONEY("landing_honey"),
|
||||
FALLING_NECTAR("falling_nectar"),
|
||||
SOUL_FIRE_FLAME("soul_fire_flame"),
|
||||
ASH("ash"),
|
||||
CRIMSON_SPORE("crimson_spore"),
|
||||
WARPED_SPORE("warped_spore"),
|
||||
SOUL("soul"),
|
||||
DRIPPING_OBSIDIAN_TEAR("dripping_obsidian_tear"),
|
||||
FALLING_OBSIDIAN_TEAR("falling_obsidian_tear"),
|
||||
LANDING_OBSIDIAN_TEAR("landing_obsidian_tear"),
|
||||
REVERSE_PORTAL("reverse_portal"),
|
||||
WHITE_ASH("white_ash"),
|
||||
// ----- Legacy Separator -----
|
||||
LEGACY_BLOCK_CRACK("block"),
|
||||
LEGACY_BLOCK_DUST("block"),
|
||||
|
||||
@@ -7,13 +7,13 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import com.mojang.serialization.DynamicOps;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufOutputStream;
|
||||
import io.netty.buffer.Unpooled;
|
||||
@@ -36,6 +36,9 @@ import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
@@ -45,21 +48,30 @@ import javax.imageio.ImageIO;
|
||||
import jline.console.ConsoleReader;
|
||||
import net.minecraft.server.Advancement;
|
||||
import net.minecraft.server.ArgumentEntity;
|
||||
import net.minecraft.server.BiomeManager;
|
||||
import net.minecraft.server.Block;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.BossBattleCustom;
|
||||
import net.minecraft.server.CommandDispatcher;
|
||||
import net.minecraft.server.CommandListenerWrapper;
|
||||
import net.minecraft.server.CommandReload;
|
||||
import net.minecraft.server.Convertable;
|
||||
import net.minecraft.server.DataConverterRegistry;
|
||||
import net.minecraft.server.DedicatedPlayerList;
|
||||
import net.minecraft.server.DedicatedServer;
|
||||
import net.minecraft.server.DedicatedServerProperties;
|
||||
import net.minecraft.server.DedicatedServerSettings;
|
||||
import net.minecraft.server.DimensionManager;
|
||||
import net.minecraft.server.DynamicOpsNBT;
|
||||
import net.minecraft.server.Enchantments;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.EnumDifficulty;
|
||||
import net.minecraft.server.EnumGamemode;
|
||||
import net.minecraft.server.GameRules;
|
||||
import net.minecraft.server.GeneratorSettings;
|
||||
import net.minecraft.server.IRecipe;
|
||||
import net.minecraft.server.IRegistry;
|
||||
import net.minecraft.server.IRegistryCustom;
|
||||
import net.minecraft.server.Item;
|
||||
import net.minecraft.server.ItemWorldMap;
|
||||
import net.minecraft.server.Items;
|
||||
@@ -67,18 +79,30 @@ import net.minecraft.server.JsonListEntry;
|
||||
import net.minecraft.server.LootTableRegistry;
|
||||
import net.minecraft.server.MapIcon;
|
||||
import net.minecraft.server.MinecraftKey;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.MobEffects;
|
||||
import net.minecraft.server.MobSpawner;
|
||||
import net.minecraft.server.MobSpawnerCat;
|
||||
import net.minecraft.server.MobSpawnerPatrol;
|
||||
import net.minecraft.server.MobSpawnerPhantom;
|
||||
import net.minecraft.server.MobSpawnerTrader;
|
||||
import net.minecraft.server.NBTBase;
|
||||
import net.minecraft.server.PlayerList;
|
||||
import net.minecraft.server.RegistryMaterials;
|
||||
import net.minecraft.server.RegistryReadOps;
|
||||
import net.minecraft.server.ResourceKey;
|
||||
import net.minecraft.server.SaveData;
|
||||
import net.minecraft.server.ServerCommand;
|
||||
import net.minecraft.server.TagsServer;
|
||||
import net.minecraft.server.TicketType;
|
||||
import net.minecraft.server.Vec3D;
|
||||
import net.minecraft.server.WorldData;
|
||||
import net.minecraft.server.VillageSiege;
|
||||
import net.minecraft.server.WorldDataServer;
|
||||
import net.minecraft.server.WorldDimension;
|
||||
import net.minecraft.server.WorldMap;
|
||||
import net.minecraft.server.WorldNBTStorage;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import net.minecraft.server.WorldSettings;
|
||||
import net.minecraft.server.WorldType;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.BanList;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -404,7 +428,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
private void syncCommands() {
|
||||
// Clear existing commands
|
||||
CommandDispatcher dispatcher = console.commandDispatcher = new CommandDispatcher();
|
||||
CommandDispatcher dispatcher = console.dataPackResources.commandDispatcher = new CommandDispatcher();
|
||||
|
||||
// Register all commands, vanilla ones will be using the old dispatcher references
|
||||
for (Map.Entry<String, Command> entry : commandMap.getKnownCommands().entrySet()) {
|
||||
@@ -510,7 +534,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public Player getPlayer(UUID id) {
|
||||
EntityPlayer player = playerList.a(id);
|
||||
EntityPlayer player = playerList.getPlayer(id);
|
||||
|
||||
if (player != null) {
|
||||
return player.getBukkitEntity();
|
||||
@@ -577,12 +601,12 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public String getWorldType() {
|
||||
return this.getProperties().levelType.name();
|
||||
return this.getProperties().properties.getProperty("level-type");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGenerateStructures() {
|
||||
return this.getServer().getGenerateStructures();
|
||||
return this.getProperties().generatorSettings.shouldGenerateMapFeatures();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -721,7 +745,6 @@ public final class CraftServer implements Server {
|
||||
console.propertyManager = new DedicatedServerSettings(console.options);
|
||||
DedicatedServerProperties config = console.propertyManager.getProperties();
|
||||
|
||||
console.setSpawnAnimals(config.spawnAnimals);
|
||||
console.setPVP(config.pvp);
|
||||
console.setAllowFlight(config.allowFlight);
|
||||
console.setMotd(config.motd);
|
||||
@@ -748,7 +771,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
for (WorldServer world : console.getWorlds()) {
|
||||
world.worldData.setDifficulty(config.difficulty);
|
||||
world.worldDataServer.setDifficulty(config.difficulty);
|
||||
world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals);
|
||||
if (this.getTicksPerAnimalSpawns() < 0) {
|
||||
world.ticksPerAnimalSpawns = 400;
|
||||
@@ -814,7 +837,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public void reloadData() {
|
||||
console.reload();
|
||||
CommandReload.reload(console);
|
||||
}
|
||||
|
||||
private void loadIcon() {
|
||||
@@ -906,8 +929,6 @@ public final class CraftServer implements Server {
|
||||
ChunkGenerator generator = creator.generator();
|
||||
File folder = new File(getWorldContainer(), name);
|
||||
World world = getWorld(name);
|
||||
WorldType type = WorldType.getType(creator.type().getName());
|
||||
boolean generateStructures = creator.generateStructures();
|
||||
|
||||
if (world != null) {
|
||||
return world;
|
||||
@@ -921,50 +942,88 @@ public final class CraftServer implements Server {
|
||||
generator = getGenerator(name);
|
||||
}
|
||||
|
||||
console.convertWorld(name);
|
||||
ResourceKey<WorldDimension> actualDimension;
|
||||
switch (creator.environment()) {
|
||||
case NORMAL:
|
||||
actualDimension = WorldDimension.OVERWORLD;
|
||||
break;
|
||||
case NETHER:
|
||||
actualDimension = WorldDimension.THE_NETHER;
|
||||
break;
|
||||
case THE_END:
|
||||
actualDimension = WorldDimension.THE_END;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Illegal dimension");
|
||||
}
|
||||
|
||||
Convertable.ConversionSession worldSession;
|
||||
try {
|
||||
worldSession = Convertable.a(getWorldContainer().toPath()).c(name, actualDimension);
|
||||
} catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
MinecraftServer.convertWorld(worldSession); // Run conversion now
|
||||
|
||||
int dimension = CraftWorld.CUSTOM_DIMENSION_OFFSET + console.worldServer.size();
|
||||
boolean used = false;
|
||||
do {
|
||||
for (WorldServer server : console.getWorlds()) {
|
||||
used = server.getWorldProvider().getDimensionManager().getDimensionID() == dimension;
|
||||
if (used) {
|
||||
dimension++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (used);
|
||||
boolean hardcore = creator.hardcore();
|
||||
|
||||
WorldNBTStorage sdm = new WorldNBTStorage(getWorldContainer(), name, getServer(), getHandle().getServer().dataConverterManager);
|
||||
WorldData worlddata = sdm.getWorldData();
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = IRegistryCustom.b();
|
||||
|
||||
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.a, console.dataPackResources.h(), (IRegistryCustom) iregistrycustom_dimension);
|
||||
WorldDataServer worlddata = (WorldDataServer) worldSession.a((DynamicOps) registryreadops, console.datapackconfiguration);
|
||||
|
||||
WorldSettings worldSettings;
|
||||
// See MinecraftServer.a(String, String, long, WorldType, JsonElement)
|
||||
if (worlddata == null) {
|
||||
worldSettings = new WorldSettings(creator.seed(), EnumGamemode.getById(getDefaultGameMode().getValue()), generateStructures, hardcore, type);
|
||||
JsonElement parsedSettings = new JsonParser().parse(creator.generatorSettings());
|
||||
if (parsedSettings.isJsonObject()) {
|
||||
worldSettings.setGeneratorSettings(parsedSettings.getAsJsonObject());
|
||||
}
|
||||
worlddata = new WorldData(worldSettings, name);
|
||||
} else {
|
||||
worlddata.setName(name);
|
||||
worldSettings = new WorldSettings(worlddata);
|
||||
Properties properties = new Properties();
|
||||
properties.put("generator-settings", Objects.toString(creator.generatorSettings()));
|
||||
properties.put("level-seed", Objects.toString(creator.seed()));
|
||||
properties.put("generate-structures", Objects.toString(creator.generateStructures()));
|
||||
properties.put("level-type", Objects.toString(creator.type().getName()));
|
||||
|
||||
GeneratorSettings generatorsettings = GeneratorSettings.a(properties);
|
||||
worldSettings = new WorldSettings(name, EnumGamemode.getById(getDefaultGameMode().getValue()), hardcore, EnumDifficulty.EASY, false, new GameRules(), console.datapackconfiguration);
|
||||
worlddata = new WorldDataServer(worldSettings, generatorsettings, Lifecycle.stable());
|
||||
}
|
||||
worlddata.a(console.getServerModName(), console.getModded().isPresent());
|
||||
|
||||
if (console.options.has("forceUpgrade")) {
|
||||
net.minecraft.server.Main.convertWorld(worldSession, DataConverterRegistry.a(), console.options.has("eraseCache"), () -> {
|
||||
return true;
|
||||
}, worlddata.getGeneratorSettings().g());
|
||||
}
|
||||
|
||||
DimensionManager actualDimension = DimensionManager.a(creator.environment().getId());
|
||||
DimensionManager internalDimension = DimensionManager.register(name.toLowerCase(java.util.Locale.ENGLISH), new DimensionManager(dimension, actualDimension.getSuffix(), actualDimension.folder, (w, manager) -> actualDimension.providerFactory.apply(w, manager), actualDimension.hasSkyLight(), actualDimension.getGenLayerZoomer(), actualDimension));
|
||||
WorldServer internal = (WorldServer) new WorldServer(console, console.executorService, sdm, worlddata, internalDimension, console.getMethodProfiler(), getServer().worldLoadListenerFactory.create(11), creator.environment(), generator);
|
||||
long j = BiomeManager.a(creator.seed());
|
||||
List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(worlddata));
|
||||
RegistryMaterials<WorldDimension> registrymaterials = worlddata.getGeneratorSettings().e();
|
||||
WorldDimension worlddimension = (WorldDimension) registrymaterials.a(actualDimension);
|
||||
DimensionManager dimensionmanager;
|
||||
net.minecraft.server.ChunkGenerator chunkgenerator;
|
||||
|
||||
if (worlddimension == null) {
|
||||
dimensionmanager = DimensionManager.a();
|
||||
chunkgenerator = GeneratorSettings.a((new Random()).nextLong());
|
||||
} else {
|
||||
dimensionmanager = worlddimension.b();
|
||||
chunkgenerator = worlddimension.c();
|
||||
}
|
||||
|
||||
ResourceKey<DimensionManager> typeKey = (ResourceKey) console.f.a().c(dimensionmanager).orElseThrow(() -> {
|
||||
return new IllegalStateException("Unregistered dimension type: " + dimensionmanager);
|
||||
});
|
||||
ResourceKey<net.minecraft.server.World> worldKey = ResourceKey.a(IRegistry.ae, new MinecraftKey(name.toLowerCase(java.util.Locale.ENGLISH)));
|
||||
|
||||
WorldServer internal = (WorldServer) new WorldServer(console, console.executorService, worldSession, worlddata, worldKey, typeKey, dimensionmanager, getServer().worldLoadListenerFactory.create(11),
|
||||
chunkgenerator, worlddata.getGeneratorSettings().isDebugWorld(), j, creator.environment() == Environment.NORMAL ? list : ImmutableList.of(), creator.environment() == Environment.NORMAL, creator.environment(), generator);
|
||||
|
||||
if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
console.initWorld(internal, worlddata, worldSettings);
|
||||
console.initWorld(internal, worlddata, worlddata, worlddata.getGeneratorSettings());
|
||||
|
||||
internal.worldData.setDifficulty(EnumDifficulty.EASY);
|
||||
internal.setSpawnFlags(true, true);
|
||||
console.worldServer.put(internal.getWorldProvider().getDimensionManager(), internal);
|
||||
console.worldServer.put(internal.getDimensionKey(), internal);
|
||||
|
||||
pluginManager.callEvent(new WorldInitEvent(internal.getWorld()));
|
||||
|
||||
@@ -987,11 +1046,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
WorldServer handle = ((CraftWorld) world).getHandle();
|
||||
|
||||
if (!(console.worldServer.containsKey(handle.getWorldProvider().getDimensionManager()))) {
|
||||
if (!(console.worldServer.containsKey(handle.getDimensionKey()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handle.getWorldProvider().getDimensionManager() == DimensionManager.OVERWORLD) {
|
||||
if (handle.getDimensionKey() == net.minecraft.server.World.OVERWORLD) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1017,7 +1076,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH));
|
||||
console.worldServer.remove(handle.getWorldProvider().getDimensionManager());
|
||||
console.worldServer.remove(handle.getDimensionKey());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1138,7 +1197,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public void resetRecipes() {
|
||||
console.reload(); // Not ideal but hard to reload a subset of a resource pack
|
||||
reloadData(); // Not ideal but hard to reload a subset of a resource pack
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1256,7 +1315,7 @@ public final class CraftServer implements Server {
|
||||
@Override
|
||||
@Deprecated
|
||||
public CraftMapView getMap(int id) {
|
||||
WorldMap worldmap = console.getWorldServer(DimensionManager.OVERWORLD).a("map_" + id);
|
||||
WorldMap worldmap = console.getWorldServer(net.minecraft.server.World.OVERWORLD).a("map_" + id);
|
||||
if (worldmap == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -1453,7 +1512,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public GameMode getDefaultGameMode() {
|
||||
return GameMode.getByValue(console.getWorldServer(DimensionManager.OVERWORLD).getWorldData().getGameType().getId());
|
||||
return GameMode.getByValue(console.getWorldServer(net.minecraft.server.World.OVERWORLD).worldDataServer.getGameType().getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1461,7 +1520,7 @@ public final class CraftServer implements Server {
|
||||
Validate.notNull(mode, "Mode cannot be null");
|
||||
|
||||
for (World world : getWorlds()) {
|
||||
((CraftWorld) world).getHandle().worldData.setGameType(EnumGamemode.getById(mode.getValue()));
|
||||
((CraftWorld) world).getHandle().worldDataServer.setGameType(EnumGamemode.getById(mode.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1484,20 +1543,12 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public File getWorldContainer() {
|
||||
if (this.getServer().universe != null) {
|
||||
return this.getServer().universe;
|
||||
}
|
||||
|
||||
if (container == null) {
|
||||
container = new File(configuration.getString("settings.world-container", "."));
|
||||
}
|
||||
|
||||
return container;
|
||||
return this.getServer().convertable.a(net.minecraft.server.World.OVERWORLD).getParentFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfflinePlayer[] getOfflinePlayers() {
|
||||
WorldNBTStorage storage = (WorldNBTStorage) console.getWorldServer(DimensionManager.OVERWORLD).getDataManager();
|
||||
WorldNBTStorage storage = console.worldNBTStorage;
|
||||
String[] files = storage.getPlayerDir().list(new DatFileFilter());
|
||||
Set<OfflinePlayer> players = new HashSet<OfflinePlayer>();
|
||||
|
||||
|
||||
@@ -9,13 +9,33 @@ import org.bukkit.Sound;
|
||||
|
||||
public enum CraftSound {
|
||||
|
||||
AMBIENT_BASALT_DELTAS_ADDITIONS("ambient.basalt_deltas.additions"),
|
||||
AMBIENT_BASALT_DELTAS_LOOP("ambient.basalt_deltas.loop"),
|
||||
AMBIENT_BASALT_DELTAS_MOOD("ambient.basalt_deltas.mood"),
|
||||
AMBIENT_CAVE("ambient.cave"),
|
||||
AMBIENT_CRIMSON_FOREST_ADDITIONS("ambient.crimson_forest.additions"),
|
||||
AMBIENT_CRIMSON_FOREST_LOOP("ambient.crimson_forest.loop"),
|
||||
AMBIENT_CRIMSON_FOREST_MOOD("ambient.crimson_forest.mood"),
|
||||
AMBIENT_NETHER_WASTES_ADDITIONS("ambient.nether_wastes.additions"),
|
||||
AMBIENT_NETHER_WASTES_LOOP("ambient.nether_wastes.loop"),
|
||||
AMBIENT_NETHER_WASTES_MOOD("ambient.nether_wastes.mood"),
|
||||
AMBIENT_SOUL_SAND_VALLEY_ADDITIONS("ambient.soul_sand_valley.additions"),
|
||||
AMBIENT_SOUL_SAND_VALLEY_LOOP("ambient.soul_sand_valley.loop"),
|
||||
AMBIENT_SOUL_SAND_VALLEY_MOOD("ambient.soul_sand_valley.mood"),
|
||||
AMBIENT_UNDERWATER_ENTER("ambient.underwater.enter"),
|
||||
AMBIENT_UNDERWATER_EXIT("ambient.underwater.exit"),
|
||||
AMBIENT_UNDERWATER_LOOP("ambient.underwater.loop"),
|
||||
AMBIENT_UNDERWATER_LOOP_ADDITIONS("ambient.underwater.loop.additions"),
|
||||
AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE("ambient.underwater.loop.additions.rare"),
|
||||
AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE("ambient.underwater.loop.additions.ultra_rare"),
|
||||
AMBIENT_WARPED_FOREST_ADDITIONS("ambient.warped_forest.additions"),
|
||||
AMBIENT_WARPED_FOREST_LOOP("ambient.warped_forest.loop"),
|
||||
AMBIENT_WARPED_FOREST_MOOD("ambient.warped_forest.mood"),
|
||||
BLOCK_ANCIENT_DEBRIS_BREAK("block.ancient_debris.break"),
|
||||
BLOCK_ANCIENT_DEBRIS_FALL("block.ancient_debris.fall"),
|
||||
BLOCK_ANCIENT_DEBRIS_HIT("block.ancient_debris.hit"),
|
||||
BLOCK_ANCIENT_DEBRIS_PLACE("block.ancient_debris.place"),
|
||||
BLOCK_ANCIENT_DEBRIS_STEP("block.ancient_debris.step"),
|
||||
BLOCK_ANVIL_BREAK("block.anvil.break"),
|
||||
BLOCK_ANVIL_DESTROY("block.anvil.destroy"),
|
||||
BLOCK_ANVIL_FALL("block.anvil.fall"),
|
||||
@@ -34,6 +54,11 @@ public enum CraftSound {
|
||||
BLOCK_BAMBOO_STEP("block.bamboo.step"),
|
||||
BLOCK_BARREL_CLOSE("block.barrel.close"),
|
||||
BLOCK_BARREL_OPEN("block.barrel.open"),
|
||||
BLOCK_BASALT_BREAK("block.basalt.break"),
|
||||
BLOCK_BASALT_FALL("block.basalt.fall"),
|
||||
BLOCK_BASALT_HIT("block.basalt.hit"),
|
||||
BLOCK_BASALT_PLACE("block.basalt.place"),
|
||||
BLOCK_BASALT_STEP("block.basalt.step"),
|
||||
BLOCK_BEACON_ACTIVATE("block.beacon.activate"),
|
||||
BLOCK_BEACON_AMBIENT("block.beacon.ambient"),
|
||||
BLOCK_BEACON_DEACTIVATE("block.beacon.deactivate"),
|
||||
@@ -46,6 +71,11 @@ public enum CraftSound {
|
||||
BLOCK_BELL_RESONATE("block.bell.resonate"),
|
||||
BLOCK_BELL_USE("block.bell.use"),
|
||||
BLOCK_BLASTFURNACE_FIRE_CRACKLE("block.blastfurnace.fire_crackle"),
|
||||
BLOCK_BONE_BLOCK_BREAK("block.bone_block.break"),
|
||||
BLOCK_BONE_BLOCK_FALL("block.bone_block.fall"),
|
||||
BLOCK_BONE_BLOCK_HIT("block.bone_block.hit"),
|
||||
BLOCK_BONE_BLOCK_PLACE("block.bone_block.place"),
|
||||
BLOCK_BONE_BLOCK_STEP("block.bone_block.step"),
|
||||
BLOCK_BREWING_STAND_BREW("block.brewing_stand.brew"),
|
||||
BLOCK_BUBBLE_COLUMN_BUBBLE_POP("block.bubble_column.bubble_pop"),
|
||||
BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT("block.bubble_column.upwards_ambient"),
|
||||
@@ -53,6 +83,11 @@ public enum CraftSound {
|
||||
BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT("block.bubble_column.whirlpool_ambient"),
|
||||
BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE("block.bubble_column.whirlpool_inside"),
|
||||
BLOCK_CAMPFIRE_CRACKLE("block.campfire.crackle"),
|
||||
BLOCK_CHAIN_BREAK("block.chain.break"),
|
||||
BLOCK_CHAIN_FALL("block.chain.fall"),
|
||||
BLOCK_CHAIN_HIT("block.chain.hit"),
|
||||
BLOCK_CHAIN_PLACE("block.chain.place"),
|
||||
BLOCK_CHAIN_STEP("block.chain.step"),
|
||||
BLOCK_CHEST_CLOSE("block.chest.close"),
|
||||
BLOCK_CHEST_LOCKED("block.chest.locked"),
|
||||
BLOCK_CHEST_OPEN("block.chest.open"),
|
||||
@@ -87,7 +122,17 @@ public enum CraftSound {
|
||||
BLOCK_FENCE_GATE_OPEN("block.fence_gate.open"),
|
||||
BLOCK_FIRE_AMBIENT("block.fire.ambient"),
|
||||
BLOCK_FIRE_EXTINGUISH("block.fire.extinguish"),
|
||||
BLOCK_FUNGUS_BREAK("block.fungus.break"),
|
||||
BLOCK_FUNGUS_FALL("block.fungus.fall"),
|
||||
BLOCK_FUNGUS_HIT("block.fungus.hit"),
|
||||
BLOCK_FUNGUS_PLACE("block.fungus.place"),
|
||||
BLOCK_FUNGUS_STEP("block.fungus.step"),
|
||||
BLOCK_FURNACE_FIRE_CRACKLE("block.furnace.fire_crackle"),
|
||||
BLOCK_GILDED_BLACKSTONE_BREAK("block.gilded_blackstone.break"),
|
||||
BLOCK_GILDED_BLACKSTONE_FALL("block.gilded_blackstone.fall"),
|
||||
BLOCK_GILDED_BLACKSTONE_HIT("block.gilded_blackstone.hit"),
|
||||
BLOCK_GILDED_BLACKSTONE_PLACE("block.gilded_blackstone.place"),
|
||||
BLOCK_GILDED_BLACKSTONE_STEP("block.gilded_blackstone.step"),
|
||||
BLOCK_GLASS_BREAK("block.glass.break"),
|
||||
BLOCK_GLASS_FALL("block.glass.fall"),
|
||||
BLOCK_GLASS_HIT("block.glass.hit"),
|
||||
@@ -129,6 +174,11 @@ public enum CraftSound {
|
||||
BLOCK_LAVA_POP("block.lava.pop"),
|
||||
BLOCK_LEVER_CLICK("block.lever.click"),
|
||||
BLOCK_LILY_PAD_PLACE("block.lily_pad.place"),
|
||||
BLOCK_LODESTONE_BREAK("block.lodestone.break"),
|
||||
BLOCK_LODESTONE_FALL("block.lodestone.fall"),
|
||||
BLOCK_LODESTONE_HIT("block.lodestone.hit"),
|
||||
BLOCK_LODESTONE_PLACE("block.lodestone.place"),
|
||||
BLOCK_LODESTONE_STEP("block.lodestone.step"),
|
||||
BLOCK_METAL_BREAK("block.metal.break"),
|
||||
BLOCK_METAL_FALL("block.metal.fall"),
|
||||
BLOCK_METAL_HIT("block.metal.hit"),
|
||||
@@ -136,6 +186,36 @@ public enum CraftSound {
|
||||
BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF("block.metal_pressure_plate.click_off"),
|
||||
BLOCK_METAL_PRESSURE_PLATE_CLICK_ON("block.metal_pressure_plate.click_on"),
|
||||
BLOCK_METAL_STEP("block.metal.step"),
|
||||
BLOCK_NETHERITE_BLOCK_BREAK("block.netherite_block.break"),
|
||||
BLOCK_NETHERITE_BLOCK_FALL("block.netherite_block.fall"),
|
||||
BLOCK_NETHERITE_BLOCK_HIT("block.netherite_block.hit"),
|
||||
BLOCK_NETHERITE_BLOCK_PLACE("block.netherite_block.place"),
|
||||
BLOCK_NETHERITE_BLOCK_STEP("block.netherite_block.step"),
|
||||
BLOCK_NETHERRACK_BREAK("block.netherrack.break"),
|
||||
BLOCK_NETHERRACK_FALL("block.netherrack.fall"),
|
||||
BLOCK_NETHERRACK_HIT("block.netherrack.hit"),
|
||||
BLOCK_NETHERRACK_PLACE("block.netherrack.place"),
|
||||
BLOCK_NETHERRACK_STEP("block.netherrack.step"),
|
||||
BLOCK_NETHER_BRICKS_BREAK("block.nether_bricks.break"),
|
||||
BLOCK_NETHER_BRICKS_FALL("block.nether_bricks.fall"),
|
||||
BLOCK_NETHER_BRICKS_HIT("block.nether_bricks.hit"),
|
||||
BLOCK_NETHER_BRICKS_PLACE("block.nether_bricks.place"),
|
||||
BLOCK_NETHER_BRICKS_STEP("block.nether_bricks.step"),
|
||||
BLOCK_NETHER_GOLD_ORE_BREAK("block.nether_gold_ore.break"),
|
||||
BLOCK_NETHER_GOLD_ORE_FALL("block.nether_gold_ore.fall"),
|
||||
BLOCK_NETHER_GOLD_ORE_HIT("block.nether_gold_ore.hit"),
|
||||
BLOCK_NETHER_GOLD_ORE_PLACE("block.nether_gold_ore.place"),
|
||||
BLOCK_NETHER_GOLD_ORE_STEP("block.nether_gold_ore.step"),
|
||||
BLOCK_NETHER_ORE_BREAK("block.nether_ore.break"),
|
||||
BLOCK_NETHER_ORE_FALL("block.nether_ore.fall"),
|
||||
BLOCK_NETHER_ORE_HIT("block.nether_ore.hit"),
|
||||
BLOCK_NETHER_ORE_PLACE("block.nether_ore.place"),
|
||||
BLOCK_NETHER_ORE_STEP("block.nether_ore.step"),
|
||||
BLOCK_NETHER_SPROUTS_BREAK("block.nether_sprouts.break"),
|
||||
BLOCK_NETHER_SPROUTS_FALL("block.nether_sprouts.fall"),
|
||||
BLOCK_NETHER_SPROUTS_HIT("block.nether_sprouts.hit"),
|
||||
BLOCK_NETHER_SPROUTS_PLACE("block.nether_sprouts.place"),
|
||||
BLOCK_NETHER_SPROUTS_STEP("block.nether_sprouts.step"),
|
||||
BLOCK_NETHER_WART_BREAK("block.nether_wart.break"),
|
||||
BLOCK_NOTE_BLOCK_BANJO("block.note_block.banjo"),
|
||||
BLOCK_NOTE_BLOCK_BASEDRUM("block.note_block.basedrum"),
|
||||
@@ -153,6 +233,11 @@ public enum CraftSound {
|
||||
BLOCK_NOTE_BLOCK_PLING("block.note_block.pling"),
|
||||
BLOCK_NOTE_BLOCK_SNARE("block.note_block.snare"),
|
||||
BLOCK_NOTE_BLOCK_XYLOPHONE("block.note_block.xylophone"),
|
||||
BLOCK_NYLIUM_BREAK("block.nylium.break"),
|
||||
BLOCK_NYLIUM_FALL("block.nylium.fall"),
|
||||
BLOCK_NYLIUM_HIT("block.nylium.hit"),
|
||||
BLOCK_NYLIUM_PLACE("block.nylium.place"),
|
||||
BLOCK_NYLIUM_STEP("block.nylium.step"),
|
||||
BLOCK_PISTON_CONTRACT("block.piston.contract"),
|
||||
BLOCK_PISTON_EXTEND("block.piston.extend"),
|
||||
BLOCK_PORTAL_AMBIENT("block.portal.ambient"),
|
||||
@@ -160,6 +245,15 @@ public enum CraftSound {
|
||||
BLOCK_PORTAL_TRIGGER("block.portal.trigger"),
|
||||
BLOCK_PUMPKIN_CARVE("block.pumpkin.carve"),
|
||||
BLOCK_REDSTONE_TORCH_BURNOUT("block.redstone_torch.burnout"),
|
||||
BLOCK_RESPAWN_ANCHOR_AMBIENT("block.respawn_anchor.ambient"),
|
||||
BLOCK_RESPAWN_ANCHOR_CHARGE("block.respawn_anchor.charge"),
|
||||
BLOCK_RESPAWN_ANCHOR_DEPLETE("block.respawn_anchor.deplete"),
|
||||
BLOCK_RESPAWN_ANCHOR_SET_SPAWN("block.respawn_anchor.set_spawn"),
|
||||
BLOCK_ROOTS_BREAK("block.roots.break"),
|
||||
BLOCK_ROOTS_FALL("block.roots.fall"),
|
||||
BLOCK_ROOTS_HIT("block.roots.hit"),
|
||||
BLOCK_ROOTS_PLACE("block.roots.place"),
|
||||
BLOCK_ROOTS_STEP("block.roots.step"),
|
||||
BLOCK_SAND_BREAK("block.sand.break"),
|
||||
BLOCK_SAND_FALL("block.sand.fall"),
|
||||
BLOCK_SAND_HIT("block.sand.hit"),
|
||||
@@ -170,6 +264,11 @@ public enum CraftSound {
|
||||
BLOCK_SCAFFOLDING_HIT("block.scaffolding.hit"),
|
||||
BLOCK_SCAFFOLDING_PLACE("block.scaffolding.place"),
|
||||
BLOCK_SCAFFOLDING_STEP("block.scaffolding.step"),
|
||||
BLOCK_SHROOMLIGHT_BREAK("block.shroomlight.break"),
|
||||
BLOCK_SHROOMLIGHT_FALL("block.shroomlight.fall"),
|
||||
BLOCK_SHROOMLIGHT_HIT("block.shroomlight.hit"),
|
||||
BLOCK_SHROOMLIGHT_PLACE("block.shroomlight.place"),
|
||||
BLOCK_SHROOMLIGHT_STEP("block.shroomlight.step"),
|
||||
BLOCK_SHULKER_BOX_CLOSE("block.shulker_box.close"),
|
||||
BLOCK_SHULKER_BOX_OPEN("block.shulker_box.open"),
|
||||
BLOCK_SLIME_BLOCK_BREAK("block.slime_block.break"),
|
||||
@@ -177,12 +276,28 @@ public enum CraftSound {
|
||||
BLOCK_SLIME_BLOCK_HIT("block.slime_block.hit"),
|
||||
BLOCK_SLIME_BLOCK_PLACE("block.slime_block.place"),
|
||||
BLOCK_SLIME_BLOCK_STEP("block.slime_block.step"),
|
||||
BLOCK_SMITHING_TABLE_USE("block.smithing_table.use"),
|
||||
BLOCK_SMOKER_SMOKE("block.smoker.smoke"),
|
||||
BLOCK_SNOW_BREAK("block.snow.break"),
|
||||
BLOCK_SNOW_FALL("block.snow.fall"),
|
||||
BLOCK_SNOW_HIT("block.snow.hit"),
|
||||
BLOCK_SNOW_PLACE("block.snow.place"),
|
||||
BLOCK_SNOW_STEP("block.snow.step"),
|
||||
BLOCK_SOUL_SAND_BREAK("block.soul_sand.break"),
|
||||
BLOCK_SOUL_SAND_FALL("block.soul_sand.fall"),
|
||||
BLOCK_SOUL_SAND_HIT("block.soul_sand.hit"),
|
||||
BLOCK_SOUL_SAND_PLACE("block.soul_sand.place"),
|
||||
BLOCK_SOUL_SAND_STEP("block.soul_sand.step"),
|
||||
BLOCK_SOUL_SOIL_BREAK("block.soul_soil.break"),
|
||||
BLOCK_SOUL_SOIL_FALL("block.soul_soil.fall"),
|
||||
BLOCK_SOUL_SOIL_HIT("block.soul_soil.hit"),
|
||||
BLOCK_SOUL_SOIL_PLACE("block.soul_soil.place"),
|
||||
BLOCK_SOUL_SOIL_STEP("block.soul_soil.step"),
|
||||
BLOCK_STEM_BREAK("block.stem.break"),
|
||||
BLOCK_STEM_FALL("block.stem.fall"),
|
||||
BLOCK_STEM_HIT("block.stem.hit"),
|
||||
BLOCK_STEM_PLACE("block.stem.place"),
|
||||
BLOCK_STEM_STEP("block.stem.step"),
|
||||
BLOCK_STONE_BREAK("block.stone.break"),
|
||||
BLOCK_STONE_BUTTON_CLICK_OFF("block.stone_button.click_off"),
|
||||
BLOCK_STONE_BUTTON_CLICK_ON("block.stone_button.click_on"),
|
||||
@@ -198,7 +313,18 @@ public enum CraftSound {
|
||||
BLOCK_TRIPWIRE_CLICK_OFF("block.tripwire.click_off"),
|
||||
BLOCK_TRIPWIRE_CLICK_ON("block.tripwire.click_on"),
|
||||
BLOCK_TRIPWIRE_DETACH("block.tripwire.detach"),
|
||||
BLOCK_VINE_STEP("block.vine.step"),
|
||||
BLOCK_WART_BLOCK_BREAK("block.wart_block.break"),
|
||||
BLOCK_WART_BLOCK_FALL("block.wart_block.fall"),
|
||||
BLOCK_WART_BLOCK_HIT("block.wart_block.hit"),
|
||||
BLOCK_WART_BLOCK_PLACE("block.wart_block.place"),
|
||||
BLOCK_WART_BLOCK_STEP("block.wart_block.step"),
|
||||
BLOCK_WATER_AMBIENT("block.water.ambient"),
|
||||
BLOCK_WEEPING_VINES_BREAK("block.weeping_vines.break"),
|
||||
BLOCK_WEEPING_VINES_FALL("block.weeping_vines.fall"),
|
||||
BLOCK_WEEPING_VINES_HIT("block.weeping_vines.hit"),
|
||||
BLOCK_WEEPING_VINES_PLACE("block.weeping_vines.place"),
|
||||
BLOCK_WEEPING_VINES_STEP("block.weeping_vines.step"),
|
||||
BLOCK_WET_GRASS_BREAK("block.wet_grass.break"),
|
||||
BLOCK_WET_GRASS_FALL("block.wet_grass.fall"),
|
||||
BLOCK_WET_GRASS_HIT("block.wet_grass.hit"),
|
||||
@@ -288,6 +414,7 @@ public enum CraftSound {
|
||||
ENTITY_DONKEY_ANGRY("entity.donkey.angry"),
|
||||
ENTITY_DONKEY_CHEST("entity.donkey.chest"),
|
||||
ENTITY_DONKEY_DEATH("entity.donkey.death"),
|
||||
ENTITY_DONKEY_EAT("entity.donkey.eat"),
|
||||
ENTITY_DONKEY_HURT("entity.donkey.hurt"),
|
||||
ENTITY_DRAGON_FIREBALL_EXPLODE("entity.dragon_fireball.explode"),
|
||||
ENTITY_DROWNED_AMBIENT("entity.drowned.ambient"),
|
||||
@@ -360,6 +487,7 @@ public enum CraftSound {
|
||||
ENTITY_FOX_SLEEP("entity.fox.sleep"),
|
||||
ENTITY_FOX_SNIFF("entity.fox.sniff"),
|
||||
ENTITY_FOX_SPIT("entity.fox.spit"),
|
||||
ENTITY_FOX_TELEPORT("entity.fox.teleport"),
|
||||
ENTITY_GENERIC_BIG_FALL("entity.generic.big_fall"),
|
||||
ENTITY_GENERIC_BURN("entity.generic.burn"),
|
||||
ENTITY_GENERIC_DEATH("entity.generic.death"),
|
||||
@@ -385,6 +513,14 @@ public enum CraftSound {
|
||||
ENTITY_GUARDIAN_FLOP("entity.guardian.flop"),
|
||||
ENTITY_GUARDIAN_HURT("entity.guardian.hurt"),
|
||||
ENTITY_GUARDIAN_HURT_LAND("entity.guardian.hurt_land"),
|
||||
ENTITY_HOGLIN_AMBIENT("entity.hoglin.ambient"),
|
||||
ENTITY_HOGLIN_ANGRY("entity.hoglin.angry"),
|
||||
ENTITY_HOGLIN_ATTACK("entity.hoglin.attack"),
|
||||
ENTITY_HOGLIN_CONVERTED_TO_ZOMBIFIED("entity.hoglin.converted_to_zombified"),
|
||||
ENTITY_HOGLIN_DEATH("entity.hoglin.death"),
|
||||
ENTITY_HOGLIN_HURT("entity.hoglin.hurt"),
|
||||
ENTITY_HOGLIN_RETREAT("entity.hoglin.retreat"),
|
||||
ENTITY_HOGLIN_STEP("entity.hoglin.step"),
|
||||
ENTITY_HORSE_AMBIENT("entity.horse.ambient"),
|
||||
ENTITY_HORSE_ANGRY("entity.horse.angry"),
|
||||
ENTITY_HORSE_ARMOR("entity.horse.armor"),
|
||||
@@ -458,8 +594,10 @@ public enum CraftSound {
|
||||
ENTITY_MOOSHROOM_SHEAR("entity.mooshroom.shear"),
|
||||
ENTITY_MOOSHROOM_SUSPICIOUS_MILK("entity.mooshroom.suspicious_milk"),
|
||||
ENTITY_MULE_AMBIENT("entity.mule.ambient"),
|
||||
ENTITY_MULE_ANGRY("entity.mule.angry"),
|
||||
ENTITY_MULE_CHEST("entity.mule.chest"),
|
||||
ENTITY_MULE_DEATH("entity.mule.death"),
|
||||
ENTITY_MULE_EAT("entity.mule.eat"),
|
||||
ENTITY_MULE_HURT("entity.mule.hurt"),
|
||||
ENTITY_OCELOT_AMBIENT("entity.ocelot.ambient"),
|
||||
ENTITY_OCELOT_DEATH("entity.ocelot.death"),
|
||||
@@ -491,10 +629,12 @@ public enum CraftSound {
|
||||
ENTITY_PARROT_IMITATE_EVOKER("entity.parrot.imitate.evoker"),
|
||||
ENTITY_PARROT_IMITATE_GHAST("entity.parrot.imitate.ghast"),
|
||||
ENTITY_PARROT_IMITATE_GUARDIAN("entity.parrot.imitate.guardian"),
|
||||
ENTITY_PARROT_IMITATE_HOGLIN("entity.parrot.imitate.hoglin"),
|
||||
ENTITY_PARROT_IMITATE_HUSK("entity.parrot.imitate.husk"),
|
||||
ENTITY_PARROT_IMITATE_ILLUSIONER("entity.parrot.imitate.illusioner"),
|
||||
ENTITY_PARROT_IMITATE_MAGMA_CUBE("entity.parrot.imitate.magma_cube"),
|
||||
ENTITY_PARROT_IMITATE_PHANTOM("entity.parrot.imitate.phantom"),
|
||||
ENTITY_PARROT_IMITATE_PIGLIN("entity.parrot.imitate.piglin"),
|
||||
ENTITY_PARROT_IMITATE_PILLAGER("entity.parrot.imitate.pillager"),
|
||||
ENTITY_PARROT_IMITATE_RAVAGER("entity.parrot.imitate.ravager"),
|
||||
ENTITY_PARROT_IMITATE_SHULKER("entity.parrot.imitate.shulker"),
|
||||
@@ -508,6 +648,7 @@ public enum CraftSound {
|
||||
ENTITY_PARROT_IMITATE_WITCH("entity.parrot.imitate.witch"),
|
||||
ENTITY_PARROT_IMITATE_WITHER("entity.parrot.imitate.wither"),
|
||||
ENTITY_PARROT_IMITATE_WITHER_SKELETON("entity.parrot.imitate.wither_skeleton"),
|
||||
ENTITY_PARROT_IMITATE_ZOGLIN("entity.parrot.imitate.zoglin"),
|
||||
ENTITY_PARROT_IMITATE_ZOMBIE("entity.parrot.imitate.zombie"),
|
||||
ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER("entity.parrot.imitate.zombie_villager"),
|
||||
ENTITY_PARROT_STEP("entity.parrot.step"),
|
||||
@@ -517,6 +658,16 @@ public enum CraftSound {
|
||||
ENTITY_PHANTOM_FLAP("entity.phantom.flap"),
|
||||
ENTITY_PHANTOM_HURT("entity.phantom.hurt"),
|
||||
ENTITY_PHANTOM_SWOOP("entity.phantom.swoop"),
|
||||
ENTITY_PIGLIN_ADMIRING_ITEM("entity.piglin.admiring_item"),
|
||||
ENTITY_PIGLIN_AMBIENT("entity.piglin.ambient"),
|
||||
ENTITY_PIGLIN_ANGRY("entity.piglin.angry"),
|
||||
ENTITY_PIGLIN_CELEBRATE("entity.piglin.celebrate"),
|
||||
ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED("entity.piglin.converted_to_zombified"),
|
||||
ENTITY_PIGLIN_DEATH("entity.piglin.death"),
|
||||
ENTITY_PIGLIN_HURT("entity.piglin.hurt"),
|
||||
ENTITY_PIGLIN_JEALOUS("entity.piglin.jealous"),
|
||||
ENTITY_PIGLIN_RETREAT("entity.piglin.retreat"),
|
||||
ENTITY_PIGLIN_STEP("entity.piglin.step"),
|
||||
ENTITY_PIG_AMBIENT("entity.pig.ambient"),
|
||||
ENTITY_PIG_DEATH("entity.pig.death"),
|
||||
ENTITY_PIG_HURT("entity.pig.hurt"),
|
||||
@@ -620,6 +771,7 @@ public enum CraftSound {
|
||||
ENTITY_SNOW_GOLEM_AMBIENT("entity.snow_golem.ambient"),
|
||||
ENTITY_SNOW_GOLEM_DEATH("entity.snow_golem.death"),
|
||||
ENTITY_SNOW_GOLEM_HURT("entity.snow_golem.hurt"),
|
||||
ENTITY_SNOW_GOLEM_SHEAR("entity.snow_golem.shear"),
|
||||
ENTITY_SNOW_GOLEM_SHOOT("entity.snow_golem.shoot"),
|
||||
ENTITY_SPIDER_AMBIENT("entity.spider.ambient"),
|
||||
ENTITY_SPIDER_DEATH("entity.spider.death"),
|
||||
@@ -635,6 +787,15 @@ public enum CraftSound {
|
||||
ENTITY_STRAY_DEATH("entity.stray.death"),
|
||||
ENTITY_STRAY_HURT("entity.stray.hurt"),
|
||||
ENTITY_STRAY_STEP("entity.stray.step"),
|
||||
ENTITY_STRIDER_AMBIENT("entity.strider.ambient"),
|
||||
ENTITY_STRIDER_DEATH("entity.strider.death"),
|
||||
ENTITY_STRIDER_EAT("entity.strider.eat"),
|
||||
ENTITY_STRIDER_HAPPY("entity.strider.happy"),
|
||||
ENTITY_STRIDER_HURT("entity.strider.hurt"),
|
||||
ENTITY_STRIDER_RETREAT("entity.strider.retreat"),
|
||||
ENTITY_STRIDER_SADDLE("entity.strider.saddle"),
|
||||
ENTITY_STRIDER_STEP("entity.strider.step"),
|
||||
ENTITY_STRIDER_STEP_LAVA("entity.strider.step_lava"),
|
||||
ENTITY_TNT_PRIMED("entity.tnt.primed"),
|
||||
ENTITY_TROPICAL_FISH_AMBIENT("entity.tropical_fish.ambient"),
|
||||
ENTITY_TROPICAL_FISH_DEATH("entity.tropical_fish.death"),
|
||||
@@ -715,6 +876,12 @@ public enum CraftSound {
|
||||
ENTITY_WOLF_SHAKE("entity.wolf.shake"),
|
||||
ENTITY_WOLF_STEP("entity.wolf.step"),
|
||||
ENTITY_WOLF_WHINE("entity.wolf.whine"),
|
||||
ENTITY_ZOGLIN_AMBIENT("entity.zoglin.ambient"),
|
||||
ENTITY_ZOGLIN_ANGRY("entity.zoglin.angry"),
|
||||
ENTITY_ZOGLIN_ATTACK("entity.zoglin.attack"),
|
||||
ENTITY_ZOGLIN_DEATH("entity.zoglin.death"),
|
||||
ENTITY_ZOGLIN_HURT("entity.zoglin.hurt"),
|
||||
ENTITY_ZOGLIN_STEP("entity.zoglin.step"),
|
||||
ENTITY_ZOMBIE_AMBIENT("entity.zombie.ambient"),
|
||||
ENTITY_ZOMBIE_ATTACK_IRON_DOOR("entity.zombie.attack_iron_door"),
|
||||
ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR("entity.zombie.attack_wooden_door"),
|
||||
@@ -727,10 +894,6 @@ public enum CraftSound {
|
||||
ENTITY_ZOMBIE_HORSE_HURT("entity.zombie_horse.hurt"),
|
||||
ENTITY_ZOMBIE_HURT("entity.zombie.hurt"),
|
||||
ENTITY_ZOMBIE_INFECT("entity.zombie.infect"),
|
||||
ENTITY_ZOMBIE_PIGMAN_AMBIENT("entity.zombie_pigman.ambient"),
|
||||
ENTITY_ZOMBIE_PIGMAN_ANGRY("entity.zombie_pigman.angry"),
|
||||
ENTITY_ZOMBIE_PIGMAN_DEATH("entity.zombie_pigman.death"),
|
||||
ENTITY_ZOMBIE_PIGMAN_HURT("entity.zombie_pigman.hurt"),
|
||||
ENTITY_ZOMBIE_STEP("entity.zombie.step"),
|
||||
ENTITY_ZOMBIE_VILLAGER_AMBIENT("entity.zombie_villager.ambient"),
|
||||
ENTITY_ZOMBIE_VILLAGER_CONVERTED("entity.zombie_villager.converted"),
|
||||
@@ -738,6 +901,10 @@ public enum CraftSound {
|
||||
ENTITY_ZOMBIE_VILLAGER_DEATH("entity.zombie_villager.death"),
|
||||
ENTITY_ZOMBIE_VILLAGER_HURT("entity.zombie_villager.hurt"),
|
||||
ENTITY_ZOMBIE_VILLAGER_STEP("entity.zombie_villager.step"),
|
||||
ENTITY_ZOMBIFIED_PIGLIN_AMBIENT("entity.zombified_piglin.ambient"),
|
||||
ENTITY_ZOMBIFIED_PIGLIN_ANGRY("entity.zombified_piglin.angry"),
|
||||
ENTITY_ZOMBIFIED_PIGLIN_DEATH("entity.zombified_piglin.death"),
|
||||
ENTITY_ZOMBIFIED_PIGLIN_HURT("entity.zombified_piglin.hurt"),
|
||||
EVENT_RAID_HORN("event.raid.horn"),
|
||||
ITEM_ARMOR_EQUIP_CHAIN("item.armor.equip_chain"),
|
||||
ITEM_ARMOR_EQUIP_DIAMOND("item.armor.equip_diamond"),
|
||||
@@ -746,6 +913,7 @@ public enum CraftSound {
|
||||
ITEM_ARMOR_EQUIP_GOLD("item.armor.equip_gold"),
|
||||
ITEM_ARMOR_EQUIP_IRON("item.armor.equip_iron"),
|
||||
ITEM_ARMOR_EQUIP_LEATHER("item.armor.equip_leather"),
|
||||
ITEM_ARMOR_EQUIP_NETHERITE("item.armor.equip_netherite"),
|
||||
ITEM_ARMOR_EQUIP_TURTLE("item.armor.equip_turtle"),
|
||||
ITEM_AXE_STRIP("item.axe.strip"),
|
||||
ITEM_BOOK_PAGE_TURN("item.book.page_turn"),
|
||||
@@ -774,6 +942,7 @@ public enum CraftSound {
|
||||
ITEM_FLINTANDSTEEL_USE("item.flintandsteel.use"),
|
||||
ITEM_HOE_TILL("item.hoe.till"),
|
||||
ITEM_HONEY_BOTTLE_DRINK("item.honey_bottle.drink"),
|
||||
ITEM_LODESTONE_COMPASS_LOCK("item.lodestone_compass.lock"),
|
||||
ITEM_NETHER_WART_PLANT("item.nether_wart.plant"),
|
||||
ITEM_SHIELD_BLOCK("item.shield.block"),
|
||||
ITEM_SHIELD_BREAK("item.shield.break"),
|
||||
@@ -798,6 +967,7 @@ public enum CraftSound {
|
||||
MUSIC_DISC_FAR("music_disc.far"),
|
||||
MUSIC_DISC_MALL("music_disc.mall"),
|
||||
MUSIC_DISC_MELLOHI("music_disc.mellohi"),
|
||||
MUSIC_DISC_PIGSTEP("music_disc.pigstep"),
|
||||
MUSIC_DISC_STAL("music_disc.stal"),
|
||||
MUSIC_DISC_STRAD("music_disc.strad"),
|
||||
MUSIC_DISC_WAIT("music_disc.wait"),
|
||||
@@ -806,8 +976,13 @@ public enum CraftSound {
|
||||
MUSIC_END("music.end"),
|
||||
MUSIC_GAME("music.game"),
|
||||
MUSIC_MENU("music.menu"),
|
||||
MUSIC_NETHER("music.nether"),
|
||||
MUSIC_NETHER_BASALT_DELTAS("music.nether.basalt_deltas"),
|
||||
MUSIC_NETHER_CRIMSON_FOREST("music.nether.crimson_forest"),
|
||||
MUSIC_NETHER_NETHER_WASTES("music.nether.nether_wastes"),
|
||||
MUSIC_NETHER_SOUL_SAND_VALLEY("music.nether.soul_sand_valley"),
|
||||
MUSIC_NETHER_WARPED_FOREST("music.nether.warped_forest"),
|
||||
MUSIC_UNDER_WATER("music.under_water"),
|
||||
PARTICLE_SOUL_ESCAPE("particle.soul_escape"),
|
||||
UI_BUTTON_CLICK("ui.button.click"),
|
||||
UI_CARTOGRAPHY_TABLE_TAKE_RESULT("ui.cartography_table.take_result"),
|
||||
UI_LOOM_SELECT_PATTERN("ui.loom.select_pattern"),
|
||||
|
||||
@@ -96,7 +96,10 @@ public enum CraftStatistic {
|
||||
RAID_TRIGGER(StatisticList.RAID_TRIGGER),
|
||||
RAID_WIN(StatisticList.RAID_WIN),
|
||||
INTERACT_WITH_ANVIL(StatisticList.INTERACT_WITH_ANVIL),
|
||||
INTERACT_WITH_GRINDSTONE(StatisticList.INTERACT_WITH_GRINDSTONE);
|
||||
INTERACT_WITH_GRINDSTONE(StatisticList.INTERACT_WITH_GRINDSTONE),
|
||||
TARGET_HIT(StatisticList.TARGET_HIT),
|
||||
INTERACT_WITH_SMITHING_TABLE(StatisticList.INTERACT_WITH_SMITHING_TABLE),
|
||||
STRIDER_ONE_CM(StatisticList.STRIDER_ONE_CM);
|
||||
private final MinecraftKey minecraftKey;
|
||||
private final org.bukkit.Statistic bukkit;
|
||||
private static final BiMap<MinecraftKey, org.bukkit.Statistic> statistics;
|
||||
|
||||
@@ -67,7 +67,6 @@ import net.minecraft.server.EntityZombie;
|
||||
import net.minecraft.server.EnumDifficulty;
|
||||
import net.minecraft.server.EnumDirection;
|
||||
import net.minecraft.server.EnumMobSpawn;
|
||||
import net.minecraft.server.ExceptionWorldConflict;
|
||||
import net.minecraft.server.Explosion;
|
||||
import net.minecraft.server.GameRules;
|
||||
import net.minecraft.server.GroupDataEntity;
|
||||
@@ -82,14 +81,14 @@ import net.minecraft.server.PersistentRaid;
|
||||
import net.minecraft.server.PlayerChunk;
|
||||
import net.minecraft.server.ProtoChunkExtension;
|
||||
import net.minecraft.server.RayTrace;
|
||||
import net.minecraft.server.SavedFile;
|
||||
import net.minecraft.server.SoundCategory;
|
||||
import net.minecraft.server.StructureGenerator;
|
||||
import net.minecraft.server.Ticket;
|
||||
import net.minecraft.server.TicketType;
|
||||
import net.minecraft.server.Unit;
|
||||
import net.minecraft.server.Vec3D;
|
||||
import net.minecraft.server.WorldGenerator;
|
||||
import net.minecraft.server.WorldProvider;
|
||||
import net.minecraft.server.WorldProviderTheEnd;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.BlockChangeDelegate;
|
||||
@@ -119,8 +118,6 @@ import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.boss.CraftDragonBattle;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.entity.CraftItem;
|
||||
import org.bukkit.craftbukkit.entity.CraftLightningStrike;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.metadata.BlockMetadataStore;
|
||||
@@ -173,6 +170,7 @@ import org.bukkit.entity.Giant;
|
||||
import org.bukkit.entity.Golem;
|
||||
import org.bukkit.entity.Guardian;
|
||||
import org.bukkit.entity.Hanging;
|
||||
import org.bukkit.entity.Hoglin;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Husk;
|
||||
import org.bukkit.entity.Illager;
|
||||
@@ -196,6 +194,7 @@ import org.bukkit.entity.Parrot;
|
||||
import org.bukkit.entity.Phantom;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.PigZombie;
|
||||
import org.bukkit.entity.Piglin;
|
||||
import org.bukkit.entity.Pillager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.PolarBear;
|
||||
@@ -219,6 +218,7 @@ import org.bukkit.entity.Spellcaster;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.entity.Squid;
|
||||
import org.bukkit.entity.Stray;
|
||||
import org.bukkit.entity.Strider;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.ThrownExpBottle;
|
||||
@@ -237,6 +237,7 @@ import org.bukkit.entity.Wither;
|
||||
import org.bukkit.entity.WitherSkeleton;
|
||||
import org.bukkit.entity.WitherSkull;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.entity.Zoglin;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.entity.ZombieHorse;
|
||||
import org.bukkit.entity.ZombieVillager;
|
||||
@@ -642,16 +643,19 @@ public class CraftWorld implements World {
|
||||
|
||||
@Override
|
||||
public LightningStrike strikeLightning(Location loc) {
|
||||
EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ(), false);
|
||||
EntityLightning lightning = EntityTypes.LIGHTNING_BOLT.a(world);
|
||||
lightning.teleportAndSync(loc.getX(), loc.getY(), loc.getZ());
|
||||
world.strikeLightning(lightning);
|
||||
return new CraftLightningStrike(server, lightning);
|
||||
return (LightningStrike) lightning.getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LightningStrike strikeLightningEffect(Location loc) {
|
||||
EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ(), true);
|
||||
EntityLightning lightning = EntityTypes.LIGHTNING_BOLT.a(world);
|
||||
lightning.teleportAndSync(loc.getX(), loc.getY(), loc.getZ());
|
||||
lightning.setEffect(true);
|
||||
world.strikeLightning(lightning);
|
||||
return new CraftLightningStrike(server, lightning);
|
||||
return (LightningStrike) lightning.getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -662,35 +666,35 @@ public class CraftWorld implements World {
|
||||
net.minecraft.server.WorldGenFeatureConfiguration conf;
|
||||
switch (type) {
|
||||
case BIG_TREE:
|
||||
gen = WorldGenerator.FANCY_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.FANCY_TREE;
|
||||
break;
|
||||
case BIRCH:
|
||||
gen = WorldGenerator.NORMAL_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.BIRCH_TREE;
|
||||
break;
|
||||
case REDWOOD:
|
||||
gen = WorldGenerator.NORMAL_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.SPRUCE_TREE;
|
||||
break;
|
||||
case TALL_REDWOOD:
|
||||
gen = WorldGenerator.NORMAL_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.PINE_TREE;
|
||||
break;
|
||||
case JUNGLE:
|
||||
gen = WorldGenerator.MEGA_JUNGLE_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.MEGA_JUNGLE_TREE;
|
||||
break;
|
||||
case SMALL_JUNGLE:
|
||||
gen = WorldGenerator.NORMAL_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.JUNGLE_TREE_NOVINE;
|
||||
break;
|
||||
case COCOA_TREE:
|
||||
gen = WorldGenerator.NORMAL_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.JUNGLE_TREE;
|
||||
break;
|
||||
case JUNGLE_BUSH:
|
||||
gen = WorldGenerator.JUNGLE_GROUND_BUSH;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.JUNGLE_BUSH;
|
||||
break;
|
||||
case RED_MUSHROOM:
|
||||
@@ -702,23 +706,23 @@ public class CraftWorld implements World {
|
||||
conf = BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM;
|
||||
break;
|
||||
case SWAMP:
|
||||
gen = WorldGenerator.NORMAL_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.SWAMP_TREE;
|
||||
break;
|
||||
case ACACIA:
|
||||
gen = WorldGenerator.ACACIA_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.ACACIA_TREE;
|
||||
break;
|
||||
case DARK_OAK:
|
||||
gen = WorldGenerator.DARK_OAK_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.DARK_OAK_TREE;
|
||||
break;
|
||||
case MEGA_REDWOOD:
|
||||
gen = WorldGenerator.MEGA_SPRUCE_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.MEGA_PINE_TREE;
|
||||
break;
|
||||
case TALL_BIRCH:
|
||||
gen = WorldGenerator.NORMAL_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.TALL_BIRCH_TREE_BEES_0002;
|
||||
break;
|
||||
case CHORUS_PLANT:
|
||||
@@ -726,12 +730,12 @@ public class CraftWorld implements World {
|
||||
return true;
|
||||
case TREE:
|
||||
default:
|
||||
gen = WorldGenerator.NORMAL_TREE;
|
||||
gen = WorldGenerator.TREE;
|
||||
conf = BiomeDecoratorGroups.NORMAL_TREE;
|
||||
break;
|
||||
}
|
||||
|
||||
return gen.generate(world, world.worldProvider.getChunkGenerator(), rand, pos, conf);
|
||||
return gen.generate(world, world.getStructureManager(), world.getChunkProvider().getChunkGenerator(), rand, pos, conf);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -760,12 +764,12 @@ public class CraftWorld implements World {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return world.worldData.getName();
|
||||
return world.worldDataServer.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUID() {
|
||||
return world.getDataManager().getUUID();
|
||||
return world.uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -898,7 +902,7 @@ public class CraftWorld implements World {
|
||||
@Override
|
||||
public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) {
|
||||
// Transient load for this tick
|
||||
return world.getChunkAt(x >> 4, z >> 4).a(CraftHeightMap.toNMS(heightMap), x, z);
|
||||
return world.getChunkAt(x >> 4, z >> 4).getHighestBlock(CraftHeightMap.toNMS(heightMap), x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1242,16 +1246,12 @@ public class CraftWorld implements World {
|
||||
@Override
|
||||
public void save() {
|
||||
this.server.checkSaveState();
|
||||
try {
|
||||
boolean oldSave = world.savingDisabled;
|
||||
boolean oldSave = world.savingDisabled;
|
||||
|
||||
world.savingDisabled = false;
|
||||
world.save(null, false, false);
|
||||
world.savingDisabled = false;
|
||||
world.save(null, false, false);
|
||||
|
||||
world.savingDisabled = oldSave;
|
||||
} catch (ExceptionWorldConflict ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
world.savingDisabled = oldSave;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1266,7 +1266,7 @@ public class CraftWorld implements World {
|
||||
|
||||
@Override
|
||||
public void setDifficulty(Difficulty difficulty) {
|
||||
this.getHandle().worldData.setDifficulty(EnumDifficulty.getById(difficulty.getValue()));
|
||||
this.getHandle().worldDataServer.setDifficulty(EnumDifficulty.getById(difficulty.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1291,12 +1291,12 @@ public class CraftWorld implements World {
|
||||
|
||||
@Override
|
||||
public int getWeatherDuration() {
|
||||
return world.worldData.getWeatherDuration();
|
||||
return world.worldDataServer.getWeatherDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWeatherDuration(int duration) {
|
||||
world.worldData.setWeatherDuration(duration);
|
||||
world.worldDataServer.setWeatherDuration(duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1306,23 +1306,23 @@ public class CraftWorld implements World {
|
||||
|
||||
@Override
|
||||
public void setThundering(boolean thundering) {
|
||||
world.worldData.setThundering(thundering);
|
||||
world.worldDataServer.setThundering(thundering);
|
||||
setThunderDuration(0); // Reset weather duration (legacy behaviour)
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getThunderDuration() {
|
||||
return world.worldData.getThunderDuration();
|
||||
return world.worldDataServer.getThunderDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThunderDuration(int duration) {
|
||||
world.worldData.setThunderDuration(duration);
|
||||
world.worldDataServer.setThunderDuration(duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSeed() {
|
||||
return world.worldData.getSeed();
|
||||
return world.getSeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1593,7 +1593,7 @@ public class CraftWorld implements World {
|
||||
entity = EntityTypes.CAT.a(world);
|
||||
}
|
||||
} else if (PigZombie.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.ZOMBIE_PIGMAN.a(world);
|
||||
entity = EntityTypes.ZOMBIFIED_PIGLIN.a(world);
|
||||
} else if (Zombie.class.isAssignableFrom(clazz)) {
|
||||
if (Husk.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.HUSK.a(world);
|
||||
@@ -1684,6 +1684,14 @@ public class CraftWorld implements World {
|
||||
entity = EntityTypes.FOX.a(world);
|
||||
} else if (Bee.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.BEE.a(world);
|
||||
} else if (Hoglin.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.HOGLIN.a(world);
|
||||
} else if (Piglin.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.PIGLIN.a(world);
|
||||
} else if (Strider.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.STRIDER.a(world);
|
||||
} else if (Zoglin.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.ZOGLIN.a(world);
|
||||
}
|
||||
|
||||
if (entity != null) {
|
||||
@@ -1751,9 +1759,9 @@ public class CraftWorld implements World {
|
||||
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
|
||||
entity = new EntityExperienceOrb(world, x, y, z, 0);
|
||||
} else if (LightningStrike.class.isAssignableFrom(clazz)) {
|
||||
entity = new EntityLightning(world, x, y, z, false);
|
||||
entity = EntityTypes.LIGHTNING_BOLT.a(world);
|
||||
} else if (Firework.class.isAssignableFrom(clazz)) {
|
||||
entity = new EntityFireworks(world, x, y, z, net.minecraft.server.ItemStack.a);
|
||||
entity = new EntityFireworks(world, x, y, z, net.minecraft.server.ItemStack.b);
|
||||
} else if (AreaEffectCloud.class.isAssignableFrom(clazz)) {
|
||||
entity = new EntityAreaEffectCloud(world, x, y, z);
|
||||
} else if (EvokerFangs.class.isAssignableFrom(clazz)) {
|
||||
@@ -1777,7 +1785,7 @@ public class CraftWorld implements World {
|
||||
Preconditions.checkArgument(entity != null, "Cannot spawn null entity");
|
||||
|
||||
if (entity instanceof EntityInsentient) {
|
||||
((EntityInsentient) entity).prepare(getHandle(), getHandle().getDamageScaler(new BlockPosition(entity)), EnumMobSpawn.COMMAND, (GroupDataEntity) null, null);
|
||||
((EntityInsentient) entity).prepare(getHandle(), getHandle().getDamageScaler(entity.getChunkCoordinates()), EnumMobSpawn.COMMAND, (GroupDataEntity) null, null);
|
||||
}
|
||||
|
||||
if (function != null) {
|
||||
@@ -1863,7 +1871,7 @@ public class CraftWorld implements World {
|
||||
|
||||
@Override
|
||||
public File getWorldFolder() {
|
||||
return world.getDataManager().getDirectory();
|
||||
return world.convertable.getWorldFolder(SavedFile.ROOT).toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1888,12 +1896,12 @@ public class CraftWorld implements World {
|
||||
|
||||
@Override
|
||||
public org.bukkit.WorldType getWorldType() {
|
||||
return org.bukkit.WorldType.getByName(world.getWorldData().getType().name());
|
||||
return world.isFlatWorld() ? org.bukkit.WorldType.FLAT : org.bukkit.WorldType.NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerateStructures() {
|
||||
return world.getWorldData().shouldGenerateMapFeatures();
|
||||
return world.worldDataServer.getGeneratorSettings().shouldGenerateMapFeatures();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1903,7 +1911,7 @@ public class CraftWorld implements World {
|
||||
|
||||
@Override
|
||||
public void setHardcore(boolean hardcore) {
|
||||
world.getWorldData().setHardcore(hardcore);
|
||||
world.worldDataServer.b.hardcore = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2052,7 +2060,7 @@ public class CraftWorld implements World {
|
||||
double z = loc.getZ();
|
||||
|
||||
PacketPlayOutCustomSoundEffect packet = new PacketPlayOutCustomSoundEffect(new MinecraftKey(sound), SoundCategory.valueOf(category.name()), new Vec3D(x, y, z), volume, pitch);
|
||||
world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world.getWorldProvider().getDimensionManager(), packet);
|
||||
world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world.getDimensionKey(), packet);
|
||||
}
|
||||
|
||||
private static Map<String, GameRules.GameRuleKey<?>> gamerules;
|
||||
@@ -2257,7 +2265,7 @@ public class CraftWorld implements World {
|
||||
@Override
|
||||
public Location locateNearestStructure(Location origin, StructureType structureType, int radius, boolean findUnexplored) {
|
||||
BlockPosition originPos = new BlockPosition(origin.getX(), origin.getY(), origin.getZ());
|
||||
BlockPosition nearest = getHandle().getChunkProvider().getChunkGenerator().findNearestMapFeature(getHandle(), structureType.getName(), originPos, radius, findUnexplored);
|
||||
BlockPosition nearest = getHandle().getChunkProvider().getChunkGenerator().findNearestMapFeature(getHandle(), StructureGenerator.a.get(structureType.getName()), originPos, radius, findUnexplored);
|
||||
return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ());
|
||||
}
|
||||
|
||||
@@ -2279,11 +2287,6 @@ public class CraftWorld implements World {
|
||||
|
||||
@Override
|
||||
public DragonBattle getEnderDragonBattle() {
|
||||
WorldProvider worldProvider = getHandle().worldProvider;
|
||||
if (!(worldProvider instanceof WorldProviderTheEnd)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new CraftDragonBattle(((WorldProviderTheEnd) worldProvider).o()); // PAIL rename getDragonBattle
|
||||
return (getHandle().getDragonBattle() == null) ? null : new CraftDragonBattle(getHandle().getDragonBattle());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import joptsimple.OptionParser;
|
||||
import joptsimple.OptionSet;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.fusesource.jansi.AnsiConsole;
|
||||
|
||||
public class Main {
|
||||
@@ -45,6 +44,7 @@ public class Main {
|
||||
acceptsAll(asList("W", "world-dir", "universe", "world-container"), "World container")
|
||||
.withRequiredArg()
|
||||
.ofType(File.class)
|
||||
.defaultsTo(new File("."))
|
||||
.describedAs("Directory containing worlds");
|
||||
|
||||
acceptsAll(asList("w", "world", "level-name"), "World name")
|
||||
@@ -177,11 +177,11 @@ 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 Date(Integer.parseInt(Main.class.getPackage().getImplementationVendor()) * 1000L);
|
||||
|
||||
Calendar deadline = Calendar.getInstance();
|
||||
deadline.add(Calendar.DAY_OF_YEAR, -21);
|
||||
deadline.add(Calendar.DAY_OF_YEAR, -3);
|
||||
if (buildDate.before(deadline.getTime())) {
|
||||
System.err.println("*** Error, this build is outdated ***");
|
||||
System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");
|
||||
@@ -191,7 +191,7 @@ public class Main {
|
||||
}
|
||||
|
||||
System.out.println("Loading libraries, please wait...");
|
||||
MinecraftServer.main(options);
|
||||
net.minecraft.server.Main.main(options);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ import org.bukkit.attribute.AttributeModifier;
|
||||
|
||||
public class CraftAttributeInstance implements AttributeInstance {
|
||||
|
||||
private final net.minecraft.server.AttributeInstance handle;
|
||||
private final net.minecraft.server.AttributeModifiable handle;
|
||||
private final Attribute attribute;
|
||||
|
||||
public CraftAttributeInstance(net.minecraft.server.AttributeInstance handle, Attribute attribute) {
|
||||
public CraftAttributeInstance(net.minecraft.server.AttributeModifiable handle, Attribute attribute) {
|
||||
this.handle = handle;
|
||||
this.attribute = attribute;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package org.bukkit.craftbukkit.attribute;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.server.AttributeMapBase;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
import net.minecraft.server.IRegistry;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Registry;
|
||||
import org.bukkit.attribute.Attributable;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
|
||||
public class CraftAttributeMap implements Attributable {
|
||||
|
||||
@@ -20,36 +21,12 @@ public class CraftAttributeMap implements Attributable {
|
||||
@Override
|
||||
public AttributeInstance getAttribute(Attribute attribute) {
|
||||
Preconditions.checkArgument(attribute != null, "attribute");
|
||||
net.minecraft.server.AttributeInstance nms = handle.a(toMinecraft(attribute.name()));
|
||||
net.minecraft.server.AttributeModifiable nms = handle.a(IRegistry.ATTRIBUTE.get(CraftNamespacedKey.toMinecraft(attribute.getKey())));
|
||||
|
||||
return (nms == null) ? null : new CraftAttributeInstance(nms, attribute);
|
||||
}
|
||||
|
||||
public static String toMinecraft(String bukkit) {
|
||||
int first = bukkit.indexOf('_');
|
||||
int second = bukkit.indexOf('_', first + 1);
|
||||
|
||||
StringBuilder sb = new StringBuilder(bukkit.toLowerCase(java.util.Locale.ENGLISH));
|
||||
|
||||
sb.setCharAt(first, '.');
|
||||
if (second != -1) {
|
||||
sb.deleteCharAt(second);
|
||||
sb.setCharAt(second, bukkit.charAt(second + 1));
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String toMinecraft(Attribute attribute) {
|
||||
return toMinecraft(attribute.name());
|
||||
}
|
||||
|
||||
public static Attribute fromMinecraft(String nms) {
|
||||
String[] split = nms.split("\\.", 2);
|
||||
|
||||
String generic = split[0];
|
||||
String descriptor = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, split[1]); // movementSpeed -> MOVEMENT_SPEED
|
||||
String fin = generic + "_" + descriptor;
|
||||
return EnumUtils.getEnum(Attribute.class, fin.toUpperCase(Locale.ROOT)); // so we can return null without throwing exceptions
|
||||
return Registry.ATTRIBUTE.get(NamespacedKey.minecraft(nms));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,12 +43,12 @@ public class CraftBeehive extends CraftBlockEntityState<TileEntityBeehive> imple
|
||||
|
||||
@Override
|
||||
public boolean isSedated() {
|
||||
return isPlaced() && getTileEntity().k(); // PAIL rename isSedated
|
||||
return isPlaced() && getTileEntity().isSedated();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEntityCount() {
|
||||
return getSnapshot().j(); // PAIL rename beeCount
|
||||
return getSnapshot().getBeeCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,6 +81,6 @@ public class CraftBeehive extends CraftBlockEntityState<TileEntityBeehive> imple
|
||||
public void addEntity(Bee entity) {
|
||||
Preconditions.checkArgument(entity != null, "Entity must not be null");
|
||||
|
||||
getSnapshot().a(((CraftBee) entity).getHandle(), false); // PAIL rename addBee
|
||||
getSnapshot().addBee(((CraftBee) entity).getHandle(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,20 +551,29 @@ public class CraftBlock implements Block {
|
||||
@Override
|
||||
public int getBlockPower(BlockFace face) {
|
||||
int power = 0;
|
||||
BlockRedstoneWire wire = (BlockRedstoneWire) Blocks.REDSTONE_WIRE;
|
||||
net.minecraft.server.World world = this.world.getMinecraftWorld();
|
||||
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(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)));
|
||||
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y - 1, z), EnumDirection.DOWN)) power = 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 = 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 = 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 = 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 = 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 = getPower(power, world.getType(new BlockPosition(x, y, z + 1)));
|
||||
return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
|
||||
}
|
||||
|
||||
private static int getPower(int i, IBlockData iblockdata) {
|
||||
if (!iblockdata.getBlock().a(Blocks.REDSTONE_WIRE)) {
|
||||
return i;
|
||||
} else {
|
||||
int j = iblockdata.get(BlockRedstoneWire.POWER);
|
||||
|
||||
return j > i ? j : i;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockPower() {
|
||||
return getBlockPower(BlockFace.SELF);
|
||||
@@ -599,7 +608,7 @@ public class CraftBlock implements Block {
|
||||
boolean result = false;
|
||||
|
||||
// Modelled off EntityHuman#hasBlock
|
||||
if (block != Blocks.AIR && (item == null || iblockdata.getMaterial().isAlwaysDestroyable() || nmsItem.canDestroySpecialBlock(iblockdata))) {
|
||||
if (block != Blocks.AIR && (item == null || iblockdata.isAlwaysDestroyable() || nmsItem.canDestroySpecialBlock(iblockdata))) {
|
||||
net.minecraft.server.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem);
|
||||
result = true;
|
||||
}
|
||||
@@ -623,7 +632,7 @@ public class CraftBlock implements Block {
|
||||
net.minecraft.server.ItemStack nms = CraftItemStack.asNMSCopy(item);
|
||||
|
||||
// Modelled off EntityHuman#hasBlock
|
||||
if (item == null || iblockdata.getMaterial().isAlwaysDestroyable() || nms.canDestroySpecialBlock(iblockdata)) {
|
||||
if (item == null || iblockdata.isAlwaysDestroyable() || nms.canDestroySpecialBlock(iblockdata)) {
|
||||
return net.minecraft.server.Block.getDrops(iblockdata, (WorldServer) world.getMinecraftWorld(), position, world.getTileEntity(position), entity == null ? null : ((CraftEntity) entity).getHandle(), nms)
|
||||
.stream().map(CraftItemStack::asBukkitCopy).collect(Collectors.toList());
|
||||
} else {
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
|
||||
}
|
||||
|
||||
NBTTagCompound nbtTagCompound = tileEntity.save(new NBTTagCompound());
|
||||
T snapshot = (T) TileEntity.create(nbtTagCompound);
|
||||
T snapshot = (T) TileEntity.create(getHandle(), nbtTagCompound);
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
|
||||
private void copyData(T from, T to) {
|
||||
BlockPosition pos = to.getPosition();
|
||||
NBTTagCompound nbtTagCompound = from.save(new NBTTagCompound());
|
||||
to.load(nbtTagCompound);
|
||||
to.load(getHandle(), nbtTagCompound);
|
||||
|
||||
// reset the original position:
|
||||
to.setPosition(pos);
|
||||
|
||||
@@ -13,12 +13,12 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import net.minecraft.server.ArgumentBlock;
|
||||
import net.minecraft.server.Block;
|
||||
import net.minecraft.server.BlockDataAbstract;
|
||||
import net.minecraft.server.BlockStateBoolean;
|
||||
import net.minecraft.server.BlockStateEnum;
|
||||
import net.minecraft.server.BlockStateInteger;
|
||||
import net.minecraft.server.EnumDirection;
|
||||
import net.minecraft.server.IBlockData;
|
||||
import net.minecraft.server.IBlockDataHolder;
|
||||
import net.minecraft.server.IBlockState;
|
||||
import net.minecraft.server.INamable;
|
||||
import net.minecraft.server.IRegistry;
|
||||
@@ -93,7 +93,7 @@ public class CraftBlockData implements BlockData {
|
||||
*/
|
||||
protected <B extends Enum<B>, N extends Enum<N> & INamable> void set(BlockStateEnum<N> nms, Enum<B> bukkit) {
|
||||
this.parsedStates = null;
|
||||
this.state = this.state.set(nms, toNMS(bukkit, nms.b()));
|
||||
this.state = this.state.set(nms, toNMS(bukkit, nms.getType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -241,7 +241,7 @@ public class CraftBlockData implements BlockData {
|
||||
|
||||
@Override
|
||||
public String getAsString() {
|
||||
return toString(((BlockDataAbstract) state).getStateMap());
|
||||
return toString(state.getStateMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -269,7 +269,7 @@ public class CraftBlockData implements BlockData {
|
||||
|
||||
if (!states.isEmpty()) {
|
||||
stateString.append('[');
|
||||
stateString.append(states.entrySet().stream().map(BlockDataAbstract.STATE_TO_VALUE).collect(Collectors.joining(",")));
|
||||
stateString.append(states.entrySet().stream().map(IBlockDataHolder.STATE_TO_VALUE).collect(Collectors.joining(",")));
|
||||
stateString.append(']');
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ public class CraftBlockData implements BlockData {
|
||||
for (Map.Entry<IBlockState<?>, Comparable<?>> entry : state.getStateMap().entrySet()) {
|
||||
IBlockState iblockstate = (IBlockState) entry.getKey();
|
||||
|
||||
compound.setString(iblockstate.a(), iblockstate.a(entry.getValue()));
|
||||
compound.setString(iblockstate.getName(), iblockstate.a(entry.getValue()));
|
||||
}
|
||||
|
||||
return compound;
|
||||
@@ -403,6 +403,7 @@ public class CraftBlockData implements BlockData {
|
||||
register(net.minecraft.server.BlockCampfire.class, org.bukkit.craftbukkit.block.impl.CraftCampfire::new);
|
||||
register(net.minecraft.server.BlockCarrots.class, org.bukkit.craftbukkit.block.impl.CraftCarrots::new);
|
||||
register(net.minecraft.server.BlockCauldron.class, org.bukkit.craftbukkit.block.impl.CraftCauldron::new);
|
||||
register(net.minecraft.server.BlockChain.class, org.bukkit.craftbukkit.block.impl.CraftChain::new);
|
||||
register(net.minecraft.server.BlockChest.class, org.bukkit.craftbukkit.block.impl.CraftChest::new);
|
||||
register(net.minecraft.server.BlockChestTrapped.class, org.bukkit.craftbukkit.block.impl.CraftChestTrapped::new);
|
||||
register(net.minecraft.server.BlockChorusFlower.class, org.bukkit.craftbukkit.block.impl.CraftChorusFlower::new);
|
||||
@@ -449,7 +450,6 @@ public class CraftBlockData implements BlockData {
|
||||
register(net.minecraft.server.BlockLeaves.class, org.bukkit.craftbukkit.block.impl.CraftLeaves::new);
|
||||
register(net.minecraft.server.BlockLectern.class, org.bukkit.craftbukkit.block.impl.CraftLectern::new);
|
||||
register(net.minecraft.server.BlockLever.class, org.bukkit.craftbukkit.block.impl.CraftLever::new);
|
||||
register(net.minecraft.server.BlockLogAbstract.class, org.bukkit.craftbukkit.block.impl.CraftLogAbstract::new);
|
||||
register(net.minecraft.server.BlockLoom.class, org.bukkit.craftbukkit.block.impl.CraftLoom::new);
|
||||
register(net.minecraft.server.BlockMinecartDetector.class, org.bukkit.craftbukkit.block.impl.CraftMinecartDetector::new);
|
||||
register(net.minecraft.server.BlockMinecartTrack.class, org.bukkit.craftbukkit.block.impl.CraftMinecartTrack::new);
|
||||
@@ -474,6 +474,7 @@ public class CraftBlockData implements BlockData {
|
||||
register(net.minecraft.server.BlockRedstoneWire.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneWire::new);
|
||||
register(net.minecraft.server.BlockReed.class, org.bukkit.craftbukkit.block.impl.CraftReed::new);
|
||||
register(net.minecraft.server.BlockRepeater.class, org.bukkit.craftbukkit.block.impl.CraftRepeater::new);
|
||||
register(net.minecraft.server.BlockRespawnAnchor.class, org.bukkit.craftbukkit.block.impl.CraftRespawnAnchor::new);
|
||||
register(net.minecraft.server.BlockRotatable.class, org.bukkit.craftbukkit.block.impl.CraftRotatable::new);
|
||||
register(net.minecraft.server.BlockSapling.class, org.bukkit.craftbukkit.block.impl.CraftSapling::new);
|
||||
register(net.minecraft.server.BlockScaffolding.class, org.bukkit.craftbukkit.block.impl.CraftScaffolding::new);
|
||||
@@ -499,13 +500,16 @@ public class CraftBlockData implements BlockData {
|
||||
register(net.minecraft.server.BlockTallPlant.class, org.bukkit.craftbukkit.block.impl.CraftTallPlant::new);
|
||||
register(net.minecraft.server.BlockTallPlantFlower.class, org.bukkit.craftbukkit.block.impl.CraftTallPlantFlower::new);
|
||||
register(net.minecraft.server.BlockTallSeaGrass.class, org.bukkit.craftbukkit.block.impl.CraftTallSeaGrass::new);
|
||||
register(net.minecraft.server.BlockTarget.class, org.bukkit.craftbukkit.block.impl.CraftTarget::new);
|
||||
register(net.minecraft.server.BlockTorchWall.class, org.bukkit.craftbukkit.block.impl.CraftTorchWall::new);
|
||||
register(net.minecraft.server.BlockTrapdoor.class, org.bukkit.craftbukkit.block.impl.CraftTrapdoor::new);
|
||||
register(net.minecraft.server.BlockTripwire.class, org.bukkit.craftbukkit.block.impl.CraftTripwire::new);
|
||||
register(net.minecraft.server.BlockTripwireHook.class, org.bukkit.craftbukkit.block.impl.CraftTripwireHook::new);
|
||||
register(net.minecraft.server.BlockTurtleEgg.class, org.bukkit.craftbukkit.block.impl.CraftTurtleEgg::new);
|
||||
register(net.minecraft.server.BlockTwistingVines.class, org.bukkit.craftbukkit.block.impl.CraftTwistingVines::new);
|
||||
register(net.minecraft.server.BlockVine.class, org.bukkit.craftbukkit.block.impl.CraftVine::new);
|
||||
register(net.minecraft.server.BlockWallSign.class, org.bukkit.craftbukkit.block.impl.CraftWallSign::new);
|
||||
register(net.minecraft.server.BlockWeepingVines.class, org.bukkit.craftbukkit.block.impl.CraftWeepingVines::new);
|
||||
register(net.minecraft.server.BlockWitherSkull.class, org.bukkit.craftbukkit.block.impl.CraftWitherSkull::new);
|
||||
register(net.minecraft.server.BlockWitherSkullWall.class, org.bukkit.craftbukkit.block.impl.CraftWitherSkullWall::new);
|
||||
register(net.minecraft.server.BlockWoodButton.class, org.bukkit.craftbukkit.block.impl.CraftWoodButton::new);
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.bukkit.craftbukkit.block.data.type;
|
||||
|
||||
import org.bukkit.block.data.type.Jigsaw;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
|
||||
public abstract class CraftJigsaw extends CraftBlockData implements Jigsaw {
|
||||
|
||||
private static final net.minecraft.server.BlockStateEnum<?> ORIENTATION = getEnum("orientation");
|
||||
|
||||
@Override
|
||||
public Orientation getOrientation() {
|
||||
return get(ORIENTATION, Orientation.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation(Orientation orientation) {
|
||||
set(ORIENTATION, orientation);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.bukkit.craftbukkit.block.data.type;
|
||||
|
||||
import org.bukkit.block.data.type.RespawnAnchor;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
|
||||
public abstract class CraftRespawnAnchor extends CraftBlockData implements RespawnAnchor {
|
||||
|
||||
private static final net.minecraft.server.BlockStateInteger CHARGES = getInteger("charges");
|
||||
|
||||
@Override
|
||||
public int getCharges() {
|
||||
return get(CHARGES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCharges(int charges) {
|
||||
set(CHARGES, charges);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumCharges() {
|
||||
return getMax(CHARGES);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.bukkit.craftbukkit.block.data.type;
|
||||
|
||||
import org.bukkit.block.data.type.Wall;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
|
||||
public abstract class CraftWall extends CraftBlockData implements Wall {
|
||||
|
||||
private static final net.minecraft.server.BlockStateEnum<?>[] HEIGHTS = new net.minecraft.server.BlockStateEnum[]{
|
||||
getEnum("north"), getEnum("east"), getEnum("south"), getEnum("west")
|
||||
};
|
||||
|
||||
@Override
|
||||
public Height getHeight(org.bukkit.block.BlockFace face) {
|
||||
return get(HEIGHTS[face.ordinal()], Height.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(org.bukkit.block.BlockFace face, Height height) {
|
||||
set(HEIGHTS[face.ordinal()], height);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Automatically generated file, changes will be lost.
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftChain extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Waterlogged {
|
||||
|
||||
public CraftChain() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CraftChain(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.BlockChain.class, "waterlogged");
|
||||
|
||||
@Override
|
||||
public boolean isWaterlogged() {
|
||||
return get(WATERLOGGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWaterlogged(boolean waterlogged) {
|
||||
set(WATERLOGGED, waterlogged);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftCobbleWall extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Fence, org.bukkit.block.data.MultipleFacing, org.bukkit.block.data.Waterlogged {
|
||||
public final class CraftCobbleWall extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Wall, org.bukkit.block.data.Waterlogged {
|
||||
|
||||
public CraftCobbleWall() {
|
||||
super();
|
||||
@@ -13,54 +13,20 @@ public final class CraftCobbleWall extends org.bukkit.craftbukkit.block.data.Cra
|
||||
super(state);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.CraftMultipleFacing
|
||||
// org.bukkit.craftbukkit.block.data.type.CraftWall
|
||||
|
||||
private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
|
||||
getBoolean(net.minecraft.server.BlockCobbleWall.class, "north", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "east", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "south", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "west", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "up", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "down", true)
|
||||
private static final net.minecraft.server.BlockStateEnum<?>[] HEIGHTS = new net.minecraft.server.BlockStateEnum[]{
|
||||
getEnum(net.minecraft.server.BlockCobbleWall.class, "north"), getEnum(net.minecraft.server.BlockCobbleWall.class, "east"), getEnum(net.minecraft.server.BlockCobbleWall.class, "south"), getEnum(net.minecraft.server.BlockCobbleWall.class, "west")
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean hasFace(org.bukkit.block.BlockFace face) {
|
||||
net.minecraft.server.BlockStateBoolean state = FACES[face.ordinal()];
|
||||
if (state == null) {
|
||||
throw new IllegalArgumentException("Non-allowed face " + face + ". Check MultipleFacing.getAllowedFaces.");
|
||||
}
|
||||
return get(state);
|
||||
public Height getHeight(org.bukkit.block.BlockFace face) {
|
||||
return get(HEIGHTS[face.ordinal()], Height.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFace(org.bukkit.block.BlockFace face, boolean has) {
|
||||
net.minecraft.server.BlockStateBoolean state = FACES[face.ordinal()];
|
||||
if (state == null) {
|
||||
throw new IllegalArgumentException("Non-allowed face " + face + ". Check MultipleFacing.getAllowedFaces.");
|
||||
}
|
||||
set(state, has);
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
|
||||
com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
|
||||
|
||||
for (int i = 0; i < FACES.length; i++) {
|
||||
if (FACES[i] != null && get(FACES[i])) {
|
||||
faces.add(org.bukkit.block.BlockFace.values()[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return faces.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
|
||||
com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
|
||||
|
||||
for (int i = 0; i < FACES.length; i++) {
|
||||
if (FACES[i] != null) {
|
||||
faces.add(org.bukkit.block.BlockFace.values()[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return faces.build();
|
||||
public void setHeight(org.bukkit.block.BlockFace face, Height height) {
|
||||
set(HEIGHTS[face.ordinal()], height);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftJigsaw extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
|
||||
public final class CraftJigsaw extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Jigsaw {
|
||||
|
||||
public CraftJigsaw() {
|
||||
super();
|
||||
@@ -13,22 +13,17 @@ public final class CraftJigsaw extends org.bukkit.craftbukkit.block.data.CraftBl
|
||||
super(state);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.CraftDirectional
|
||||
// org.bukkit.craftbukkit.block.data.type.CraftJigsaw
|
||||
|
||||
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockJigsaw.class, "facing");
|
||||
private static final net.minecraft.server.BlockStateEnum<?> ORIENTATION = getEnum(net.minecraft.server.BlockJigsaw.class, "orientation");
|
||||
|
||||
@Override
|
||||
public org.bukkit.block.BlockFace getFacing() {
|
||||
return get(FACING, org.bukkit.block.BlockFace.class);
|
||||
public Orientation getOrientation() {
|
||||
return get(ORIENTATION, Orientation.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFacing(org.bukkit.block.BlockFace facing) {
|
||||
set(FACING, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
|
||||
return getValues(FACING, org.bukkit.block.BlockFace.class);
|
||||
public void setOrientation(Orientation orientation) {
|
||||
set(ORIENTATION, orientation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* Automatically generated file, changes will be lost.
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftLogAbstract extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Orientable {
|
||||
|
||||
public CraftLogAbstract() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CraftLogAbstract(net.minecraft.server.IBlockData state) {
|
||||
super(state);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.CraftOrientable
|
||||
|
||||
private static final net.minecraft.server.BlockStateEnum<?> AXIS = getEnum(net.minecraft.server.BlockLogAbstract.class, "axis");
|
||||
|
||||
@Override
|
||||
public org.bukkit.Axis getAxis() {
|
||||
return get(AXIS, org.bukkit.Axis.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAxis(org.bukkit.Axis axis) {
|
||||
set(AXIS, axis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.Set<org.bukkit.Axis> getAxes() {
|
||||
return getValues(AXIS, org.bukkit.Axis.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Automatically generated file, changes will be lost.
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftRespawnAnchor extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.RespawnAnchor {
|
||||
|
||||
public CraftRespawnAnchor() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CraftRespawnAnchor(net.minecraft.server.IBlockData state) {
|
||||
super(state);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.type.CraftRespawnAnchor
|
||||
|
||||
private static final net.minecraft.server.BlockStateInteger CHARGES = getInteger(net.minecraft.server.BlockRespawnAnchor.class, "charges");
|
||||
|
||||
@Override
|
||||
public int getCharges() {
|
||||
return get(CHARGES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCharges(int charges) {
|
||||
set(CHARGES, charges);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumCharges() {
|
||||
return getMax(CHARGES);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Automatically generated file, changes will be lost.
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftTarget extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.AnaloguePowerable {
|
||||
|
||||
public CraftTarget() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CraftTarget(net.minecraft.server.IBlockData state) {
|
||||
super(state);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.CraftAnaloguePowerable
|
||||
|
||||
private static final net.minecraft.server.BlockStateInteger POWER = getInteger(net.minecraft.server.BlockTarget.class, "power");
|
||||
|
||||
@Override
|
||||
public int getPower() {
|
||||
return get(POWER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(int power) {
|
||||
set(POWER, power);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumPower() {
|
||||
return getMax(POWER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Automatically generated file, changes will be lost.
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftTwistingVines extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
|
||||
|
||||
public CraftTwistingVines() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CraftTwistingVines(net.minecraft.server.IBlockData state) {
|
||||
super(state);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.CraftAgeable
|
||||
|
||||
private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockTwistingVines.class, "age");
|
||||
|
||||
@Override
|
||||
public int getAge() {
|
||||
return get(AGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAge(int age) {
|
||||
set(AGE, age);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumAge() {
|
||||
return getMax(AGE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Automatically generated file, changes will be lost.
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
public final class CraftWeepingVines extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
|
||||
|
||||
public CraftWeepingVines() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CraftWeepingVines(net.minecraft.server.IBlockData state) {
|
||||
super(state);
|
||||
}
|
||||
|
||||
// org.bukkit.craftbukkit.block.data.CraftAgeable
|
||||
|
||||
private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockWeepingVines.class, "age");
|
||||
|
||||
@Override
|
||||
public int getAge() {
|
||||
return get(AGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAge(int age) {
|
||||
set(AGE, age);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumAge() {
|
||||
return getMax(AGE);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public class CraftDragonBattle implements DragonBattle {
|
||||
|
||||
@Override
|
||||
public EnderDragon getEnderDragon() {
|
||||
Entity entity = handle.d.getEntity(handle.m);
|
||||
Entity entity = handle.world.getEntity(handle.dragonUUID);
|
||||
return (entity != null) ? (EnderDragon) entity.getBukkitEntity() : null;
|
||||
}
|
||||
|
||||
@@ -30,39 +30,39 @@ public class CraftDragonBattle implements DragonBattle {
|
||||
|
||||
@Override
|
||||
public Location getEndPortalLocation() {
|
||||
return new Location(handle.d.getWorld(), handle.o.getX(), handle.o.getY(), handle.o.getZ());
|
||||
return new Location(handle.world.getWorld(), handle.exitPortalLocation.getX(), handle.exitPortalLocation.getY(), handle.exitPortalLocation.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBeenPreviouslyKilled() {
|
||||
return handle.d(); // PAIL rename hasBeenPreviouslyKilled
|
||||
return handle.isPreviouslyKilled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiateRespawn() {
|
||||
this.handle.e(); // PAIL rename initiateRespawn
|
||||
this.handle.initiateRespawn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RespawnPhase getRespawnPhase() {
|
||||
return toBukkitRespawnPhase(handle.p);
|
||||
return toBukkitRespawnPhase(handle.respawnPhase);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setRespawnPhase(RespawnPhase phase) {
|
||||
Preconditions.checkArgument(phase != null && phase != RespawnPhase.NONE, "Invalid respawn phase provided: %s", phase);
|
||||
|
||||
if (handle.p == null) {
|
||||
if (handle.respawnPhase == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.handle.a(toNMSRespawnPhase(phase));
|
||||
this.handle.setRespawnPhase(toNMSRespawnPhase(phase));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetCrystals() {
|
||||
this.handle.f(); // PAIL rename resetCrystals
|
||||
this.handle.resetCrystals();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ColouredConsoleSender extends CraftConsoleCommandSender {
|
||||
// support jansi passthrough VM option when jansi doesn't detect an ANSI supported terminal
|
||||
if (jansiPassthrough || terminal.isAnsiSupported()) {
|
||||
if (!conversationTracker.isConversingModaly()) {
|
||||
String result = message;
|
||||
String result = message.replaceAll("(?i)" + ChatColor.COLOR_CHAR + "x(" + ChatColor.COLOR_CHAR + "[0-9a-f]){6}", ""); // Hex is not supported by ANSI console
|
||||
for (ChatColor color : colors) {
|
||||
if (replacements.containsKey(color)) {
|
||||
result = result.replaceAll("(?i)" + color.toString(), replacements.get(color));
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.command;
|
||||
|
||||
import net.minecraft.server.CommandListenerWrapper;
|
||||
import net.minecraft.server.IChatBaseComponent;
|
||||
import net.minecraft.server.SystemUtils;
|
||||
import net.minecraft.server.TileEntity;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.BlockCommandSender;
|
||||
@@ -29,7 +30,7 @@ public class CraftBlockCommandSender extends ServerCommandSender implements Bloc
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
for (IChatBaseComponent component : CraftChatMessage.fromString(message)) {
|
||||
block.base.sendMessage(component);
|
||||
block.base.sendMessage(component, SystemUtils.b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.command;
|
||||
|
||||
import net.minecraft.server.ChatComponentText;
|
||||
import net.minecraft.server.RemoteControlCommandListener;
|
||||
import net.minecraft.server.SystemUtils;
|
||||
import org.bukkit.command.RemoteConsoleCommandSender;
|
||||
|
||||
public class CraftRemoteConsoleCommandSender extends ServerCommandSender implements RemoteConsoleCommandSender {
|
||||
@@ -14,7 +15,7 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
listener.sendMessage(new ChatComponentText(message + "\n")); // Send a newline after each message, to preserve formatting.
|
||||
listener.sendMessage(new ChatComponentText(message + "\n"), SystemUtils.b); // Send a newline after each message, to preserve formatting.
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,8 +31,6 @@ public class CraftEnchantment extends Enchantment {
|
||||
@Override
|
||||
public EnchantmentTarget getItemTarget() {
|
||||
switch (target.itemTarget) {
|
||||
case ALL:
|
||||
return EnchantmentTarget.ALL;
|
||||
case ARMOR:
|
||||
return EnchantmentTarget.ARMOR;
|
||||
case ARMOR_FEET:
|
||||
@@ -59,6 +57,8 @@ public class CraftEnchantment extends Enchantment {
|
||||
return EnchantmentTarget.TRIDENT;
|
||||
case CROSSBOW:
|
||||
return EnchantmentTarget.CROSSBOW;
|
||||
case VANISHABLE:
|
||||
return EnchantmentTarget.VANISHABLE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -106,56 +106,58 @@ public class CraftEnchantment extends Enchantment {
|
||||
case 10:
|
||||
return "BINDING_CURSE";
|
||||
case 11:
|
||||
return "DAMAGE_ALL";
|
||||
return "SOUL_SPEED";
|
||||
case 12:
|
||||
return "DAMAGE_UNDEAD";
|
||||
return "DAMAGE_ALL";
|
||||
case 13:
|
||||
return "DAMAGE_ARTHROPODS";
|
||||
return "DAMAGE_UNDEAD";
|
||||
case 14:
|
||||
return "KNOCKBACK";
|
||||
return "DAMAGE_ARTHROPODS";
|
||||
case 15:
|
||||
return "FIRE_ASPECT";
|
||||
return "KNOCKBACK";
|
||||
case 16:
|
||||
return "LOOT_BONUS_MOBS";
|
||||
return "FIRE_ASPECT";
|
||||
case 17:
|
||||
return "SWEEPING_EDGE";
|
||||
return "LOOT_BONUS_MOBS";
|
||||
case 18:
|
||||
return "DIG_SPEED";
|
||||
return "SWEEPING_EDGE";
|
||||
case 19:
|
||||
return "SILK_TOUCH";
|
||||
return "DIG_SPEED";
|
||||
case 20:
|
||||
return "DURABILITY";
|
||||
return "SILK_TOUCH";
|
||||
case 21:
|
||||
return "LOOT_BONUS_BLOCKS";
|
||||
return "DURABILITY";
|
||||
case 22:
|
||||
return "ARROW_DAMAGE";
|
||||
return "LOOT_BONUS_BLOCKS";
|
||||
case 23:
|
||||
return "ARROW_KNOCKBACK";
|
||||
return "ARROW_DAMAGE";
|
||||
case 24:
|
||||
return "ARROW_FIRE";
|
||||
return "ARROW_KNOCKBACK";
|
||||
case 25:
|
||||
return "ARROW_INFINITE";
|
||||
return "ARROW_FIRE";
|
||||
case 26:
|
||||
return "LUCK";
|
||||
return "ARROW_INFINITE";
|
||||
case 27:
|
||||
return "LURE";
|
||||
return "LUCK";
|
||||
case 28:
|
||||
return "LOYALTY";
|
||||
return "LURE";
|
||||
case 29:
|
||||
return "IMPALING";
|
||||
return "LOYALTY";
|
||||
case 30:
|
||||
return "RIPTIDE";
|
||||
return "IMPALING";
|
||||
case 31:
|
||||
return "CHANNELING";
|
||||
return "RIPTIDE";
|
||||
case 32:
|
||||
return "MULTISHOT";
|
||||
return "CHANNELING";
|
||||
case 33:
|
||||
return "QUICK_CHARGE";
|
||||
return "MULTISHOT";
|
||||
case 34:
|
||||
return "PIERCING";
|
||||
return "QUICK_CHARGE";
|
||||
case 35:
|
||||
return "MENDING";
|
||||
return "PIERCING";
|
||||
case 36:
|
||||
return "MENDING";
|
||||
case 37:
|
||||
return "VANISHING_CURSE";
|
||||
default:
|
||||
return "UNKNOWN_ENCHANT_" + IRegistry.ENCHANTMENT.a(target);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import java.util.UUID;
|
||||
import net.minecraft.server.EntityHorse;
|
||||
import net.minecraft.server.EntityHorseAbstract;
|
||||
import net.minecraft.server.GenericAttributes;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryAbstractHorse;
|
||||
@@ -58,7 +58,7 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
|
||||
@Override
|
||||
public void setJumpStrength(double strength) {
|
||||
Validate.isTrue(strength >= 0, "Jump strength cannot be less than zero");
|
||||
getHandle().getAttributeInstance(EntityHorse.attributeJumpStrength).setValue(strength);
|
||||
getHandle().getAttributeInstance(GenericAttributes.JUMP_STRENGTH).setValue(strength);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -112,12 +112,12 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
|
||||
|
||||
@Override
|
||||
public boolean isShotFromCrossbow() {
|
||||
return getHandle().r();
|
||||
return getHandle().isShotFromCrossbow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShotFromCrossbow(boolean shotFromCrossbow) {
|
||||
getHandle().o(shotFromCrossbow);
|
||||
getHandle().setShotFromCrossbow(shotFromCrossbow);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -76,6 +76,6 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
|
||||
|
||||
@Override
|
||||
public int getDeathAnimationTicks() {
|
||||
return getHandle().bA; // PAIL rename deathAnimationTicks
|
||||
return getHandle().deathAnimationTicks;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ import net.minecraft.server.EntityGolem;
|
||||
import net.minecraft.server.EntityGuardian;
|
||||
import net.minecraft.server.EntityGuardianElder;
|
||||
import net.minecraft.server.EntityHanging;
|
||||
import net.minecraft.server.EntityHoglin;
|
||||
import net.minecraft.server.EntityHorse;
|
||||
import net.minecraft.server.EntityHorseAbstract;
|
||||
import net.minecraft.server.EntityHorseChestedAbstract;
|
||||
@@ -92,6 +93,7 @@ import net.minecraft.server.EntityParrot;
|
||||
import net.minecraft.server.EntityPhantom;
|
||||
import net.minecraft.server.EntityPig;
|
||||
import net.minecraft.server.EntityPigZombie;
|
||||
import net.minecraft.server.EntityPiglin;
|
||||
import net.minecraft.server.EntityPillager;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.EntityPolarBear;
|
||||
@@ -115,6 +117,7 @@ import net.minecraft.server.EntitySnowman;
|
||||
import net.minecraft.server.EntitySpectralArrow;
|
||||
import net.minecraft.server.EntitySpider;
|
||||
import net.minecraft.server.EntitySquid;
|
||||
import net.minecraft.server.EntityStrider;
|
||||
import net.minecraft.server.EntityTNTPrimed;
|
||||
import net.minecraft.server.EntityTameableAnimal;
|
||||
import net.minecraft.server.EntityThrownExpBottle;
|
||||
@@ -132,6 +135,7 @@ import net.minecraft.server.EntityWitch;
|
||||
import net.minecraft.server.EntityWither;
|
||||
import net.minecraft.server.EntityWitherSkull;
|
||||
import net.minecraft.server.EntityWolf;
|
||||
import net.minecraft.server.EntityZoglin;
|
||||
import net.minecraft.server.EntityZombie;
|
||||
import net.minecraft.server.EntityZombieHusk;
|
||||
import net.minecraft.server.EntityZombieVillager;
|
||||
@@ -234,6 +238,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
else if (entity instanceof EntityPanda) { return new CraftPanda(server, (EntityPanda) entity); }
|
||||
else if (entity instanceof EntityFox) { return new CraftFox(server, (EntityFox) entity); }
|
||||
else if (entity instanceof EntityBee) { return new CraftBee(server, (EntityBee) entity); }
|
||||
else if (entity instanceof EntityHoglin) { return new CraftHoglin(server, (EntityHoglin) entity); }
|
||||
else if (entity instanceof EntityStrider) { return new CraftStrider(server, (EntityStrider) entity); }
|
||||
else { return new CraftAnimals(server, (EntityAnimal) entity); }
|
||||
}
|
||||
// Monsters
|
||||
@@ -278,6 +284,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
else { return new CraftIllager(server, (EntityIllagerAbstract) entity); }
|
||||
}
|
||||
else if (entity instanceof EntityRavager) { return new CraftRavager(server, (EntityRavager) entity); }
|
||||
else if (entity instanceof EntityPiglin) { return new CraftPiglin(server, (EntityPiglin) entity); }
|
||||
else if (entity instanceof EntityZoglin) { return new CraftZoglin(server, (EntityZoglin) entity); }
|
||||
|
||||
else { return new CraftMonster(server, (EntityMonster) entity); }
|
||||
}
|
||||
@@ -426,7 +434,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
if (entity instanceof EntityArrow) {
|
||||
return ((EntityArrow) entity).inGround;
|
||||
}
|
||||
return entity.onGround;
|
||||
return entity.isOnGround();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -468,7 +476,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
|
||||
// Let the server handle cross world teleports
|
||||
if (!location.getWorld().equals(getWorld())) {
|
||||
entity.teleportTo(((CraftWorld) location.getWorld()).getHandle().getWorldProvider().getDimensionManager(), new BlockPosition(location.getX(), location.getY(), location.getZ()));
|
||||
entity.teleportTo(((CraftWorld) location.getWorld()).getHandle(), new BlockPosition(location.getX(), location.getY(), location.getZ()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
|
||||
@Override
|
||||
public void setShooter(ProjectileSource shooter) {
|
||||
if (shooter instanceof CraftLivingEntity) {
|
||||
getHandle().shooter = ((CraftLivingEntity) shooter).getHandle();
|
||||
getHandle().setShooter(((CraftLivingEntity) shooter).getHandle());
|
||||
} else {
|
||||
getHandle().shooter = null;
|
||||
getHandle().setShooter(null);
|
||||
}
|
||||
getHandle().projectileSource = shooter;
|
||||
}
|
||||
@@ -57,13 +57,7 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
|
||||
@Override
|
||||
public void setDirection(Vector direction) {
|
||||
Validate.notNull(direction, "Direction can not be null");
|
||||
double x = direction.getX();
|
||||
double y = direction.getY();
|
||||
double z = direction.getZ();
|
||||
double magnitude = (double) MathHelper.sqrt(x * x + y * y + z * z);
|
||||
getHandle().dirX = x / magnitude * 0.1D;
|
||||
getHandle().dirY = y / magnitude * 0.1D;
|
||||
getHandle().dirZ = z / magnitude * 0.1D;
|
||||
getHandle().setDirection(direction.getX(), direction.getY(), direction.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
|
||||
public class CraftFirework extends CraftEntity implements Firework {
|
||||
public class CraftFirework extends CraftProjectile implements Firework {
|
||||
|
||||
private final Random random = new Random();
|
||||
private final CraftItemStack item;
|
||||
|
||||
@@ -2,37 +2,19 @@ package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.EntityFishingHook;
|
||||
import net.minecraft.server.EntityHuman;
|
||||
import net.minecraft.server.MathHelper;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
public class CraftFishHook extends AbstractProjectile implements FishHook {
|
||||
public class CraftFishHook extends CraftProjectile implements FishHook {
|
||||
private double biteChance = -1;
|
||||
|
||||
public CraftFishHook(CraftServer server, EntityFishingHook entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectileSource getShooter() {
|
||||
if (getHandle().owner != null) {
|
||||
return getHandle().owner.getBukkitEntity();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShooter(ProjectileSource shooter) {
|
||||
if (shooter instanceof CraftHumanEntity) {
|
||||
getHandle().owner = (EntityHuman) ((CraftHumanEntity) shooter).entity;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityFishingHook getHandle() {
|
||||
return (EntityFishingHook) entity;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityHoglin;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Hoglin;
|
||||
|
||||
public class CraftHoglin extends CraftAnimals implements Hoglin {
|
||||
|
||||
public CraftHoglin(CraftServer server, EntityHoglin entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityHoglin getHandle() {
|
||||
return (EntityHoglin) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftHoglin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType getType() {
|
||||
return EntityType.HOGLIN;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityHorse;
|
||||
import net.minecraft.server.HorseColor;
|
||||
import net.minecraft.server.HorseStyle;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryHorse;
|
||||
@@ -26,24 +28,24 @@ public class CraftHorse extends CraftAbstractHorse implements Horse {
|
||||
|
||||
@Override
|
||||
public Color getColor() {
|
||||
return Color.values()[getHandle().getVariant() & 0xFF];
|
||||
return Color.values()[getHandle().getColor().a()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(Color color) {
|
||||
Validate.notNull(color, "Color cannot be null");
|
||||
getHandle().setVariant(color.ordinal() & 0xFF | getStyle().ordinal() << 8);
|
||||
getHandle().setVariant(HorseColor.a(color.ordinal()), getHandle().getStyle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style getStyle() {
|
||||
return Style.values()[getHandle().getVariant() >>> 8];
|
||||
return Style.values()[getHandle().getStyle().a()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStyle(Style style) {
|
||||
Validate.notNull(style, "Style cannot be null");
|
||||
getHandle().setVariant(getColor().ordinal() & 0xFF | style.ordinal() << 8);
|
||||
getHandle().setVariant(getHandle().getColor(), HorseStyle.a(style.ordinal()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,15 +31,12 @@ import net.minecraft.server.PacketPlayInCloseWindow;
|
||||
import net.minecraft.server.PacketPlayOutOpenWindow;
|
||||
import net.minecraft.server.TileEntity;
|
||||
import net.minecraft.server.TileEntityContainer;
|
||||
import net.minecraft.server.Vec3D;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftContainer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
@@ -128,36 +125,6 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
return getHandle().sleepTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBedSpawnLocation() {
|
||||
World world = getServer().getWorld(getHandle().spawnWorld);
|
||||
BlockPosition bed = getHandle().getBed();
|
||||
|
||||
if (world != null && bed != null) {
|
||||
Optional<Vec3D> spawnLoc = EntityHuman.getBed(((CraftWorld) world).getHandle(), bed, getHandle().isRespawnForced());
|
||||
if (spawnLoc.isPresent()) {
|
||||
Vec3D vec = spawnLoc.get();
|
||||
return new Location(world, vec.x, vec.y, vec.z);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBedSpawnLocation(Location location) {
|
||||
setBedSpawnLocation(location, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBedSpawnLocation(Location location, boolean override) {
|
||||
if (location == null) {
|
||||
getHandle().setRespawnPosition(null, override, false);
|
||||
} else {
|
||||
getHandle().setRespawnPosition(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override, false);
|
||||
getHandle().spawnWorld = location.getWorld().getName();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sleep(Location location, boolean force) {
|
||||
Preconditions.checkArgument(location != null, "Location cannot be null");
|
||||
@@ -192,7 +159,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
public Location getBedLocation() {
|
||||
Preconditions.checkState(isSleeping(), "Not sleeping");
|
||||
|
||||
BlockPosition bed = getHandle().getBed();
|
||||
BlockPosition bed = getHandle().getBedPosition().get();
|
||||
return new Location(getWorld(), bed.getX(), bed.getY(), bed.getZ());
|
||||
}
|
||||
|
||||
@@ -492,7 +459,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
|
||||
@Override
|
||||
public float getAttackCooldown() {
|
||||
return getHandle().s(0.5f);
|
||||
return getHandle().getAttackCooldown(0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,7 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
|
||||
|
||||
@Override
|
||||
public boolean isEffect() {
|
||||
return ((EntityLightning) super.getHandle()).isEffect;
|
||||
return getHandle().isEffect;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -428,7 +428,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
|
||||
launch = EntityTypes.LLAMA_SPIT.a(world);
|
||||
|
||||
((EntityLlamaSpit) launch).shooter = getHandle();
|
||||
((EntityLlamaSpit) launch).setShooter(getHandle());
|
||||
((EntityLlamaSpit) launch).shoot(direction.getX(), direction.getY(), direction.getZ(), 1.5F, 10.0F); // EntityLlama
|
||||
launch.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
} else if (ShulkerBullet.class.isAssignableFrom(projectile)) {
|
||||
@@ -588,17 +588,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public void attack(Entity target) {
|
||||
Preconditions.checkArgument(target != null, "target == null");
|
||||
|
||||
getHandle().B(((CraftEntity) target).getHandle()); // PAIL rename attack
|
||||
getHandle().attackEntity(((CraftEntity) target).getHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swingMainHand() {
|
||||
getHandle().a(EnumHand.MAIN_HAND, true); // PAIL rename swingHand
|
||||
getHandle().swingHand(EnumHand.MAIN_HAND, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swingOffHand() {
|
||||
getHandle().a(EnumHand.OFF_HAND, true); // PAIL rename swingHand
|
||||
getHandle().swingHand(EnumHand.OFF_HAND, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,11 +29,11 @@ public class CraftLlamaSpit extends AbstractProjectile implements LlamaSpit {
|
||||
|
||||
@Override
|
||||
public ProjectileSource getShooter() {
|
||||
return (getHandle().shooter != null) ? (ProjectileSource) getHandle().shooter.getBukkitEntity() : null;
|
||||
return (getHandle().getShooter() != null) ? (ProjectileSource) getHandle().getShooter().getBukkitEntity() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShooter(ProjectileSource source) {
|
||||
getHandle().shooter = (source != null) ? ((CraftLivingEntity) source).getHandle() : null;
|
||||
getHandle().setShooter((source != null) ? ((CraftLivingEntity) source).getHandle() : null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class CraftPig extends CraftAnimals implements Pig {
|
||||
|
||||
@Override
|
||||
public void setSaddle(boolean saddled) {
|
||||
getHandle().setSaddle(saddled);
|
||||
getHandle().saddleStorage.setSaddle(saddled);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,12 +13,12 @@ public class CraftPigZombie extends CraftZombie implements PigZombie {
|
||||
|
||||
@Override
|
||||
public int getAnger() {
|
||||
return getHandle().angerLevel;
|
||||
return getHandle().getAnger();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnger(int level) {
|
||||
getHandle().angerLevel = level;
|
||||
getHandle().setAnger(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,7 +43,7 @@ public class CraftPigZombie extends CraftZombie implements PigZombie {
|
||||
|
||||
@Override
|
||||
public EntityType getType() {
|
||||
return EntityType.PIG_ZOMBIE;
|
||||
return EntityType.ZOMBIFIED_PIGLIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityPiglin;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Piglin;
|
||||
|
||||
public class CraftPiglin extends CraftMonster implements Piglin {
|
||||
|
||||
public CraftPiglin(CraftServer server, EntityPiglin entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPiglin getHandle() {
|
||||
return (EntityPiglin) super.getHandle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType getType() {
|
||||
return EntityType.PIGLIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftPiglin";
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.WeakHashMap;
|
||||
@@ -25,18 +26,19 @@ import java.util.logging.Logger;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.server.AdvancementDataPlayer;
|
||||
import net.minecraft.server.AdvancementProgress;
|
||||
import net.minecraft.server.AttributeInstance;
|
||||
import net.minecraft.server.AttributeMapServer;
|
||||
import net.minecraft.server.AttributeMapBase;
|
||||
import net.minecraft.server.AttributeModifiable;
|
||||
import net.minecraft.server.AttributeRanged;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.ChatComponentText;
|
||||
import net.minecraft.server.ChatMessageType;
|
||||
import net.minecraft.server.Container;
|
||||
import net.minecraft.server.Entity;
|
||||
import net.minecraft.server.EntityHuman;
|
||||
import net.minecraft.server.EntityLiving;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.EnumColor;
|
||||
import net.minecraft.server.EnumGamemode;
|
||||
import net.minecraft.server.GenericAttributes;
|
||||
import net.minecraft.server.IChatBaseComponent;
|
||||
import net.minecraft.server.MapIcon;
|
||||
import net.minecraft.server.MinecraftKey;
|
||||
@@ -60,6 +62,7 @@ import net.minecraft.server.PacketPlayOutWorldEvent;
|
||||
import net.minecraft.server.PacketPlayOutWorldParticles;
|
||||
import net.minecraft.server.PlayerChunkMap;
|
||||
import net.minecraft.server.PlayerConnection;
|
||||
import net.minecraft.server.SystemUtils;
|
||||
import net.minecraft.server.TileEntitySign;
|
||||
import net.minecraft.server.Vec3D;
|
||||
import net.minecraft.server.WhiteListEntry;
|
||||
@@ -80,6 +83,7 @@ import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.WeatherType;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.configuration.serialization.DelegateDeserialization;
|
||||
import org.bukkit.conversations.Conversation;
|
||||
@@ -189,7 +193,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
if (getHandle().playerConnection == null) return;
|
||||
|
||||
for (IChatBaseComponent component : CraftChatMessage.fromString(message)) {
|
||||
getHandle().playerConnection.sendPacket(new PacketPlayOutChat(component));
|
||||
getHandle().playerConnection.sendPacket(new PacketPlayOutChat(component, ChatMessageType.CHAT, SystemUtils.b));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -664,7 +668,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
if (fromWorld == toWorld) {
|
||||
entity.playerConnection.teleport(to);
|
||||
} else {
|
||||
server.getHandle().moveToWorld(entity, toWorld.getWorldProvider().getDimensionManager(), true, to, true);
|
||||
server.getHandle().moveToWorld(entity, toWorld, true, to, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -716,6 +720,43 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return getHandle().fauxSleeping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBedSpawnLocation() {
|
||||
World world = getHandle().server.getWorldServer(getHandle().getSpawnDimension()).getWorld();
|
||||
BlockPosition bed = getHandle().getSpawn();
|
||||
|
||||
if (world != null && bed != null) {
|
||||
Optional<Vec3D> spawnLoc = EntityHuman.getBed(((CraftWorld) world).getHandle(), bed, getHandle().isSpawnForced(), true);
|
||||
if (spawnLoc.isPresent()) {
|
||||
Vec3D vec = spawnLoc.get();
|
||||
return new Location(world, vec.x, vec.y, vec.z);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBedSpawnLocation(Location location) {
|
||||
setBedSpawnLocation(location, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBedSpawnLocation(Location location, boolean override) {
|
||||
if (location == null) {
|
||||
getHandle().setRespawnPosition(null, null, override, false);
|
||||
} else {
|
||||
getHandle().setRespawnPosition(((CraftWorld) location.getWorld()).getHandle().getDimensionKey(), new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getBedLocation() {
|
||||
Preconditions.checkState(isSleeping(), "Not sleeping");
|
||||
|
||||
BlockPosition bed = getHandle().getSpawn();
|
||||
return new Location(getWorld(), bed.getX(), bed.getY(), bed.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementStatistic(Statistic statistic) {
|
||||
CraftStatistic.incrementStatistic(getHandle().getStatisticManager(), statistic);
|
||||
@@ -1457,8 +1498,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public void updateScaledHealth(boolean sendHealth) {
|
||||
AttributeMapServer attributemapserver = (AttributeMapServer) getHandle().getAttributeMap();
|
||||
Collection<AttributeInstance> set = attributemapserver.c(); // PAIL: Rename
|
||||
AttributeMapBase attributemapserver = getHandle().getAttributeMap();
|
||||
Collection<AttributeModifiable> set = attributemapserver.b(); // PAIL: Rename
|
||||
|
||||
injectScaledMaxHealth(set, true);
|
||||
|
||||
@@ -1478,17 +1519,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().getFoodLevel(), getHandle().getFoodData().getSaturationLevel()));
|
||||
}
|
||||
|
||||
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
|
||||
public void injectScaledMaxHealth(Collection<AttributeModifiable> collection, boolean force) {
|
||||
if (!scaledHealth && !force) {
|
||||
return;
|
||||
}
|
||||
for (AttributeInstance genericInstance : collection) {
|
||||
if (genericInstance.getAttribute().getName().equals("generic.maxHealth")) {
|
||||
collection.remove(genericInstance);
|
||||
for (AttributeModifiable genericInstance : collection) {
|
||||
if (genericInstance.getAttribute() == GenericAttributes.MAX_HEALTH) {
|
||||
genericInstance.setValue(scaledHealth ? healthScale : getMaxHealth());
|
||||
break;
|
||||
}
|
||||
}
|
||||
collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityLiving;
|
||||
import net.minecraft.server.EntityProjectile;
|
||||
import net.minecraft.server.IProjectile;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
public abstract class CraftProjectile extends AbstractProjectile implements Projectile {
|
||||
public CraftProjectile(CraftServer server, net.minecraft.server.Entity entity) {
|
||||
public CraftProjectile(CraftServer server, net.minecraft.server.IProjectile entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@@ -19,18 +19,16 @@ public abstract class CraftProjectile extends AbstractProjectile implements Proj
|
||||
@Override
|
||||
public void setShooter(ProjectileSource shooter) {
|
||||
if (shooter instanceof CraftLivingEntity) {
|
||||
getHandle().shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
|
||||
getHandle().shooterId = ((CraftLivingEntity) shooter).getUniqueId();
|
||||
getHandle().setShooter((EntityLiving) ((CraftLivingEntity) shooter).entity);
|
||||
} else {
|
||||
getHandle().shooter = null;
|
||||
getHandle().shooterId = null;
|
||||
getHandle().setShooter(null);
|
||||
}
|
||||
getHandle().projectileSource = shooter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityProjectile getHandle() {
|
||||
return (EntityProjectile) entity;
|
||||
public IProjectile getHandle() {
|
||||
return (IProjectile) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,8 +41,8 @@ public class CraftRabbit extends CraftAnimals implements Rabbit {
|
||||
if (getRabbitType() == Type.THE_KILLER_BUNNY) {
|
||||
// Reset goals and target finders.
|
||||
World world = ((CraftWorld) this.getWorld()).getHandle();
|
||||
entity.goalSelector = new PathfinderGoalSelector(world != null && world.getMethodProfiler() != null ? world.getMethodProfiler() : null);
|
||||
entity.targetSelector = new PathfinderGoalSelector(world != null && world.getMethodProfiler() != null ? world.getMethodProfiler() : null);
|
||||
entity.goalSelector = new PathfinderGoalSelector(world.getMethodProfilerSupplier());
|
||||
entity.targetSelector = new PathfinderGoalSelector(world.getMethodProfilerSupplier());
|
||||
entity.initializePathFinderGoals();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityShulkerBullet;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.ShulkerBullet;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
@@ -20,8 +20,8 @@ public class CraftShulkerBullet extends AbstractProjectile implements ShulkerBul
|
||||
|
||||
@Override
|
||||
public void setShooter(ProjectileSource shooter) {
|
||||
if (shooter instanceof LivingEntity) {
|
||||
getHandle().setShooter(((CraftLivingEntity) shooter).getHandle());
|
||||
if (shooter instanceof Entity) {
|
||||
getHandle().setShooter(((CraftEntity) shooter).getHandle());
|
||||
} else {
|
||||
getHandle().setShooter(null);
|
||||
}
|
||||
|
||||
@@ -15,16 +15,16 @@ public class CraftSizedFireball extends CraftFireball implements SizedFireball {
|
||||
|
||||
@Override
|
||||
public ItemStack getDisplayItem() {
|
||||
if (getHandle().l().isEmpty()) { // PAIL rename getItem
|
||||
if (getHandle().getItem().isEmpty()) {
|
||||
return new ItemStack(Material.FIRE_CHARGE);
|
||||
} else {
|
||||
return CraftItemStack.asBukkitCopy(getHandle().l()); // PAIL rename getItem
|
||||
return CraftItemStack.asBukkitCopy(getHandle().getItem());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayItem(ItemStack item) {
|
||||
getHandle().b(CraftItemStack.asNMSCopy(item)); // PAIL rename setItem
|
||||
getHandle().setItem(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityStrider;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Strider;
|
||||
|
||||
public class CraftStrider extends CraftAnimals implements Strider {
|
||||
|
||||
public CraftStrider(CraftServer server, EntityStrider entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityStrider getHandle() {
|
||||
return (EntityStrider) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftStrider";
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType getType() {
|
||||
return EntityType.STRIDER;
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat
|
||||
|
||||
public void setSitting(boolean sitting) {
|
||||
getHandle().setSitting(sitting);
|
||||
getHandle().getGoalSit().setSitting(sitting);
|
||||
getHandle().setWillSit(sitting);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,7 @@ public abstract class CraftThrowableProjectile extends CraftProjectile implement
|
||||
@Override
|
||||
public ItemStack getItem() {
|
||||
if (getHandle().getItem().isEmpty()) {
|
||||
return CraftItemStack.asBukkitCopy(new net.minecraft.server.ItemStack(getHandle().getDefaultItem()));
|
||||
return CraftItemStack.asBukkitCopy(new net.minecraft.server.ItemStack(getHandle().getDefaultItemPublic()));
|
||||
} else {
|
||||
return CraftItemStack.asBukkitCopy(getHandle().getItem());
|
||||
}
|
||||
|
||||
@@ -19,7 +19,11 @@ public class CraftWolf extends CraftTameableAnimal implements Wolf {
|
||||
|
||||
@Override
|
||||
public void setAngry(boolean angry) {
|
||||
getHandle().setAngry(angry);
|
||||
if (angry) {
|
||||
getHandle().anger();
|
||||
} else {
|
||||
getHandle().pacify();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityZoglin;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Zoglin;
|
||||
|
||||
public class CraftZoglin extends CraftMonster implements Zoglin {
|
||||
|
||||
public CraftZoglin(CraftServer server, EntityZoglin entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityZoglin getHandle() {
|
||||
return (EntityZoglin) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftZoglin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType getType() {
|
||||
return EntityType.ZOGLIN;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.bukkit.craftbukkit.entity.memory;
|
||||
|
||||
import java.util.UUID;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.GlobalPos;
|
||||
import net.minecraft.server.MinecraftSerializableLong;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
@@ -15,8 +15,12 @@ public final class CraftMemoryMapper {
|
||||
public static Object fromNms(Object object) {
|
||||
if (object instanceof GlobalPos) {
|
||||
return fromNms((GlobalPos) object);
|
||||
} else if (object instanceof MinecraftSerializableLong) {
|
||||
return ((MinecraftSerializableLong) object).a();
|
||||
} else if (object instanceof Long) {
|
||||
return (Long) object;
|
||||
} else if (object instanceof UUID) {
|
||||
return (UUID) object;
|
||||
} else if (object instanceof Boolean) {
|
||||
return (Boolean) object;
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("Do not know how to map " + object);
|
||||
@@ -28,7 +32,11 @@ public final class CraftMemoryMapper {
|
||||
} else if (object instanceof Location) {
|
||||
return toNms((Location) object);
|
||||
} else if (object instanceof Long) {
|
||||
return MinecraftSerializableLong.a((Long) object);
|
||||
return (Long) object;
|
||||
} else if (object instanceof UUID) {
|
||||
return (UUID) object;
|
||||
} else if (object instanceof Boolean) {
|
||||
return (Boolean) object;
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("Do not know how to map " + object);
|
||||
@@ -39,6 +47,6 @@ public final class CraftMemoryMapper {
|
||||
}
|
||||
|
||||
public static GlobalPos toNms(Location location) {
|
||||
return GlobalPos.create(((CraftWorld) location.getWorld()).getHandle().getWorldProvider().getDimensionManager(), new BlockPosition(location.getX(), location.getY(), location.getZ()));
|
||||
return GlobalPos.create(((CraftWorld) location.getWorld()).getHandle().getDimensionKey(), new BlockPosition(location.getX(), location.getY(), location.getZ()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.server.ChatModifier;
|
||||
import net.minecraft.server.Container;
|
||||
import net.minecraft.server.ContainerMerchant;
|
||||
import net.minecraft.server.DamageSource;
|
||||
import net.minecraft.server.DimensionManager;
|
||||
import net.minecraft.server.Entity;
|
||||
import net.minecraft.server.EntityAnimal;
|
||||
import net.minecraft.server.EntityAreaEffectCloud;
|
||||
@@ -39,7 +38,6 @@ import net.minecraft.server.EntityMonster;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.EntityPotion;
|
||||
import net.minecraft.server.EntityRaider;
|
||||
import net.minecraft.server.EntitySheep;
|
||||
import net.minecraft.server.EntitySlime;
|
||||
import net.minecraft.server.EntityTypes;
|
||||
import net.minecraft.server.EntityVillager;
|
||||
@@ -68,6 +66,7 @@ import net.minecraft.server.PacketPlayInCloseWindow;
|
||||
import net.minecraft.server.Raid;
|
||||
import net.minecraft.server.Unit;
|
||||
import net.minecraft.server.World;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -111,7 +110,6 @@ import org.bukkit.entity.PigZombie;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Raider;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.entity.ThrownExpBottle;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
@@ -218,10 +216,10 @@ public class CraftEventFactory {
|
||||
public static Entity entityDamage; // For use in EntityDamageByEntityEvent
|
||||
|
||||
// helper methods
|
||||
private static boolean canBuild(World world, Player player, int x, int z) {
|
||||
private static boolean canBuild(WorldServer world, Player player, int x, int z) {
|
||||
int spawnSize = Bukkit.getServer().getSpawnRadius();
|
||||
|
||||
if (world.getWorldProvider().getDimensionManager() != DimensionManager.OVERWORLD) return true;
|
||||
if (world.getDimensionKey() != World.OVERWORLD) return true;
|
||||
if (spawnSize <= 0) return true;
|
||||
if (((CraftServer) Bukkit.getServer()).getHandle().getOPs().isEmpty()) return true;
|
||||
if (player.isOp()) return true;
|
||||
@@ -284,7 +282,7 @@ public class CraftEventFactory {
|
||||
/**
|
||||
* Block place methods
|
||||
*/
|
||||
public static BlockMultiPlaceEvent callBlockMultiPlaceEvent(World world, EntityHuman who, EnumHand hand, List<BlockState> blockStates, int clickedX, int clickedY, int clickedZ) {
|
||||
public static BlockMultiPlaceEvent callBlockMultiPlaceEvent(WorldServer world, EntityHuman who, EnumHand hand, List<BlockState> blockStates, int clickedX, int clickedY, int clickedZ) {
|
||||
CraftWorld craftWorld = world.getWorld();
|
||||
CraftServer craftServer = world.getServer();
|
||||
Player player = (Player) who.getBukkitEntity();
|
||||
@@ -312,7 +310,7 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
public static BlockPlaceEvent callBlockPlaceEvent(World world, EntityHuman who, EnumHand hand, BlockState replacedBlockState, int clickedX, int clickedY, int clickedZ) {
|
||||
public static BlockPlaceEvent callBlockPlaceEvent(WorldServer world, EntityHuman who, EnumHand hand, BlockState replacedBlockState, int clickedX, int clickedY, int clickedZ) {
|
||||
CraftWorld craftWorld = world.getWorld();
|
||||
CraftServer craftServer = world.getServer();
|
||||
|
||||
@@ -368,15 +366,15 @@ public class CraftEventFactory {
|
||||
/**
|
||||
* Bucket methods
|
||||
*/
|
||||
public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemInHand) {
|
||||
public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(WorldServer world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemInHand) {
|
||||
return (PlayerBucketEmptyEvent) getPlayerBucketEvent(false, world, who, changed, clicked, clickedFace, itemInHand, Items.BUCKET);
|
||||
}
|
||||
|
||||
public static PlayerBucketFillEvent callPlayerBucketFillEvent(World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemInHand, net.minecraft.server.Item bucket) {
|
||||
public static PlayerBucketFillEvent callPlayerBucketFillEvent(WorldServer world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemInHand, net.minecraft.server.Item bucket) {
|
||||
return (PlayerBucketFillEvent) getPlayerBucketEvent(true, world, who, clicked, changed, clickedFace, itemInHand, bucket);
|
||||
}
|
||||
|
||||
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
|
||||
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, WorldServer world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
|
||||
Player player = (Player) who.getBukkitEntity();
|
||||
CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item);
|
||||
Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem());
|
||||
@@ -1272,10 +1270,9 @@ public class CraftEventFactory {
|
||||
private static IChatBaseComponent stripEvents(IChatBaseComponent c) {
|
||||
ChatModifier modi = c.getChatModifier();
|
||||
if (modi != null) {
|
||||
modi.setChatClickable(null);
|
||||
modi.setChatHoverable(null);
|
||||
modi = modi.setChatClickable(null);
|
||||
modi = modi.setChatHoverable(null);
|
||||
}
|
||||
c.setChatModifier(modi);
|
||||
if (c instanceof ChatMessage) {
|
||||
ChatMessage cm = (ChatMessage) c;
|
||||
Object[] oo = cm.getArgs();
|
||||
@@ -1292,7 +1289,7 @@ public class CraftEventFactory {
|
||||
ls.set(i, stripEvents(ls.get(i)));
|
||||
}
|
||||
}
|
||||
return c;
|
||||
return c.mutableCopy().setChatModifier(modi);
|
||||
}
|
||||
|
||||
public static PlayerUnleashEntityEvent callPlayerUnleashEntityEvent(EntityInsentient entity, EntityHuman player) {
|
||||
@@ -1307,9 +1304,8 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
public static BlockShearEntityEvent callBlockShearEntityEvent(EntitySheep animal, org.bukkit.block.Block dispenser, CraftItemStack is) {
|
||||
Sheep sheep = (Sheep) animal.getBukkitEntity();
|
||||
BlockShearEntityEvent bse = new BlockShearEntityEvent(dispenser, sheep, is);
|
||||
public static BlockShearEntityEvent callBlockShearEntityEvent(Entity animal, org.bukkit.block.Block dispenser, CraftItemStack is) {
|
||||
BlockShearEntityEvent bse = new BlockShearEntityEvent(dispenser, animal.getBukkitEntity(), is);
|
||||
Bukkit.getPluginManager().callEvent(bse);
|
||||
return bse;
|
||||
}
|
||||
@@ -1324,7 +1320,7 @@ public class CraftEventFactory {
|
||||
return !event.isCancelled();
|
||||
}
|
||||
|
||||
public static Cancellable handleStatisticsIncrease(EntityHuman entityHuman, net.minecraft.server.Statistic<?> statistic, int current, int incrementation) {
|
||||
public static Cancellable handleStatisticsIncrease(EntityHuman entityHuman, net.minecraft.server.Statistic<?> statistic, int current, int newValue) {
|
||||
Player player = ((EntityPlayer) entityHuman).getBukkitEntity();
|
||||
Event event;
|
||||
if (true) {
|
||||
@@ -1355,13 +1351,13 @@ public class CraftEventFactory {
|
||||
default:
|
||||
}
|
||||
if (stat.getType() == Type.UNTYPED) {
|
||||
event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation);
|
||||
event = new PlayerStatisticIncrementEvent(player, stat, current, newValue);
|
||||
} else if (stat.getType() == Type.ENTITY) {
|
||||
EntityType entityType = CraftStatistic.getEntityTypeFromStatistic((net.minecraft.server.Statistic<EntityTypes<?>>) statistic);
|
||||
event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, entityType);
|
||||
event = new PlayerStatisticIncrementEvent(player, stat, current, newValue, entityType);
|
||||
} else {
|
||||
Material material = CraftStatistic.getMaterialFromStatistic(statistic);
|
||||
event = new PlayerStatisticIncrementEvent(player, stat, current, current + incrementation, material);
|
||||
event = new PlayerStatisticIncrementEvent(player, stat, current, newValue, material);
|
||||
}
|
||||
}
|
||||
entityHuman.world.getServer().getPluginManager().callEvent(event);
|
||||
@@ -1549,7 +1545,7 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static LootGenerateEvent callLootGenerateEvent(IInventory inventory, LootTable lootTable, LootTableInfo lootInfo, List<ItemStack> loot, boolean plugin) {
|
||||
CraftWorld world = lootInfo.c().getWorld(); // PAIL rename getWorld
|
||||
CraftWorld world = lootInfo.getWorld().getWorld();
|
||||
Entity entity = lootInfo.getContextParameter(LootContextParameters.THIS_ENTITY);
|
||||
NamespacedKey key = CraftNamespacedKey.fromMinecraft(world.getHandle().getMinecraftServer().getLootTableRegistry().lootTableToKey.get(lootTable));
|
||||
CraftLootTable craftLootTable = new CraftLootTable(key, lootTable);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.craftbukkit.generator;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.mojang.serialization.Codec;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.server.BiomeBase;
|
||||
@@ -8,36 +9,33 @@ import net.minecraft.server.BiomeManager;
|
||||
import net.minecraft.server.BiomeStorage;
|
||||
import net.minecraft.server.Block;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.ChunkProviderGenerate;
|
||||
import net.minecraft.server.ChunkProviderHell;
|
||||
import net.minecraft.server.ChunkProviderTheEnd;
|
||||
import net.minecraft.server.ChunkSection;
|
||||
import net.minecraft.server.DefinedStructureManager;
|
||||
import net.minecraft.server.DimensionManager;
|
||||
import net.minecraft.server.EnumCreatureType;
|
||||
import net.minecraft.server.GeneratorAccess;
|
||||
import net.minecraft.server.GeneratorSettingsDefault;
|
||||
import net.minecraft.server.GeneratorSettingsEnd;
|
||||
import net.minecraft.server.GeneratorSettingsNether;
|
||||
import net.minecraft.server.GeneratorSettingsOverworld;
|
||||
import net.minecraft.server.HeightMap;
|
||||
import net.minecraft.server.IBlockAccess;
|
||||
import net.minecraft.server.IChunkAccess;
|
||||
import net.minecraft.server.ITileEntity;
|
||||
import net.minecraft.server.ProtoChunk;
|
||||
import net.minecraft.server.RegionLimitedWorldAccess;
|
||||
import net.minecraft.server.StructureGenerator;
|
||||
import net.minecraft.server.RegistryMaterials;
|
||||
import net.minecraft.server.StructureManager;
|
||||
import net.minecraft.server.StructureSettings;
|
||||
import net.minecraft.server.TileEntity;
|
||||
import net.minecraft.server.World;
|
||||
import net.minecraft.server.WorldChunkManager;
|
||||
import net.minecraft.server.WorldGenFeatureConfiguration;
|
||||
import net.minecraft.server.WorldDimension;
|
||||
import net.minecraft.server.WorldGenStage;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettingsDefault> {
|
||||
public class CustomChunkGenerator extends InternalChunkGenerator {
|
||||
private final net.minecraft.server.ChunkGenerator delegate;
|
||||
private final ChunkGenerator generator;
|
||||
private final WorldServer world;
|
||||
@@ -74,23 +72,11 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
|
||||
}
|
||||
}
|
||||
|
||||
public CustomChunkGenerator(World world, ChunkGenerator generator) {
|
||||
super(world, world.worldProvider.getChunkGenerator().getWorldChunkManager(), new GeneratorSettingsDefault());
|
||||
switch (world.getWorld().getEnvironment()) {
|
||||
case NORMAL:
|
||||
this.delegate = new ChunkProviderGenerate(world, world.worldProvider.getChunkGenerator().getWorldChunkManager(), new GeneratorSettingsOverworld());
|
||||
break;
|
||||
case NETHER:
|
||||
this.delegate = new ChunkProviderHell(world, world.worldProvider.getChunkGenerator().getWorldChunkManager(), new GeneratorSettingsNether());
|
||||
break;
|
||||
case THE_END:
|
||||
this.delegate = new ChunkProviderTheEnd(world, world.worldProvider.getChunkGenerator().getWorldChunkManager(), new GeneratorSettingsEnd());
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError("Unknown delegate for environment " + world.getWorld().getEnvironment());
|
||||
}
|
||||
public CustomChunkGenerator(WorldServer world, net.minecraft.server.ChunkGenerator delegate, ChunkGenerator generator) {
|
||||
super(delegate.getWorldChunkManager(), delegate.getSettings());
|
||||
|
||||
this.world = (WorldServer) world;
|
||||
this.world = world;
|
||||
this.delegate = delegate;
|
||||
this.generator = generator;
|
||||
}
|
||||
|
||||
@@ -99,19 +85,14 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
|
||||
// Don't allow the server to override any custom biomes that have been set
|
||||
}
|
||||
|
||||
@Override
|
||||
public <C extends WorldGenFeatureConfiguration> C getFeatureConfiguration(BiomeBase biomebase, StructureGenerator<C> structuregenerator) {
|
||||
return (C) delegate.getFeatureConfiguration(biomebase, structuregenerator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldChunkManager getWorldChunkManager() {
|
||||
return delegate.getWorldChunkManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeStructures(GeneratorAccess generatoraccess, IChunkAccess ichunkaccess) {
|
||||
delegate.storeStructures(generatoraccess, ichunkaccess);
|
||||
public void storeStructures(GeneratorAccess generatoraccess, StructureManager structuremanager, IChunkAccess ichunkaccess) {
|
||||
delegate.storeStructures(generatoraccess, structuremanager, ichunkaccess);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,23 +155,23 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createStructures(BiomeManager biomemanager, IChunkAccess ichunkaccess, net.minecraft.server.ChunkGenerator<?> chunkgenerator, DefinedStructureManager definedstructuremanager) {
|
||||
public void createStructures(StructureManager structuremanager, IChunkAccess ichunkaccess, DefinedStructureManager definedstructuremanager, long i) {
|
||||
if (generator.shouldGenerateStructures()) {
|
||||
// Still need a way of getting the biome of this chunk to pass to createStructures
|
||||
// Using default biomes for now.
|
||||
delegate.createStructures(biomemanager, ichunkaccess, chunkgenerator, definedstructuremanager);
|
||||
delegate.createStructures(structuremanager, ichunkaccess, definedstructuremanager, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCarving(BiomeManager biomemanager, IChunkAccess ichunkaccess, WorldGenStage.Features worldgenstage_features) {
|
||||
public void doCarving(long i, BiomeManager biomemanager, IChunkAccess ichunkaccess, WorldGenStage.Features worldgenstage_features) {
|
||||
if (generator.shouldGenerateCaves()) {
|
||||
delegate.doCarving(biomemanager, ichunkaccess, worldgenstage_features);
|
||||
delegate.doCarving(i, biomemanager, ichunkaccess, worldgenstage_features);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildNoise(GeneratorAccess generatoraccess, IChunkAccess ichunkaccess) {
|
||||
public void buildNoise(GeneratorAccess generatoraccess, StructureManager structuremanager, IChunkAccess ichunkaccess) {
|
||||
// Disable vanilla generation
|
||||
}
|
||||
|
||||
@@ -200,14 +181,14 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BiomeBase.BiomeMeta> getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
|
||||
return delegate.getMobsFor(enumcreaturetype, blockposition);
|
||||
public List<BiomeBase.BiomeMeta> getMobsFor(BiomeBase biomebase, StructureManager structuremanager, EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
|
||||
return delegate.getMobsFor(biomebase, structuremanager, enumcreaturetype, blockposition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDecorations(RegionLimitedWorldAccess regionlimitedworldaccess) {
|
||||
public void addDecorations(RegionLimitedWorldAccess regionlimitedworldaccess, StructureManager structuremanager) {
|
||||
if (generator.shouldGenerateDecorations()) {
|
||||
delegate.addDecorations(regionlimitedworldaccess);
|
||||
delegate.addDecorations(regionlimitedworldaccess, structuremanager);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,31 +199,6 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPosition findNearestMapFeature(World world, String s, BlockPosition blockposition, int i, boolean flag) {
|
||||
return delegate.findNearestMapFeature(world, s, blockposition, i, flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratorSettingsDefault getSettings() {
|
||||
return delegate.getSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doMobSpawning(WorldServer worldserver, boolean flag, boolean flag1) {
|
||||
delegate.doMobSpawning(worldserver, flag, flag1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSpawnStructure(BiomeBase biomebase, StructureGenerator<? extends WorldGenFeatureConfiguration> structuregenerator) {
|
||||
return delegate.canSpawnStructure(biomebase, structuregenerator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSeed() {
|
||||
return delegate.getSeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpawnHeight() {
|
||||
return delegate.getSpawnHeight();
|
||||
@@ -252,4 +208,14 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
|
||||
public int getGenerationDepth() {
|
||||
return delegate.getGenerationDepth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockAccess a(int i, int j) {
|
||||
return delegate.a(i, j);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Codec<? extends net.minecraft.server.ChunkGenerator> a() {
|
||||
throw new UnsupportedOperationException("Cannot serialize CustomChunkGenerator");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package org.bukkit.craftbukkit.generator;
|
||||
|
||||
import net.minecraft.server.GeneratorAccess;
|
||||
import net.minecraft.server.GeneratorSettingsDefault;
|
||||
import net.minecraft.server.StructureSettings;
|
||||
import net.minecraft.server.WorldChunkManager;
|
||||
|
||||
// Do not implement functions to this class, add to NormalChunkGenerator
|
||||
public abstract class InternalChunkGenerator<C extends GeneratorSettingsDefault> extends net.minecraft.server.ChunkGenerator<C> {
|
||||
public abstract class InternalChunkGenerator extends net.minecraft.server.ChunkGenerator {
|
||||
|
||||
public InternalChunkGenerator(GeneratorAccess generatorAccess, WorldChunkManager worldChunkManager, C c0) {
|
||||
super(generatorAccess, worldChunkManager, c0);
|
||||
public InternalChunkGenerator(WorldChunkManager worldchunkmanager, StructureSettings structuresettings) {
|
||||
super(worldchunkmanager, structuresettings);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.server.ContainerLoom;
|
||||
import net.minecraft.server.ContainerMerchant;
|
||||
import net.minecraft.server.ContainerProperties;
|
||||
import net.minecraft.server.ContainerShulkerBox;
|
||||
import net.minecraft.server.ContainerSmithing;
|
||||
import net.minecraft.server.ContainerSmoker;
|
||||
import net.minecraft.server.ContainerStonecutter;
|
||||
import net.minecraft.server.ContainerWorkbench;
|
||||
@@ -157,6 +158,8 @@ public class CraftContainer extends Container {
|
||||
return Containers.BEACON;
|
||||
case ANVIL:
|
||||
return Containers.ANVIL;
|
||||
case SMITHING:
|
||||
return Containers.SMITHING;
|
||||
case HOPPER:
|
||||
return Containers.HOPPER;
|
||||
case DROPPER:
|
||||
@@ -221,6 +224,9 @@ public class CraftContainer extends Container {
|
||||
case ANVIL:
|
||||
delegate = new ContainerAnvil(windowId, bottom);
|
||||
break;
|
||||
case SMITHING:
|
||||
delegate = new ContainerSmithing(windowId, bottom);
|
||||
break;
|
||||
case BEACON:
|
||||
delegate = new ContainerBeacon(windowId, bottom);
|
||||
break;
|
||||
|
||||
@@ -473,6 +473,8 @@ public class CraftInventory implements Inventory {
|
||||
return InventoryType.BEACON;
|
||||
} else if (this instanceof CraftInventoryAnvil) {
|
||||
return InventoryType.ANVIL;
|
||||
} else if (this instanceof CraftInventorySmithing) {
|
||||
return InventoryType.SMITHING;
|
||||
} else if (inventory instanceof IHopper) {
|
||||
return InventoryType.HOPPER;
|
||||
} else if (inventory instanceof TileEntityShulkerBox) {
|
||||
|
||||
@@ -105,7 +105,7 @@ public class CraftInventoryCrafting extends CraftInventory implements CraftingIn
|
||||
if (i < contents.length) {
|
||||
getMatrixInventory().setItem(i, CraftItemStack.asNMSCopy(contents[i]));
|
||||
} else {
|
||||
getMatrixInventory().setItem(i, net.minecraft.server.ItemStack.a);
|
||||
getMatrixInventory().setItem(i, net.minecraft.server.ItemStack.b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class CraftInventoryCustom extends CraftInventory {
|
||||
|
||||
public MinecraftInventory(InventoryHolder owner, int size, String title) {
|
||||
Validate.notNull(title, "Title cannot be null");
|
||||
this.items = NonNullList.a(size, ItemStack.a);
|
||||
this.items = NonNullList.a(size, ItemStack.b);
|
||||
this.title = title;
|
||||
this.viewers = new ArrayList<HumanEntity>();
|
||||
this.owner = owner;
|
||||
@@ -76,9 +76,9 @@ public class CraftInventoryCustom extends CraftInventory {
|
||||
public ItemStack splitStack(int i, int j) {
|
||||
ItemStack stack = this.getItem(i);
|
||||
ItemStack result;
|
||||
if (stack == ItemStack.a) return stack;
|
||||
if (stack == ItemStack.b) return stack;
|
||||
if (stack.getCount() <= j) {
|
||||
this.setItem(i, ItemStack.a);
|
||||
this.setItem(i, ItemStack.b);
|
||||
result = stack;
|
||||
} else {
|
||||
result = CraftItemStack.copyNMSStack(stack, j);
|
||||
@@ -92,7 +92,7 @@ public class CraftInventoryCustom extends CraftInventory {
|
||||
public ItemStack splitWithoutUpdate(int i) {
|
||||
ItemStack stack = this.getItem(i);
|
||||
ItemStack result;
|
||||
if (stack == ItemStack.a) return stack;
|
||||
if (stack == ItemStack.b) return stack;
|
||||
if (stack.getCount() <= 1) {
|
||||
this.setItem(i, null);
|
||||
result = stack;
|
||||
@@ -106,7 +106,7 @@ public class CraftInventoryCustom extends CraftInventory {
|
||||
@Override
|
||||
public void setItem(int i, ItemStack itemstack) {
|
||||
items.set(i, itemstack);
|
||||
if (itemstack != ItemStack.a && this.getMaxStackSize() > 0 && itemstack.getCount() > this.getMaxStackSize()) {
|
||||
if (itemstack != ItemStack.b && this.getMaxStackSize() > 0 && itemstack.getCount() > this.getMaxStackSize()) {
|
||||
itemstack.setCount(this.getMaxStackSize());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.bukkit.craftbukkit.inventory;
|
||||
|
||||
import net.minecraft.server.IInventory;
|
||||
import org.bukkit.inventory.SmithingInventory;
|
||||
|
||||
public class CraftInventorySmithing extends CraftResultInventory implements SmithingInventory {
|
||||
|
||||
public CraftInventorySmithing(IInventory inventory, IInventory resultInventory) {
|
||||
super(inventory, resultInventory);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.bukkit.craftbukkit.inventory;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.util.Collection;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
@@ -13,27 +11,11 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public final class CraftItemFactory implements ItemFactory {
|
||||
static final Color DEFAULT_LEATHER_COLOR = Color.fromRGB(0xA06540);
|
||||
static final Collection<String> KNOWN_NBT_ATTRIBUTE_NAMES;
|
||||
private static final CraftItemFactory instance;
|
||||
|
||||
static {
|
||||
instance = new CraftItemFactory();
|
||||
ConfigurationSerialization.registerClass(CraftMetaItem.SerializableMeta.class);
|
||||
KNOWN_NBT_ATTRIBUTE_NAMES = ImmutableSet.<String>builder()
|
||||
.add("generic.armor")
|
||||
.add("generic.armorToughness")
|
||||
.add("generic.attackDamage")
|
||||
.add("generic.followRange")
|
||||
.add("generic.knockbackResistance")
|
||||
.add("generic.maxHealth")
|
||||
.add("generic.movementSpeed")
|
||||
.add("generic.flyingSpeed")
|
||||
.add("generic.attackSpeed")
|
||||
.add("generic.luck")
|
||||
.add("horse.jumpStrength")
|
||||
.add("zombie.spawnReinforcements")
|
||||
.add("generic.attackKnockback")
|
||||
.build();
|
||||
}
|
||||
|
||||
private CraftItemFactory() {
|
||||
@@ -159,6 +141,7 @@ public final class CraftItemFactory implements ItemFactory {
|
||||
case FOX_SPAWN_EGG:
|
||||
case GHAST_SPAWN_EGG:
|
||||
case GUARDIAN_SPAWN_EGG:
|
||||
case HOGLIN_SPAWN_EGG:
|
||||
case HORSE_SPAWN_EGG:
|
||||
case HUSK_SPAWN_EGG:
|
||||
case LLAMA_SPAWN_EGG:
|
||||
@@ -169,6 +152,7 @@ public final class CraftItemFactory implements ItemFactory {
|
||||
case PANDA_SPAWN_EGG:
|
||||
case PARROT_SPAWN_EGG:
|
||||
case PHANTOM_SPAWN_EGG:
|
||||
case PIGLIN_SPAWN_EGG:
|
||||
case PIG_SPAWN_EGG:
|
||||
case PILLAGER_SPAWN_EGG:
|
||||
case POLAR_BEAR_SPAWN_EGG:
|
||||
@@ -185,6 +169,7 @@ public final class CraftItemFactory implements ItemFactory {
|
||||
case SPIDER_SPAWN_EGG:
|
||||
case SQUID_SPAWN_EGG:
|
||||
case STRAY_SPAWN_EGG:
|
||||
case STRIDER_SPAWN_EGG:
|
||||
case TRADER_LLAMA_SPAWN_EGG:
|
||||
case TROPICAL_FISH_SPAWN_EGG:
|
||||
case TURTLE_SPAWN_EGG:
|
||||
@@ -195,10 +180,11 @@ public final class CraftItemFactory implements ItemFactory {
|
||||
case WITCH_SPAWN_EGG:
|
||||
case WITHER_SKELETON_SPAWN_EGG:
|
||||
case WOLF_SPAWN_EGG:
|
||||
case ZOGLIN_SPAWN_EGG:
|
||||
case ZOMBIE_HORSE_SPAWN_EGG:
|
||||
case ZOMBIE_PIGMAN_SPAWN_EGG:
|
||||
case ZOMBIE_SPAWN_EGG:
|
||||
case ZOMBIE_VILLAGER_SPAWN_EGG:
|
||||
case ZOMBIFIED_PIGLIN_SPAWN_EGG:
|
||||
return meta instanceof CraftMetaSpawnEgg ? meta : new CraftMetaSpawnEgg(meta);
|
||||
case ARMOR_STAND:
|
||||
return meta instanceof CraftMetaArmorStand ? meta : new CraftMetaArmorStand(meta);
|
||||
|
||||
@@ -25,16 +25,16 @@ public final class CraftItemStack extends ItemStack {
|
||||
public static net.minecraft.server.ItemStack asNMSCopy(ItemStack original) {
|
||||
if (original instanceof CraftItemStack) {
|
||||
CraftItemStack stack = (CraftItemStack) original;
|
||||
return stack.handle == null ? net.minecraft.server.ItemStack.a : stack.handle.cloneItemStack();
|
||||
return stack.handle == null ? net.minecraft.server.ItemStack.b : stack.handle.cloneItemStack();
|
||||
}
|
||||
if (original == null || original.getType() == Material.AIR) {
|
||||
return net.minecraft.server.ItemStack.a;
|
||||
return net.minecraft.server.ItemStack.b;
|
||||
}
|
||||
|
||||
Item item = CraftMagicNumbers.getItem(original.getType(), original.getDurability());
|
||||
|
||||
if (item == null) {
|
||||
return net.minecraft.server.ItemStack.a;
|
||||
return net.minecraft.server.ItemStack.b;
|
||||
}
|
||||
|
||||
net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(item, original.getAmount());
|
||||
@@ -410,6 +410,7 @@ public final class CraftItemStack extends ItemStack {
|
||||
case FOX_SPAWN_EGG:
|
||||
case GHAST_SPAWN_EGG:
|
||||
case GUARDIAN_SPAWN_EGG:
|
||||
case HOGLIN_SPAWN_EGG:
|
||||
case HORSE_SPAWN_EGG:
|
||||
case HUSK_SPAWN_EGG:
|
||||
case LLAMA_SPAWN_EGG:
|
||||
@@ -420,6 +421,7 @@ public final class CraftItemStack extends ItemStack {
|
||||
case PANDA_SPAWN_EGG:
|
||||
case PARROT_SPAWN_EGG:
|
||||
case PHANTOM_SPAWN_EGG:
|
||||
case PIGLIN_SPAWN_EGG:
|
||||
case PIG_SPAWN_EGG:
|
||||
case PILLAGER_SPAWN_EGG:
|
||||
case POLAR_BEAR_SPAWN_EGG:
|
||||
@@ -436,6 +438,7 @@ public final class CraftItemStack extends ItemStack {
|
||||
case SPIDER_SPAWN_EGG:
|
||||
case SQUID_SPAWN_EGG:
|
||||
case STRAY_SPAWN_EGG:
|
||||
case STRIDER_SPAWN_EGG:
|
||||
case TRADER_LLAMA_SPAWN_EGG:
|
||||
case TROPICAL_FISH_SPAWN_EGG:
|
||||
case TURTLE_SPAWN_EGG:
|
||||
@@ -446,10 +449,11 @@ public final class CraftItemStack extends ItemStack {
|
||||
case WITCH_SPAWN_EGG:
|
||||
case WITHER_SKELETON_SPAWN_EGG:
|
||||
case WOLF_SPAWN_EGG:
|
||||
case ZOGLIN_SPAWN_EGG:
|
||||
case ZOMBIE_HORSE_SPAWN_EGG:
|
||||
case ZOMBIE_PIGMAN_SPAWN_EGG:
|
||||
case ZOMBIE_SPAWN_EGG:
|
||||
case ZOMBIE_VILLAGER_SPAWN_EGG:
|
||||
case ZOMBIFIED_PIGLIN_SPAWN_EGG:
|
||||
return new CraftMetaSpawnEgg(item.getTag());
|
||||
case ARMOR_STAND:
|
||||
return new CraftMetaArmorStand(item.getTag());
|
||||
|
||||
@@ -72,7 +72,7 @@ public class CraftMerchantCustom extends CraftMerchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void i(ItemStack itemstack) {
|
||||
public void k(ItemStack itemstack) {
|
||||
}
|
||||
|
||||
public IChatBaseComponent getScoreboardDisplayName() {
|
||||
@@ -90,7 +90,7 @@ public class CraftMerchantCustom extends CraftMerchant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExperience(int i) {
|
||||
public void setForcedExperience(int i) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,8 @@ public class CraftMerchantRecipe extends MerchantRecipe {
|
||||
public CraftMerchantRecipe(ItemStack result, int uses, int maxUses, boolean experienceReward, int experience, float priceMultiplier) {
|
||||
super(result, uses, maxUses, experienceReward, experience, priceMultiplier);
|
||||
this.handle = new net.minecraft.server.MerchantRecipe(
|
||||
net.minecraft.server.ItemStack.a,
|
||||
net.minecraft.server.ItemStack.a,
|
||||
net.minecraft.server.ItemStack.b,
|
||||
net.minecraft.server.ItemStack.b,
|
||||
CraftItemStack.asNMSCopy(result),
|
||||
uses,
|
||||
maxUses,
|
||||
|
||||
@@ -293,7 +293,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
|
||||
break;
|
||||
}
|
||||
}
|
||||
TileEntity te = (blockEntityTag == null) ? null : TileEntity.create(blockEntityTag);
|
||||
TileEntity te = (blockEntityTag == null) ? null : TileEntity.create(CraftMagicNumbers.getBlock(material).getBlockData(), blockEntityTag);
|
||||
|
||||
switch (material) {
|
||||
case ACACIA_SIGN:
|
||||
|
||||
@@ -38,7 +38,6 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.server.ChatComponentText;
|
||||
import net.minecraft.server.EnumItemSlot;
|
||||
import net.minecraft.server.GenericAttributes;
|
||||
import net.minecraft.server.IChatBaseComponent;
|
||||
import net.minecraft.server.ItemBlock;
|
||||
import net.minecraft.server.NBTBase;
|
||||
@@ -429,7 +428,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
// entry is not an actual NBTTagCompound. getCompound returns empty NBTTagCompound in that case
|
||||
continue;
|
||||
}
|
||||
net.minecraft.server.AttributeModifier nmsModifier = GenericAttributes.a(entry);
|
||||
net.minecraft.server.AttributeModifier nmsModifier = net.minecraft.server.AttributeModifier.a(entry);
|
||||
if (nmsModifier == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -710,12 +709,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
continue;
|
||||
}
|
||||
net.minecraft.server.AttributeModifier nmsModifier = CraftAttributeInstance.convert(entry.getValue());
|
||||
NBTTagCompound sub = GenericAttributes.a(nmsModifier);
|
||||
NBTTagCompound sub = nmsModifier.save();
|
||||
if (sub.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = CraftAttributeMap.toMinecraft(entry.getKey());
|
||||
String name = entry.getKey().getKey().toString();
|
||||
if (name == null || name.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||
case FOX_SPAWN_EGG:
|
||||
case GHAST_SPAWN_EGG:
|
||||
case GUARDIAN_SPAWN_EGG:
|
||||
case HOGLIN_SPAWN_EGG:
|
||||
case HORSE_SPAWN_EGG:
|
||||
case HUSK_SPAWN_EGG:
|
||||
case LLAMA_SPAWN_EGG:
|
||||
@@ -139,6 +140,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||
case PANDA_SPAWN_EGG:
|
||||
case PARROT_SPAWN_EGG:
|
||||
case PHANTOM_SPAWN_EGG:
|
||||
case PIGLIN_SPAWN_EGG:
|
||||
case PIG_SPAWN_EGG:
|
||||
case PILLAGER_SPAWN_EGG:
|
||||
case POLAR_BEAR_SPAWN_EGG:
|
||||
@@ -155,6 +157,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||
case SPIDER_SPAWN_EGG:
|
||||
case SQUID_SPAWN_EGG:
|
||||
case STRAY_SPAWN_EGG:
|
||||
case STRIDER_SPAWN_EGG:
|
||||
case TRADER_LLAMA_SPAWN_EGG:
|
||||
case TROPICAL_FISH_SPAWN_EGG:
|
||||
case TURTLE_SPAWN_EGG:
|
||||
@@ -165,10 +168,11 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||
case WITCH_SPAWN_EGG:
|
||||
case WITHER_SKELETON_SPAWN_EGG:
|
||||
case WOLF_SPAWN_EGG:
|
||||
case ZOGLIN_SPAWN_EGG:
|
||||
case ZOMBIE_HORSE_SPAWN_EGG:
|
||||
case ZOMBIE_PIGMAN_SPAWN_EGG:
|
||||
case ZOMBIE_SPAWN_EGG:
|
||||
case ZOMBIE_VILLAGER_SPAWN_EGG:
|
||||
case ZOMBIFIED_PIGLIN_SPAWN_EGG:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -25,6 +25,7 @@ public final class CraftInventoryCreator {
|
||||
converterMap.put(InventoryType.MERCHANT, DEFAULT_CONVERTER);
|
||||
converterMap.put(InventoryType.ENDER_CHEST, DEFAULT_CONVERTER);
|
||||
converterMap.put(InventoryType.ANVIL, DEFAULT_CONVERTER);
|
||||
converterMap.put(InventoryType.SMITHING, DEFAULT_CONVERTER);
|
||||
converterMap.put(InventoryType.BEACON, DEFAULT_CONVERTER);
|
||||
converterMap.put(InventoryType.HOPPER, new CraftTileInventoryConverter.Hopper());
|
||||
converterMap.put(InventoryType.SHULKER_BOX, DEFAULT_CONVERTER);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.bukkit.craftbukkit.inventory.util;
|
||||
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.DimensionManager;
|
||||
import net.minecraft.server.IInventory;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.TileEntityBlastFurnace;
|
||||
@@ -14,6 +13,7 @@ import net.minecraft.server.TileEntityHopper;
|
||||
import net.minecraft.server.TileEntityLectern;
|
||||
import net.minecraft.server.TileEntityLootable;
|
||||
import net.minecraft.server.TileEntitySmoker;
|
||||
import net.minecraft.server.World;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
|
||||
@@ -50,7 +50,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
|
||||
@Override
|
||||
public IInventory getTileEntity() {
|
||||
TileEntityFurnace furnace = new TileEntityFurnaceFurnace();
|
||||
furnace.setLocation(MinecraftServer.getServer().getWorldServer(DimensionManager.OVERWORLD), BlockPosition.ZERO); // TODO: customize this if required
|
||||
furnace.setLocation(MinecraftServer.getServer().getWorldServer(World.OVERWORLD), BlockPosition.ZERO); // TODO: customize this if required
|
||||
return furnace;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.bukkit.craftbukkit.legacy;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.mojang.datafixers.Dynamic;
|
||||
import com.mojang.serialization.Dynamic;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -309,7 +309,7 @@ public final class CraftLegacy {
|
||||
SPAWN_EGGS.put((byte) EntityType.WOLF.getTypeId(), Material.WOLF_SPAWN_EGG);
|
||||
SPAWN_EGGS.put((byte) EntityType.ZOMBIE.getTypeId(), Material.ZOMBIE_SPAWN_EGG);
|
||||
SPAWN_EGGS.put((byte) EntityType.ZOMBIE_HORSE.getTypeId(), Material.ZOMBIE_HORSE_SPAWN_EGG);
|
||||
SPAWN_EGGS.put((byte) EntityType.PIG_ZOMBIE.getTypeId(), Material.ZOMBIE_PIGMAN_SPAWN_EGG);
|
||||
SPAWN_EGGS.put((byte) EntityType.ZOMBIFIED_PIGLIN.getTypeId(), Material.ZOMBIFIED_PIGLIN_SPAWN_EGG);
|
||||
SPAWN_EGGS.put((byte) EntityType.ZOMBIE_VILLAGER.getTypeId(), Material.ZOMBIE_VILLAGER_SPAWN_EGG);
|
||||
|
||||
DispenserRegistry.init();
|
||||
@@ -338,7 +338,7 @@ public final class CraftLegacy {
|
||||
IBlockData blockData = block.getBlockData();
|
||||
BlockStateList states = block.getStates();
|
||||
|
||||
Optional<NBTTagCompound> propMap = blockTag.getElement("Properties");
|
||||
Optional<NBTTagCompound> propMap = blockTag.getElement("Properties").result();
|
||||
if (propMap.isPresent()) {
|
||||
NBTTagCompound properties = propMap.get();
|
||||
for (String dataKey : properties.getKeys()) {
|
||||
|
||||
@@ -6,8 +6,8 @@ import java.util.HashMap;
|
||||
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.ResourceKey;
|
||||
import net.minecraft.server.WorldMap;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -60,7 +60,7 @@ public final class CraftMapView implements MapView {
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
DimensionManager dimension = worldMap.map;
|
||||
ResourceKey<net.minecraft.server.World> dimension = worldMap.map;
|
||||
WorldServer world = MinecraftServer.getServer().getWorldServer(dimension);
|
||||
|
||||
return (world == null) ? null : world.getWorld();
|
||||
@@ -68,7 +68,7 @@ public final class CraftMapView implements MapView {
|
||||
|
||||
@Override
|
||||
public void setWorld(World world) {
|
||||
worldMap.map = ((CraftWorld) world).getHandle().getWorldProvider().getDimensionManager();
|
||||
worldMap.map = ((CraftWorld) world).getHandle().getDimensionKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,6 @@ public class CraftBlockTag extends CraftTag<Block, Material> {
|
||||
|
||||
@Override
|
||||
public Set<Material> getValues() {
|
||||
return Collections.unmodifiableSet(getHandle().a().stream().map((block) -> CraftMagicNumbers.getMaterial(block)).collect(Collectors.toSet()));
|
||||
return Collections.unmodifiableSet(getHandle().getTagged().stream().map((block) -> CraftMagicNumbers.getMaterial(block)).collect(Collectors.toSet()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,6 @@ public class CraftItemTag extends CraftTag<Item, Material> {
|
||||
|
||||
@Override
|
||||
public Set<Material> getValues() {
|
||||
return Collections.unmodifiableSet(getHandle().a().stream().map((item) -> CraftMagicNumbers.getMaterial(item)).collect(Collectors.toSet()));
|
||||
return Collections.unmodifiableSet(getHandle().getTagged().stream().map((item) -> CraftMagicNumbers.getMaterial(item)).collect(Collectors.toSet()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class Commodore
|
||||
ClassReader cr = new ClassReader( b );
|
||||
ClassWriter cw = new ClassWriter( cr, 0 );
|
||||
|
||||
cr.accept( new ClassVisitor( Opcodes.ASM7, cw )
|
||||
cr.accept( new ClassVisitor( Opcodes.ASM8, cw )
|
||||
{
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)
|
||||
@@ -160,6 +160,9 @@ public class Commodore
|
||||
case "WALL_SIGN":
|
||||
name = "OAK_WALL_SIGN";
|
||||
break;
|
||||
case "ZOMBIE_PIGMAN_SPAWN_EGG":
|
||||
name = "ZOMBIFIED_PIGLIN_SPAWN_EGG";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,6 +219,26 @@ public class Commodore
|
||||
}
|
||||
}
|
||||
|
||||
if ( owner.equals( "org/bukkit/block/Biome" ) )
|
||||
{
|
||||
switch ( name )
|
||||
{
|
||||
case "NETHER":
|
||||
super.visitFieldInsn( opcode, owner, "NETHER_WASTES", desc );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( owner.equals( "org/bukkit/entity/EntityType" ) )
|
||||
{
|
||||
switch ( name )
|
||||
{
|
||||
case "PIG_ZOMBIE":
|
||||
super.visitFieldInsn( opcode, owner, "ZOMBIFIED_PIGLIN", desc );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
super.visitFieldInsn( opcode, owner, name, desc );
|
||||
}
|
||||
|
||||
|
||||
@@ -5,15 +5,18 @@ import com.google.common.collect.ImmutableMap.Builder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import net.minecraft.server.ChatClickable;
|
||||
import net.minecraft.server.ChatClickable.EnumClickAction;
|
||||
import net.minecraft.server.ChatComponentText;
|
||||
import net.minecraft.server.ChatHexColor;
|
||||
import net.minecraft.server.ChatMessage;
|
||||
import net.minecraft.server.ChatModifier;
|
||||
import net.minecraft.server.EnumChatFormat;
|
||||
import net.minecraft.server.IChatBaseComponent;
|
||||
import net.minecraft.server.IChatMutableComponent;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public final class CraftChatMessage {
|
||||
@@ -38,15 +41,16 @@ public final class CraftChatMessage {
|
||||
}
|
||||
|
||||
private static final class StringMessage {
|
||||
private static final Pattern INCREMENTAL_PATTERN = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-or])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " \\n]|$))))|(\\n)", Pattern.CASE_INSENSITIVE);
|
||||
private static final Pattern INCREMENTAL_PATTERN = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-orx])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " \\n]|$))))|(\\n)", Pattern.CASE_INSENSITIVE);
|
||||
// Separate pattern with no group 3, new lines are part of previous string
|
||||
private static final Pattern INCREMENTAL_PATTERN_KEEP_NEWLINES = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-or])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " ]|$))))", Pattern.CASE_INSENSITIVE);
|
||||
private static final Pattern INCREMENTAL_PATTERN_KEEP_NEWLINES = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-orx])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " ]|$))))", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
private final List<IChatBaseComponent> list = new ArrayList<IChatBaseComponent>();
|
||||
private IChatBaseComponent currentChatComponent = new ChatComponentText("");
|
||||
private ChatModifier modifier = new ChatModifier();
|
||||
private IChatMutableComponent currentChatComponent = new ChatComponentText("");
|
||||
private ChatModifier modifier = ChatModifier.b;
|
||||
private final IChatBaseComponent[] output;
|
||||
private int currentIndex;
|
||||
private StringBuilder hex;
|
||||
private final String message;
|
||||
|
||||
private StringMessage(String message, boolean keepNewlines) {
|
||||
@@ -72,29 +76,40 @@ public final class CraftChatMessage {
|
||||
}
|
||||
switch (groupId) {
|
||||
case 1:
|
||||
EnumChatFormat format = formatMap.get(match.toLowerCase(java.util.Locale.ENGLISH).charAt(1));
|
||||
if (format.isFormat() && format != EnumChatFormat.RESET) {
|
||||
char c = match.toLowerCase(java.util.Locale.ENGLISH).charAt(1);
|
||||
EnumChatFormat format = formatMap.get(c);
|
||||
|
||||
if (c == 'x') {
|
||||
hex = new StringBuilder("#");
|
||||
} else if (hex != null) {
|
||||
hex.append(c);
|
||||
|
||||
if (hex.length() == 7) {
|
||||
modifier = modifier.setColor(ChatHexColor.a(hex.toString()));
|
||||
hex = null;
|
||||
}
|
||||
} else if (format.isFormat() && format != EnumChatFormat.RESET) {
|
||||
switch (format) {
|
||||
case BOLD:
|
||||
modifier.setBold(Boolean.TRUE);
|
||||
modifier = modifier.setBold(Boolean.TRUE);
|
||||
break;
|
||||
case ITALIC:
|
||||
modifier.setItalic(Boolean.TRUE);
|
||||
modifier = modifier.setItalic(Boolean.TRUE);
|
||||
break;
|
||||
case STRIKETHROUGH:
|
||||
modifier.setStrikethrough(Boolean.TRUE);
|
||||
modifier = modifier.setStrikethrough(Boolean.TRUE);
|
||||
break;
|
||||
case UNDERLINE:
|
||||
modifier.setUnderline(Boolean.TRUE);
|
||||
modifier = modifier.setUnderline(Boolean.TRUE);
|
||||
break;
|
||||
case OBFUSCATED:
|
||||
modifier.setRandom(Boolean.TRUE);
|
||||
modifier = modifier.setRandom(Boolean.TRUE);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError("Unexpected message format");
|
||||
}
|
||||
} else { // Color resets formatting
|
||||
modifier = new ChatModifier().setColor(format);
|
||||
modifier = ChatModifier.b.setColor(format);
|
||||
}
|
||||
needsAdd = true;
|
||||
break;
|
||||
@@ -102,9 +117,9 @@ public final class CraftChatMessage {
|
||||
if (!(match.startsWith("http://") || match.startsWith("https://"))) {
|
||||
match = "http://" + match;
|
||||
}
|
||||
modifier.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match));
|
||||
modifier = modifier.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match));
|
||||
appendNewComponent(matcher.end(groupId));
|
||||
modifier.setChatClickable((ChatClickable) null);
|
||||
modifier = modifier.setChatClickable((ChatClickable) null);
|
||||
break;
|
||||
case 3:
|
||||
if (needsAdd) {
|
||||
@@ -126,10 +141,6 @@ public final class CraftChatMessage {
|
||||
private void appendNewComponent(int index) {
|
||||
IChatBaseComponent addition = new ChatComponentText(message.substring(currentIndex, index)).setChatModifier(modifier);
|
||||
currentIndex = index;
|
||||
modifier = modifier.clone();
|
||||
if (modifier.getColor() == EnumChatFormat.RESET) {
|
||||
modifier.setColor(null);
|
||||
}
|
||||
if (currentChatComponent == null) {
|
||||
currentChatComponent = new ChatComponentText("");
|
||||
list.add(currentChatComponent);
|
||||
@@ -177,13 +188,18 @@ public final class CraftChatMessage {
|
||||
boolean hadFormat = false;
|
||||
for (IChatBaseComponent c : component) {
|
||||
ChatModifier modi = c.getChatModifier();
|
||||
EnumChatFormat color = modi.getColor();
|
||||
ChatHexColor color = modi.getColor();
|
||||
if (!c.getText().isEmpty() || color != null) {
|
||||
if (color != null) {
|
||||
out.append(color);
|
||||
if (color != EnumChatFormat.RESET) {
|
||||
hadFormat = true;
|
||||
if (color.format != null) {
|
||||
out.append(color.format);
|
||||
} else {
|
||||
out.append(ChatColor.COLOR_CHAR).append("x");
|
||||
for (char magic : color.b().substring(1).toCharArray()) {
|
||||
out.append(ChatColor.COLOR_CHAR).append(magic);
|
||||
}
|
||||
}
|
||||
hadFormat = true;
|
||||
} else if (hadFormat) {
|
||||
out.append(ChatColor.RESET);
|
||||
hadFormat = false;
|
||||
@@ -191,20 +207,28 @@ public final class CraftChatMessage {
|
||||
}
|
||||
if (modi.isBold()) {
|
||||
out.append(EnumChatFormat.BOLD);
|
||||
hadFormat = true;
|
||||
}
|
||||
if (modi.isItalic()) {
|
||||
out.append(EnumChatFormat.ITALIC);
|
||||
hadFormat = true;
|
||||
}
|
||||
if (modi.isUnderlined()) {
|
||||
out.append(EnumChatFormat.UNDERLINE);
|
||||
hadFormat = true;
|
||||
}
|
||||
if (modi.isStrikethrough()) {
|
||||
out.append(EnumChatFormat.STRIKETHROUGH);
|
||||
hadFormat = true;
|
||||
}
|
||||
if (modi.isRandom()) {
|
||||
out.append(EnumChatFormat.OBFUSCATED);
|
||||
hadFormat = true;
|
||||
}
|
||||
out.append(c.getText());
|
||||
c.b((x) -> {
|
||||
out.append(x);
|
||||
return Optional.empty();
|
||||
});
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
@@ -221,7 +245,7 @@ public final class CraftChatMessage {
|
||||
if (matcher.reset(msg).find()) {
|
||||
matcher.reset();
|
||||
|
||||
ChatModifier modifier = text.getChatModifier() != null ? text.getChatModifier() : new ChatModifier();
|
||||
ChatModifier modifier = text.getChatModifier();
|
||||
List<IChatBaseComponent> extras = new ArrayList<IChatBaseComponent>();
|
||||
List<IChatBaseComponent> extrasOld = new ArrayList<IChatBaseComponent>(text.getSiblings());
|
||||
component = text = new ChatComponentText("");
|
||||
@@ -239,8 +263,7 @@ public final class CraftChatMessage {
|
||||
extras.add(prev);
|
||||
|
||||
ChatComponentText link = new ChatComponentText(matcher.group());
|
||||
ChatModifier linkModi = modifier.clone();
|
||||
linkModi.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match));
|
||||
ChatModifier linkModi = modifier.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match));
|
||||
link.setChatModifier(linkModi);
|
||||
extras.add(link);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.io.Files;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.datafixers.Dynamic;
|
||||
import com.mojang.serialization.Dynamic;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
@@ -197,7 +197,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
* @return string
|
||||
*/
|
||||
public String getMappingsVersion() {
|
||||
return "5684afcc1835d966e1b6eb0ed3f72edb";
|
||||
return "25afc67716a170ea965092c1067ff439";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -256,7 +256,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
return file.delete();
|
||||
}
|
||||
|
||||
private static final List<String> SUPPORTED_API = Arrays.asList("1.13", "1.14", "1.15");
|
||||
private static final List<String> SUPPORTED_API = Arrays.asList("1.13", "1.14", "1.15", "1.16");
|
||||
|
||||
@Override
|
||||
public void checkSupported(PluginDescriptionFile pdf) throws InvalidPluginException {
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.server.Block;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.ChunkStatus;
|
||||
import net.minecraft.server.DifficultyDamageScaler;
|
||||
import net.minecraft.server.DimensionManager;
|
||||
import net.minecraft.server.Entity;
|
||||
import net.minecraft.server.EntityHuman;
|
||||
import net.minecraft.server.Fluid;
|
||||
@@ -28,7 +29,6 @@ import net.minecraft.server.TileEntity;
|
||||
import net.minecraft.server.World;
|
||||
import net.minecraft.server.WorldBorder;
|
||||
import net.minecraft.server.WorldData;
|
||||
import net.minecraft.server.WorldProvider;
|
||||
|
||||
public class DummyGeneratorAccess implements GeneratorAccess {
|
||||
|
||||
@@ -37,11 +37,6 @@ public class DummyGeneratorAccess implements GeneratorAccess {
|
||||
protected DummyGeneratorAccess() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSeed() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickList<Block> getBlockTickList() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -77,11 +72,6 @@ public class DummyGeneratorAccess implements GeneratorAccess {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(BlockPosition bp, Block block) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(EntityHuman eh, BlockPosition bp, SoundEffect se, SoundCategory sc, float f, float f1) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -138,7 +128,7 @@ public class DummyGeneratorAccess implements GeneratorAccess {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean p_() {
|
||||
public boolean s_() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@@ -148,7 +138,7 @@ public class DummyGeneratorAccess implements GeneratorAccess {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldProvider getWorldProvider() {
|
||||
public DimensionManager getDimensionManager() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@@ -183,7 +173,7 @@ public class DummyGeneratorAccess implements GeneratorAccess {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
|
||||
public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -193,7 +183,7 @@ public class DummyGeneratorAccess implements GeneratorAccess {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(BlockPosition blockposition, boolean flag, Entity entity) {
|
||||
public boolean a(BlockPosition blockposition, boolean flag, Entity entity, int i) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.bukkit.craftbukkit.util;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public final class WorldUUID {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
private WorldUUID() {
|
||||
}
|
||||
|
||||
public static UUID getUUID(File baseDir) {
|
||||
File file1 = new File(baseDir, "uid.dat");
|
||||
if (file1.exists()) {
|
||||
DataInputStream dis = null;
|
||||
try {
|
||||
dis = new DataInputStream(new FileInputStream(file1));
|
||||
return new UUID(dis.readLong(), dis.readLong());
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to read " + file1 + ", generating new random UUID", ex);
|
||||
} finally {
|
||||
if (dis != null) {
|
||||
try {
|
||||
dis.close();
|
||||
} catch (IOException ex) {
|
||||
// NOOP
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UUID uuid = UUID.randomUUID();
|
||||
DataOutputStream dos = null;
|
||||
try {
|
||||
dos = new DataOutputStream(new FileOutputStream(file1));
|
||||
dos.writeLong(uuid.getMostSignificantBits());
|
||||
dos.writeLong(uuid.getLeastSignificantBits());
|
||||
} catch (IOException ex) {
|
||||
LOGGER.warn("Failed to write " + file1, ex);
|
||||
} finally {
|
||||
if (dos != null) {
|
||||
try {
|
||||
dos.close();
|
||||
} catch (IOException ex) {
|
||||
// NOOP
|
||||
}
|
||||
}
|
||||
}
|
||||
return uuid;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user