Update to Minecraft 1.17

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-06-11 15:00:00 +10:00
parent 75faba7fde
commit b3a8254758
619 changed files with 10708 additions and 8451 deletions

View File

@@ -19,13 +19,16 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.chunk.BiomeStorage;
import net.minecraft.world.level.chunk.ChunkSection;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.DataPaletteBlock;
import net.minecraft.world.level.chunk.IChunkAccess;
import net.minecraft.world.level.chunk.NibbleArray;
import net.minecraft.world.level.levelgen.HeightMap;
import net.minecraft.world.level.levelgen.SeededRandom;
import net.minecraft.world.level.lighting.LightEngine;
import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
@@ -48,7 +51,7 @@ public class CraftChunk implements Chunk {
public CraftChunk(net.minecraft.world.level.chunk.Chunk chunk) {
this.weakChunk = new WeakReference<net.minecraft.world.level.chunk.Chunk>(chunk);
worldServer = (WorldServer) getHandle().world;
worldServer = (WorldServer) getHandle().level;
x = getHandle().getPos().x;
z = getHandle().getPos().z;
}
@@ -95,7 +98,7 @@ public class CraftChunk implements Chunk {
@Override
public Block getBlock(int x, int y, int z) {
validateChunkCoordinates(x, y, z);
validateChunkCoordinates(getHandle().getMinBuildHeight(), getHandle().getMaxBuildHeight(), x, y, z);
return new CraftBlock(worldServer, new BlockPosition((this.x << 4) | x, y, (this.z << 4) | z));
}
@@ -105,27 +108,12 @@ public class CraftChunk implements Chunk {
if (!isLoaded()) {
getWorld().getChunkAt(x, z); // Transient load for this tick
}
int count = 0, index = 0;
net.minecraft.world.level.chunk.Chunk chunk = getHandle();
for (int i = 0; i < 16; i++) {
count += chunk.entitySlices[i].size();
}
Entity[] entities = new Entity[count];
for (int i = 0; i < 16; i++) {
for (Object obj : chunk.entitySlices[i].toArray()) {
if (!(obj instanceof net.minecraft.world.entity.Entity)) {
continue;
}
entities[index++] = ((net.minecraft.world.entity.Entity) obj).getBukkitEntity();
}
}
return entities;
Location location = new Location(null, 0, 0, 0);
return getWorld().getEntities().stream().filter((entity) -> {
entity.getLocation(location);
return location.getBlockX() >> 4 == this.x && location.getBlockZ() >> 4 == this.z;
}).toArray(Entity[]::new);
}
@Override
@@ -136,9 +124,9 @@ public class CraftChunk implements Chunk {
int index = 0;
net.minecraft.world.level.chunk.Chunk chunk = getHandle();
BlockState[] entities = new BlockState[chunk.tileEntities.size()];
BlockState[] entities = new BlockState[chunk.blockEntities.size()];
for (Object obj : chunk.tileEntities.keySet().toArray()) {
for (Object obj : chunk.blockEntities.keySet().toArray()) {
if (!(obj instanceof BlockPosition)) {
continue;
}
@@ -257,12 +245,12 @@ 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.world.level.block.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection
DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_BLOCKSTATE_PALETTE, net.minecraft.world.level.block.Block.BLOCK_STATE_REGISTRY, 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;
LightEngine lightengine = chunk.world.getChunkProvider().getLightEngine();
LightEngine lightengine = chunk.level.getChunkProvider().getLightEngine();
NibbleArray skyLightArray = lightengine.a(EnumSkyBlock.SKY).a(SectionPosition.a(x, i, z));
if (skyLightArray == null) {
sectionSkyLights[i] = emptyLight;
@@ -283,8 +271,8 @@ public class CraftChunk implements Chunk {
HeightMap hmap = null;
if (includeMaxBlockY) {
hmap = new HeightMap(null, HeightMap.Type.MOTION_BLOCKING);
hmap.a(chunk.heightMap.get(HeightMap.Type.MOTION_BLOCKING).a());
hmap = new HeightMap(chunk, HeightMap.Type.MOTION_BLOCKING);
hmap.a(chunk, HeightMap.Type.MOTION_BLOCKING, chunk.heightmaps.get(HeightMap.Type.MOTION_BLOCKING).a());
}
BiomeStorage biome = null;
@@ -294,7 +282,7 @@ public class CraftChunk implements Chunk {
}
World world = getWorld();
return new CraftChunkSnapshot(getX(), getZ(), world.getName(), world.getFullTime(), sectionBlockIDs, sectionSkyLights, sectionEmitLights, sectionEmpty, hmap, biome);
return new CraftChunkSnapshot(getX(), getZ(), chunk.getMinBuildHeight(), chunk.getMaxBuildHeight(), world.getName(), world.getFullTime(), sectionBlockIDs, sectionSkyLights, sectionEmitLights, sectionEmpty, hmap, biome);
}
@Override
@@ -307,11 +295,12 @@ public class CraftChunk implements Chunk {
if (includeBiome || includeBiomeTempRain) {
WorldChunkManager wcm = world.getHandle().getChunkProvider().getChunkGenerator().getWorldChunkManager();
biome = new BiomeStorage(world.getHandle().r().b(IRegistry.ay), new ChunkCoordIntPair(x, z), wcm);
biome = new BiomeStorage(world.getHandle().t().d(IRegistry.BIOME_REGISTRY), world.getHandle(), new ChunkCoordIntPair(x, z), wcm);
}
IChunkAccess actual = world.getHandle().getChunkAt(x, z, ChunkStatus.EMPTY);
/* Fill with empty data */
int hSection = world.getMaxHeight() >> 4;
int hSection = actual.getSectionsCount();
DataPaletteBlock[] blockIDs = new DataPaletteBlock[hSection];
byte[][] skyLight = new byte[hSection][];
byte[][] emitLight = new byte[hSection][];
@@ -324,12 +313,12 @@ public class CraftChunk implements Chunk {
empty[i] = true;
}
return new CraftChunkSnapshot(x, z, world.getName(), world.getFullTime(), blockIDs, skyLight, emitLight, empty, new HeightMap(null, HeightMap.Type.MOTION_BLOCKING), biome);
return new CraftChunkSnapshot(x, z, world.getMinHeight(), world.getMaxHeight(), world.getName(), world.getFullTime(), blockIDs, skyLight, emitLight, empty, new HeightMap(actual, HeightMap.Type.MOTION_BLOCKING), biome);
}
static void validateChunkCoordinates(int x, int y, int z) {
static void validateChunkCoordinates(int minY, int maxY, int x, int y, int z) {
Preconditions.checkArgument(0 <= x && x <= 15, "x out of range (expected 0-15, got %s)", x);
Preconditions.checkArgument(0 <= y && y <= 255, "y out of range (expected 0-255, got %s)", y);
Preconditions.checkArgument(minY <= y && y <= maxY, "y out of range (expected %s-%s, got %s)", minY, maxY, y);
Preconditions.checkArgument(0 <= z && z <= 15, "z out of range (expected 0-15, got %s)", z);
}

View File

@@ -24,6 +24,7 @@ import org.bukkit.craftbukkit.util.CraftMagicNumbers;
*/
public class CraftChunkSnapshot implements ChunkSnapshot {
private final int x, z;
private final int minHeight, maxHeight;
private final String worldname;
private final DataPaletteBlock<IBlockData>[] blockids;
private final byte[][] skylight;
@@ -33,9 +34,11 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
private final long captureFulltime;
private final BiomeStorage biome;
CraftChunkSnapshot(int x, int z, String wname, long wtime, DataPaletteBlock<IBlockData>[] sectionBlockIDs, byte[][] sectionSkyLights, byte[][] sectionEmitLights, boolean[] sectionEmpty, HeightMap hmap, BiomeStorage biome) {
CraftChunkSnapshot(int x, int z, int minHeight, int maxHeight, String wname, long wtime, DataPaletteBlock<IBlockData>[] sectionBlockIDs, byte[][] sectionSkyLights, byte[][] sectionEmitLights, boolean[] sectionEmpty, HeightMap hmap, BiomeStorage biome) {
this.x = x;
this.z = z;
this.minHeight = minHeight;
this.maxHeight = maxHeight;
this.worldname = wname;
this.captureFulltime = wtime;
this.blockids = sectionBlockIDs;
@@ -77,45 +80,45 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
@Override
public Material getBlockType(int x, int y, int z) {
CraftChunk.validateChunkCoordinates(x, y, z);
validateChunkCoordinates(x, y, z);
return CraftMagicNumbers.getMaterial(blockids[y >> 4].a(x, y & 0xF, z).getBlock());
return CraftMagicNumbers.getMaterial(blockids[getSectionIndex(y)].a(x, y & 0xF, z).getBlock());
}
@Override
public final BlockData getBlockData(int x, int y, int z) {
CraftChunk.validateChunkCoordinates(x, y, z);
validateChunkCoordinates(x, y, z);
return CraftBlockData.fromData(blockids[y >> 4].a(x, y & 0xF, z));
return CraftBlockData.fromData(blockids[getSectionIndex(y)].a(x, y & 0xF, z));
}
@Override
public final int getData(int x, int y, int z) {
CraftChunk.validateChunkCoordinates(x, y, z);
validateChunkCoordinates(x, y, z);
return CraftMagicNumbers.toLegacyData(blockids[y >> 4].a(x, y & 0xF, z));
return CraftMagicNumbers.toLegacyData(blockids[getSectionIndex(y)].a(x, y & 0xF, z));
}
@Override
public final int getBlockSkyLight(int x, int y, int z) {
CraftChunk.validateChunkCoordinates(x, y, z);
validateChunkCoordinates(x, y, z);
int off = ((y & 0xF) << 7) | (z << 3) | (x >> 1);
return (skylight[y >> 4][off] >> ((x & 1) << 2)) & 0xF;
return (skylight[getSectionIndex(y)][off] >> ((x & 1) << 2)) & 0xF;
}
@Override
public final int getBlockEmittedLight(int x, int y, int z) {
CraftChunk.validateChunkCoordinates(x, y, z);
validateChunkCoordinates(x, y, z);
int off = ((y & 0xF) << 7) | (z << 3) | (x >> 1);
return (emitlight[y >> 4][off] >> ((x & 1) << 2)) & 0xF;
return (emitlight[getSectionIndex(y)][off] >> ((x & 1) << 2)) & 0xF;
}
@Override
public final int getHighestBlockYAt(int x, int z) {
Preconditions.checkState(hmap != null, "ChunkSnapshot created without height map. Please call getSnapshot with includeMaxblocky=true");
CraftChunk.validateChunkCoordinates(x, 0, z);
validateChunkCoordinates(x, 0, z);
return hmap.a(x, z);
}
@@ -128,9 +131,9 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
@Override
public final Biome getBiome(int x, int y, int z) {
Preconditions.checkState(biome != null, "ChunkSnapshot created without biome. Please call getSnapshot with includeBiome=true");
CraftChunk.validateChunkCoordinates(x, y, z);
validateChunkCoordinates(x, y, z);
return CraftBlock.biomeBaseToBiome((IRegistry<BiomeBase>) biome.registry, biome.getBiome(x >> 2, y >> 2, z >> 2));
return CraftBlock.biomeBaseToBiome((IRegistry<BiomeBase>) biome.biomeRegistry, biome.getBiome(x >> 2, y >> 2, z >> 2));
}
@Override
@@ -141,7 +144,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
@Override
public final double getRawBiomeTemperature(int x, int y, int z) {
Preconditions.checkState(biome != null, "ChunkSnapshot created without biome. Please call getSnapshot with includeBiome=true");
CraftChunk.validateChunkCoordinates(x, y, z);
validateChunkCoordinates(x, y, z);
return biome.getBiome(x >> 2, y >> 2, z >> 2).getAdjustedTemperature(new BlockPosition((this.x << 4) | x, y, (this.z << 4) | z));
}
@@ -155,4 +158,12 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
public final boolean isSectionEmpty(int sy) {
return empty[sy];
}
private int getSectionIndex(int y) {
return (y - minHeight) >> 4;
}
private void validateChunkCoordinates(int x, int y, int z) {
CraftChunk.validateChunkCoordinates(minHeight, maxHeight, x, y, z);
}
}

View File

@@ -5,7 +5,7 @@ import java.io.StringWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import net.minecraft.CrashReportCallable;
import java.util.function.Supplier;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
@@ -14,10 +14,10 @@ import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
public class CraftCrashReport implements CrashReportCallable<Object> {
public class CraftCrashReport implements Supplier<String> {
@Override
public Object call() throws Exception {
public String get() {
StringWriter value = new StringWriter();
try {
value.append("\n Running: ").append(Bukkit.getName()).append(" version ").append(Bukkit.getVersion()).append(" (Implementing API version ").append(Bukkit.getBukkitVersion()).append(") ").append(String.valueOf(MinecraftServer.getServer().getOnlineMode()));

View File

@@ -33,7 +33,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
protected CraftOfflinePlayer(CraftServer server, GameProfile profile) {
this.server = server;
this.profile = profile;
this.storage = server.console.worldNBTStorage;
this.storage = server.console.playerDataStorage;
}

View File

@@ -3,17 +3,27 @@ package org.bukkit.craftbukkit;
import com.google.common.base.Preconditions;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.mojang.math.Vector3fa;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.IRegistry;
import net.minecraft.core.particles.DustColorTransitionOptions;
import net.minecraft.core.particles.ParticleParam;
import net.minecraft.core.particles.ParticleParamBlock;
import net.minecraft.core.particles.ParticleParamItem;
import net.minecraft.core.particles.ParticleParamRedstone;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.particles.VibrationParticleOption;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.level.gameevent.BlockPositionSource;
import net.minecraft.world.level.gameevent.EntityPositionSource;
import net.minecraft.world.level.gameevent.PositionSource;
import net.minecraft.world.level.gameevent.vibrations.VibrationPath;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.Vibration;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
@@ -98,6 +108,23 @@ public enum CraftParticle {
LANDING_OBSIDIAN_TEAR("landing_obsidian_tear"),
REVERSE_PORTAL("reverse_portal"),
WHITE_ASH("white_ash"),
LIGHT("light"),
DUST_COLOR_TRANSITION("dust_color_transition"),
VIBRATION("vibration"),
FALLING_SPORE_BLOSSOM("falling_spore_blossom"),
SPORE_BLOSSOM_AIR("spore_blossom_air"),
SMALL_FLAME("small_flame"),
SNOWFLAKE("snowflake"),
DRIPPING_DRIPSTONE_LAVA("dripping_dripstone_lava"),
FALLING_DRIPSTONE_LAVA("falling_dripstone_lava"),
DRIPPING_DRIPSTONE_WATER("dripping_dripstone_water"),
FALLING_DRIPSTONE_WATER("falling_dripstone_water"),
GLOW_SQUID_INK("glow_squid_ink"),
GLOW("glow"),
WAX_ON("wax_on"),
WAX_OFF("wax_off"),
ELECTRIC_SPARK("electric_spark"),
SCRAPE("scrape"),
// ----- Legacy Separator -----
LEGACY_BLOCK_CRACK("block"),
LEGACY_BLOCK_DUST("block"),
@@ -159,7 +186,30 @@ public enum CraftParticle {
if (particle.getDataType() == Particle.DustOptions.class) {
Particle.DustOptions data = (Particle.DustOptions) obj;
Color color = data.getColor();
return new ParticleParamRedstone(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, data.getSize());
return new ParticleParamRedstone(new Vector3fa(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f), data.getSize());
}
if (particle.getDataType() == Particle.DustTransition.class) {
Particle.DustTransition data = (Particle.DustTransition) obj;
Color from = data.getColor();
Color to = data.getToColor();
return new DustColorTransitionOptions(new Vector3fa(from.getRed() / 255.0f, from.getGreen() / 255.0f, from.getBlue() / 255.0f), new Vector3fa(to.getRed() / 255.0f, to.getGreen() / 255.0f, to.getBlue() / 255.0f), data.getSize());
}
if (particle.getDataType() == Vibration.class) {
Vibration vibration = (Vibration) obj;
Location origin = vibration.getOrigin();
PositionSource source;
if (vibration.getDestination() instanceof Vibration.Destination.BlockDestination) {
Location destination = ((Vibration.Destination.BlockDestination) vibration.getDestination()).getLocation();
source = new BlockPositionSource(new BlockPosition(destination.getBlockX(), destination.getBlockY(), destination.getBlockZ()));
} else if (vibration.getDestination() instanceof Vibration.Destination.EntityDestination) {
source = new EntityPositionSource(((Vibration.Destination.EntityDestination) vibration.getDestination()).getEntity().getEntityId());
} else {
throw new IllegalArgumentException("Unknown vibration destination " + vibration.getDestination());
}
VibrationPath path = new VibrationPath(new BlockPosition(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ()), source, vibration.getArrivalTime());
return new VibrationParticleOption(path);
}
throw new IllegalArgumentException(particle.getDataType().toString());
}

View File

@@ -87,7 +87,7 @@ public final class CraftRaid implements Raid {
@Override
public Set<UUID> getHeroes() {
return Collections.unmodifiableSet(handle.heroes);
return Collections.unmodifiableSet(handle.heroesOfTheVillage);
}
@Override

View File

@@ -73,6 +73,9 @@ import net.minecraft.server.level.WorldServer;
import net.minecraft.server.players.JsonListEntry;
import net.minecraft.server.players.PlayerList;
import net.minecraft.tags.Tags;
import net.minecraft.tags.TagsBlock;
import net.minecraft.tags.TagsFluid;
import net.minecraft.tags.TagsItem;
import net.minecraft.util.datafix.DataConverterRegistry;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.effect.MobEffects;
@@ -279,7 +282,7 @@ public final class CraftServer implements Server {
Bukkit.setServer(this);
// Register all the Enchantments and PotionTypes now so we can stop new registration immediately after
Enchantments.DAMAGE_ALL.getClass();
Enchantments.SHARPNESS.getClass();
org.bukkit.enchantments.Enchantment.stopAcceptingRegistrations();
Potion.setPotionBrewer(new CraftPotionBrewer());
@@ -337,7 +340,7 @@ public final class CraftServer implements Server {
ambientSpawn = configuration.getInt("spawn-limits.ambient");
console.autosavePeriod = configuration.getInt("ticks-per.autosave");
warningState = WarningState.value(configuration.getString("settings.deprecated-verbose"));
TicketType.PLUGIN.loadPeriod = configuration.getInt("chunk-gc.period-in-ticks");
TicketType.PLUGIN.timeout = configuration.getInt("chunk-gc.period-in-ticks");
minimumAPI = configuration.getString("settings.minimum-api");
loadIcon();
}
@@ -432,7 +435,7 @@ public final class CraftServer implements Server {
public void syncCommands() {
// Clear existing commands
CommandDispatcher dispatcher = console.dataPackResources.commandDispatcher = new CommandDispatcher();
CommandDispatcher dispatcher = console.resources.commands = new CommandDispatcher();
// Register all commands, vanilla ones will be using the old dispatcher references
for (Map.Entry<String, Command> entry : commandMap.getKnownCommands().entrySet()) {
@@ -610,7 +613,7 @@ public final class CraftServer implements Server {
@Override
public boolean getGenerateStructures() {
return this.getProperties().generatorSettings.shouldGenerateMapFeatures();
return this.getProperties().worldGenSettings.shouldGenerateMapFeatures();
}
@Override
@@ -717,15 +720,15 @@ public final class CraftServer implements Server {
Conversable conversable = (Conversable) sender;
if (conversable.isConversing()) {
conversable.acceptConversationInput(serverCommand.command);
conversable.acceptConversationInput(serverCommand.msg);
return true;
}
}
try {
this.playerCommandState = true;
return dispatchCommand(sender, serverCommand.command);
return dispatchCommand(sender, serverCommand.msg);
} catch (Exception ex) {
getLogger().log(Level.WARNING, "Unexpected exception while parsing console command \"" + serverCommand.command + '"', ex);
getLogger().log(Level.WARNING, "Unexpected exception while parsing console command \"" + serverCommand.msg + '"', ex);
return false;
} finally {
this.playerCommandState = false;
@@ -756,8 +759,8 @@ public final class CraftServer implements Server {
configuration = YamlConfiguration.loadConfiguration(getConfigFile());
commandsConfiguration = YamlConfiguration.loadConfiguration(getCommandsConfigFile());
console.propertyManager = new DedicatedServerSettings(console.getCustomRegistry(), console.options);
DedicatedServerProperties config = console.propertyManager.getProperties();
console.settings = new DedicatedServerSettings(console.options);
DedicatedServerProperties config = console.settings.getProperties();
console.setPVP(config.pvp);
console.setAllowFlight(config.allowFlight);
@@ -768,7 +771,7 @@ public final class CraftServer implements Server {
waterAmbientSpawn = configuration.getInt("spawn-limits.water-ambient");
ambientSpawn = configuration.getInt("spawn-limits.ambient");
warningState = WarningState.value(configuration.getString("settings.deprecated-verbose"));
TicketType.PLUGIN.loadPeriod = configuration.getInt("chunk-gc.period-in-ticks");
TicketType.PLUGIN.timeout = configuration.getInt("chunk-gc.period-in-ticks");
minimumAPI = configuration.getString("settings.minimum-api");
printSaveWarning = false;
console.autosavePeriod = configuration.getInt("ticks-per.autosave");
@@ -786,7 +789,7 @@ public final class CraftServer implements Server {
}
for (WorldServer world : console.getWorlds()) {
world.worldDataServer.setDifficulty(config.difficulty);
world.serverLevelData.setDifficulty(config.difficulty);
world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals);
if (this.getTicksPerAnimalSpawns() < 0) {
world.ticksPerAnimalSpawns = 400;
@@ -943,7 +946,7 @@ public final class CraftServer implements Server {
@Override
public World createWorld(WorldCreator creator) {
Preconditions.checkState(!console.worldServer.isEmpty(), "Cannot create additional worlds on STARTUP");
Preconditions.checkState(!console.levels.isEmpty(), "Cannot create additional worlds on STARTUP");
Validate.notNull(creator, "Creator may not be null");
String name = creator.name();
@@ -969,10 +972,10 @@ public final class CraftServer implements Server {
actualDimension = WorldDimension.OVERWORLD;
break;
case NETHER:
actualDimension = WorldDimension.THE_NETHER;
actualDimension = WorldDimension.NETHER;
break;
case THE_END:
actualDimension = WorldDimension.THE_END;
actualDimension = WorldDimension.END;
break;
default:
throw new IllegalArgumentException("Illegal dimension");
@@ -988,7 +991,7 @@ public final class CraftServer implements Server {
boolean hardcore = creator.hardcore();
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.a, console.dataPackResources.h(), console.customRegistry);
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.INSTANCE, console.resources.i(), console.registryHolder);
WorldDataServer worlddata = (WorldDataServer) worldSession.a((DynamicOps) registryreadops, console.datapackconfiguration);
WorldSettings worldSettings;
@@ -1011,7 +1014,7 @@ public final class CraftServer implements Server {
net.minecraft.server.Main.convertWorld(worldSession, DataConverterRegistry.a(), console.options.has("eraseCache"), () -> {
return true;
}, worlddata.getGeneratorSettings().d().d().stream().map((entry) -> {
return ResourceKey.a(IRegistry.K, ((ResourceKey) entry.getKey()).a());
return ResourceKey.a(IRegistry.DIMENSION_TYPE_REGISTRY, ((ResourceKey) entry.getKey()).a());
}).collect(ImmutableSet.toImmutableSet()));
}
@@ -1023,8 +1026,8 @@ public final class CraftServer implements Server {
net.minecraft.world.level.chunk.ChunkGenerator chunkgenerator;
if (worlddimension == null) {
dimensionmanager = (DimensionManager) console.customRegistry.a().d(DimensionManager.OVERWORLD);
chunkgenerator = GeneratorSettings.a(console.customRegistry.b(IRegistry.ay), console.customRegistry.b(IRegistry.ar), (new Random()).nextLong());
dimensionmanager = (DimensionManager) console.registryHolder.d(IRegistry.DIMENSION_TYPE_REGISTRY).d(DimensionManager.OVERWORLD_LOCATION);
chunkgenerator = GeneratorSettings.a(console.registryHolder.d(IRegistry.BIOME_REGISTRY), console.registryHolder.d(IRegistry.NOISE_GENERATOR_SETTINGS_REGISTRY), (new Random()).nextLong());
} else {
dimensionmanager = worlddimension.b();
chunkgenerator = worlddimension.c();
@@ -1033,14 +1036,14 @@ public final class CraftServer implements Server {
ResourceKey<net.minecraft.world.level.World> worldKey;
String levelName = this.getServer().getDedicatedServerProperties().levelName;
if (name.equals(levelName + "_nether")) {
worldKey = net.minecraft.world.level.World.THE_NETHER;
worldKey = net.minecraft.world.level.World.NETHER;
} else if (name.equals(levelName + "_the_end")) {
worldKey = net.minecraft.world.level.World.THE_END;
worldKey = net.minecraft.world.level.World.END;
} else {
worldKey = ResourceKey.a(IRegistry.L, new MinecraftKey(name.toLowerCase(java.util.Locale.ENGLISH)));
worldKey = ResourceKey.a(IRegistry.DIMENSION_REGISTRY, new MinecraftKey(name.toLowerCase(java.util.Locale.ENGLISH)));
}
WorldServer internal = (WorldServer) new WorldServer(console, console.executorService, worldSession, worlddata, worldKey, dimensionmanager, getServer().worldLoadListenerFactory.create(11),
WorldServer internal = (WorldServer) new WorldServer(console, console.executor, worldSession, worlddata, worldKey, dimensionmanager, getServer().progressListenerFactory.create(11),
chunkgenerator, worlddata.getGeneratorSettings().isDebugWorld(), j, creator.environment() == Environment.NORMAL ? list : ImmutableList.of(), true, creator.environment(), generator);
if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
@@ -1050,9 +1053,9 @@ public final class CraftServer implements Server {
console.initWorld(internal, worlddata, worlddata, worlddata.getGeneratorSettings());
internal.setSpawnFlags(true, true);
console.worldServer.put(internal.getDimensionKey(), internal);
console.levels.put(internal.getDimensionKey(), internal);
getServer().loadSpawn(internal.getChunkProvider().playerChunkMap.worldLoadListener, internal);
getServer().loadSpawn(internal.getChunkProvider().chunkMap.progressListener, internal);
pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
return internal.getWorld();
@@ -1071,7 +1074,7 @@ public final class CraftServer implements Server {
WorldServer handle = ((CraftWorld) world).getHandle();
if (!(console.worldServer.containsKey(handle.getDimensionKey()))) {
if (!(console.levels.containsKey(handle.getDimensionKey()))) {
return false;
}
@@ -1102,7 +1105,7 @@ public final class CraftServer implements Server {
}
worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH));
console.worldServer.remove(handle.getDimensionKey());
console.levels.remove(handle.getDimensionKey());
return true;
}
@@ -1547,7 +1550,7 @@ public final class CraftServer implements Server {
@Override
public GameMode getDefaultGameMode() {
return GameMode.getByValue(console.getWorldServer(net.minecraft.world.level.World.OVERWORLD).worldDataServer.getGameType().getId());
return GameMode.getByValue(console.getWorldServer(net.minecraft.world.level.World.OVERWORLD).serverLevelData.getGameType().getId());
}
@Override
@@ -1555,7 +1558,7 @@ public final class CraftServer implements Server {
Validate.notNull(mode, "Mode cannot be null");
for (World world : getWorlds()) {
((CraftWorld) world).getHandle().worldDataServer.setGameType(EnumGamemode.getById(mode.getValue()));
((CraftWorld) world).getHandle().serverLevelData.setGameType(EnumGamemode.getById(mode.getValue()));
}
}
@@ -1578,12 +1581,12 @@ public final class CraftServer implements Server {
@Override
public File getWorldContainer() {
return this.getServer().convertable.a(net.minecraft.world.level.World.OVERWORLD).getParentFile();
return this.getServer().storageSource.a(net.minecraft.world.level.World.OVERWORLD).getParentFile();
}
@Override
public OfflinePlayer[] getOfflinePlayers() {
WorldNBTStorage storage = console.worldNBTStorage;
WorldNBTStorage storage = console.playerDataStorage;
String[] files = storage.getPlayerDir().list(new DatFileFilter());
Set<OfflinePlayer> players = new HashSet<OfflinePlayer>();
@@ -1959,15 +1962,15 @@ public final class CraftServer implements Server {
case org.bukkit.Tag.REGISTRY_BLOCKS:
Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Block namespace must have material type");
return (org.bukkit.Tag<T>) new CraftBlockTag(console.getTagRegistry().getBlockTags(), key);
return (org.bukkit.Tag<T>) new CraftBlockTag(TagsBlock.a(), key);
case org.bukkit.Tag.REGISTRY_ITEMS:
Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Item namespace must have material type");
return (org.bukkit.Tag<T>) new CraftItemTag(console.getTagRegistry().getItemTags(), key);
return (org.bukkit.Tag<T>) new CraftItemTag(TagsItem.a(), key);
case org.bukkit.Tag.REGISTRY_FLUIDS:
Preconditions.checkArgument(clazz == org.bukkit.Fluid.class, "Fluid namespace must have fluid type");
return (org.bukkit.Tag<T>) new CraftFluidTag(console.getTagRegistry().getFluidTags(), key);
return (org.bukkit.Tag<T>) new CraftFluidTag(TagsFluid.a(), key);
default:
throw new IllegalArgumentException();
}
@@ -1980,17 +1983,17 @@ public final class CraftServer implements Server {
case org.bukkit.Tag.REGISTRY_BLOCKS:
Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Block namespace must have material type");
Tags<Block> blockTags = console.getTagRegistry().getBlockTags();
Tags<Block> blockTags = TagsBlock.a();
return blockTags.a().keySet().stream().map(key -> (org.bukkit.Tag<T>) new CraftBlockTag(blockTags, key)).collect(ImmutableList.toImmutableList());
case org.bukkit.Tag.REGISTRY_ITEMS:
Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Item namespace must have material type");
Tags<Item> itemTags = console.getTagRegistry().getItemTags();
Tags<Item> itemTags = TagsItem.a();
return itemTags.a().keySet().stream().map(key -> (org.bukkit.Tag<T>) new CraftItemTag(itemTags, key)).collect(ImmutableList.toImmutableList());
case org.bukkit.Tag.REGISTRY_FLUIDS:
Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Fluid namespace must have fluid type");
Tags<FluidType> fluidTags = console.getTagRegistry().getFluidTags();
Tags<FluidType> fluidTags = TagsFluid.a();
return fluidTags.a().keySet().stream().map(key -> (org.bukkit.Tag<T>) new CraftFluidTag(fluidTags, key)).collect(ImmutableList.toImmutableList());
default:
throw new IllegalArgumentException();

View File

@@ -30,11 +30,12 @@ public enum CraftStatistic {
DROP_COUNT(StatisticList.DROP),
DROP(new MinecraftKey("dropped")),
PICKUP(new MinecraftKey("picked_up")),
PLAY_ONE_MINUTE(StatisticList.PLAY_ONE_MINUTE),
PLAY_ONE_MINUTE(StatisticList.PLAY_TIME),
TOTAL_WORLD_TIME(StatisticList.TOTAL_WORLD_TIME),
WALK_ONE_CM(StatisticList.WALK_ONE_CM),
WALK_ON_WATER_ONE_CM(StatisticList.WALK_ON_WATER_ONE_CM),
FALL_ONE_CM(StatisticList.FALL_ONE_CM),
SNEAK_TIME(StatisticList.SNEAK_TIME),
SNEAK_TIME(StatisticList.CROUCH_TIME),
CLIMB_ONE_CM(StatisticList.CLIMB_ONE_CM),
FLY_ONE_CM(StatisticList.FLY_ONE_CM),
WALK_UNDER_WATER_ONE_CM(StatisticList.WALK_UNDER_WATER_ONE_CM),
@@ -122,7 +123,7 @@ public enum CraftStatistic {
public static org.bukkit.Statistic getBukkitStatistic(net.minecraft.stats.Statistic<?> statistic) {
IRegistry statRegistry = statistic.getWrapper().getRegistry();
MinecraftKey nmsKey = IRegistry.STATS.getKey(statistic.getWrapper());
MinecraftKey nmsKey = IRegistry.STAT_TYPE.getKey(statistic.getWrapper());
if (statRegistry == IRegistry.CUSTOM_STAT) {
nmsKey = (MinecraftKey) statistic.b();

View File

@@ -85,6 +85,7 @@ import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.IChunkAccess;
import net.minecraft.world.level.chunk.ProtoChunkExtension;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.StructureGenerator;
import net.minecraft.world.level.storage.SavedFile;
import net.minecraft.world.phys.AxisAlignedBB;
@@ -132,6 +133,7 @@ import org.bukkit.entity.Ambient;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Axolotl;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Bee;
import org.bukkit.entity.Blaze;
@@ -168,6 +170,9 @@ import org.bukkit.entity.Fish;
import org.bukkit.entity.Fox;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Giant;
import org.bukkit.entity.GlowItemFrame;
import org.bukkit.entity.GlowSquid;
import org.bukkit.entity.Goat;
import org.bukkit.entity.Golem;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.Hanging;
@@ -185,6 +190,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Llama;
import org.bukkit.entity.LlamaSpit;
import org.bukkit.entity.MagmaCube;
import org.bukkit.entity.Marker;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Mule;
import org.bukkit.entity.MushroomCow;
@@ -318,7 +324,7 @@ public class CraftWorld implements World {
public boolean setSpawnLocation(int x, int y, int z, float angle) {
try {
Location previousLocation = getSpawnLocation();
world.worldData.setSpawn(new BlockPosition(x, y, z), angle);
world.levelData.setSpawn(new BlockPosition(x, y, z), angle);
// Notify anyone who's listening.
SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
@@ -355,7 +361,7 @@ public class CraftWorld implements World {
@Override
public boolean isChunkGenerated(int x, int z) {
try {
return isChunkLoaded(x, z) || world.getChunkProvider().playerChunkMap.read(new ChunkCoordIntPair(x, z)) != null;
return isChunkLoaded(x, z) || world.getChunkProvider().chunkMap.read(new ChunkCoordIntPair(x, z)) != null;
} catch (IOException ex) {
throw new RuntimeException(ex);
}
@@ -363,7 +369,7 @@ public class CraftWorld implements World {
@Override
public Chunk[] getLoadedChunks() {
Long2ObjectLinkedOpenHashMap<PlayerChunk> chunks = world.getChunkProvider().playerChunkMap.visibleChunks;
Long2ObjectLinkedOpenHashMap<PlayerChunk> chunks = world.getChunkProvider().chunkMap.visibleChunkMap;
return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.Chunk::getBukkitChunk).toArray(Chunk[]::new);
}
@@ -498,7 +504,7 @@ public class CraftWorld implements World {
Preconditions.checkArgument(plugin != null, "null plugin");
Preconditions.checkArgument(plugin.isEnabled(), "plugin is not enabled");
ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager;
ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().chunkMap.distanceManager;
if (chunkDistanceManager.addTicketAtLevel(TicketType.PLUGIN_TICKET, new ChunkCoordIntPair(x, z), 31, plugin)) { // keep in-line with force loading, add at level 31
this.getChunkAt(x, z); // ensure loaded
@@ -512,7 +518,7 @@ public class CraftWorld implements World {
public boolean removePluginChunkTicket(int x, int z, Plugin plugin) {
Preconditions.checkNotNull(plugin, "null plugin");
ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager;
ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().chunkMap.distanceManager;
return chunkDistanceManager.removeTicketAtLevel(TicketType.PLUGIN_TICKET, new ChunkCoordIntPair(x, z), 31, plugin); // keep in-line with force loading, remove at level 31
}
@@ -520,13 +526,13 @@ public class CraftWorld implements World {
public void removePluginChunkTickets(Plugin plugin) {
Preconditions.checkNotNull(plugin, "null plugin");
ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager;
ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().chunkMap.distanceManager;
chunkDistanceManager.removeAllTicketsFor(TicketType.PLUGIN_TICKET, 31, plugin); // keep in-line with force loading, remove at level 31
}
@Override
public Collection<Plugin> getPluginChunkTickets(int x, int z) {
ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager;
ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().chunkMap.distanceManager;
ArraySetSorted<Ticket<?>> tickets = chunkDistanceManager.tickets.get(ChunkCoordIntPair.pair(x, z));
if (tickets == null) {
@@ -536,7 +542,7 @@ public class CraftWorld implements World {
ImmutableList.Builder<Plugin> ret = ImmutableList.builder();
for (Ticket<?> ticket : tickets) {
if (ticket.getTicketType() == TicketType.PLUGIN_TICKET) {
ret.add((Plugin) ticket.identifier);
ret.add((Plugin) ticket.key);
}
}
@@ -546,7 +552,7 @@ public class CraftWorld implements World {
@Override
public Map<Plugin, Collection<Chunk>> getPluginChunkTickets() {
Map<Plugin, ImmutableList.Builder<Chunk>> ret = new HashMap<>();
ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager;
ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().chunkMap.distanceManager;
for (Long2ObjectMap.Entry<ArraySetSorted<Ticket<?>>> chunkTickets : chunkDistanceManager.tickets.long2ObjectEntrySet()) {
long chunkKey = chunkTickets.getLongKey();
@@ -562,7 +568,7 @@ public class CraftWorld implements World {
chunk = this.getChunkAt(ChunkCoordIntPair.getX(chunkKey), ChunkCoordIntPair.getZ(chunkKey));
}
ret.computeIfAbsent((Plugin) ticket.identifier, (key) -> ImmutableList.builder()).add(chunk);
ret.computeIfAbsent((Plugin) ticket.key, (key) -> ImmutableList.builder()).add(chunk);
}
}
@@ -716,7 +722,7 @@ public class CraftWorld implements World {
gen = BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM;
break;
case SWAMP:
gen = BiomeDecoratorGroups.SWAMP_TREE;
gen = BiomeDecoratorGroups.SWAMP_OAK;
break;
case ACACIA:
gen = BiomeDecoratorGroups.ACACIA;
@@ -739,13 +745,16 @@ public class CraftWorld implements World {
case WARPED_FUNGUS:
gen = BiomeDecoratorGroups.WARPED_FUNGI_PLANTED;
break;
case AZALEA:
gen = BiomeDecoratorGroups.AZALEA_TREE;
break;
case TREE:
default:
gen = BiomeDecoratorGroups.OAK;
break;
}
return gen.e.generate(world, world.getChunkProvider().getChunkGenerator(), rand, pos, gen.f);
return gen.feature.generate(new FeaturePlaceContext(world, world.getChunkProvider().getChunkGenerator(), rand, pos, gen.config));
}
@Override
@@ -767,7 +776,7 @@ public class CraftWorld implements World {
@Override
public String getName() {
return world.worldDataServer.getName();
return world.serverLevelData.getName();
}
@Override
@@ -813,15 +822,15 @@ public class CraftWorld implements World {
// Forces the client to update to the new time immediately
for (Player p : getPlayers()) {
CraftPlayer cp = (CraftPlayer) p;
if (cp.getHandle().playerConnection == null) continue;
if (cp.getHandle().connection == null) continue;
cp.getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateTime(cp.getHandle().world.getTime(), cp.getHandle().getPlayerTime(), cp.getHandle().world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)));
cp.getHandle().connection.sendPacket(new PacketPlayOutUpdateTime(cp.getHandle().level.getTime(), cp.getHandle().getPlayerTime(), cp.getHandle().level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
}
}
@Override
public long getGameTime() {
return world.worldData.getTime();
return world.levelData.getTime();
}
@Override
@@ -935,7 +944,7 @@ public class CraftWorld implements World {
@Override
public Biome getBiome(int x, int y, int z) {
return CraftBlock.biomeBaseToBiome(getHandle().r().b(IRegistry.ay), this.world.getBiome(x >> 2, y >> 2, z >> 2));
return CraftBlock.biomeBaseToBiome(getHandle().t().d(IRegistry.BIOME_REGISTRY), this.world.getBiome(x >> 2, y >> 2, z >> 2));
}
@Override
@@ -948,7 +957,7 @@ public class CraftWorld implements World {
@Override
public void setBiome(int x, int y, int z, Biome bio) {
Preconditions.checkArgument(bio != Biome.CUSTOM, "Cannot set the biome to %s", bio);
BiomeBase bb = CraftBlock.biomeToBiomeBase(getHandle().r().b(IRegistry.ay), bio);
BiomeBase bb = CraftBlock.biomeToBiomeBase(getHandle().t().d(IRegistry.BIOME_REGISTRY), bio);
BlockPosition pos = new BlockPosition(x, 0, z);
if (this.world.isLoaded(pos)) {
net.minecraft.world.level.chunk.Chunk chunk = this.world.getChunkAtWorldCoords(pos);
@@ -986,17 +995,14 @@ public class CraftWorld implements World {
public List<Entity> getEntities() {
List<Entity> list = new ArrayList<Entity>();
for (Object o : world.entitiesById.values()) {
if (o instanceof net.minecraft.world.entity.Entity) {
net.minecraft.world.entity.Entity mcEnt = (net.minecraft.world.entity.Entity) o;
Entity bukkitEntity = mcEnt.getBukkitEntity();
world.getEntities().a().forEach((mcEnt) -> {
Entity bukkitEntity = mcEnt.getBukkitEntity();
// Assuming that bukkitEntity isn't null
if (bukkitEntity != null && bukkitEntity.isValid()) {
list.add(bukkitEntity);
}
// Assuming that bukkitEntity isn't null
if (bukkitEntity != null && bukkitEntity.isValid()) {
list.add(bukkitEntity);
}
}
});
return list;
}
@@ -1005,17 +1011,14 @@ public class CraftWorld implements World {
public List<LivingEntity> getLivingEntities() {
List<LivingEntity> list = new ArrayList<LivingEntity>();
for (Object o : world.entitiesById.values()) {
if (o instanceof net.minecraft.world.entity.Entity) {
net.minecraft.world.entity.Entity mcEnt = (net.minecraft.world.entity.Entity) o;
Entity bukkitEntity = mcEnt.getBukkitEntity();
world.getEntities().a().forEach((mcEnt) -> {
Entity bukkitEntity = mcEnt.getBukkitEntity();
// Assuming that bukkitEntity isn't null
if (bukkitEntity != null && bukkitEntity instanceof LivingEntity && bukkitEntity.isValid()) {
list.add((LivingEntity) bukkitEntity);
}
// Assuming that bukkitEntity isn't null
if (bukkitEntity != null && bukkitEntity instanceof LivingEntity && bukkitEntity.isValid()) {
list.add((LivingEntity) bukkitEntity);
}
}
});
return list;
}
@@ -1032,21 +1035,19 @@ public class CraftWorld implements World {
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T> clazz) {
Collection<T> list = new ArrayList<T>();
for (Object entity: world.entitiesById.values()) {
if (entity instanceof net.minecraft.world.entity.Entity) {
Entity bukkitEntity = ((net.minecraft.world.entity.Entity) entity).getBukkitEntity();
world.getEntities().a().forEach((entity) -> {
Entity bukkitEntity = ((net.minecraft.world.entity.Entity) entity).getBukkitEntity();
if (bukkitEntity == null) {
continue;
}
Class<?> bukkitClass = bukkitEntity.getClass();
if (clazz.isAssignableFrom(bukkitClass) && bukkitEntity.isValid()) {
list.add((T) bukkitEntity);
}
if (bukkitEntity == null) {
return;
}
}
Class<?> bukkitClass = bukkitEntity.getClass();
if (clazz.isAssignableFrom(bukkitClass) && bukkitEntity.isValid()) {
list.add((T) bukkitEntity);
}
});
return list;
}
@@ -1055,26 +1056,24 @@ public class CraftWorld implements World {
public Collection<Entity> getEntitiesByClasses(Class<?>... classes) {
Collection<Entity> list = new ArrayList<Entity>();
for (Object entity: world.entitiesById.values()) {
if (entity instanceof net.minecraft.world.entity.Entity) {
Entity bukkitEntity = ((net.minecraft.world.entity.Entity) entity).getBukkitEntity();
world.getEntities().a().forEach((entity) -> {
Entity bukkitEntity = ((net.minecraft.world.entity.Entity) entity).getBukkitEntity();
if (bukkitEntity == null) {
continue;
}
if (bukkitEntity == null) {
return;
}
Class<?> bukkitClass = bukkitEntity.getClass();
Class<?> bukkitClass = bukkitEntity.getClass();
for (Class<?> clazz : classes) {
if (clazz.isAssignableFrom(bukkitClass)) {
if (bukkitEntity.isValid()) {
list.add(bukkitEntity);
}
break;
for (Class<?> clazz : classes) {
if (clazz.isAssignableFrom(bukkitClass)) {
if (bukkitEntity.isValid()) {
list.add(bukkitEntity);
}
break;
}
}
}
});
return list;
}
@@ -1255,27 +1254,27 @@ public class CraftWorld implements World {
@Override
public void save() {
this.server.checkSaveState();
boolean oldSave = world.savingDisabled;
boolean oldSave = world.noSave;
world.savingDisabled = false;
world.noSave = false;
world.save(null, false, false);
world.savingDisabled = oldSave;
world.noSave = oldSave;
}
@Override
public boolean isAutoSave() {
return !world.savingDisabled;
return !world.noSave;
}
@Override
public void setAutoSave(boolean value) {
world.savingDisabled = !value;
world.noSave = !value;
}
@Override
public void setDifficulty(Difficulty difficulty) {
this.getHandle().worldDataServer.setDifficulty(EnumDifficulty.getById(difficulty.getValue()));
this.getHandle().serverLevelData.setDifficulty(EnumDifficulty.getById(difficulty.getValue()));
}
@Override
@@ -1289,46 +1288,46 @@ public class CraftWorld implements World {
@Override
public boolean hasStorm() {
return world.worldData.hasStorm();
return world.levelData.hasStorm();
}
@Override
public void setStorm(boolean hasStorm) {
world.worldData.setStorm(hasStorm);
world.levelData.setStorm(hasStorm);
setWeatherDuration(0); // Reset weather duration (legacy behaviour)
setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
}
@Override
public int getWeatherDuration() {
return world.worldDataServer.getWeatherDuration();
return world.serverLevelData.getWeatherDuration();
}
@Override
public void setWeatherDuration(int duration) {
world.worldDataServer.setWeatherDuration(duration);
world.serverLevelData.setWeatherDuration(duration);
}
@Override
public boolean isThundering() {
return world.worldData.isThundering();
return world.levelData.isThundering();
}
@Override
public void setThundering(boolean thundering) {
world.worldDataServer.setThundering(thundering);
world.serverLevelData.setThundering(thundering);
setThunderDuration(0); // Reset weather duration (legacy behaviour)
setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
}
@Override
public int getThunderDuration() {
return world.worldDataServer.getThunderDuration();
return world.serverLevelData.getThunderDuration();
}
@Override
public void setThunderDuration(int duration) {
world.worldDataServer.setThunderDuration(duration);
world.serverLevelData.setThunderDuration(duration);
}
@Override
@@ -1338,12 +1337,12 @@ public class CraftWorld implements World {
@Override
public void setClearWeatherDuration(int duration) {
world.worldDataServer.setClearWeatherTime(duration);
world.serverLevelData.setClearWeatherTime(duration);
}
@Override
public int getClearWeatherDuration() {
return world.worldDataServer.getClearWeatherTime();
return world.serverLevelData.getClearWeatherTime();
}
@Override
@@ -1398,12 +1397,12 @@ public class CraftWorld implements World {
radius *= radius;
for (Player player : getPlayers()) {
if (((CraftPlayer) player).getHandle().playerConnection == null) continue;
if (((CraftPlayer) player).getHandle().connection == null) continue;
if (!location.getWorld().equals(player.getWorld())) continue;
distance = (int) player.getLocation().distanceSquared(location);
if (distance <= radius) {
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
((CraftPlayer) player).getHandle().connection.sendPacket(packet);
}
}
}
@@ -1431,7 +1430,7 @@ public class CraftWorld implements World {
Validate.isTrue(material.isBlock(), "Material must be a block");
EntityFallingBlock entity = new EntityFallingBlock(world, location.getX(), location.getY(), location.getZ(), CraftMagicNumbers.getBlock(material).getBlockData());
entity.ticksLived = 1;
entity.time = 1;
world.addEntity(entity, SpawnReason.CUSTOM);
return (FallingBlock) entity.getBukkitEntity();
@@ -1443,7 +1442,7 @@ public class CraftWorld implements World {
Validate.notNull(data, "Material cannot be null");
EntityFallingBlock entity = new EntityFallingBlock(world, location.getX(), location.getY(), location.getZ(), ((CraftBlockData) data).getState());
entity.ticksLived = 1;
entity.time = 1;
world.addEntity(entity, SpawnReason.CUSTOM);
return (FallingBlock) entity.getBukkitEntity();
@@ -1520,7 +1519,7 @@ public class CraftWorld implements World {
entity = EntityTypes.LLAMA_SPIT.a(world);
entity.setPositionRotation(x, y, z, yaw, pitch);
} else if (Firework.class.isAssignableFrom(clazz)) {
entity = new EntityFireworks(world, x, y, z, net.minecraft.world.item.ItemStack.b);
entity = new EntityFireworks(world, x, y, z, net.minecraft.world.item.ItemStack.EMPTY);
}
} else if (Minecart.class.isAssignableFrom(clazz)) {
if (PoweredMinecart.class.isAssignableFrom(clazz)) {
@@ -1611,7 +1610,11 @@ public class CraftWorld implements World {
entity = EntityTypes.SPIDER.a(world);
}
} else if (Squid.class.isAssignableFrom(clazz)) {
entity = EntityTypes.SQUID.a(world);
if (GlowSquid.class.isAssignableFrom(clazz)) {
entity = EntityTypes.GLOW_SQUID.a(world);
} else {
entity = EntityTypes.SQUID.a(world);
}
} else if (Tameable.class.isAssignableFrom(clazz)) {
if (Wolf.class.isAssignableFrom(clazz)) {
entity = EntityTypes.WOLF.a(world);
@@ -1722,6 +1725,10 @@ public class CraftWorld implements World {
entity = EntityTypes.STRIDER.a(world);
} else if (Zoglin.class.isAssignableFrom(clazz)) {
entity = EntityTypes.ZOGLIN.a(world);
} else if (Axolotl.class.isAssignableFrom(clazz)) {
entity = EntityTypes.AXOLOTL.a(world);
} else if (Goat.class.isAssignableFrom(clazz)) {
entity = EntityTypes.GOAT.a(world);
}
if (entity != null) {
@@ -1768,7 +1775,6 @@ public class CraftWorld implements World {
if (LeashHitch.class.isAssignableFrom(clazz)) {
entity = new EntityLeash(world, new BlockPosition(x, y, z));
entity.attachedToPlayer = true;
} else {
// No valid face found
Preconditions.checkArgument(face != BlockFace.SELF, "Cannot spawn hanging entity for %s at %s (no free face)", clazz.getName(), location);
@@ -1777,7 +1783,11 @@ public class CraftWorld implements World {
if (Painting.class.isAssignableFrom(clazz)) {
entity = new EntityPainting(world, new BlockPosition(x, y, z), dir);
} else if (ItemFrame.class.isAssignableFrom(clazz)) {
entity = new EntityItemFrame(world, new BlockPosition(x, y, z), dir);
if (GlowItemFrame.class.isAssignableFrom(clazz)) {
entity = new net.minecraft.world.entity.decoration.GlowItemFrame(world, new BlockPosition(x, y, z), dir);
} else {
entity = new EntityItemFrame(world, new BlockPosition(x, y, z), dir);
}
}
}
@@ -1794,6 +1804,8 @@ public class CraftWorld implements World {
entity = new EntityAreaEffectCloud(world, x, y, z);
} else if (EvokerFangs.class.isAssignableFrom(clazz)) {
entity = new EntityEvokerFangs(world, x, y, z, (float) Math.toRadians(yaw), 0, null);
} else if (Marker.class.isAssignableFrom(clazz)) {
entity = EntityTypes.MARKER.a(world);
}
if (entity != null) {
@@ -1842,22 +1854,22 @@ public class CraftWorld implements World {
@Override
public boolean getAllowAnimals() {
return world.getChunkProvider().allowAnimals;
return world.getChunkProvider().spawnFriendlies;
}
@Override
public boolean getAllowMonsters() {
return world.getChunkProvider().allowMonsters;
return world.getChunkProvider().spawnEnemies;
}
@Override
public int getMinHeight() {
return 0;
return world.getMinBuildHeight();
}
@Override
public int getMaxHeight() {
return world.getBuildHeight();
return world.getMaxBuildHeight();
}
@Override
@@ -1934,7 +1946,7 @@ public class CraftWorld implements World {
@Override
public boolean canGenerateStructures() {
return world.worldDataServer.getGeneratorSettings().shouldGenerateMapFeatures();
return world.serverLevelData.getGeneratorSettings().shouldGenerateMapFeatures();
}
@Override
@@ -1944,7 +1956,7 @@ public class CraftWorld implements World {
@Override
public void setHardcore(boolean hardcore) {
world.worldDataServer.b.hardcore = hardcore;
world.serverLevelData.settings.hardcore = hardcore;
}
@Override
@@ -2322,7 +2334,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(), StructureGenerator.a.get(structureType.getName()), originPos, radius, findUnexplored);
BlockPosition nearest = getHandle().getChunkProvider().getChunkGenerator().findNearestMapFeature(getHandle(), StructureGenerator.STRUCTURES_REGISTRY.get(structureType.getName()), originPos, radius, findUnexplored);
return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ());
}
@@ -2339,7 +2351,7 @@ public class CraftWorld implements World {
@Override
public List<Raid> getRaids() {
PersistentRaid persistentRaid = world.getPersistentRaid();
return persistentRaid.raids.values().stream().map(CraftRaid::new).collect(Collectors.toList());
return persistentRaid.raidMap.values().stream().map(CraftRaid::new).collect(Collectors.toList());
}
@Override

View File

@@ -149,6 +149,10 @@ public class Main {
}
float javaVersion = Float.parseFloat(System.getProperty("java.class.version"));
if (javaVersion < 60.0) {
System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 16. Check your Java version with the command 'java -version'.");
return;
}
if (javaVersion > 60.0) {
System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 16 is supported.");
return;
@@ -177,11 +181,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, -28);
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 ***");

View File

@@ -35,9 +35,9 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
base = DyeColor.getByWoolData((byte) ((BlockBannerAbstract) this.data.getBlock()).getColor().getColorIndex());
patterns = new ArrayList<Pattern>();
if (banner.patterns != null) {
for (int i = 0; i < banner.patterns.size(); i++) {
NBTTagCompound p = (NBTTagCompound) banner.patterns.get(i);
if (banner.itemPatterns != null) {
for (int i = 0; i < banner.itemPatterns.size(); i++) {
NBTTagCompound p = (NBTTagCompound) banner.itemPatterns.get(i);
patterns.add(new Pattern(DyeColor.getByWoolData((byte) p.getInt("Color")), PatternType.getByIdentifier(p.getString("Pattern"))));
}
}
@@ -93,7 +93,7 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
public void applyTo(TileEntityBanner banner) {
super.applyTo(banner);
banner.color = EnumColor.fromColorIndex(base.getWoolData());
banner.baseColor = EnumColor.fromColorIndex(base.getWoolData());
NBTTagList newPatterns = new NBTTagList();
@@ -103,6 +103,6 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
compound.setString("Pattern", p.getPattern().getIdentifier());
newPatterns.add(compound);
}
banner.patterns = newPatterns;
banner.itemPatterns = newPatterns;
}
}

View File

@@ -37,26 +37,26 @@ public class CraftBarrel extends CraftLootable<TileEntityBarrel> implements Barr
@Override
public void open() {
requirePlaced();
if (!getTileEntity().opened) {
if (!getTileEntity().openersCounter.opened) {
IBlockData blockData = getTileEntity().getBlock();
boolean open = blockData.get(BlockBarrel.OPEN);
if (!open) {
getTileEntity().setOpenFlag(blockData, true);
getTileEntity().playOpenSound(blockData, SoundEffects.BLOCK_BARREL_OPEN);
getTileEntity().playOpenSound(blockData, SoundEffects.BARREL_OPEN);
}
}
getTileEntity().opened = true;
getTileEntity().openersCounter.opened = true;
}
@Override
public void close() {
requirePlaced();
if (getTileEntity().opened) {
if (getTileEntity().openersCounter.opened) {
IBlockData blockData = getTileEntity().getBlock();
getTileEntity().setOpenFlag(blockData, false);
getTileEntity().playOpenSound(blockData, SoundEffects.BLOCK_BARREL_CLOSE);
getTileEntity().playOpenSound(blockData, SoundEffects.BARREL_CLOSE);
}
getTileEntity().opened = false;
getTileEntity().openersCounter.opened = false;
}
}

View File

@@ -31,7 +31,7 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
if (tileEntity instanceof TileEntityBeacon) {
TileEntityBeacon beacon = (TileEntityBeacon) tileEntity;
Collection<EntityHuman> nms = beacon.getHumansInRange();
Collection<EntityHuman> nms = TileEntityBeacon.getHumansInRange(beacon.getWorld(), beacon.getPosition(), beacon.levels);
Collection<LivingEntity> bukkit = new ArrayList<LivingEntity>(nms.size());
for (EntityHuman human : nms) {
@@ -57,7 +57,7 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
@Override
public void setPrimaryEffect(PotionEffectType effect) {
this.getSnapshot().primaryEffect = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
this.getSnapshot().primaryPower = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
}
@Override
@@ -67,13 +67,13 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
@Override
public void setSecondaryEffect(PotionEffectType effect) {
this.getSnapshot().secondaryEffect = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
this.getSnapshot().secondaryPower = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
}
@Override
public String getCustomName() {
TileEntityBeacon beacon = this.getSnapshot();
return beacon.customName != null ? CraftChatMessage.fromComponent(beacon.customName) : null;
return beacon.name != null ? CraftChatMessage.fromComponent(beacon.name) : null;
}
@Override
@@ -83,16 +83,16 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
@Override
public boolean isLocked() {
return !this.getSnapshot().chestLock.key.isEmpty();
return !this.getSnapshot().lockKey.key.isEmpty();
}
@Override
public String getLock() {
return this.getSnapshot().chestLock.key;
return this.getSnapshot().lockKey.key;
}
@Override
public void setLock(String key) {
this.getSnapshot().chestLock = (key == null) ? ChestLock.a : new ChestLock(key);
this.getSnapshot().lockKey = (key == null) ? ChestLock.NO_LOCK : new ChestLock(key);
}
}

View File

@@ -26,14 +26,14 @@ public class CraftBeehive extends CraftBlockEntityState<TileEntityBeehive> imple
@Override
public Location getFlower() {
BlockPosition flower = getSnapshot().flowerPos;
BlockPosition flower = getSnapshot().savedFlowerPos;
return (flower == null) ? null : new Location(getWorld(), flower.getX(), flower.getY(), flower.getZ());
}
@Override
public void setFlower(Location location) {
Preconditions.checkArgument(location == null || this.getWorld().equals(location.getWorld()), "Flower must be in same world");
getSnapshot().flowerPos = (location == null) ? null : new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
getSnapshot().savedFlowerPos = (location == null) ? null : new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
}
@Override

View File

@@ -472,6 +472,8 @@ public class CraftBlock implements Block {
case BEEHIVE:
case BEE_NEST:
return new CraftBeehive(this);
case SCULK_SENSOR:
return new CraftSculkSensor(this);
default:
TileEntity tileEntity = world.getTileEntity(position);
if (tileEntity != null) {
@@ -583,7 +585,7 @@ public class CraftBlock implements Block {
}
private static int getPower(int i, IBlockData iblockdata) {
if (!iblockdata.getBlock().a(Blocks.REDSTONE_WIRE)) {
if (!iblockdata.a(Blocks.REDSTONE_WIRE)) {
return i;
} else {
int j = iblockdata.get(BlockRedstoneWire.POWER);
@@ -637,7 +639,7 @@ public class CraftBlock implements Block {
@Override
public boolean applyBoneMeal(BlockFace face) {
EnumDirection direction = blockFaceToNotch(face);
ItemActionContext context = new ItemActionContext(getCraftWorld().getHandle(), null, EnumHand.MAIN_HAND, Items.BONE_MEAL.createItemStack(), new MovingObjectPositionBlock(Vec3D.ORIGIN, direction, getPosition(), false));
ItemActionContext context = new ItemActionContext(getCraftWorld().getHandle(), null, EnumHand.MAIN_HAND, Items.BONE_MEAL.createItemStack(), new MovingObjectPositionBlock(Vec3D.ZERO, direction, getPosition(), false));
return ItemBoneMeal.applyBonemeal(context) == EnumInteractionResult.SUCCESS;
}

View File

@@ -48,7 +48,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
}
NBTTagCompound nbtTagCompound = tileEntity.save(new NBTTagCompound());
T snapshot = (T) TileEntity.create(getHandle(), nbtTagCompound);
T snapshot = (T) TileEntity.create(getPosition(), getHandle(), nbtTagCompound);
return snapshot;
}
@@ -57,10 +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(getHandle(), nbtTagCompound);
// reset the original position:
to.setPosition(pos);
to.load(nbtTagCompound);
}
// gets the wrapped TileEntity

View File

@@ -48,8 +48,8 @@ public class CraftBlockState implements BlockState {
return new CraftBlockState(CraftBlock.at(world, pos));
}
public static CraftBlockState getBlockState(net.minecraft.world.level.World world, net.minecraft.core.BlockPosition pos, int flag) {
return new CraftBlockState(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), flag);
public static CraftBlockState getBlockState(GeneratorAccess world, net.minecraft.core.BlockPosition pos, int flag) {
return new CraftBlockState(CraftBlock.at(world, pos), flag);
}
@Override

View File

@@ -43,11 +43,11 @@ public class CraftBrewingStand extends CraftContainer<TileEntityBrewingStand> im
@Override
public int getFuelLevel() {
return this.getSnapshot().fuelLevel;
return this.getSnapshot().fuel;
}
@Override
public void setFuelLevel(int level) {
this.getSnapshot().fuelLevel = level;
this.getSnapshot().fuel = level;
}
}

View File

@@ -35,21 +35,21 @@ public class CraftCampfire extends CraftBlockEntityState<TileEntityCampfire> imp
@Override
public int getCookTime(int index) {
return getSnapshot().cookingTimes[index];
return getSnapshot().cookingProgress[index];
}
@Override
public void setCookTime(int index, int cookTime) {
getSnapshot().cookingTimes[index] = cookTime;
getSnapshot().cookingProgress[index] = cookTime;
}
@Override
public int getCookTimeTotal(int index) {
return getSnapshot().cookingTotalTimes[index];
return getSnapshot().cookingTime[index];
}
@Override
public void setCookTimeTotal(int index, int cookTimeTotal) {
getSnapshot().cookingTotalTimes[index] = cookTimeTotal;
getSnapshot().cookingTime[index] = cookTimeTotal;
}
}

View File

@@ -5,6 +5,7 @@ import net.minecraft.world.ITileInventory;
import net.minecraft.world.level.block.BlockChest;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.TileEntityChest;
import net.minecraft.world.level.block.state.IBlockData;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
@@ -59,22 +60,22 @@ public class CraftChest extends CraftLootable<TileEntityChest> implements Chest
@Override
public void open() {
requirePlaced();
if (!getTileEntity().opened) {
net.minecraft.world.level.block.Block block = getTileEntity().getBlock().getBlock();
getTileEntity().getWorld().playBlockAction(getTileEntity().getPosition(), block, 1, getTileEntity().viewingCount + 1);
getTileEntity().playOpenSound(SoundEffects.BLOCK_CHEST_OPEN);
if (!getTileEntity().openersCounter.opened) {
IBlockData block = getTileEntity().getBlock();
getTileEntity().getWorld().playBlockAction(getPosition(), block.getBlock(), 1, getTileEntity().openersCounter.getOpenerCount() + 1);
TileEntityChest.playOpenSound(getTileEntity().getWorld(), getPosition(), block, SoundEffects.CHEST_OPEN);
}
getTileEntity().opened = true;
getTileEntity().openersCounter.opened = true;
}
@Override
public void close() {
requirePlaced();
if (getTileEntity().opened) {
net.minecraft.world.level.block.Block block = getTileEntity().getBlock().getBlock();
getTileEntity().getWorld().playBlockAction(getTileEntity().getPosition(), block, 1, 0);
getTileEntity().playOpenSound(SoundEffects.BLOCK_CHEST_CLOSE);
if (getTileEntity().openersCounter.opened) {
IBlockData block = getTileEntity().getBlock();
getTileEntity().getWorld().playBlockAction(getPosition(), block.getBlock(), 1, 0);
TileEntityChest.playOpenSound(getTileEntity().getWorld(), getPosition(), block, SoundEffects.CHEST_OPEN);
}
getTileEntity().opened = false;
getTileEntity().openersCounter.opened = false;
}
}

View File

@@ -19,23 +19,23 @@ public abstract class CraftContainer<T extends TileEntityContainer> extends Craf
@Override
public boolean isLocked() {
return !this.getSnapshot().chestLock.key.isEmpty();
return !this.getSnapshot().lockKey.key.isEmpty();
}
@Override
public String getLock() {
return this.getSnapshot().chestLock.key;
return this.getSnapshot().lockKey.key;
}
@Override
public void setLock(String key) {
this.getSnapshot().chestLock = (key == null) ? ChestLock.a : new ChestLock(key);
this.getSnapshot().lockKey = (key == null) ? ChestLock.NO_LOCK : new ChestLock(key);
}
@Override
public String getCustomName() {
T container = this.getSnapshot();
return container.customName != null ? CraftChatMessage.fromComponent(container.getCustomName()) : null;
return container.name != null ? CraftChatMessage.fromComponent(container.getCustomName()) : null;
}
@Override
@@ -47,7 +47,7 @@ public abstract class CraftContainer<T extends TileEntityContainer> extends Craf
public void applyTo(T container) {
super.applyTo(container);
if (this.getSnapshot().customName == null) {
if (this.getSnapshot().name == null) {
container.setCustomName(null);
}
}

View File

@@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import net.minecraft.core.BlockPosition;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.level.block.entity.TileEntityMobSpawner;
@@ -21,7 +22,7 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<TileEntityMobSpa
@Override
public EntityType getSpawnedType() {
MinecraftKey key = this.getSnapshot().getSpawner().getMobName();
MinecraftKey key = this.getSnapshot().getSpawner().getMobName(null, BlockPosition.ZERO);
return (key == null) ? EntityType.PIG : EntityType.fromName(key.getKey());
}
@@ -36,7 +37,7 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<TileEntityMobSpa
@Override
public String getCreatureTypeName() {
return this.getSnapshot().getSpawner().getMobName().getKey();
return this.getSnapshot().getSpawner().getMobName(null, BlockPosition.ZERO).getKey();
}
@Override

View File

@@ -34,33 +34,33 @@ public abstract class CraftFurnace<T extends TileEntityFurnace> extends CraftCon
@Override
public short getBurnTime() {
return (short) this.getSnapshot().burnTime;
return (short) this.getSnapshot().litTime;
}
@Override
public void setBurnTime(short burnTime) {
this.getSnapshot().burnTime = burnTime;
this.getSnapshot().litTime = burnTime;
// SPIGOT-844: Allow lighting and relighting using this API
this.data = this.data.set(BlockFurnace.LIT, burnTime > 0);
}
@Override
public short getCookTime() {
return (short) this.getSnapshot().cookTime;
return (short) this.getSnapshot().cookingProgress;
}
@Override
public void setCookTime(short cookTime) {
this.getSnapshot().cookTime = cookTime;
this.getSnapshot().cookingProgress = cookTime;
}
@Override
public int getCookTimeTotal() {
return this.getSnapshot().cookTimeTotal;
return this.getSnapshot().cookingTotalTime;
}
@Override
public void setCookTimeTotal(int cookTimeTotal) {
this.getSnapshot().cookTimeTotal = cookTimeTotal;
this.getSnapshot().cookingTotalTime = cookTimeTotal;
}
}

View File

@@ -30,7 +30,7 @@ public class CraftLectern extends CraftBlockEntityState<TileEntityLectern> imple
@Override
public Inventory getSnapshotInventory() {
return new CraftInventoryLectern(this.getSnapshot().inventory);
return new CraftInventoryLectern(this.getSnapshot().bookAccess);
}
@Override
@@ -39,7 +39,7 @@ public class CraftLectern extends CraftBlockEntityState<TileEntityLectern> imple
return this.getSnapshotInventory();
}
return new CraftInventoryLectern(this.getTileEntity().inventory);
return new CraftInventoryLectern(this.getTileEntity().bookAccess);
}
@Override

View File

@@ -0,0 +1,29 @@
package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import net.minecraft.world.level.block.entity.SculkSensorBlockEntity;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.SculkSensor;
public class CraftSculkSensor extends CraftBlockEntityState<SculkSensorBlockEntity> implements SculkSensor {
public CraftSculkSensor(final Block block) {
super(block, SculkSensorBlockEntity.class);
}
public CraftSculkSensor(final Material material, final SculkSensorBlockEntity te) {
super(material, te);
}
@Override
public int getLastVibrationFrequency() {
return getTileEntity().getLastVibrationFrequency();
}
@Override
public void setLastVibrationFrequency(int lastVibrationFrequency) {
Preconditions.checkArgument(0 <= lastVibrationFrequency && lastVibrationFrequency <= 15, "Vibration frequency must be between 0-15");
getTileEntity().lastVibrationFrequency = lastVibrationFrequency;
}
}

View File

@@ -51,7 +51,7 @@ public class CraftShulkerBox extends CraftLootable<TileEntityShulkerBox> impleme
if (!getTileEntity().opened) {
World world = getTileEntity().getWorld();
world.playBlockAction(getPosition(), getTileEntity().getBlock().getBlock(), 1, 1);
world.playSound(null, getPosition(), SoundEffects.BLOCK_SHULKER_BOX_OPEN, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
world.playSound(null, getPosition(), SoundEffects.SHULKER_BOX_OPEN, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
}
getTileEntity().opened = true;
}
@@ -62,7 +62,7 @@ public class CraftShulkerBox extends CraftLootable<TileEntityShulkerBox> impleme
if (getTileEntity().opened) {
World world = getTileEntity().getWorld();
world.playBlockAction(getPosition(), getTileEntity().getBlock().getBlock(), 1, 0);
world.playSound(null, getPosition(), SoundEffects.BLOCK_SHULKER_BOX_OPEN, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
world.playSound(null, getPosition(), SoundEffects.SHULKER_BOX_OPEN, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
}
getTileEntity().opened = false;
}

View File

@@ -29,8 +29,8 @@ public class CraftSign extends CraftBlockEntityState<TileEntitySign> implements
if (lines == null) {
// Lazy initialization:
TileEntitySign sign = this.getSnapshot();
lines = new String[sign.lines.length];
System.arraycopy(revertComponents(sign.lines), 0, lines, 0, lines.length);
lines = new String[sign.messages.length];
System.arraycopy(revertComponents(sign.messages), 0, lines, 0, lines.length);
originalLines = new String[lines.length];
System.arraycopy(lines, 0, originalLines, 0, originalLines.length);
}
@@ -57,6 +57,16 @@ public class CraftSign extends CraftBlockEntityState<TileEntitySign> implements
getSnapshot().isEditable = editable;
}
@Override
public boolean isGlowingText() {
return getSnapshot().hasGlowingText();
}
@Override
public void setGlowingText(boolean glowing) {
getSnapshot().setHasGlowingText(glowing);
}
@Override
public DyeColor getColor() {
return DyeColor.getByWoolData((byte) getSnapshot().getColor().getColorIndex());
@@ -77,7 +87,7 @@ public class CraftSign extends CraftBlockEntityState<TileEntitySign> implements
if (line.equals(originalLines[i])) {
continue; // The line contents are still the same, skip.
}
sign.lines[i] = CraftChatMessage.fromString(line)[0];
sign.a(i, CraftChatMessage.fromString(line)[0]);
}
}
}

View File

@@ -33,7 +33,7 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
public void load(TileEntitySkull skull) {
super.load(skull);
profile = skull.gameProfile;
profile = skull.owner;
}
static int getSkullType(SkullType type) {

View File

@@ -59,7 +59,7 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
@Override
public BlockVector getRelativePosition() {
return new BlockVector(getSnapshot().relativePosition.getX(), getSnapshot().relativePosition.getY(), getSnapshot().relativePosition.getZ());
return new BlockVector(getSnapshot().structurePos.getX(), getSnapshot().structurePos.getY(), getSnapshot().structurePos.getZ());
}
@Override
@@ -67,12 +67,12 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
Validate.isTrue(isBetween(vector.getBlockX(), -MAX_SIZE, MAX_SIZE), "Structure Size (X) must be between -" + MAX_SIZE + " and " + MAX_SIZE);
Validate.isTrue(isBetween(vector.getBlockY(), -MAX_SIZE, MAX_SIZE), "Structure Size (Y) must be between -" + MAX_SIZE + " and " + MAX_SIZE);
Validate.isTrue(isBetween(vector.getBlockZ(), -MAX_SIZE, MAX_SIZE), "Structure Size (Z) must be between -" + MAX_SIZE + " and " + MAX_SIZE);
getSnapshot().relativePosition = new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
getSnapshot().structurePos = new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
}
@Override
public BlockVector getStructureSize() {
return new BlockVector(getSnapshot().size.getX(), getSnapshot().size.getY(), getSnapshot().size.getZ());
return new BlockVector(getSnapshot().structureSize.getX(), getSnapshot().structureSize.getY(), getSnapshot().structureSize.getZ());
}
@Override
@@ -80,7 +80,7 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
Validate.isTrue(isBetween(vector.getBlockX(), 0, MAX_SIZE), "Structure Size (X) must be between 0 and " + MAX_SIZE);
Validate.isTrue(isBetween(vector.getBlockY(), 0, MAX_SIZE), "Structure Size (Y) must be between 0 and " + MAX_SIZE);
Validate.isTrue(isBetween(vector.getBlockZ(), 0, MAX_SIZE), "Structure Size (Z) must be between 0 and " + MAX_SIZE);
getSnapshot().size = new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
getSnapshot().structureSize = new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
}
@Override
@@ -105,7 +105,7 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
@Override
public void setUsageMode(UsageMode mode) {
getSnapshot().usageMode = BlockPropertyStructureMode.valueOf(mode.name());
getSnapshot().mode = BlockPropertyStructureMode.valueOf(mode.name());
}
@Override
@@ -168,13 +168,13 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
public void setMetadata(String metadata) {
Validate.notNull(metadata, "Structure metadata cannot be null");
if (getUsageMode() == UsageMode.DATA) {
getSnapshot().metadata = metadata;
getSnapshot().metaData = metadata;
}
}
@Override
public String getMetadata() {
return getSnapshot().metadata;
return getSnapshot().metaData;
}
@Override

View File

@@ -225,7 +225,7 @@ public class CraftBlockData implements BlockData {
if (!states.isEmpty()) {
stateString.append('[');
stateString.append(states.entrySet().stream().map(IBlockDataHolder.STATE_TO_VALUE).collect(Collectors.joining(",")));
stateString.append(states.entrySet().stream().map(IBlockDataHolder.PROPERTY_ENTRY_TO_STRING_FUNCTION).collect(Collectors.joining(",")));
stateString.append(']');
}
@@ -342,6 +342,9 @@ public class CraftBlockData implements BlockData {
static {
//<editor-fold desc="CraftBlockData Registration" defaultstate="collapsed">
register(net.minecraft.world.level.block.AmethystClusterBlock.class, org.bukkit.craftbukkit.block.impl.CraftAmethystCluster::new);
register(net.minecraft.world.level.block.BigDripleafBlock.class, org.bukkit.craftbukkit.block.impl.CraftBigDripleaf::new);
register(net.minecraft.world.level.block.BigDripleafStemBlock.class, org.bukkit.craftbukkit.block.impl.CraftBigDripleafStem::new);
register(net.minecraft.world.level.block.BlockAnvil.class, org.bukkit.craftbukkit.block.impl.CraftAnvil::new);
register(net.minecraft.world.level.block.BlockBamboo.class, org.bukkit.craftbukkit.block.impl.CraftBamboo::new);
register(net.minecraft.world.level.block.BlockBanner.class, org.bukkit.craftbukkit.block.impl.CraftBanner::new);
@@ -358,7 +361,6 @@ public class CraftBlockData implements BlockData {
register(net.minecraft.world.level.block.BlockCake.class, org.bukkit.craftbukkit.block.impl.CraftCake::new);
register(net.minecraft.world.level.block.BlockCampfire.class, org.bukkit.craftbukkit.block.impl.CraftCampfire::new);
register(net.minecraft.world.level.block.BlockCarrots.class, org.bukkit.craftbukkit.block.impl.CraftCarrots::new);
register(net.minecraft.world.level.block.BlockCauldron.class, org.bukkit.craftbukkit.block.impl.CraftCauldron::new);
register(net.minecraft.world.level.block.BlockChain.class, org.bukkit.craftbukkit.block.impl.CraftChain::new);
register(net.minecraft.world.level.block.BlockChest.class, org.bukkit.craftbukkit.block.impl.CraftChest::new);
register(net.minecraft.world.level.block.BlockChestTrapped.class, org.bukkit.craftbukkit.block.impl.CraftChestTrapped::new);
@@ -413,9 +415,6 @@ public class CraftBlockData implements BlockData {
register(net.minecraft.world.level.block.BlockNetherWart.class, org.bukkit.craftbukkit.block.impl.CraftNetherWart::new);
register(net.minecraft.world.level.block.BlockNote.class, org.bukkit.craftbukkit.block.impl.CraftNote::new);
register(net.minecraft.world.level.block.BlockObserver.class, org.bukkit.craftbukkit.block.impl.CraftObserver::new);
register(net.minecraft.world.level.block.piston.BlockPiston.class, org.bukkit.craftbukkit.block.impl.CraftPiston::new);
register(net.minecraft.world.level.block.piston.BlockPistonExtension.class, org.bukkit.craftbukkit.block.impl.CraftPistonExtension::new);
register(net.minecraft.world.level.block.piston.BlockPistonMoving.class, org.bukkit.craftbukkit.block.impl.CraftPistonMoving::new);
register(net.minecraft.world.level.block.BlockPortal.class, org.bukkit.craftbukkit.block.impl.CraftPortal::new);
register(net.minecraft.world.level.block.BlockPotatoes.class, org.bukkit.craftbukkit.block.impl.CraftPotatoes::new);
register(net.minecraft.world.level.block.BlockPoweredRail.class, org.bukkit.craftbukkit.block.impl.CraftPoweredRail::new);
@@ -455,7 +454,6 @@ public class CraftBlockData implements BlockData {
register(net.minecraft.world.level.block.BlockTNT.class, org.bukkit.craftbukkit.block.impl.CraftTNT::new);
register(net.minecraft.world.level.block.BlockTallPlant.class, org.bukkit.craftbukkit.block.impl.CraftTallPlant::new);
register(net.minecraft.world.level.block.BlockTallPlantFlower.class, org.bukkit.craftbukkit.block.impl.CraftTallPlantFlower::new);
register(net.minecraft.world.level.block.BlockTallSeaGrass.class, org.bukkit.craftbukkit.block.impl.CraftTallSeaGrass::new);
register(net.minecraft.world.level.block.BlockTarget.class, org.bukkit.craftbukkit.block.impl.CraftTarget::new);
register(net.minecraft.world.level.block.BlockTorchWall.class, org.bukkit.craftbukkit.block.impl.CraftTorchWall::new);
register(net.minecraft.world.level.block.BlockTrapdoor.class, org.bukkit.craftbukkit.block.impl.CraftTrapdoor::new);
@@ -469,6 +467,26 @@ public class CraftBlockData implements BlockData {
register(net.minecraft.world.level.block.BlockWitherSkull.class, org.bukkit.craftbukkit.block.impl.CraftWitherSkull::new);
register(net.minecraft.world.level.block.BlockWitherSkullWall.class, org.bukkit.craftbukkit.block.impl.CraftWitherSkullWall::new);
register(net.minecraft.world.level.block.BlockWoodButton.class, org.bukkit.craftbukkit.block.impl.CraftWoodButton::new);
register(net.minecraft.world.level.block.CandleBlock.class, org.bukkit.craftbukkit.block.impl.CraftCandle::new);
register(net.minecraft.world.level.block.CandleCakeBlock.class, org.bukkit.craftbukkit.block.impl.CraftCandleCake::new);
register(net.minecraft.world.level.block.CaveVinesBlock.class, org.bukkit.craftbukkit.block.impl.CraftCaveVines::new);
register(net.minecraft.world.level.block.CaveVinesPlantBlock.class, org.bukkit.craftbukkit.block.impl.CraftCaveVinesPlant::new);
register(net.minecraft.world.level.block.GlowLichenBlock.class, org.bukkit.craftbukkit.block.impl.CraftGlowLichen::new);
register(net.minecraft.world.level.block.HangingRootsBlock.class, org.bukkit.craftbukkit.block.impl.CraftHangingRoots::new);
register(net.minecraft.world.level.block.InfestedRotatedPillarBlock.class, org.bukkit.craftbukkit.block.impl.CraftInfestedRotatedPillar::new);
register(net.minecraft.world.level.block.LayeredCauldronBlock.class, org.bukkit.craftbukkit.block.impl.CraftLayeredCauldron::new);
register(net.minecraft.world.level.block.LightBlock.class, org.bukkit.craftbukkit.block.impl.CraftLight::new);
register(net.minecraft.world.level.block.LightningRodBlock.class, org.bukkit.craftbukkit.block.impl.CraftLightningRod::new);
register(net.minecraft.world.level.block.PointedDripstoneBlock.class, org.bukkit.craftbukkit.block.impl.CraftPointedDripstone::new);
register(net.minecraft.world.level.block.PowderSnowCauldronBlock.class, org.bukkit.craftbukkit.block.impl.CraftPowderSnowCauldron::new);
register(net.minecraft.world.level.block.SculkSensorBlock.class, org.bukkit.craftbukkit.block.impl.CraftSculkSensor::new);
register(net.minecraft.world.level.block.SmallDripleafBlock.class, org.bukkit.craftbukkit.block.impl.CraftSmallDripleaf::new);
register(net.minecraft.world.level.block.TallSeagrassBlock.class, org.bukkit.craftbukkit.block.impl.CraftTallSeagrass::new);
register(net.minecraft.world.level.block.WeatheringCopperSlabBlock.class, org.bukkit.craftbukkit.block.impl.CraftWeatheringCopperSlab::new);
register(net.minecraft.world.level.block.WeatheringCopperStairBlock.class, org.bukkit.craftbukkit.block.impl.CraftWeatheringCopperStair::new);
register(net.minecraft.world.level.block.piston.BlockPiston.class, org.bukkit.craftbukkit.block.impl.CraftPiston::new);
register(net.minecraft.world.level.block.piston.BlockPistonExtension.class, org.bukkit.craftbukkit.block.impl.CraftPistonExtension::new);
register(net.minecraft.world.level.block.piston.BlockPistonMoving.class, org.bukkit.craftbukkit.block.impl.CraftPistonMoving::new);
//</editor-fold>
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.BigDripleaf;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftBigDripleaf extends CraftBlockData implements BigDripleaf {
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> TILT = getEnum("tilt");
@Override
public Tilt getTilt() {
return get(TILT, org.bukkit.block.data.type.BigDripleaf.Tilt.class);
}
@Override
public void setTilt(org.bukkit.block.data.type.BigDripleaf.Tilt tilt) {
set(TILT, tilt);
}
}

View File

@@ -0,0 +1,24 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Candle;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftCandle extends CraftBlockData implements Candle {
private static final net.minecraft.world.level.block.state.properties.BlockStateInteger CANDLES = getInteger("candles");
@Override
public int getCandles() {
return get(CANDLES);
}
@Override
public void setCandles(int candles) {
set(CANDLES, candles);
}
@Override
public int getMaximumCandles() {
return getMax(CANDLES);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.CaveVinesPlant;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftCaveVinesPlant extends CraftBlockData implements CaveVinesPlant {
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean BERRIES = getBoolean("berries");
@Override
public boolean isBerries() {
return get(BERRIES);
}
@Override
public void setBerries(boolean berries) {
set(BERRIES, berries);
}
}

View File

@@ -0,0 +1,35 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.PointedDripstone;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftPointedDripstone extends CraftBlockData implements PointedDripstone {
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> VERTICAL_DIRECTION = getEnum("vertical_direction");
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> THICKNESS = getEnum("thickness");
@Override
public org.bukkit.block.BlockFace getVerticalDirection() {
return get(VERTICAL_DIRECTION, org.bukkit.block.BlockFace.class);
}
@Override
public void setVerticalDirection(org.bukkit.block.BlockFace direction) {
set(VERTICAL_DIRECTION, direction);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getVerticalDirections() {
return getValues(VERTICAL_DIRECTION, org.bukkit.block.BlockFace.class);
}
@Override
public org.bukkit.block.data.type.PointedDripstone.Thickness getThickness() {
return get(THICKNESS, org.bukkit.block.data.type.PointedDripstone.Thickness.class);
}
@Override
public void setThickness(org.bukkit.block.data.type.PointedDripstone.Thickness thickness) {
set(THICKNESS, thickness);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.SculkSensor;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftSculkSensor extends CraftBlockData implements SculkSensor {
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> PHASE = getEnum("sculk_sensor_phase");
@Override
public org.bukkit.block.data.type.SculkSensor.Phase getPhase() {
return get(PHASE, org.bukkit.block.data.type.SculkSensor.Phase.class);
}
@Override
public void setPhase(org.bukkit.block.data.type.SculkSensor.Phase phase) {
set(PHASE, phase);
}
}

View File

@@ -0,0 +1,48 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftAmethystCluster extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.AmethystCluster, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
public CraftAmethystCluster() {
super();
}
public CraftAmethystCluster(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> FACING = getEnum(net.minecraft.world.level.block.AmethystClusterBlock.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.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);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.AmethystClusterBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,62 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftBigDripleaf extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.BigDripleaf, org.bukkit.block.data.type.Dripleaf, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
public CraftBigDripleaf() {
super();
}
public CraftBigDripleaf(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftBigDripleaf
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> TILT = getEnum(net.minecraft.world.level.block.BigDripleafBlock.class, "tilt");
@Override
public Tilt getTilt() {
return get(TILT, org.bukkit.block.data.type.BigDripleaf.Tilt.class);
}
@Override
public void setTilt(org.bukkit.block.data.type.BigDripleaf.Tilt tilt) {
set(TILT, tilt);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> FACING = getEnum(net.minecraft.world.level.block.BigDripleafBlock.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.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);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.BigDripleafBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,48 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftBigDripleafStem extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Dripleaf, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
public CraftBigDripleafStem() {
super();
}
public CraftBigDripleafStem(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> FACING = getEnum(net.minecraft.world.level.block.BigDripleafStemBlock.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.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);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.BigDripleafStemBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,62 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCandle extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Candle, org.bukkit.block.data.Lightable, org.bukkit.block.data.Waterlogged {
public CraftCandle() {
super();
}
public CraftCandle(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftCandle
private static final net.minecraft.world.level.block.state.properties.BlockStateInteger CANDLES = getInteger(net.minecraft.world.level.block.CandleBlock.class, "candles");
@Override
public int getCandles() {
return get(CANDLES);
}
@Override
public void setCandles(int candles) {
set(CANDLES, candles);
}
@Override
public int getMaximumCandles() {
return getMax(CANDLES);
}
// org.bukkit.craftbukkit.block.data.CraftLightable
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean LIT = getBoolean(net.minecraft.world.level.block.CandleBlock.class, "lit");
@Override
public boolean isLit() {
return get(LIT);
}
@Override
public void setLit(boolean lit) {
set(LIT, lit);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.CandleBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,29 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCandleCake extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Lightable {
public CraftCandleCake() {
super();
}
public CraftCandleCake(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftLightable
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean LIT = getBoolean(net.minecraft.world.level.block.CandleCakeBlock.class, "lit");
@Override
public boolean isLit() {
return get(LIT);
}
@Override
public void setLit(boolean lit) {
set(LIT, lit);
}
}

View File

@@ -0,0 +1,48 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCaveVines extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.CaveVines, org.bukkit.block.data.Ageable, org.bukkit.block.data.type.CaveVinesPlant {
public CraftCaveVines() {
super();
}
public CraftCaveVines(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftAgeable
private static final net.minecraft.world.level.block.state.properties.BlockStateInteger AGE = getInteger(net.minecraft.world.level.block.CaveVinesBlock.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);
}
// org.bukkit.craftbukkit.block.data.type.CraftCaveVinesPlant
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean BERRIES = getBoolean(net.minecraft.world.level.block.CaveVinesBlock.class, "berries");
@Override
public boolean isBerries() {
return get(BERRIES);
}
@Override
public void setBerries(boolean berries) {
set(BERRIES, berries);
}
}

View File

@@ -0,0 +1,29 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCaveVinesPlant extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.CaveVinesPlant {
public CraftCaveVinesPlant() {
super();
}
public CraftCaveVinesPlant(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftCaveVinesPlant
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean BERRIES = getBoolean(net.minecraft.world.level.block.CaveVinesPlantBlock.class, "berries");
@Override
public boolean isBerries() {
return get(BERRIES);
}
@Override
public void setBerries(boolean berries) {
set(BERRIES, berries);
}
}

View File

@@ -0,0 +1,79 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftGlowLichen extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.GlowLichen, org.bukkit.block.data.MultipleFacing, org.bukkit.block.data.Waterlogged {
public CraftGlowLichen() {
super();
}
public CraftGlowLichen(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftMultipleFacing
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean[] FACES = new net.minecraft.world.level.block.state.properties.BlockStateBoolean[]{
getBoolean(net.minecraft.world.level.block.GlowLichenBlock.class, "north", true), getBoolean(net.minecraft.world.level.block.GlowLichenBlock.class, "east", true), getBoolean(net.minecraft.world.level.block.GlowLichenBlock.class, "south", true), getBoolean(net.minecraft.world.level.block.GlowLichenBlock.class, "west", true), getBoolean(net.minecraft.world.level.block.GlowLichenBlock.class, "up", true), getBoolean(net.minecraft.world.level.block.GlowLichenBlock.class, "down", true)
};
@Override
public boolean hasFace(org.bukkit.block.BlockFace face) {
net.minecraft.world.level.block.state.properties.BlockStateBoolean state = FACES[face.ordinal()];
if (state == null) {
throw new IllegalArgumentException("Non-allowed face " + face + ". Check MultipleFacing.getAllowedFaces.");
}
return get(state);
}
@Override
public void setFace(org.bukkit.block.BlockFace face, boolean has) {
net.minecraft.world.level.block.state.properties.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();
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.GlowLichenBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,29 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftHangingRoots extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Waterlogged {
public CraftHangingRoots() {
super();
}
public CraftHangingRoots(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.HangingRootsBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftInfestedRotatedPillar extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Orientable {
public CraftInfestedRotatedPillar() {
super();
}
public CraftInfestedRotatedPillar(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftOrientable
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> AXIS = getEnum(net.minecraft.world.level.block.InfestedRotatedPillarBlock.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);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftLayeredCauldron extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Levelled {
public CraftLayeredCauldron() {
super();
}
public CraftLayeredCauldron(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftLevelled
private static final net.minecraft.world.level.block.state.properties.BlockStateInteger LEVEL = getInteger(net.minecraft.world.level.block.LayeredCauldronBlock.class, "level");
@Override
public int getLevel() {
return get(LEVEL);
}
@Override
public void setLevel(int level) {
set(LEVEL, level);
}
@Override
public int getMaximumLevel() {
return getMax(LEVEL);
}
}

View File

@@ -0,0 +1,48 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftLight extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Light, org.bukkit.block.data.Levelled, org.bukkit.block.data.Waterlogged {
public CraftLight() {
super();
}
public CraftLight(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftLevelled
private static final net.minecraft.world.level.block.state.properties.BlockStateInteger LEVEL = getInteger(net.minecraft.world.level.block.LightBlock.class, "level");
@Override
public int getLevel() {
return get(LEVEL);
}
@Override
public void setLevel(int level) {
set(LEVEL, level);
}
@Override
public int getMaximumLevel() {
return getMax(LEVEL);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.LightBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,62 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftLightningRod extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.LightningRod, org.bukkit.block.data.Directional, org.bukkit.block.data.Powerable, org.bukkit.block.data.Waterlogged {
public CraftLightningRod() {
super();
}
public CraftLightningRod(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> FACING = getEnum(net.minecraft.world.level.block.LightningRodBlock.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.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);
}
// org.bukkit.craftbukkit.block.data.CraftPowerable
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean POWERED = getBoolean(net.minecraft.world.level.block.LightningRodBlock.class, "powered");
@Override
public boolean isPowered() {
return get(POWERED);
}
@Override
public void setPowered(boolean powered) {
set(POWERED, powered);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.LightningRodBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -3,7 +3,7 @@
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftMinecartDetector extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.RedstoneRail, org.bukkit.block.data.Powerable, org.bukkit.block.data.Rail {
public final class CraftMinecartDetector extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.RedstoneRail, org.bukkit.block.data.Powerable, org.bukkit.block.data.Rail, org.bukkit.block.data.Waterlogged {
public CraftMinecartDetector() {
super();
@@ -45,4 +45,18 @@ public final class CraftMinecartDetector extends org.bukkit.craftbukkit.block.da
public java.util.Set<org.bukkit.block.data.Rail.Shape> getShapes() {
return getValues(SHAPE, org.bukkit.block.data.Rail.Shape.class);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.BlockMinecartDetector.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -3,7 +3,7 @@
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftMinecartTrack extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Rail {
public final class CraftMinecartTrack extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Rail, org.bukkit.block.data.Waterlogged {
public CraftMinecartTrack() {
super();
@@ -31,4 +31,18 @@ public final class CraftMinecartTrack extends org.bukkit.craftbukkit.block.data.
public java.util.Set<org.bukkit.block.data.Rail.Shape> getShapes() {
return getValues(SHAPE, org.bukkit.block.data.Rail.Shape.class);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.BlockMinecartTrack.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,59 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftPointedDripstone extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.PointedDripstone, org.bukkit.block.data.Waterlogged {
public CraftPointedDripstone() {
super();
}
public CraftPointedDripstone(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftPointedDripstone
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> VERTICAL_DIRECTION = getEnum(net.minecraft.world.level.block.PointedDripstoneBlock.class, "vertical_direction");
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> THICKNESS = getEnum(net.minecraft.world.level.block.PointedDripstoneBlock.class, "thickness");
@Override
public org.bukkit.block.BlockFace getVerticalDirection() {
return get(VERTICAL_DIRECTION, org.bukkit.block.BlockFace.class);
}
@Override
public void setVerticalDirection(org.bukkit.block.BlockFace direction) {
set(VERTICAL_DIRECTION, direction);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getVerticalDirections() {
return getValues(VERTICAL_DIRECTION, org.bukkit.block.BlockFace.class);
}
@Override
public org.bukkit.block.data.type.PointedDripstone.Thickness getThickness() {
return get(THICKNESS, org.bukkit.block.data.type.PointedDripstone.Thickness.class);
}
@Override
public void setThickness(org.bukkit.block.data.type.PointedDripstone.Thickness thickness) {
set(THICKNESS, thickness);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.PointedDripstoneBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftPowderSnowCauldron extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Levelled {
public CraftPowderSnowCauldron() {
super();
}
public CraftPowderSnowCauldron(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftLevelled
private static final net.minecraft.world.level.block.state.properties.BlockStateInteger LEVEL = getInteger(net.minecraft.world.level.block.PowderSnowCauldronBlock.class, "level");
@Override
public int getLevel() {
return get(LEVEL);
}
@Override
public void setLevel(int level) {
set(LEVEL, level);
}
@Override
public int getMaximumLevel() {
return getMax(LEVEL);
}
}

View File

@@ -3,7 +3,7 @@
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftPoweredRail extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.RedstoneRail, org.bukkit.block.data.Powerable, org.bukkit.block.data.Rail {
public final class CraftPoweredRail extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.RedstoneRail, org.bukkit.block.data.Powerable, org.bukkit.block.data.Rail, org.bukkit.block.data.Waterlogged {
public CraftPoweredRail() {
super();
@@ -45,4 +45,18 @@ public final class CraftPoweredRail extends org.bukkit.craftbukkit.block.data.Cr
public java.util.Set<org.bukkit.block.data.Rail.Shape> getShapes() {
return getValues(SHAPE, org.bukkit.block.data.Rail.Shape.class);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.BlockPoweredRail.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,62 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftSculkSensor extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.SculkSensor, org.bukkit.block.data.AnaloguePowerable, org.bukkit.block.data.Waterlogged {
public CraftSculkSensor() {
super();
}
public CraftSculkSensor(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftSculkSensor
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> PHASE = getEnum(net.minecraft.world.level.block.SculkSensorBlock.class, "sculk_sensor_phase");
@Override
public org.bukkit.block.data.type.SculkSensor.Phase getPhase() {
return get(PHASE, org.bukkit.block.data.type.SculkSensor.Phase.class);
}
@Override
public void setPhase(org.bukkit.block.data.type.SculkSensor.Phase phase) {
set(PHASE, phase);
}
// org.bukkit.craftbukkit.block.data.CraftAnaloguePowerable
private static final net.minecraft.world.level.block.state.properties.BlockStateInteger POWER = getInteger(net.minecraft.world.level.block.SculkSensorBlock.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);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.SculkSensorBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,48 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftSmallDripleaf extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Dripleaf, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
public CraftSmallDripleaf() {
super();
}
public CraftSmallDripleaf(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> FACING = getEnum(net.minecraft.world.level.block.SmallDripleafBlock.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.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);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.SmallDripleafBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -3,19 +3,19 @@
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftTallSeaGrass extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Bisected {
public final class CraftTallSeagrass extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Bisected {
public CraftTallSeaGrass() {
public CraftTallSeagrass() {
super();
}
public CraftTallSeaGrass(net.minecraft.world.level.block.state.IBlockData state) {
public CraftTallSeagrass(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftBisected
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> HALF = getEnum(net.minecraft.world.level.block.BlockTallSeaGrass.class, "half");
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> HALF = getEnum(net.minecraft.world.level.block.TallSeagrassBlock.class, "half");
@Override
public org.bukkit.block.data.Bisected.Half getHalf() {

View File

@@ -0,0 +1,43 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftWeatheringCopperSlab extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Slab, org.bukkit.block.data.Waterlogged {
public CraftWeatheringCopperSlab() {
super();
}
public CraftWeatheringCopperSlab(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftSlab
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> TYPE = getEnum(net.minecraft.world.level.block.WeatheringCopperSlabBlock.class, "type");
@Override
public org.bukkit.block.data.type.Slab.Type getType() {
return get(TYPE, org.bukkit.block.data.type.Slab.Type.class);
}
@Override
public void setType(org.bukkit.block.data.type.Slab.Type type) {
set(TYPE, type);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.WeatheringCopperSlabBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,76 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftWeatheringCopperStair extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Stairs, org.bukkit.block.data.Bisected, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
public CraftWeatheringCopperStair() {
super();
}
public CraftWeatheringCopperStair(net.minecraft.world.level.block.state.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftStairs
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> SHAPE = getEnum(net.minecraft.world.level.block.WeatheringCopperStairBlock.class, "shape");
@Override
public org.bukkit.block.data.type.Stairs.Shape getShape() {
return get(SHAPE, org.bukkit.block.data.type.Stairs.Shape.class);
}
@Override
public void setShape(org.bukkit.block.data.type.Stairs.Shape shape) {
set(SHAPE, shape);
}
// org.bukkit.craftbukkit.block.data.CraftBisected
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> HALF = getEnum(net.minecraft.world.level.block.WeatheringCopperStairBlock.class, "half");
@Override
public org.bukkit.block.data.Bisected.Half getHalf() {
return get(HALF, org.bukkit.block.data.Bisected.Half.class);
}
@Override
public void setHalf(org.bukkit.block.data.Bisected.Half half) {
set(HALF, half);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.world.level.block.state.properties.BlockStateEnum<?> FACING = getEnum(net.minecraft.world.level.block.WeatheringCopperStairBlock.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.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);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.world.level.block.state.properties.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.world.level.block.WeatheringCopperStairBlock.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -97,13 +97,13 @@ public class CraftBossBar implements BossBar {
@Override
public String getTitle() {
return CraftChatMessage.fromComponent(handle.title);
return CraftChatMessage.fromComponent(handle.name);
}
@Override
public void setTitle(String title) {
handle.title = CraftChatMessage.fromString(title, true)[0];
handle.sendUpdate(PacketPlayOutBoss.Action.UPDATE_NAME);
handle.name = CraftChatMessage.fromString(title, true)[0];
handle.sendUpdate(PacketPlayOutBoss::createUpdateNamePacket);
}
@Override
@@ -114,18 +114,18 @@ public class CraftBossBar implements BossBar {
@Override
public void setColor(BarColor color) {
handle.color = convertColor(color);
handle.sendUpdate(PacketPlayOutBoss.Action.UPDATE_STYLE);
handle.sendUpdate(PacketPlayOutBoss::createUpdatePropertiesPacket);
}
@Override
public BarStyle getStyle() {
return convertStyle(handle.style);
return convertStyle(handle.overlay);
}
@Override
public void setStyle(BarStyle style) {
handle.style = convertStyle(style);
handle.sendUpdate(PacketPlayOutBoss.Action.UPDATE_STYLE);
handle.overlay = convertStyle(style);
handle.sendUpdate(PacketPlayOutBoss::createUpdatePropertiesPacket);
}
@Override
@@ -167,7 +167,7 @@ public class CraftBossBar implements BossBar {
@Override
public void addPlayer(Player player) {
Preconditions.checkArgument(player != null, "player == null");
Preconditions.checkArgument(((CraftPlayer) player).getHandle().playerConnection != null, "player is not fully connected (wait for PlayerJoinEvent)");
Preconditions.checkArgument(((CraftPlayer) player).getHandle().connection != null, "player is not fully connected (wait for PlayerJoinEvent)");
handle.addPlayer(((CraftPlayer) player).getHandle());
}

View File

@@ -20,27 +20,27 @@ public class CraftDragonBattle implements DragonBattle {
@Override
public EnderDragon getEnderDragon() {
Entity entity = handle.world.getEntity(handle.dragonUUID);
Entity entity = handle.level.getEntity(handle.dragonUUID);
return (entity != null) ? (EnderDragon) entity.getBukkitEntity() : null;
}
@Override
public BossBar getBossBar() {
return new CraftBossBar(handle.bossBattle);
return new CraftBossBar(handle.dragonEvent);
}
@Override
public Location getEndPortalLocation() {
if (handle.exitPortalLocation == null) {
if (handle.portalLocation == null) {
return null;
}
return new Location(handle.world.getWorld(), handle.exitPortalLocation.getX(), handle.exitPortalLocation.getY(), handle.exitPortalLocation.getZ());
return new Location(handle.level.getWorld(), handle.portalLocation.getX(), handle.portalLocation.getY(), handle.portalLocation.getZ());
}
@Override
public boolean generateEndPortal(boolean withPortals) {
if (handle.exitPortalLocation != null || handle.getExitPortalShape() != null) {
if (handle.portalLocation != null || handle.getExitPortalShape() != null) {
return false;
}
@@ -60,14 +60,14 @@ public class CraftDragonBattle implements DragonBattle {
@Override
public RespawnPhase getRespawnPhase() {
return toBukkitRespawnPhase(handle.respawnPhase);
return toBukkitRespawnPhase(handle.respawnStage);
}
@Override
public boolean setRespawnPhase(RespawnPhase phase) {
Preconditions.checkArgument(phase != null && phase != RespawnPhase.NONE, "Invalid respawn phase provided: %s", phase);
if (handle.respawnPhase == null) {
if (handle.respawnStage == null) {
return false;
}

View File

@@ -30,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, SystemUtils.b);
block.source.sendMessage(component, SystemUtils.NIL_UUID);
}
}

View File

@@ -15,7 +15,7 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme
@Override
public void sendMessage(String message) {
listener.sendMessage(new ChatComponentText(message + "\n"), SystemUtils.b); // Send a newline after each message, to preserve formatting.
listener.sendMessage(new ChatComponentText(message + "\n"), SystemUtils.NIL_UUID); // Send a newline after each message, to preserve formatting.
}
@Override

View File

@@ -74,7 +74,7 @@ public final class VanillaCommandWrapper extends BukkitCommand {
return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlock().getWrapper();
}
if (sender instanceof RemoteConsoleCommandSender) {
return ((DedicatedServer) MinecraftServer.getServer()).remoteControlCommandListener.getWrapper();
return ((DedicatedServer) MinecraftServer.getServer()).rconConsoleSource.getWrapper();
}
if (sender instanceof ConsoleCommandSender) {
return ((CraftServer) sender.getServer()).getServer().getServerCommandListener();

View File

@@ -30,7 +30,7 @@ public class CraftEnchantment extends Enchantment {
@Override
public EnchantmentTarget getItemTarget() {
switch (target.itemTarget) {
switch (target.category) {
case ARMOR:
return EnchantmentTarget.ARMOR;
case ARMOR_FEET:
@@ -82,7 +82,7 @@ public class CraftEnchantment extends Enchantment {
@Override
public String getName() {
// PAIL: migration paths
switch (IRegistry.ENCHANTMENT.a(target)) {
switch (IRegistry.ENCHANTMENT.getId(target)) {
case 0:
return "PROTECTION_ENVIRONMENTAL";
case 1:
@@ -160,7 +160,7 @@ public class CraftEnchantment extends Enchantment {
case 37:
return "VANISHING_CURSE";
default:
return "UNKNOWN_ENCHANT_" + IRegistry.ENCHANTMENT.a(target);
return "UNKNOWN_ENCHANT_" + IRegistry.ENCHANTMENT.getId(target);
}
}

View File

@@ -99,6 +99,6 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
@Override
public AbstractHorseInventory getInventory() {
return new CraftInventoryAbstractHorse(getHandle().inventoryChest);
return new CraftInventoryAbstractHorse(getHandle().inventory);
}
}

View File

@@ -24,12 +24,12 @@ public class CraftAnimals extends CraftAgeable implements Animals {
@Override
public UUID getBreedCause() {
return getHandle().breedCause;
return getHandle().loveCause;
}
@Override
public void setBreedCause(UUID uuid) {
getHandle().breedCause = uuid;
getHandle().loveCause = uuid;
}
@Override
@@ -45,6 +45,6 @@ public class CraftAnimals extends CraftAgeable implements Animals {
@Override
public int getLoveModeTicks() {
return getHandle().loveTicks;
return getHandle().inLove;
}
}

View File

@@ -156,7 +156,7 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
public void setGravity(boolean gravity) {
super.setGravity(gravity);
// Armor stands are special
getHandle().noclip = !gravity;
getHandle().noPhysics = !gravity;
}
@Override

View File

@@ -26,7 +26,7 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
@Override
public int getKnockbackStrength() {
return getHandle().knockbackStrength;
return getHandle().knockback;
}
@Override
@@ -94,13 +94,13 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
@Override
public PickupStatus getPickupStatus() {
return PickupStatus.values()[getHandle().fromPlayer.ordinal()];
return PickupStatus.values()[getHandle().pickup.ordinal()];
}
@Override
public void setPickupStatus(PickupStatus status) {
Preconditions.checkNotNull(status, "status");
getHandle().fromPlayer = EntityArrow.PickupStatus.a(status.ordinal());
getHandle().pickup = EntityArrow.PickupStatus.a(status.ordinal());
}
@Override
@@ -108,7 +108,7 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
super.setTicksLived(value);
// Second field for EntityArrow
getHandle().despawnCounter = value;
getHandle().life = value;
}
@Override

View File

@@ -0,0 +1,50 @@
package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Axolotl;
import org.bukkit.entity.EntityType;
public class CraftAxolotl extends CraftAnimals implements Axolotl {
public CraftAxolotl(CraftServer server, net.minecraft.world.entity.animal.axolotl.Axolotl entity) {
super(server, entity);
}
@Override
public net.minecraft.world.entity.animal.axolotl.Axolotl getHandle() {
return (net.minecraft.world.entity.animal.axolotl.Axolotl) super.getHandle();
}
@Override
public EntityType getType() {
return EntityType.AXOLOTL;
}
@Override
public String toString() {
return "CraftAxolotl";
}
@Override
public boolean isPlayingDead() {
return getHandle().isPlayingDead();
}
@Override
public void setPlayingDead(boolean playingDead) {
getHandle().setPlayingDead(playingDead);
}
@Override
public Variant getVariant() {
return Variant.values()[getHandle().getVariant().ordinal()];
}
@Override
public void setVariant(Variant variant) {
Preconditions.checkArgument(variant != null, "variant");
getHandle().setVariant(net.minecraft.world.entity.animal.axolotl.Axolotl.Variant.BY_ID[variant.ordinal()]);
}
}

View File

@@ -85,7 +85,7 @@ public class CraftBee extends CraftAnimals implements Bee {
@Override
public int getCannotEnterHiveTicks() {
return getHandle().cannotEnterHiveTicks;
return getHandle().stayOutOfHiveCountdown;
}
@Override

View File

@@ -15,7 +15,7 @@ public class CraftComplexPart extends CraftEntity implements ComplexEntityPart {
@Override
public ComplexLivingEntity getParent() {
return (ComplexLivingEntity) ((EntityEnderDragon) getHandle().owner).getBukkitEntity();
return (ComplexLivingEntity) ((EntityEnderDragon) getHandle().parentMob).getBukkitEntity();
}
@Override

View File

@@ -44,12 +44,12 @@ public class CraftCreeper extends CraftMonster implements Creeper {
public void setMaxFuseTicks(int ticks) {
Preconditions.checkArgument(ticks >= 0, "ticks < 0");
getHandle().maxFuseTicks = ticks;
getHandle().maxSwell = ticks;
}
@Override
public int getMaxFuseTicks() {
return getHandle().maxFuseTicks;
return getHandle().maxSwell;
}
@Override
@@ -57,12 +57,12 @@ public class CraftCreeper extends CraftMonster implements Creeper {
Preconditions.checkArgument(ticks >= 0, "ticks < 0");
Preconditions.checkArgument(ticks <= getMaxFuseTicks(), "ticks > maxFuseTicks");
getHandle().fuseTicks = ticks;
getHandle().swell = ticks;
}
@Override
public int getFuseTicks() {
return getHandle().fuseTicks;
return getHandle().swell;
}
@Override

View File

@@ -25,7 +25,7 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
public Set<ComplexEntityPart> getParts() {
Builder<ComplexEntityPart> builder = ImmutableSet.builder();
for (EntityComplexPart part : getHandle().children) {
for (EntityComplexPart part : getHandle().subEntities) {
builder.add((ComplexEntityPart) part.getBukkitEntity());
}
@@ -49,7 +49,7 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
@Override
public Phase getPhase() {
return Phase.values()[getHandle().getDataWatcher().get(EntityEnderDragon.PHASE)];
return Phase.values()[getHandle().getDataWatcher().get(EntityEnderDragon.DATA_PHASE)];
}
@Override
@@ -77,6 +77,6 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
@Override
public int getDeathAnimationTicks() {
return getHandle().deathAnimationTicks;
return getHandle().dragonDeathTime;
}
}

View File

@@ -33,7 +33,7 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
@Override
public Location getTargetLocation() {
return new Location(getWorld(), getHandle().targetX, getHandle().targetY, getHandle().targetZ, getHandle().yaw, getHandle().pitch);
return new Location(getWorld(), getHandle().tx, getHandle().ty, getHandle().tz, getHandle().getYRot(), getHandle().getXRot());
}
@Override
@@ -44,17 +44,17 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
@Override
public boolean getDropItem() {
return getHandle().shouldDropItem;
return getHandle().surviveAfterDeath;
}
@Override
public void setDropItem(boolean shouldDropItem) {
getHandle().shouldDropItem = shouldDropItem;
getHandle().surviveAfterDeath = shouldDropItem;
}
@Override
public ItemStack getItem() {
return CraftItemStack.asBukkitCopy(getHandle().getItem());
return CraftItemStack.asBukkitCopy(getHandle().getSuppliedItem());
}
@Override
@@ -64,11 +64,11 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
@Override
public int getDespawnTimer() {
return getHandle().despawnTimer;
return getHandle().life;
}
@Override
public void setDespawnTimer(int time) {
getHandle().despawnTimer = time;
getHandle().life = time;
}
}

View File

@@ -28,11 +28,11 @@ public class CraftEndermite extends CraftMonster implements Endermite {
@Override
public boolean isPlayerSpawned() {
return getHandle().isPlayerSpawned();
return false;
}
@Override
public void setPlayerSpawned(boolean playerSpawned) {
getHandle().setPlayerSpawned(playerSpawned);
// Nop
}
}

View File

@@ -20,6 +20,8 @@ import net.minecraft.world.entity.EntityFlying;
import net.minecraft.world.entity.EntityLightning;
import net.minecraft.world.entity.EntityLiving;
import net.minecraft.world.entity.EntityTameableAnimal;
import net.minecraft.world.entity.GlowSquid;
import net.minecraft.world.entity.Marker;
import net.minecraft.world.entity.ambient.EntityAmbient;
import net.minecraft.world.entity.ambient.EntityBat;
import net.minecraft.world.entity.animal.EntityAnimal;
@@ -49,6 +51,8 @@ import net.minecraft.world.entity.animal.EntityTropicalFish;
import net.minecraft.world.entity.animal.EntityTurtle;
import net.minecraft.world.entity.animal.EntityWaterAnimal;
import net.minecraft.world.entity.animal.EntityWolf;
import net.minecraft.world.entity.animal.axolotl.Axolotl;
import net.minecraft.world.entity.animal.goat.Goat;
import net.minecraft.world.entity.animal.horse.EntityHorse;
import net.minecraft.world.entity.animal.horse.EntityHorseAbstract;
import net.minecraft.world.entity.animal.horse.EntityHorseChestedAbstract;
@@ -67,6 +71,7 @@ import net.minecraft.world.entity.decoration.EntityHanging;
import net.minecraft.world.entity.decoration.EntityItemFrame;
import net.minecraft.world.entity.decoration.EntityLeash;
import net.minecraft.world.entity.decoration.EntityPainting;
import net.minecraft.world.entity.decoration.GlowItemFrame;
import net.minecraft.world.entity.item.EntityFallingBlock;
import net.minecraft.world.entity.item.EntityItem;
import net.minecraft.world.entity.item.EntityTNTPrimed;
@@ -198,7 +203,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
// Water Animals
else if (entity instanceof EntityWaterAnimal) {
if (entity instanceof EntitySquid) { return new CraftSquid(server, (EntitySquid) entity); }
if (entity instanceof EntitySquid) {
if (entity instanceof GlowSquid) { return new CraftGlowSquid(server, (GlowSquid) entity); }
else { return new CraftSquid(server, (EntitySquid) entity); }
}
else if (entity instanceof EntityFish) {
if (entity instanceof EntityCod) { return new CraftCod(server, (EntityCod) entity); }
else if (entity instanceof EntityPufferFish) { return new CraftPufferFish(server, (EntityPufferFish) entity); }
@@ -243,6 +251,8 @@ public abstract class CraftEntity implements org.bukkit.entity.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 if (entity instanceof Axolotl) { return new CraftAxolotl(server, (Axolotl) entity); }
else if (entity instanceof Goat) { return new CraftGoat(server, (Goat) entity); }
else { return new CraftAnimals(server, (EntityAnimal) entity); }
}
// Monsters
@@ -332,7 +342,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
else if (entity instanceof EntityComplexPart) {
EntityComplexPart part = (EntityComplexPart) entity;
if (part.owner instanceof EntityEnderDragon) { return new CraftEnderDragonPart(server, (EntityComplexPart) entity); }
if (part.parentMob instanceof EntityEnderDragon) { return new CraftEnderDragonPart(server, (EntityComplexPart) entity); }
else { return new CraftComplexPart(server, (EntityComplexPart) entity); }
}
else if (entity instanceof EntityExperienceOrb) { return new CraftExperienceOrb(server, (EntityExperienceOrb) entity); }
@@ -373,7 +383,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityMinecartCommandBlock) { return new CraftMinecartCommand(server, (EntityMinecartCommandBlock) entity); }
} else if (entity instanceof EntityHanging) {
if (entity instanceof EntityPainting) { return new CraftPainting(server, (EntityPainting) entity); }
else if (entity instanceof EntityItemFrame) { return new CraftItemFrame(server, (EntityItemFrame) entity); }
else if (entity instanceof EntityItemFrame) {
if (entity instanceof GlowItemFrame) { return new CraftGlowItemFrame(server, (GlowItemFrame) entity); }
else { return new CraftItemFrame(server, (EntityItemFrame) entity); }
}
else if (entity instanceof EntityLeash) { return new CraftLeash(server, (EntityLeash) entity); }
else { return new CraftHanging(server, (EntityHanging) entity); }
}
@@ -383,6 +396,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityAreaEffectCloud) { return new CraftAreaEffectCloud(server, (EntityAreaEffectCloud) entity); }
else if (entity instanceof EntityEvokerFangs) { return new CraftEvokerFangs(server, (EntityEvokerFangs) entity); }
else if (entity instanceof EntityLlamaSpit) { return new CraftLlamaSpit(server, (EntityLlamaSpit) entity); }
else if (entity instanceof Marker) { return new CraftMarker(server, (Marker) entity); }
// CHECKSTYLE:ON
throw new AssertionError("Unknown entity " + (entity == null ? null : entity.getClass()));
@@ -390,7 +404,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public Location getLocation() {
return new Location(getWorld(), entity.locX(), entity.locY(), entity.locZ(), entity.getBukkitYaw(), entity.pitch);
return new Location(getWorld(), entity.locX(), entity.locY(), entity.locZ(), entity.getBukkitYaw(), entity.getXRot());
}
@Override
@@ -401,7 +415,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
loc.setY(entity.locY());
loc.setZ(entity.locZ());
loc.setYaw(entity.getBukkitYaw());
loc.setPitch(entity.pitch);
loc.setPitch(entity.getXRot());
}
return loc;
@@ -417,7 +431,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
Preconditions.checkArgument(velocity != null, "velocity");
velocity.checkFinite();
entity.setMot(CraftVector.toNMS(velocity));
entity.velocityChanged = true;
entity.hurtMarked = true;
}
@Override
@@ -451,7 +465,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public World getWorld() {
return entity.world.getWorld();
return entity.level.getWorld();
}
@Override
@@ -462,10 +476,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
yaw = Location.normalizeYaw(yaw);
pitch = Location.normalizePitch(pitch);
entity.yaw = yaw;
entity.pitch = pitch;
entity.lastYaw = yaw;
entity.lastPitch = pitch;
entity.setYRot(yaw);
entity.setXRot(pitch);
entity.yRotO = yaw;
entity.xRotO = pitch;
entity.setHeadRotation(yaw);
}
@@ -479,7 +493,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
Preconditions.checkArgument(location != null, "location");
location.checkFinite();
if (entity.isVehicle() || entity.dead) {
if (entity.isVehicle() || entity.isRemoved()) {
return false;
}
@@ -512,7 +526,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z) {
List<Entity> notchEntityList = entity.world.getEntities(entity, entity.getBoundingBox().grow(x, y, z), null);
List<Entity> notchEntityList = entity.level.getEntities(entity, entity.getBoundingBox().grow(x, y, z), null);
List<org.bukkit.entity.Entity> bukkitEntityList = new java.util.ArrayList<org.bukkit.entity.Entity>(notchEntityList.size());
for (Entity e : notchEntityList) {
@@ -528,7 +542,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public int getFireTicks() {
return entity.fireTicks;
return entity.remainingFireTicks;
}
@Override
@@ -538,7 +552,39 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public void setFireTicks(int ticks) {
entity.fireTicks = ticks;
entity.remainingFireTicks = ticks;
}
@Override
public void setVisualFire(boolean fire) {
getHandle().hasVisualFire = fire;
}
@Override
public boolean isVisualFire() {
return getHandle().hasVisualFire;
}
@Override
public int getFreezeTicks() {
return getHandle().getTicksFrozen();
}
@Override
public int getMaxFreezeTicks() {
return getHandle().getTicksRequiredToFreeze();
}
@Override
public void setFreezeTicks(int ticks) {
Preconditions.checkArgument(0 <= ticks && ticks <= getMaxFreezeTicks(), "Ticks cannot be less than 0 or greater than getMaxFreezeTicks");
getHandle().setTicksFrozen(ticks);
}
@Override
public boolean isFrozen() {
return getHandle().isFullyFrozen();
}
@Override
@@ -662,7 +708,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public int getTicksLived() {
return getHandle().ticksLived;
return getHandle().tickCount;
}
@Override
@@ -670,7 +716,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
if (value <= 0) {
throw new IllegalArgumentException("Age must be at least 1 tick");
}
getHandle().ticksLived = value;
getHandle().tickCount = value;
}
public Entity getHandle() {
@@ -682,7 +728,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
Preconditions.checkArgument(type != null, "type");
if (type.getApplicable().isInstance(this)) {
this.getHandle().world.broadcastEntityEffect(getHandle(), type.getData());
this.getHandle().level.broadcastEntityEffect(getHandle(), type.getData());
}
}
@@ -881,16 +927,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public void setGlowing(boolean flag) {
getHandle().glowing = flag;
Entity e = getHandle();
if (e.getFlag(6) != flag) {
e.setFlag(6, flag);
}
getHandle().setGlowingTag(true);
}
@Override
public boolean isGlowing() {
return getHandle().glowing;
return getHandle().isCurrentlyGlowing();
}
@Override

View File

@@ -64,6 +64,6 @@ public class CraftFallingBlock extends CraftEntity implements FallingBlock {
super.setTicksLived(value);
// Second field for EntityFallingBlock
getHandle().ticksLived = value;
getHandle().time = value;
}
}

View File

@@ -50,7 +50,7 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
@Override
public Vector getDirection() {
return new Vector(getHandle().dirX, getHandle().dirY, getHandle().dirZ);
return new Vector(getHandle().xPower, getHandle().yPower, getHandle().zPower);
}
@Override

View File

@@ -19,11 +19,11 @@ public class CraftFirework extends CraftProjectile implements Firework {
public CraftFirework(CraftServer server, EntityFireworks entity) {
super(server, entity);
ItemStack item = getHandle().getDataWatcher().get(EntityFireworks.FIREWORK_ITEM);
ItemStack item = getHandle().getDataWatcher().get(EntityFireworks.DATA_ID_FIREWORKS_ITEM);
if (item.isEmpty()) {
item = new ItemStack(Items.FIREWORK_ROCKET);
getHandle().getDataWatcher().set(EntityFireworks.FIREWORK_ITEM, item);
getHandle().getDataWatcher().set(EntityFireworks.DATA_ID_FIREWORKS_ITEM, item);
}
this.item = CraftItemStack.asCraftMirror(item);
@@ -59,14 +59,14 @@ public class CraftFirework extends CraftProjectile implements Firework {
item.setItemMeta(meta);
// Copied from EntityFireworks constructor, update firework lifetime/power
getHandle().expectedLifespan = 10 * (1 + meta.getPower()) + random.nextInt(6) + random.nextInt(7);
getHandle().lifetime = 10 * (1 + meta.getPower()) + random.nextInt(6) + random.nextInt(7);
getHandle().getDataWatcher().markDirty(EntityFireworks.FIREWORK_ITEM);
getHandle().getDataWatcher().markDirty(EntityFireworks.DATA_ID_FIREWORKS_ITEM);
}
@Override
public void detonate() {
getHandle().expectedLifespan = 0;
getHandle().lifetime = 0;
}
@Override
@@ -76,6 +76,6 @@ public class CraftFirework extends CraftProjectile implements Firework {
@Override
public void setShotAtAngle(boolean shotAtAngle) {
getHandle().getDataWatcher().set(EntityFireworks.SHOT_AT_ANGLE, shotAtAngle);
getHandle().getDataWatcher().set(EntityFireworks.DATA_SHOT_AT_ANGLE, shotAtAngle);
}
}

View File

@@ -71,7 +71,7 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
EntityFishingHook hook = getHandle();
if (this.biteChance == -1) {
if (hook.world.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX()), MathHelper.floor(hook.locY()) + 1, MathHelper.floor(hook.locZ())))) {
if (hook.level.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX()), MathHelper.floor(hook.locY()) + 1, MathHelper.floor(hook.locZ())))) {
return 1 / 300.0;
}
return 1 / 500.0;
@@ -92,7 +92,7 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
@Override
public Entity getHookedEntity() {
net.minecraft.world.entity.Entity hooked = getHandle().hooked;
net.minecraft.world.entity.Entity hooked = getHandle().hookedIn;
return (hooked != null) ? hooked.getBukkitEntity() : null;
}
@@ -100,23 +100,23 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
public void setHookedEntity(Entity entity) {
EntityFishingHook hook = getHandle();
hook.hooked = (entity != null) ? ((CraftEntity) entity).getHandle() : null;
hook.getDataWatcher().set(EntityFishingHook.HOOKED_ENTITY, hook.hooked != null ? hook.hooked.getId() + 1 : 0);
hook.hookedIn = (entity != null) ? ((CraftEntity) entity).getHandle() : null;
hook.getDataWatcher().set(EntityFishingHook.DATA_HOOKED_ENTITY, hook.hookedIn != null ? hook.hookedIn.getId() + 1 : 0);
}
@Override
public boolean pullHookedEntity() {
EntityFishingHook hook = getHandle();
if (hook.hooked == null) {
if (hook.hookedIn == null) {
return false;
}
hook.reel();
hook.reel(hook.hookedIn);
return true;
}
@Override
public HookState getState() {
return HookState.values()[getHandle().hookState.ordinal()];
return HookState.values()[getHandle().currentState.ordinal()];
}
}

View File

@@ -70,7 +70,7 @@ public class CraftFox extends CraftAnimals implements Fox {
@Override
public AnimalTamer getFirstTrustedPlayer() {
UUID uuid = getHandle().getDataWatcher().get(EntityFox.FIRST_TRUSTED_PLAYER).orElse(null);
UUID uuid = getHandle().getDataWatcher().get(EntityFox.DATA_TRUSTED_ID_0).orElse(null);
if (uuid == null) {
return null;
}
@@ -85,16 +85,16 @@ public class CraftFox extends CraftAnimals implements Fox {
@Override
public void setFirstTrustedPlayer(AnimalTamer player) {
if (player == null && getHandle().getDataWatcher().get(EntityFox.SECOND_TRUSTED_PLAYER).isPresent()) {
if (player == null && getHandle().getDataWatcher().get(EntityFox.DATA_TRUSTED_ID_1).isPresent()) {
throw new IllegalStateException("Must remove second trusted player first");
}
getHandle().getDataWatcher().set(EntityFox.FIRST_TRUSTED_PLAYER, player == null ? Optional.empty() : Optional.of(player.getUniqueId()));
getHandle().getDataWatcher().set(EntityFox.DATA_TRUSTED_ID_0, player == null ? Optional.empty() : Optional.of(player.getUniqueId()));
}
@Override
public AnimalTamer getSecondTrustedPlayer() {
UUID uuid = getHandle().getDataWatcher().get(EntityFox.SECOND_TRUSTED_PLAYER).orElse(null);
UUID uuid = getHandle().getDataWatcher().get(EntityFox.DATA_TRUSTED_ID_1).orElse(null);
if (uuid == null) {
return null;
}
@@ -109,10 +109,10 @@ public class CraftFox extends CraftAnimals implements Fox {
@Override
public void setSecondTrustedPlayer(AnimalTamer player) {
if (player != null && !getHandle().getDataWatcher().get(EntityFox.FIRST_TRUSTED_PLAYER).isPresent()) {
if (player != null && !getHandle().getDataWatcher().get(EntityFox.DATA_TRUSTED_ID_0).isPresent()) {
throw new IllegalStateException("Must add first trusted player first");
}
getHandle().getDataWatcher().set(EntityFox.SECOND_TRUSTED_PLAYER, player == null ? Optional.empty() : Optional.of(player.getUniqueId()));
getHandle().getDataWatcher().set(EntityFox.DATA_TRUSTED_ID_1, player == null ? Optional.empty() : Optional.of(player.getUniqueId()));
}
}

View File

@@ -0,0 +1,27 @@
package org.bukkit.craftbukkit.entity;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.GlowItemFrame;
public class CraftGlowItemFrame extends CraftItemFrame implements GlowItemFrame {
public CraftGlowItemFrame(CraftServer server, net.minecraft.world.entity.decoration.GlowItemFrame entity) {
super(server, entity);
}
@Override
public net.minecraft.world.entity.decoration.GlowItemFrame getHandle() {
return (net.minecraft.world.entity.decoration.GlowItemFrame) super.getHandle();
}
@Override
public EntityType getType() {
return EntityType.GLOW_ITEM_FRAME;
}
@Override
public String toString() {
return "CraftGlowItemFrame";
}
}

View File

@@ -0,0 +1,39 @@
package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.GlowSquid;
public class CraftGlowSquid extends CraftSquid implements GlowSquid {
public CraftGlowSquid(CraftServer server, net.minecraft.world.entity.GlowSquid entity) {
super(server, entity);
}
@Override
public net.minecraft.world.entity.GlowSquid getHandle() {
return (net.minecraft.world.entity.GlowSquid) super.getHandle();
}
@Override
public EntityType getType() {
return EntityType.GLOW_SQUID;
}
@Override
public String toString() {
return "CraftGlowSquid";
}
@Override
public int getDarkTicksRemaining() {
return getHandle().getDarkTicksRemaining();
}
@Override
public void setDarkTicksRemaining(int darkTicksRemaining) {
Preconditions.checkArgument(darkTicksRemaining >= 0, "darkTicksRemaining must be >= 0");
getHandle().setDarkTicksRemaining(darkTicksRemaining);
}
}

View File

@@ -0,0 +1,37 @@
package org.bukkit.craftbukkit.entity;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Goat;
public class CraftGoat extends CraftAnimals implements Goat {
public CraftGoat(CraftServer server, net.minecraft.world.entity.animal.goat.Goat entity) {
super(server, entity);
}
@Override
public net.minecraft.world.entity.animal.goat.Goat getHandle() {
return (net.minecraft.world.entity.animal.goat.Goat) super.getHandle();
}
@Override
public EntityType getType() {
return EntityType.GOAT;
}
@Override
public String toString() {
return "CraftGoat";
}
@Override
public boolean isScreaming() {
return getHandle().isScreamingGoat();
}
@Override
public void setScreaming(boolean screaming) {
getHandle().setScreamingGoat(screaming);
}
}

View File

@@ -81,12 +81,12 @@ public class CraftHanging extends CraftEntity implements Hanging {
}
WorldServer world = ((CraftWorld) getWorld()).getHandle();
PlayerChunkMap.EntityTracker entityTracker = world.getChunkProvider().playerChunkMap.trackedEntities.get(getEntityId());
PlayerChunkMap.EntityTracker entityTracker = world.getChunkProvider().chunkMap.entityMap.get(getEntityId());
if (entityTracker == null) {
return;
}
entityTracker.broadcast(getHandle().P());
entityTracker.broadcast(getHandle().getPacket());
}
}

View File

@@ -35,16 +35,16 @@ public class CraftHoglin extends CraftAnimals implements Hoglin {
@Override
public int getConversionTime() {
Preconditions.checkState(isConverting(), "Entity not converting");
return getHandle().conversionTicks;
return getHandle().timeInOverworld;
}
@Override
public void setConversionTime(int time) {
if (time < 0) {
getHandle().conversionTicks = -1;
getHandle().timeInOverworld = -1;
getHandle().setImmuneToZombification(false);
} else {
getHandle().conversionTicks = time;
getHandle().timeInOverworld = time;
}
}

View File

@@ -63,7 +63,7 @@ public class CraftHorse extends CraftAbstractHorse implements Horse {
@Override
public HorseInventory getInventory() {
return new CraftInventoryHorse(getHandle().inventoryChest);
return new CraftInventoryHorse(getHandle().inventory);
}
@Override

View File

@@ -73,7 +73,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
public CraftHumanEntity(final CraftServer server, final EntityHuman entity) {
super(server, entity);
mode = server.getDefaultGameMode();
this.inventory = new CraftInventoryPlayer(entity.inventory);
this.inventory = new CraftInventoryPlayer(entity.getInventory());
enderChest = new CraftInventory(entity.getEnderChest());
}
@@ -109,21 +109,21 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public ItemStack getItemOnCursor() {
return CraftItemStack.asCraftMirror(getHandle().inventory.getCarried());
return CraftItemStack.asCraftMirror(getHandle().inventoryMenu.getCarried());
}
@Override
public void setItemOnCursor(ItemStack item) {
net.minecraft.world.item.ItemStack stack = CraftItemStack.asNMSCopy(item);
getHandle().inventory.setCarried(stack);
getHandle().inventoryMenu.setCarried(stack);
if (this instanceof CraftPlayer) {
((EntityPlayer) getHandle()).broadcastCarriedItem(); // Send set slot for cursor
getHandle().inventoryMenu.broadcastCarriedItem(); // Send set slot for cursor
}
}
@Override
public int getSleepTicks() {
return getHandle().sleepTicks;
return getHandle().sleepCounter;
}
@Override
@@ -133,7 +133,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
Preconditions.checkArgument(location.getWorld().equals(getWorld()), "Cannot sleep across worlds");
BlockPosition blockposition = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
IBlockData iblockdata = getHandle().world.getType(blockposition);
IBlockData iblockdata = getHandle().level.getType(blockposition);
if (!(iblockdata.getBlock() instanceof BlockBed)) {
return false;
}
@@ -144,7 +144,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
// From BlockBed
iblockdata = (IBlockData) iblockdata.set(BlockBed.OCCUPIED, true);
getHandle().world.setTypeAndData(blockposition, iblockdata, 4);
getHandle().level.setTypeAndData(blockposition, iblockdata, 4);
return true;
}
@@ -256,7 +256,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
public void setHandle(final EntityHuman entity) {
super.setHandle(entity);
this.inventory = new CraftInventoryPlayer(entity.inventory);
this.inventory = new CraftInventoryPlayer(entity.getInventory());
}
@Override
@@ -266,14 +266,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public InventoryView getOpenInventory() {
return getHandle().activeContainer.getBukkitView();
return getHandle().containerMenu.getBukkitView();
}
@Override
public InventoryView openInventory(Inventory inventory) {
if (!(getHandle() instanceof EntityPlayer)) return null;
EntityPlayer player = (EntityPlayer) getHandle();
Container formerContainer = getHandle().activeContainer;
Container formerContainer = getHandle().containerMenu;
ITileInventory iinventory = null;
if (inventory instanceof CraftInventoryDoubleChest) {
@@ -291,7 +291,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
if (iinventory instanceof TileEntity) {
TileEntity te = (TileEntity) iinventory;
if (!te.hasWorld()) {
te.setLocation(getHandle().world, getHandle().getChunkCoordinates());
te.setWorld(getHandle().level);
}
}
}
@@ -303,26 +303,26 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
openCustomInventory(inventory, player, container);
}
if (getHandle().activeContainer == formerContainer) {
if (getHandle().containerMenu == formerContainer) {
return null;
}
getHandle().activeContainer.checkReachable = false;
return getHandle().activeContainer.getBukkitView();
getHandle().containerMenu.checkReachable = false;
return getHandle().containerMenu.getBukkitView();
}
private void openCustomInventory(Inventory inventory, EntityPlayer player, Containers<?> windowType) {
if (player.playerConnection == null) return;
private static void openCustomInventory(Inventory inventory, EntityPlayer player, Containers<?> windowType) {
if (player.connection == null) return;
Preconditions.checkArgument(windowType != null, "Unknown windowType");
Container container = new CraftContainer(inventory, this.getHandle(), player.nextContainerCounter());
Container container = new CraftContainer(inventory, player, player.nextContainerCounter());
container = CraftEventFactory.callInventoryOpenEvent(player, container);
if (container == null) return;
String title = container.getBukkitView().getTitle();
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0]));
getHandle().activeContainer = container;
getHandle().activeContainer.addSlotListener(player);
player.connection.sendPacket(new PacketPlayOutOpenWindow(container.containerId, windowType, CraftChatMessage.fromString(title)[0]));
player.containerMenu = container;
player.initMenu(container);
}
@Override
@@ -336,11 +336,11 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
return null;
}
}
getHandle().openContainer(((BlockWorkbench) Blocks.CRAFTING_TABLE).getInventory(null, getHandle().world, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())));
getHandle().openContainer(((BlockWorkbench) Blocks.CRAFTING_TABLE).getInventory(null, getHandle().level, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())));
if (force) {
getHandle().activeContainer.checkReachable = false;
getHandle().containerMenu.checkReachable = false;
}
return getHandle().activeContainer.getBukkitView();
return getHandle().containerMenu.getBukkitView();
}
@Override
@@ -357,21 +357,21 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
// If there isn't an enchant table we can force create one, won't be very useful though.
BlockPosition pos = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
getHandle().openContainer(((BlockEnchantmentTable) Blocks.ENCHANTING_TABLE).getInventory(null, getHandle().world, pos));
getHandle().openContainer(((BlockEnchantmentTable) Blocks.ENCHANTING_TABLE).getInventory(null, getHandle().level, pos));
if (force) {
getHandle().activeContainer.checkReachable = false;
getHandle().containerMenu.checkReachable = false;
}
return getHandle().activeContainer.getBukkitView();
return getHandle().containerMenu.getBukkitView();
}
@Override
public void openInventory(InventoryView inventory) {
if (!(getHandle() instanceof EntityPlayer)) return; // TODO: NPC support?
if (((EntityPlayer) getHandle()).playerConnection == null) return;
if (getHandle().activeContainer != getHandle().defaultContainer) {
if (((EntityPlayer) getHandle()).connection == null) return;
if (getHandle().containerMenu != getHandle().inventoryMenu) {
// fire INVENTORY_CLOSE if one already open
((EntityPlayer) getHandle()).playerConnection.a(new PacketPlayInCloseWindow(getHandle().activeContainer.windowId));
((EntityPlayer) getHandle()).connection.a(new PacketPlayInCloseWindow(getHandle().containerMenu.containerId));
}
EntityPlayer player = (EntityPlayer) getHandle();
Container container;
@@ -390,9 +390,9 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
// Now open the window
Containers<?> windowType = CraftContainer.getNotchInventoryType(inventory.getTopInventory());
String title = inventory.getTitle();
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0]));
player.activeContainer = container;
player.activeContainer.addSlotListener(player);
player.connection.sendPacket(new PacketPlayOutOpenWindow(container.containerId, windowType, CraftChatMessage.fromString(title)[0]));
player.containerMenu = container;
player.initMenu(container);
}
@Override
@@ -432,7 +432,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
mcMerchant.setTradingPlayer(this.getHandle());
mcMerchant.openTrade(this.getHandle(), name, level);
return this.getHandle().activeContainer.getBukkitView();
return this.getHandle().containerMenu.getBukkitView();
}
@Override
@@ -477,7 +477,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
Preconditions.checkArgument(material != null, "material");
ItemCooldown.Info cooldown = getHandle().getCooldownTracker().cooldowns.get(CraftMagicNumbers.getItem(material));
return (cooldown == null) ? 0 : Math.max(0, cooldown.endTick - getHandle().getCooldownTracker().currentTick);
return (cooldown == null) ? 0 : Math.max(0, cooldown.endTime - getHandle().getCooldownTracker().tickCount);
}
@Override
@@ -520,7 +520,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
private Collection<IRecipe<?>> bukkitKeysToMinecraftRecipes(Collection<NamespacedKey> recipeKeys) {
Collection<IRecipe<?>> recipes = new ArrayList<>();
CraftingManager manager = getHandle().world.getMinecraftServer().getCraftingManager();
CraftingManager manager = getHandle().level.getMinecraftServer().getCraftingManager();
for (NamespacedKey recipeKey : recipeKeys) {
Optional<? extends IRecipe<?>> recipe = manager.getRecipe(CraftNamespacedKey.toMinecraft(recipeKey));
@@ -537,7 +537,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public org.bukkit.entity.Entity getShoulderEntityLeft() {
if (!getHandle().getShoulderEntityLeft().isEmpty()) {
Optional<Entity> shoulder = EntityTypes.a(getHandle().getShoulderEntityLeft(), getHandle().world);
Optional<Entity> shoulder = EntityTypes.a(getHandle().getShoulderEntityLeft(), getHandle().level);
return (!shoulder.isPresent()) ? null : shoulder.get().getBukkitEntity();
}
@@ -556,7 +556,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public org.bukkit.entity.Entity getShoulderEntityRight() {
if (!getHandle().getShoulderEntityRight().isEmpty()) {
Optional<Entity> shoulder = EntityTypes.a(getHandle().getShoulderEntityRight(), getHandle().world);
Optional<Entity> shoulder = EntityTypes.a(getHandle().getShoulderEntityRight(), getHandle().level);
return (!shoulder.isPresent()) ? null : shoulder.get().getBukkitEntity();
}

View File

@@ -42,12 +42,12 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
super.update();
// mark dirty, so that the client gets updated with item and rotation
for (DataWatcher.Item<?> dataItem : getHandle().getDataWatcher().c()) {
for (DataWatcher.Item<?> dataItem : getHandle().getDataWatcher().getAll()) {
getHandle().getDataWatcher().markDirty(dataItem.a());
}
// update redstone
getHandle().getWorld().updateAdjacentComparators(getHandle().blockPosition, Blocks.AIR);
getHandle().getWorld().updateAdjacentComparators(getHandle().pos, Blocks.AIR);
}
@Override
@@ -67,13 +67,13 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
@Override
public float getItemDropChance() {
return getHandle().itemDropChance;
return getHandle().dropChance;
}
@Override
public void setItemDropChance(float chance) {
Preconditions.checkArgument(0.0 <= chance && chance <= 1.0, "Chance outside range [0, 1]");
getHandle().itemDropChance = chance;
getHandle().dropChance = chance;
}
@Override

View File

@@ -13,7 +13,7 @@ public class CraftLargeFireball extends CraftSizedFireball implements LargeFireb
@Override
public void setYield(float yield) {
super.setYield(yield);
getHandle().yield = (int) yield;
getHandle().explosionPower = (int) yield;
}
@Override

View File

@@ -12,7 +12,7 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
@Override
public boolean isEffect() {
return getHandle().isEffect;
return getHandle().visualOnly;
}
@Override

View File

@@ -248,12 +248,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public int getArrowCooldown() {
return getHandle().arrowCooldown;
return getHandle().removeArrowTime;
}
@Override
public void setArrowCooldown(int ticks) {
getHandle().arrowCooldown = ticks;
getHandle().removeArrowTime = ticks;
}
@Override
@@ -264,7 +264,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public void setArrowsInBody(int count) {
Preconditions.checkArgument(count >= 0, "New arrow amount must be >= 0");
getHandle().getDataWatcher().set(EntityLiving.ARROWS_IN_BODY, count);
getHandle().getDataWatcher().set(EntityLiving.DATA_ARROW_COUNT_ID, count);
}
@Override
@@ -294,32 +294,32 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public int getMaximumNoDamageTicks() {
return getHandle().maxNoDamageTicks;
return getHandle().invulnerableDuration;
}
@Override
public void setMaximumNoDamageTicks(int ticks) {
getHandle().maxNoDamageTicks = ticks;
getHandle().invulnerableDuration = ticks;
}
@Override
public double getLastDamage() {
return getHandle().lastDamage;
return getHandle().lastHurt;
}
@Override
public void setLastDamage(double damage) {
getHandle().lastDamage = (float) damage;
getHandle().lastHurt = (float) damage;
}
@Override
public int getNoDamageTicks() {
return getHandle().noDamageTicks;
return getHandle().invulnerableTime;
}
@Override
public void setNoDamageTicks(int ticks) {
getHandle().noDamageTicks = ticks;
getHandle().invulnerableTime = ticks;
}
@Override
@@ -338,7 +338,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public Player getKiller() {
return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity();
return getHandle().lastHurtByPlayer == null ? null : (Player) getHandle().lastHurtByPlayer.getBukkitEntity();
}
@Override
@@ -380,7 +380,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public Collection<PotionEffect> getActivePotionEffects() {
List<PotionEffect> effects = new ArrayList<PotionEffect>();
for (MobEffect handle : getHandle().effects.values()) {
for (MobEffect handle : getHandle().activeEffects.values()) {
effects.add(new PotionEffect(PotionEffectType.getById(MobEffectList.getId(handle.getMobEffect())), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isShowParticles()));
}
return effects;
@@ -399,13 +399,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new EntitySnowball(world, getHandle());
((EntityProjectile) launch).a(getHandle(), getHandle().pitch, getHandle().yaw, 0.0F, 1.5F, 1.0F); // ItemSnowball
((EntityProjectile) launch).a(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // ItemSnowball
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new EntityEgg(world, getHandle());
((EntityProjectile) launch).a(getHandle(), getHandle().pitch, getHandle().yaw, 0.0F, 1.5F, 1.0F); // ItemEgg
((EntityProjectile) launch).a(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // ItemEgg
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new EntityEnderPearl(world, getHandle());
((EntityProjectile) launch).a(getHandle(), getHandle().pitch, getHandle().yaw, 0.0F, 1.5F, 1.0F); // ItemEnderPearl
((EntityProjectile) launch).a(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // ItemEnderPearl
} else if (AbstractArrow.class.isAssignableFrom(projectile)) {
if (TippedArrow.class.isAssignableFrom(projectile)) {
launch = new EntityTippedArrow(world, getHandle());
@@ -417,7 +417,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} else {
launch = new EntityTippedArrow(world, getHandle());
}
((EntityArrow) launch).a(getHandle(), getHandle().pitch, getHandle().yaw, 0.0F, 3.0F, 1.0F); // ItemBow
((EntityArrow) launch).a(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 3.0F, 1.0F); // ItemBow
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
if (LingeringPotion.class.isAssignableFrom(projectile)) {
launch = new EntityPotion(world, getHandle());
@@ -426,10 +426,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
launch = new EntityPotion(world, getHandle());
((EntityPotion) launch).setItem(CraftItemStack.asNMSCopy(new ItemStack(org.bukkit.Material.SPLASH_POTION, 1)));
}
((EntityProjectile) launch).a(getHandle(), getHandle().pitch, getHandle().yaw, -20.0F, 0.5F, 1.0F); // ItemSplashPotion
((EntityProjectile) launch).a(getHandle(), getHandle().getXRot(), getHandle().getYRot(), -20.0F, 0.5F, 1.0F); // ItemSplashPotion
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new EntityThrownExpBottle(world, getHandle());
((EntityProjectile) launch).a(getHandle(), getHandle().pitch, getHandle().yaw, -20.0F, 0.7F, 1.0F); // ItemExpBottle
((EntityProjectile) launch).a(getHandle(), getHandle().getXRot(), getHandle().getYRot(), -20.0F, 0.7F, 1.0F); // ItemExpBottle
} else if (FishHook.class.isAssignableFrom(projectile) && getHandle() instanceof EntityHuman) {
launch = new EntityFishingHook((EntityHuman) getHandle(), world, 0, 0);
} else if (Fireball.class.isAssignableFrom(projectile)) {
@@ -443,7 +443,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} else if (DragonFireball.class.isAssignableFrom(projectile)) {
launch = new EntityDragonFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
} else {
launch = new EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ());
launch = new EntityLargeFireball(world, getHandle(), direction.getX(), direction.getY(), direction.getZ(), 1);
}
((EntityFireball) launch).projectileSource = this;
@@ -465,7 +465,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} else if (Firework.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
launch = new EntityFireworks(world, net.minecraft.world.item.ItemStack.b, getHandle());
launch = new EntityFireworks(world, net.minecraft.world.item.ItemStack.EMPTY, getHandle());
launch.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
@@ -491,13 +491,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean getRemoveWhenFarAway() {
return getHandle() instanceof EntityInsentient && !((EntityInsentient) getHandle()).persistent;
return getHandle() instanceof EntityInsentient && !((EntityInsentient) getHandle()).persistenceRequired;
}
@Override
public void setRemoveWhenFarAway(boolean remove) {
if (getHandle() instanceof EntityInsentient) {
((EntityInsentient) getHandle()).persistent = !remove;
((EntityInsentient) getHandle()).persistenceRequired = !remove;
}
}
@@ -508,12 +508,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public void setCanPickupItems(boolean pickup) {
getHandle().canPickUpLoot = pickup;
if (getHandle() instanceof EntityInsentient) {
((EntityInsentient) getHandle()).setCanPickupLoot(pickup);
} else {
getHandle().bukkitPickUpLoot = pickup;
}
}
@Override
public boolean getCanPickupItems() {
return getHandle().canPickUpLoot;
if (getHandle() instanceof EntityInsentient) {
return ((EntityInsentient) getHandle()).canPickupLoot();
} else {
return getHandle().bukkitPickUpLoot;
}
}
@Override
@@ -669,7 +677,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return EntityCategory.ARTHROPOD;
} else if (type == EnumMonsterType.ILLAGER) {
return EntityCategory.ILLAGER;
} else if (type == EnumMonsterType.WATER_MOB) {
} else if (type == EnumMonsterType.WATER) {
return EntityCategory.WATER;
}

View File

@@ -35,7 +35,7 @@ public class CraftLlama extends CraftChestedHorse implements Llama {
@Override
public LlamaInventory getInventory() {
return new CraftInventoryLlama(getHandle().inventoryChest);
return new CraftInventoryLlama(getHandle().inventory);
}
@Override

View File

@@ -0,0 +1,27 @@
package org.bukkit.craftbukkit.entity;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Marker;
public class CraftMarker extends CraftEntity implements Marker {
public CraftMarker(CraftServer server, net.minecraft.world.entity.Marker entity) {
super(server, entity);
}
@Override
public net.minecraft.world.entity.Marker getHandle() {
return (net.minecraft.world.entity.Marker) super.getHandle();
}
@Override
public EntityType getType() {
return EntityType.MARKER;
}
@Override
public String toString() {
return "CraftMarker";
}
}

View File

@@ -34,7 +34,7 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca
@Override
public void setCommand(String command) {
getHandle().getCommandBlock().setCommand(command != null ? command : "");
getHandle().getDataWatcher().set(EntityMinecartCommandBlock.COMMAND, getHandle().getCommandBlock().getCommand());
getHandle().getDataWatcher().set(EntityMinecartCommandBlock.DATA_ID_COMMAND_NAME, getHandle().getCommandBlock().getCommand());
}
@Override

View File

@@ -53,16 +53,16 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
@Override
public void setLootTable(LootTable table) {
getHandle().lootTableKey = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
getHandle().lootTable = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
}
@Override
public LootTable getLootTable() {
if (getHandle().lootTableKey == null) {
getHandle().lootTableKey = getHandle().getLootTable();
if (getHandle().lootTable == null) {
getHandle().lootTable = getHandle().getDefaultLootTable();
}
NamespacedKey key = CraftNamespacedKey.fromMinecraft(getHandle().lootTableKey);
NamespacedKey key = CraftNamespacedKey.fromMinecraft(getHandle().lootTable);
return Bukkit.getLootTable(key);
}

View File

@@ -17,7 +17,7 @@ public class CraftPainting extends CraftHanging implements Painting {
@Override
public Art getArt() {
Paintings art = getHandle().art;
Paintings art = getHandle().motive;
return CraftArt.NotchToBukkit(art);
}
@@ -29,12 +29,12 @@ public class CraftPainting extends CraftHanging implements Painting {
@Override
public boolean setArt(Art art, boolean force) {
EntityPainting painting = this.getHandle();
Paintings oldArt = painting.art;
painting.art = CraftArt.BukkitToNotch(art);
Paintings oldArt = painting.motive;
painting.motive = CraftArt.BukkitToNotch(art);
painting.setDirection(painting.getDirection());
if (!force && !painting.survives()) {
// Revert painting since it doesn't fit
painting.art = oldArt;
painting.motive = oldArt;
painting.setDirection(painting.getDirection());
return false;
}

View File

@@ -20,36 +20,36 @@ public class CraftPig extends CraftAnimals implements Pig {
@Override
public void setSaddle(boolean saddled) {
getHandle().saddleStorage.setSaddle(saddled);
getHandle().steering.setSaddle(saddled);
}
@Override
public int getBoostTicks() {
return getHandle().saddleStorage.boosting ? getHandle().saddleStorage.boostTicks : 0;
return getHandle().steering.boosting ? getHandle().steering.boostTimeTotal : 0;
}
@Override
public void setBoostTicks(int ticks) {
Preconditions.checkArgument(ticks >= 0, "ticks must be >= 0");
getHandle().saddleStorage.setBoostTicks(ticks);
getHandle().steering.setBoostTicks(ticks);
}
@Override
public int getCurrentBoostTicks() {
return getHandle().saddleStorage.boosting ? getHandle().saddleStorage.currentBoostTicks : 0;
return getHandle().steering.boosting ? getHandle().steering.boostTime : 0;
}
@Override
public void setCurrentBoostTicks(int ticks) {
if (!getHandle().saddleStorage.boosting) {
if (!getHandle().steering.boosting) {
return;
}
int max = getHandle().saddleStorage.boostTicks;
int max = getHandle().steering.boostTimeTotal;
Preconditions.checkArgument(ticks >= 0 && ticks <= max, "boost ticks must not exceed 0 or %d (inclusive)", max);
this.getHandle().saddleStorage.currentBoostTicks = ticks;
this.getHandle().steering.boostTime = ticks;
}
@Override

View File

@@ -74,7 +74,7 @@ public class CraftPiglin extends CraftPiglinAbstract implements Piglin {
@Override
public Inventory getInventory() {
return new CraftInventory(getHandle().bu);
return new CraftInventory(getHandle().inventory);
}
@Override

View File

@@ -24,16 +24,16 @@ public class CraftPiglinAbstract extends CraftMonster implements PiglinAbstract
@Override
public int getConversionTime() {
Preconditions.checkState(isConverting(), "Entity not converting");
return getHandle().conversionTicks;
return getHandle().timeInOverworld;
}
@Override
public void setConversionTime(int time) {
if (time < 0) {
getHandle().conversionTicks = -1;
getHandle().timeInOverworld = -1;
getHandle().setImmuneToZombification(false);
} else {
getHandle().conversionTicks = time;
getHandle().timeInOverworld = time;
}
}

Some files were not shown because too many files have changed in this diff Show More