Update to Minecraft 1.15

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-12-11 09:00:00 +11:00
parent 1400103b2f
commit 0e142c7f03
293 changed files with 2875 additions and 2648 deletions

View File

@@ -203,14 +203,14 @@ public class CraftChunk implements Chunk {
@Override
public long getInhabitedTime() {
return getHandle().q();
return getHandle().getInhabitedTime();
}
@Override
public void setInhabitedTime(long ticks) {
Preconditions.checkArgument(ticks >= 0, "ticks cannot be negative");
getHandle().b(ticks);
getHandle().setInhabitedTime(ticks);
}
@Override
@@ -219,7 +219,7 @@ public class CraftChunk implements Chunk {
IBlockData nms = ((CraftBlockData) block).getState();
for (ChunkSection section : getHandle().getSections()) {
if (section != null && section.getBlocks().a(nms)) {
if (section != null && section.getBlocks().contains(nms)) {
return true;
}
}
@@ -291,7 +291,7 @@ public class CraftChunk implements Chunk {
if (includeBiome) {
biome = new BiomeBase[256];
for (int i = 0; i < 256; i++) {
biome[i] = chunk.getBiome(new BlockPosition(i & 0xF, 0, i >> 4));
biome[i] = chunk.getBiomeIndex().getBiome(i & 0xF, 0, i >> 4);
}
}
@@ -351,11 +351,10 @@ public class CraftChunk implements Chunk {
}
private static float[] getTemperatures(WorldChunkManager chunkmanager, int chunkX, int chunkZ) {
BiomeBase[] biomes = chunkmanager.getBiomeBlock(chunkX, chunkZ, 16, 16);
float[] temps = new float[biomes.length];
float[] temps = new float[256];
for (int i = 0; i < biomes.length; i++) {
float temp = biomes[i].getTemperature(); // Vanilla of olde: ((int) biomes[i].temperature * 65536.0F) / 65536.0F
for (int i = 0; i < 256; i++) {
float temp = chunkmanager.getBiome((chunkX << 4) + (i & 0xF), 0, (chunkZ << 4) + (i >> 4)).getTemperature(); // Vanilla of olde: ((int) biomes[i].temperature * 65536.0F) / 65536.0F
if (temp > 1F) {
temp = 1F;

View File

@@ -64,7 +64,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
IBlockData nms = ((CraftBlockData) block).getState();
for (DataPaletteBlock<IBlockData> palette : blockids) {
if (palette.a(nms)) {
if (palette.contains(nms)) {
return true;
}
}

View File

@@ -74,7 +74,7 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
WorldServer handle = ((CraftWorld) loc.getWorld()).getHandle();
LootTableInfo.Builder builder = new LootTableInfo.Builder(handle);
if (getHandle() != LootTable.a) { // PAIL - empty
if (getHandle() != LootTable.EMPTY) {
// builder.luck(context.getLuck());
if (context.getLootedEntity() != null) {

View File

@@ -84,6 +84,10 @@ public enum CraftParticle {
FALLING_LAVA("falling_lava"),
LANDING_LAVA("landing_lava"),
FALLING_WATER("falling_water"),
DRIPPING_HONEY("dripping_honey"),
FALLING_HONEY("falling_honey"),
LANDING_HONEY("landing_honey"),
FALLING_NECTAR("falling_nectar"),
// ----- Legacy Separator -----
LEGACY_BLOCK_CRACK("block"),
LEGACY_BLOCK_DUST("block"),

View File

@@ -104,6 +104,6 @@ public class CraftProfileBanList implements org.bukkit.BanList {
//
}
return (uuid != null) ? MinecraftServer.getServer().getUserCache().a(uuid) : MinecraftServer.getServer().getUserCache().getProfile(target);
return (uuid != null) ? MinecraftServer.getServer().getUserCache().getProfile(uuid) : MinecraftServer.getServer().getUserCache().getProfile(target);
}
}

View File

@@ -24,40 +24,40 @@ public final class CraftRaid implements Raid {
@Override
public boolean isStarted() {
return handle.j(); // PAIL rename isStarted
return handle.isStarted();
}
@Override
public long getActiveTicks() {
return handle.i;
return handle.ticksActive;
}
@Override
public int getBadOmenLevel() {
return handle.o;
return handle.badOmenLevel;
}
@Override
public void setBadOmenLevel(int badOmenLevel) {
int max = handle.l(); // PAIL rename getMaxBadOmenLevel
int max = handle.getMaxBadOmenLevel();
Preconditions.checkArgument(0 <= badOmenLevel && badOmenLevel <= max, "Bad Omen level must be between 0 and %s", max);
handle.o = badOmenLevel;
handle.badOmenLevel = badOmenLevel;
}
@Override
public Location getLocation() {
BlockPosition pos = handle.t(); // PAIL rename getCenterLocation
World world = handle.i(); // PAIL rename getWorld
BlockPosition pos = handle.getCenter();
World world = handle.getWorld();
return new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ());
}
@Override
public RaidStatus getStatus() {
if (handle.d()) { // PAIL rename isStopped
if (handle.isStopped()) {
return RaidStatus.STOPPED;
} else if (handle.e()) { // PAIL rename isVictory
} else if (handle.isVictory()) {
return RaidStatus.VICTORY;
} else if (handle.f()) { // PAIL rename isLoss
} else if (handle.isLoss()) {
return RaidStatus.LOSS;
} else {
return RaidStatus.ONGOING;
@@ -66,27 +66,27 @@ public final class CraftRaid implements Raid {
@Override
public int getSpawnedGroups() {
return handle.k(); // PAIL rename countSpawnedGroups
return handle.getGroupsSpawned();
}
@Override
public int getTotalGroups() {
return handle.v + (handle.o > 1 ? 1 : 0);
return handle.numGroups + (handle.badOmenLevel > 1 ? 1 : 0);
}
@Override
public int getTotalWaves() {
return handle.v;
return handle.numGroups;
}
@Override
public float getTotalHealth() {
return handle.q(); // PAIL rename sumMobHealth
return handle.sumMobHealth();
}
@Override
public Set<UUID> getHeroes() {
return Collections.unmodifiableSet(handle.h);
return Collections.unmodifiableSet(handle.heroes);
}
@Override

View File

@@ -161,6 +161,7 @@ import org.bukkit.generator.ChunkGenerator;
import org.bukkit.help.HelpMap;
import org.bukkit.inventory.BlastingRecipe;
import org.bukkit.inventory.CampfireRecipe;
import org.bukkit.inventory.ComplexRecipe;
import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
@@ -928,7 +929,7 @@ public final class CraftServer implements Server {
}
DimensionManager actualDimension = DimensionManager.a(creator.environment().getId());
DimensionManager internalDimension = DimensionManager.register(name.toLowerCase(java.util.Locale.ENGLISH), new DimensionManager(dimension, actualDimension.getSuffix(), actualDimension.folder, (w, manager) -> actualDimension.providerFactory.apply(w, manager), actualDimension.hasSkyLight(), actualDimension));
DimensionManager internalDimension = DimensionManager.register(name.toLowerCase(java.util.Locale.ENGLISH), new DimensionManager(dimension, actualDimension.getSuffix(), actualDimension.folder, (w, manager) -> actualDimension.providerFactory.apply(w, manager), actualDimension.hasSkyLight(), actualDimension.getGenLayerZoomer(), actualDimension));
WorldServer internal = (WorldServer) new WorldServer(console, console.executorService, sdm, worlddata, internalDimension, console.getMethodProfiler(), getServer().worldLoadListenerFactory.create(11), creator.environment(), generator);
if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
@@ -1072,6 +1073,8 @@ public final class CraftServer implements Server {
toAdd = CraftSmokingRecipe.fromBukkitRecipe((SmokingRecipe) recipe);
} else if (recipe instanceof StonecuttingRecipe) {
toAdd = CraftStonecuttingRecipe.fromBukkitRecipe((StonecuttingRecipe) recipe);
} else if (recipe instanceof ComplexRecipe) {
throw new UnsupportedOperationException("Cannot add custom complex recipe");
} else {
return false;
}
@@ -1778,7 +1781,7 @@ public final class CraftServer implements Server {
@Override
public Iterator<org.bukkit.advancement.Advancement> advancementIterator() {
return Iterators.unmodifiableIterator(Iterators.transform(console.getAdvancementData().a().iterator(), new Function<Advancement, org.bukkit.advancement.Advancement>() { // PAIL: rename
return Iterators.unmodifiableIterator(Iterators.transform(console.getAdvancementData().getAdvancements().iterator(), new Function<Advancement, org.bukkit.advancement.Advancement>() {
@Override
public org.bukkit.advancement.Advancement apply(Advancement advancement) {
return advancement.bukkit;

View File

@@ -38,6 +38,11 @@ public enum CraftSound {
BLOCK_BEACON_AMBIENT("block.beacon.ambient"),
BLOCK_BEACON_DEACTIVATE("block.beacon.deactivate"),
BLOCK_BEACON_POWER_SELECT("block.beacon.power_select"),
BLOCK_BEEHIVE_DRIP("block.beehive.drip"),
BLOCK_BEEHIVE_ENTER("block.beehive.enter"),
BLOCK_BEEHIVE_EXIT("block.beehive.exit"),
BLOCK_BEEHIVE_SHEAR("block.beehive.shear"),
BLOCK_BEEHIVE_WORK("block.beehive.work"),
BLOCK_BELL_RESONATE("block.bell.resonate"),
BLOCK_BELL_USE("block.bell.use"),
BLOCK_BLASTFURNACE_FIRE_CRACKLE("block.blastfurnace.fire_crackle"),
@@ -99,6 +104,12 @@ public enum CraftSound {
BLOCK_GRAVEL_PLACE("block.gravel.place"),
BLOCK_GRAVEL_STEP("block.gravel.step"),
BLOCK_GRINDSTONE_USE("block.grindstone.use"),
BLOCK_HONEY_BLOCK_BREAK("block.honey_block.break"),
BLOCK_HONEY_BLOCK_FALL("block.honey_block.fall"),
BLOCK_HONEY_BLOCK_HIT("block.honey_block.hit"),
BLOCK_HONEY_BLOCK_PLACE("block.honey_block.place"),
BLOCK_HONEY_BLOCK_SLIDE("block.honey_block.slide"),
BLOCK_HONEY_BLOCK_STEP("block.honey_block.step"),
BLOCK_IRON_DOOR_CLOSE("block.iron_door.close"),
BLOCK_IRON_DOOR_OPEN("block.iron_door.open"),
BLOCK_IRON_TRAPDOOR_CLOSE("block.iron_trapdoor.close"),
@@ -224,6 +235,12 @@ public enum CraftSound {
ENTITY_BAT_HURT("entity.bat.hurt"),
ENTITY_BAT_LOOP("entity.bat.loop"),
ENTITY_BAT_TAKEOFF("entity.bat.takeoff"),
ENTITY_BEE_DEATH("entity.bee.death"),
ENTITY_BEE_HURT("entity.bee.hurt"),
ENTITY_BEE_LOOP("entity.bee.loop"),
ENTITY_BEE_LOOP_AGGRESSIVE("entity.bee.loop_aggressive"),
ENTITY_BEE_POLLINATE("entity.bee.pollinate"),
ENTITY_BEE_STING("entity.bee.sting"),
ENTITY_BLAZE_AMBIENT("entity.blaze.ambient"),
ENTITY_BLAZE_BURN("entity.blaze.burn"),
ENTITY_BLAZE_DEATH("entity.blaze.death"),
@@ -400,8 +417,10 @@ public enum CraftSound {
ENTITY_ILLUSIONER_PREPARE_BLINDNESS("entity.illusioner.prepare_blindness"),
ENTITY_ILLUSIONER_PREPARE_MIRROR("entity.illusioner.prepare_mirror"),
ENTITY_IRON_GOLEM_ATTACK("entity.iron_golem.attack"),
ENTITY_IRON_GOLEM_DAMAGE("entity.iron_golem.damage"),
ENTITY_IRON_GOLEM_DEATH("entity.iron_golem.death"),
ENTITY_IRON_GOLEM_HURT("entity.iron_golem.hurt"),
ENTITY_IRON_GOLEM_REPAIR("entity.iron_golem.repair"),
ENTITY_IRON_GOLEM_STEP("entity.iron_golem.step"),
ENTITY_ITEM_BREAK("entity.item.break"),
ENTITY_ITEM_FRAME_ADD_ITEM("entity.item_frame.add_item"),
@@ -467,7 +486,6 @@ public enum CraftSound {
ENTITY_PARROT_IMITATE_CREEPER("entity.parrot.imitate.creeper"),
ENTITY_PARROT_IMITATE_DROWNED("entity.parrot.imitate.drowned"),
ENTITY_PARROT_IMITATE_ELDER_GUARDIAN("entity.parrot.imitate.elder_guardian"),
ENTITY_PARROT_IMITATE_ENDERMAN("entity.parrot.imitate.enderman"),
ENTITY_PARROT_IMITATE_ENDERMITE("entity.parrot.imitate.endermite"),
ENTITY_PARROT_IMITATE_ENDER_DRAGON("entity.parrot.imitate.ender_dragon"),
ENTITY_PARROT_IMITATE_EVOKER("entity.parrot.imitate.evoker"),
@@ -476,10 +494,8 @@ public enum CraftSound {
ENTITY_PARROT_IMITATE_HUSK("entity.parrot.imitate.husk"),
ENTITY_PARROT_IMITATE_ILLUSIONER("entity.parrot.imitate.illusioner"),
ENTITY_PARROT_IMITATE_MAGMA_CUBE("entity.parrot.imitate.magma_cube"),
ENTITY_PARROT_IMITATE_PANDA("entity.parrot.imitate.panda"),
ENTITY_PARROT_IMITATE_PHANTOM("entity.parrot.imitate.phantom"),
ENTITY_PARROT_IMITATE_PILLAGER("entity.parrot.imitate.pillager"),
ENTITY_PARROT_IMITATE_POLAR_BEAR("entity.parrot.imitate.polar_bear"),
ENTITY_PARROT_IMITATE_RAVAGER("entity.parrot.imitate.ravager"),
ENTITY_PARROT_IMITATE_SHULKER("entity.parrot.imitate.shulker"),
ENTITY_PARROT_IMITATE_SILVERFISH("entity.parrot.imitate.silverfish"),
@@ -492,9 +508,7 @@ public enum CraftSound {
ENTITY_PARROT_IMITATE_WITCH("entity.parrot.imitate.witch"),
ENTITY_PARROT_IMITATE_WITHER("entity.parrot.imitate.wither"),
ENTITY_PARROT_IMITATE_WITHER_SKELETON("entity.parrot.imitate.wither_skeleton"),
ENTITY_PARROT_IMITATE_WOLF("entity.parrot.imitate.wolf"),
ENTITY_PARROT_IMITATE_ZOMBIE("entity.parrot.imitate.zombie"),
ENTITY_PARROT_IMITATE_ZOMBIE_PIGMAN("entity.parrot.imitate.zombie_pigman"),
ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER("entity.parrot.imitate.zombie_villager"),
ENTITY_PARROT_STEP("entity.parrot.step"),
ENTITY_PHANTOM_AMBIENT("entity.phantom.ambient"),
@@ -759,6 +773,7 @@ public enum CraftSound {
ITEM_FIRECHARGE_USE("item.firecharge.use"),
ITEM_FLINTANDSTEEL_USE("item.flintandsteel.use"),
ITEM_HOE_TILL("item.hoe.till"),
ITEM_HONEY_BOTTLE_DRINK("item.honey_bottle.drink"),
ITEM_NETHER_WART_PLANT("item.nether_wart.plant"),
ITEM_SHIELD_BLOCK("item.shield.block"),
ITEM_SHIELD_BREAK("item.shield.break"),

View File

@@ -91,7 +91,9 @@ public enum CraftStatistic {
INTERACT_WITH_STONECUTTER(StatisticList.INTERACT_WITH_STONECUTTER),
BELL_RING(StatisticList.BELL_RING),
RAID_TRIGGER(StatisticList.RAID_TRIGGER),
RAID_WIN(StatisticList.RAID_WIN);
RAID_WIN(StatisticList.RAID_WIN),
INTERACT_WITH_ANVIL(StatisticList.INTERACT_WITH_ANVIL),
INTERACT_WITH_GRINDSTONE(StatisticList.INTERACT_WITH_GRINDSTONE);
private final MinecraftKey minecraftKey;
private final org.bukkit.Statistic bukkit;
private static final BiMap<MinecraftKey, org.bukkit.Statistic> statistics;

View File

@@ -21,9 +21,10 @@ import java.util.UUID;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.objects.ObjectSortedSet;
import net.minecraft.server.ArraySetSorted;
import net.minecraft.server.AxisAlignedBB;
import net.minecraft.server.BiomeBase;
import net.minecraft.server.BiomeDecoratorGroups;
import net.minecraft.server.BlockChorusFlower;
import net.minecraft.server.BlockDiodeAbstract;
import net.minecraft.server.BlockPosition;
@@ -88,7 +89,6 @@ import net.minecraft.server.TicketType;
import net.minecraft.server.Unit;
import net.minecraft.server.Vec3D;
import net.minecraft.server.WorldGenFeatureEmptyConfiguration;
import net.minecraft.server.WorldGenHugeMushroomConfiguration;
import net.minecraft.server.WorldGenerator;
import net.minecraft.server.WorldServer;
import org.apache.commons.lang.Validate;
@@ -133,6 +133,7 @@ import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Bee;
import org.bukkit.entity.Blaze;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Cat;
@@ -345,7 +346,7 @@ public class CraftWorld implements World {
@Override
public boolean isChunkGenerated(int x, int z) {
try {
return isChunkLoaded(x, z) || world.getChunkProvider().playerChunkMap.chunkExists(new ChunkCoordIntPair(x, z));
return isChunkLoaded(x, z) || world.getChunkProvider().playerChunkMap.read(new ChunkCoordIntPair(x, z)) != null;
} catch (IOException ex) {
throw new RuntimeException(ex);
}
@@ -514,7 +515,7 @@ public class CraftWorld implements World {
@Override
public Collection<Plugin> getPluginChunkTickets(int x, int z) {
ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager;
ObjectSortedSet<Ticket<?>> tickets = chunkDistanceManager.tickets.get(ChunkCoordIntPair.pair(x, z));
ArraySetSorted<Ticket<?>> tickets = chunkDistanceManager.tickets.get(ChunkCoordIntPair.pair(x, z));
if (tickets == null) {
return Collections.emptyList();
@@ -535,9 +536,9 @@ public class CraftWorld implements World {
Map<Plugin, ImmutableList.Builder<Chunk>> ret = new HashMap<>();
ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager;
for (Long2ObjectMap.Entry<ObjectSortedSet<Ticket<?>>> chunkTickets : chunkDistanceManager.tickets.long2ObjectEntrySet()) {
for (Long2ObjectMap.Entry<ArraySetSorted<Ticket<?>>> chunkTickets : chunkDistanceManager.tickets.long2ObjectEntrySet()) {
long chunkKey = chunkTickets.getLongKey();
ObjectSortedSet<Ticket<?>> tickets = chunkTickets.getValue();
ArraySetSorted<Ticket<?>> tickets = chunkTickets.getValue();
Chunk chunk = null;
for (Ticket<?> ticket : tickets) {
@@ -657,54 +658,67 @@ public class CraftWorld implements World {
BlockPosition pos = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
net.minecraft.server.WorldGenerator gen;
net.minecraft.server.WorldGenFeatureConfiguration conf = new WorldGenFeatureEmptyConfiguration();
net.minecraft.server.WorldGenFeatureConfiguration conf;
switch (type) {
case BIG_TREE:
case BIG_TREE:
gen = WorldGenerator.FANCY_TREE;
conf = BiomeDecoratorGroups.FANCY_TREE;
break;
case BIRCH:
gen = WorldGenerator.BIRCH_TREE;
gen = WorldGenerator.NORMAL_TREE;
conf = BiomeDecoratorGroups.BIRCH_TREE;
break;
case REDWOOD:
gen = WorldGenerator.SPRUCE_TREE;
gen = WorldGenerator.NORMAL_TREE;
conf = BiomeDecoratorGroups.SPRUCE_TREE;
break;
case TALL_REDWOOD:
gen = WorldGenerator.PINE_TREE;
gen = WorldGenerator.NORMAL_TREE;
conf = BiomeDecoratorGroups.PINE_TREE;
break;
case JUNGLE:
gen = WorldGenerator.MEGA_JUNGLE_TREE;
conf = BiomeDecoratorGroups.MEGA_JUNGLE_TREE;
break;
case SMALL_JUNGLE:
gen = WorldGenerator.JUNGLE_TREE;
gen = WorldGenerator.NORMAL_TREE;
conf = BiomeDecoratorGroups.JUNGLE_TREE_NOVINE;
break;
case COCOA_TREE:
gen = WorldGenerator.MEGA_JUNGLE_TREE;
gen = WorldGenerator.NORMAL_TREE;
conf = BiomeDecoratorGroups.JUNGLE_TREE;
break;
case JUNGLE_BUSH:
gen = WorldGenerator.JUNGLE_GROUND_BUSH;
conf = BiomeDecoratorGroups.JUNGLE_BUSH;
break;
case RED_MUSHROOM:
gen = WorldGenerator.HUGE_RED_MUSHROOM;
conf = new WorldGenHugeMushroomConfiguration(true);
conf = BiomeDecoratorGroups.HUGE_RED_MUSHROOM;
break;
case BROWN_MUSHROOM:
gen = WorldGenerator.HUGE_BROWN_MUSHROOM;
conf = new WorldGenHugeMushroomConfiguration(true);
conf = BiomeDecoratorGroups.HUGE_BROWN_MUSHROOM;
break;
case SWAMP:
gen = WorldGenerator.SWAMP_TREE;
gen = WorldGenerator.NORMAL_TREE;
conf = BiomeDecoratorGroups.SWAMP_TREE;
break;
case ACACIA:
gen = WorldGenerator.SAVANNA_TREE;
gen = WorldGenerator.ACACIA_TREE;
conf = BiomeDecoratorGroups.ACACIA_TREE;
break;
case DARK_OAK:
gen = WorldGenerator.DARK_OAK_TREE;
conf = BiomeDecoratorGroups.DARK_OAK_TREE;
break;
case MEGA_REDWOOD:
gen = WorldGenerator.MEGA_PINE_TREE;
gen = WorldGenerator.MEGA_SPRUCE_TREE;
conf = BiomeDecoratorGroups.MEGA_PINE_TREE;
break;
case TALL_BIRCH:
gen = WorldGenerator.SUPER_BIRCH_TREE;
gen = WorldGenerator.NORMAL_TREE;
conf = BiomeDecoratorGroups.TALL_BIRCH_TREE;
break;
case CHORUS_PLANT:
((BlockChorusFlower) Blocks.CHORUS_FLOWER).a(world, pos, rand, 8);
@@ -712,6 +726,7 @@ public class CraftWorld implements World {
case TREE:
default:
gen = WorldGenerator.NORMAL_TREE;
conf = BiomeDecoratorGroups.NORMAL_TREE;
break;
}
@@ -889,8 +904,7 @@ public class CraftWorld implements World {
net.minecraft.server.Chunk chunk = this.world.getChunkAtWorldCoords(new BlockPosition(x, 0, z));
if (chunk != null) {
BiomeBase[] biomevals = chunk.getBiomeIndex();
biomevals[((z & 0xF) << 4) | (x & 0xF)] = bb;
chunk.getBiomeIndex().setBiome(x, 0, z, bb);
chunk.markDirty(); // SPIGOT-2890
}
@@ -1620,6 +1634,8 @@ public class CraftWorld implements World {
entity = EntityTypes.PANDA.a(world);
} else if (Fox.class.isAssignableFrom(clazz)) {
entity = EntityTypes.FOX.a(world);
} else if (Bee.class.isAssignableFrom(clazz)) {
entity = EntityTypes.BEE.a(world);
}
if (entity != null) {
@@ -2172,14 +2188,14 @@ public class CraftWorld implements World {
Validate.notNull(location, "Location cannot be null");
Validate.isTrue(radius >= 0, "Radius cannot be negative");
PersistentRaid persistentRaid = world.C(); // PAIL rename getPersistentRaid
net.minecraft.server.Raid raid = persistentRaid.a(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), radius * radius); // PAIL rename getNearbyRaid
PersistentRaid persistentRaid = world.getPersistentRaid();
net.minecraft.server.Raid raid = persistentRaid.getNearbyRaid(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), radius * radius);
return (raid == null) ? null : new CraftRaid(raid);
}
@Override
public List<Raid> getRaids() {
PersistentRaid persistentRaid = world.C(); // PAIL rename getPersistentRaid
return persistentRaid.a.values().stream().map(CraftRaid::new).collect(Collectors.toList());
PersistentRaid persistentRaid = world.getPersistentRaid();
return persistentRaid.raids.values().stream().map(CraftRaid::new).collect(Collectors.toList());
}
}

View File

@@ -181,7 +181,7 @@ public class Main {
Date buildDate = new SimpleDateFormat("yyyyMMdd-HHmm").parse(Main.class.getPackage().getImplementationVendor());
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

@@ -0,0 +1,32 @@
package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.TileEntityBeehive;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Beehive;
public class CraftBeehive extends CraftBlockEntityState<TileEntityBeehive> implements Beehive {
public CraftBeehive(final Block block) {
super(block, TileEntityBeehive.class);
}
public CraftBeehive(final Material material, final TileEntityBeehive te) {
super(material, te);
}
@Override
public Location getFlower() {
BlockPosition flower = getSnapshot().flowerPos;
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());
}
}

View File

@@ -457,6 +457,8 @@ public class CraftBlock implements Block {
return new CraftLectern(this);
case SMOKER:
return new CraftSmoker(this);
case BEEHIVE:
return new CraftBeehive(this);
default:
TileEntity tileEntity = world.getTileEntity(position);
if (tileEntity != null) {
@@ -613,7 +615,7 @@ public class CraftBlock implements Block {
net.minecraft.server.ItemStack nms = CraftItemStack.asNMSCopy(item);
// Modelled off EntityHuman#hasBlock
if (iblockdata.getMaterial().isAlwaysDestroyable() || nms.b(iblockdata)) {
if (iblockdata.getMaterial().isAlwaysDestroyable() || nms.canDestroySpecialBlock(iblockdata)) {
return net.minecraft.server.Block.getDrops(iblockdata, (WorldServer) world.getMinecraftWorld(), position, world.getTileEntity(position), null, nms)
.stream().map(CraftItemStack::asBukkitCopy).collect(Collectors.toList());
} else {

View File

@@ -392,6 +392,7 @@ public class CraftBlockData implements BlockData {
register(net.minecraft.server.BlockBannerWall.class, org.bukkit.craftbukkit.block.impl.CraftBannerWall::new);
register(net.minecraft.server.BlockBarrel.class, org.bukkit.craftbukkit.block.impl.CraftBarrel::new);
register(net.minecraft.server.BlockBed.class, org.bukkit.craftbukkit.block.impl.CraftBed::new);
register(net.minecraft.server.BlockBeehive.class, org.bukkit.craftbukkit.block.impl.CraftBeehive::new);
register(net.minecraft.server.BlockBeetroot.class, org.bukkit.craftbukkit.block.impl.CraftBeetroot::new);
register(net.minecraft.server.BlockBell.class, org.bukkit.craftbukkit.block.impl.CraftBell::new);
register(net.minecraft.server.BlockBlastFurnace.class, org.bukkit.craftbukkit.block.impl.CraftBlastFurnace::new);

View File

@@ -0,0 +1,24 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Beehive;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftBeehive extends CraftBlockData implements Beehive {
private static final net.minecraft.server.BlockStateInteger HONEY_LEVEL = getInteger("honey_level");
@Override
public int getHoneyLevel() {
return get(HONEY_LEVEL);
}
@Override
public void setHoneyLevel(int honeyLevel) {
set(HONEY_LEVEL, honeyLevel);
}
@Override
public int getMaximumHoneyLevel() {
return getMax(HONEY_LEVEL);
}
}

View File

@@ -0,0 +1,53 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftBeehive extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Beehive, org.bukkit.block.data.Directional {
public CraftBeehive() {
super();
}
public CraftBeehive(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftBeehive
private static final net.minecraft.server.BlockStateInteger HONEY_LEVEL = getInteger(net.minecraft.server.BlockBeehive.class, "honey_level");
@Override
public int getHoneyLevel() {
return get(HONEY_LEVEL);
}
@Override
public void setHoneyLevel(int honeyLevel) {
set(HONEY_LEVEL, honeyLevel);
}
@Override
public int getMaximumHoneyLevel() {
return getMax(HONEY_LEVEL);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockBeehive.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);
}
}

View File

@@ -0,0 +1,85 @@
package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.EntityBee;
import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Bee;
import org.bukkit.entity.EntityType;
public class CraftBee extends CraftAnimals implements Bee {
public CraftBee(CraftServer server, EntityBee entity) {
super(server, entity);
}
@Override
public EntityBee getHandle() {
return (EntityBee) entity;
}
@Override
public String toString() {
return "CraftBee";
}
@Override
public EntityType getType() {
return EntityType.BEE;
}
@Override
public Location getHive() {
BlockPosition hive = getHandle().getHivePos();
return (hive == null) ? null : new Location(getWorld(), hive.getX(), hive.getY(), hive.getZ());
}
@Override
public void setHive(Location location) {
Preconditions.checkArgument(location == null || this.getWorld().equals(location.getWorld()), "Hive must be in same world");
getHandle().hivePos = (location == null) ? null : new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
}
@Override
public Location getFlower() {
BlockPosition flower = getHandle().getFlowerPos();
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");
getHandle().setFlowerPos(location == null ? null : new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
}
@Override
public boolean hasNectar() {
return getHandle().hasNectar();
}
@Override
public void setHasNectar(boolean nectar) {
getHandle().setHasNectar(nectar);
}
@Override
public boolean hasStung() {
return getHandle().hasStung();
}
@Override
public void setHasStung(boolean stung) {
getHandle().setHasStung(stung);
}
@Override
public int getAnger() {
return getHandle().getAnger();
}
@Override
public void setAnger(int anger) {
getHandle().setAnger(anger);
}
}

View File

@@ -16,6 +16,7 @@ import net.minecraft.server.EntityAreaEffectCloud;
import net.minecraft.server.EntityArmorStand;
import net.minecraft.server.EntityArrow;
import net.minecraft.server.EntityBat;
import net.minecraft.server.EntityBee;
import net.minecraft.server.EntityBlaze;
import net.minecraft.server.EntityBoat;
import net.minecraft.server.EntityCat;
@@ -232,6 +233,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityOcelot) { return new CraftOcelot(server, (EntityOcelot) entity); }
else if (entity instanceof EntityPanda) { return new CraftPanda(server, (EntityPanda) entity); }
else if (entity instanceof EntityFox) { return new CraftFox(server, (EntityFox) entity); }
else if (entity instanceof EntityBee) { return new CraftBee(server, (EntityBee) entity); }
else { return new CraftAnimals(server, (EntityAnimal) entity); }
}
// Monsters
@@ -372,16 +374,16 @@ 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.pitch);
}
@Override
public Location getLocation(Location loc) {
if (loc != null) {
loc.setWorld(getWorld());
loc.setX(entity.locX);
loc.setY(entity.locY);
loc.setZ(entity.locZ);
loc.setX(entity.locX());
loc.setY(entity.locY());
loc.setZ(entity.locZ());
loc.setYaw(entity.getBukkitYaw());
loc.setPitch(entity.pitch);
}

View File

@@ -71,11 +71,11 @@ public class CraftFirework extends CraftEntity implements Firework {
@Override
public boolean isShotAtAngle() {
return getHandle().i();
return getHandle().isShotAtAngle();
}
@Override
public void setShotAtAngle(boolean shotAtAngle) {
getHandle().getDataWatcher().set(EntityFireworks.d, shotAtAngle);
getHandle().getDataWatcher().set(EntityFireworks.SHOT_AT_ANGLE, shotAtAngle);
}
}

View File

@@ -53,7 +53,7 @@ public class CraftFishHook extends AbstractProjectile 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.world.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX()), MathHelper.floor(hook.locY()) + 1, MathHelper.floor(hook.locZ())))) {
return 1/300.0;
}
return 1/500.0;

View File

@@ -164,9 +164,9 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public void setBedSpawnLocation(Location location, boolean override) {
if (location == null) {
getHandle().setRespawnPosition(null, override);
getHandle().setRespawnPosition(null, override, false);
} else {
getHandle().setRespawnPosition(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override);
getHandle().setRespawnPosition(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override, false);
getHandle().spawnWorld = location.getWorld().getName();
}
}
@@ -198,7 +198,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
public void wakeup(boolean setSpawnLocation) {
Preconditions.checkState(isSleeping(), "Cannot wakeup if not sleeping");
getHandle().wakeup(true, true, setSpawnLocation);
getHandle().wakeup(true, setSpawnLocation);
}
@Override
@@ -335,7 +335,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
if (iinventory instanceof TileEntity) {
TileEntity te = (TileEntity) iinventory;
if (!te.hasWorld()) {
te.setWorld(getHandle().world);
te.setLocation(getHandle().world, getHandle().getChunkCoordinates());
}
}
}
@@ -473,7 +473,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
openCustomInventory(inventory, player, Containers.LOOM);
break;
case CARTOGRAPHY:
openCustomInventory(inventory, player, Containers.CARTOGRAPHY);
openCustomInventory(inventory, player, Containers.CARTOGRAPHY_TABLE);
break;
case GRINDSTONE:
openCustomInventory(inventory, player, Containers.GRINDSTONE);

View File

@@ -30,6 +30,6 @@ public class CraftPillager extends CraftIllager implements Pillager {
@Override
public Inventory getInventory() {
return new CraftInventory(getHandle().getInventory());
return new CraftInventory(getHandle().inventory);
}
}

View File

@@ -66,7 +66,6 @@ import net.minecraft.server.WhiteListEntry;
import net.minecraft.server.WorldServer;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang.Validate;
import org.bukkit.Achievement;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
@@ -713,21 +712,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return getHandle().fauxSleeping;
}
@Override
public void awardAchievement(Achievement achievement) {
throw new UnsupportedOperationException("Not supported in this Minecraft version.");
}
@Override
public void removeAchievement(Achievement achievement) {
throw new UnsupportedOperationException("Not supported in this Minecraft version.");
}
@Override
public boolean hasAchievement(Achievement achievement) {
throw new UnsupportedOperationException("Not supported in this Minecraft version.");
}
@Override
public void incrementStatistic(Statistic statistic) {
incrementStatistic(statistic, 1);

View File

@@ -94,7 +94,7 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
return false;
}
getHandle().e(position); // PAIL rename sleep
getHandle().entitySleep(position);
return true;
}
@@ -102,7 +102,7 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
public void wakeup() {
Preconditions.checkState(isSleeping(), "Cannot wakeup if not sleeping");
getHandle().dy(); // PAIL rename wakeup
getHandle().entityWakeup();
}
public static Profession nmsToBukkitProfession(VillagerProfession nms) {

View File

@@ -1480,18 +1480,18 @@ public class CraftEventFactory {
* Raid events
*/
public static boolean callRaidTriggerEvent(Raid raid, EntityPlayer player) {
RaidTriggerEvent event = new RaidTriggerEvent(new CraftRaid(raid), raid.i().getWorld(), player.getBukkitEntity());
RaidTriggerEvent event = new RaidTriggerEvent(new CraftRaid(raid), raid.getWorld().getWorld(), player.getBukkitEntity());
Bukkit.getPluginManager().callEvent(event);
return !event.isCancelled();
}
public static void callRaidFinishEvent(Raid raid, List<Player> players) {
RaidFinishEvent event = new RaidFinishEvent(new CraftRaid(raid), raid.i().getWorld(), players);
RaidFinishEvent event = new RaidFinishEvent(new CraftRaid(raid), raid.getWorld().getWorld(), players);
Bukkit.getPluginManager().callEvent(event);
}
public static void callRaidStopEvent(Raid raid, RaidStopEvent.Reason reason) {
RaidStopEvent event = new RaidStopEvent(new CraftRaid(raid), raid.i().getWorld(), reason);
RaidStopEvent event = new RaidStopEvent(new CraftRaid(raid), raid.getWorld().getWorld(), reason);
Bukkit.getPluginManager().callEvent(event);
}
@@ -1501,7 +1501,7 @@ public class CraftEventFactory {
for (EntityRaider entityRaider : raiders) {
craftRaiders.add((Raider) entityRaider.getBukkitEntity());
}
RaidSpawnWaveEvent event = new RaidSpawnWaveEvent(new CraftRaid(raid), raid.i().getWorld(), craftLeader, craftRaiders);
RaidSpawnWaveEvent event = new RaidSpawnWaveEvent(new CraftRaid(raid), raid.getWorld().getWorld(), craftLeader, craftRaiders);
Bukkit.getPluginManager().callEvent(event);
}
}

View File

@@ -4,6 +4,8 @@ import com.google.common.base.Preconditions;
import java.util.List;
import java.util.Random;
import net.minecraft.server.BiomeBase;
import net.minecraft.server.BiomeManager;
import net.minecraft.server.BiomeStorage;
import net.minecraft.server.Block;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.ChunkSection;
@@ -16,6 +18,7 @@ import net.minecraft.server.ITileEntity;
import net.minecraft.server.MobSpawnerCat;
import net.minecraft.server.MobSpawnerPatrol;
import net.minecraft.server.MobSpawnerPhantom;
import net.minecraft.server.ProtoChunk;
import net.minecraft.server.RegionLimitedWorldAccess;
import net.minecraft.server.StructureGenerator;
import net.minecraft.server.TileEntity;
@@ -43,16 +46,16 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
private final VillageSiege villageSiege = new VillageSiege();
private static class CustomBiomeGrid implements BiomeGrid {
BiomeBase[] biome;
BiomeStorage biome;
@Override
public Biome getBiome(int x, int z) {
return CraftBlock.biomeBaseToBiome(biome[(z << 4) | x]);
return CraftBlock.biomeBaseToBiome(biome.getBiome(x, 0, z));
}
@Override
public void setBiome(int x, int z, Biome bio) {
biome[(z << 4) | x] = CraftBlock.biomeToBiomeBase(bio);
biome.setBiome(x, 0, z, CraftBlock.biomeToBiomeBase(bio));
}
}
@@ -66,14 +69,14 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
}
@Override
public void buildBase(IChunkAccess ichunkaccess) {
public void buildBase(RegionLimitedWorldAccess regionlimitedworldaccess, IChunkAccess ichunkaccess) {
int x = ichunkaccess.getPos().x;
int z = ichunkaccess.getPos().z;
random.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
// Get default biome data for chunk
CustomBiomeGrid biomegrid = new CustomBiomeGrid();
biomegrid.biome = this.getWorldChunkManager().getBiomeBlock(x << 4, z << 4, 16, 16);
biomegrid.biome = new BiomeStorage(ichunkaccess.getPos(), this.getWorldChunkManager());
ChunkData data;
if (generator.isParallelCapable()) {
@@ -102,7 +105,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
}
// Set biome grid
ichunkaccess.a(biomegrid.biome);
((ProtoChunk) ichunkaccess).a(biomegrid.biome);
if (craftData.getTiles() != null) {
for (BlockPosition pos : craftData.getTiles()) {
@@ -120,7 +123,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator<GeneratorSettin
}
@Override
public void doCarving(IChunkAccess ichunkaccess, WorldGenStage.Features worldgenstage_features) {
public void doCarving(BiomeManager biomemanager, IChunkAccess ichunkaccess, WorldGenStage.Features worldgenstage_features) {
}
@Override

View File

@@ -0,0 +1,32 @@
package org.bukkit.craftbukkit.inventory;
import net.minecraft.server.IRecipeComplex;
import net.minecraft.server.MinecraftServer;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.inventory.ComplexRecipe;
import org.bukkit.inventory.ItemStack;
public class CraftComplexRecipe implements CraftRecipe, ComplexRecipe {
private final IRecipeComplex recipe;
public CraftComplexRecipe(IRecipeComplex recipe) {
this.recipe = recipe;
}
@Override
public ItemStack getResult() {
return CraftItemStack.asCraftMirror(recipe.getResult());
}
@Override
public NamespacedKey getKey() {
return CraftNamespacedKey.fromMinecraft(recipe.getKey());
}
@Override
public void addToCraftingManager() {
MinecraftServer.getServer().getCraftingManager().addRecipe(recipe);
}
}

View File

@@ -150,7 +150,7 @@ public class CraftContainer extends Container {
case LOOM:
return Containers.LOOM;
case CARTOGRAPHY:
return Containers.CARTOGRAPHY;
return Containers.CARTOGRAPHY_TABLE;
case GRINDSTONE:
return Containers.GRINDSTONE;
case STONECUTTER:

View File

@@ -141,6 +141,7 @@ public final class CraftItemFactory implements ItemFactory {
case YELLOW_WALL_BANNER:
return meta instanceof CraftMetaBanner ? meta : new CraftMetaBanner(meta);
case BAT_SPAWN_EGG:
case BEE_SPAWN_EGG:
case BLAZE_SPAWN_EGG:
case CAT_SPAWN_EGG:
case CAVE_SPIDER_SPAWN_EGG:
@@ -258,6 +259,7 @@ public final class CraftItemFactory implements ItemFactory {
case JIGSAW:
case LECTERN:
case SMOKER:
case BEEHIVE:
return new CraftMetaBlockState(meta, material);
case TROPICAL_FISH_BUCKET:
return meta instanceof CraftMetaTropicalFishBucket ? meta : new CraftMetaTropicalFishBucket(meta);

View File

@@ -392,6 +392,7 @@ public final class CraftItemStack extends ItemStack {
case YELLOW_WALL_BANNER:
return new CraftMetaBanner(item.getTag());
case BAT_SPAWN_EGG:
case BEE_SPAWN_EGG:
case BLAZE_SPAWN_EGG:
case CAT_SPAWN_EGG:
case CAVE_SPIDER_SPAWN_EGG:
@@ -509,6 +510,7 @@ public final class CraftItemStack extends ItemStack {
case JIGSAW:
case LECTERN:
case SMOKER:
case BEEHIVE:
return new CraftMetaBlockState(item.getTag(), CraftMagicNumbers.getMaterial(item.getItem()));
case TROPICAL_FISH_BUCKET:
return new CraftMetaTropicalFishBucket(item.getTag());
@@ -556,6 +558,10 @@ public final class CraftItemStack extends ItemStack {
((CraftMetaItem) itemMeta).applyToItem(tag);
item.convertStack(((CraftMetaItem) itemMeta).getVersion());
// SpigotCraft#463 this is required now by the Vanilla client, so mimic ItemStack constructor in ensuring it
if (item.getItem() != null && item.getItem().usesDurability()) {
item.setDamage(item.getDamage());
}
return true;
}

View File

@@ -90,16 +90,16 @@ public class CraftMerchantCustom extends CraftMerchant {
}
@Override
public void s(int i) {
public void setExperience(int i) {
}
@Override
public boolean ea() {
public boolean isRegularVillager() {
return false; // is-regular-villager flag (hides some gui elements: xp bar, name suffix)
}
@Override
public SoundEffect eb() {
public SoundEffect getTradeSound() {
return SoundEffects.ENTITY_VILLAGER_YES;
}
}

View File

@@ -10,6 +10,7 @@ import net.minecraft.server.TileEntity;
import net.minecraft.server.TileEntityBanner;
import net.minecraft.server.TileEntityBarrel;
import net.minecraft.server.TileEntityBeacon;
import net.minecraft.server.TileEntityBeehive;
import net.minecraft.server.TileEntityBell;
import net.minecraft.server.TileEntityBlastFurnace;
import net.minecraft.server.TileEntityBrewingStand;
@@ -42,6 +43,7 @@ import org.bukkit.configuration.serialization.DelegateDeserialization;
import org.bukkit.craftbukkit.block.CraftBanner;
import org.bukkit.craftbukkit.block.CraftBarrel;
import org.bukkit.craftbukkit.block.CraftBeacon;
import org.bukkit.craftbukkit.block.CraftBeehive;
import org.bukkit.craftbukkit.block.CraftBell;
import org.bukkit.craftbukkit.block.CraftBlastFurnace;
import org.bukkit.craftbukkit.block.CraftBlockEntityState;
@@ -238,6 +240,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
case JIGSAW:
case LECTERN:
case SMOKER:
case BEEHIVE:
return true;
}
return false;
@@ -500,6 +503,11 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
te = new TileEntitySmoker();
}
return new CraftSmoker(material, (TileEntitySmoker) te);
case BEEHIVE:
if (te == null){
te = new TileEntityBeehive();
}
return new CraftBeehive(material, (TileEntityBeehive) te);
default:
throw new IllegalStateException("Missing blockState for " + material);
}
@@ -665,6 +673,8 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
case SMOKER:
valid = blockState instanceof CraftSmoker;
break;
case BEEHIVE:
valid = blockState instanceof CraftBeehive;
default:
valid = false;
break;

View File

@@ -128,7 +128,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
if (hasPages()) {
NBTTagList list = new NBTTagList();
for (IChatBaseComponent page : pages) {
list.add(new NBTTagString(page == null ? "" : page.e())); // PAIL getLegacyString
list.add(NBTTagString.a(page == null ? "" : page.getLegacyString()));
}
itemData.set(BOOK_PAGES.NBT, list);
}

View File

@@ -65,7 +65,7 @@ class CraftMetaBookSigned extends CraftMetaBook implements BookMeta {
if (hasPages()) {
NBTTagList list = new NBTTagList();
for (IChatBaseComponent page : pages) {
list.add(new NBTTagString(
list.add(NBTTagString.a(
ChatSerializer.a(page)
));
}

View File

@@ -615,10 +615,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Overridden
void applyToItem(NBTTagCompound itemTag) {
if (hasDisplayName()) {
setDisplayTag(itemTag, NAME.NBT, new NBTTagString(CraftChatMessage.toJSON(displayName)));
setDisplayTag(itemTag, NAME.NBT, NBTTagString.a(CraftChatMessage.toJSON(displayName)));
}
if (hasLocalizedName()){
setDisplayTag(itemTag, LOCNAME.NBT, new NBTTagString(CraftChatMessage.toJSON(locName)));
setDisplayTag(itemTag, LOCNAME.NBT, NBTTagString.a(CraftChatMessage.toJSON(locName)));
}
if (hasLore()) {
@@ -675,7 +675,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
NBTTagList tagList = new NBTTagList();
for (IChatBaseComponent value : list) {
// SPIGOT-5342 - horrible hack as 0 version does not go through the Mojang updater
tagList.add(new NBTTagString(version <= 0 || version >= 1803 ? CraftChatMessage.toJSON(value) : CraftChatMessage.fromComponent(value, EnumChatFormat.DARK_PURPLE))); // SPIGOT-4935
tagList.add(NBTTagString.a(version <= 0 || version >= 1803 ? CraftChatMessage.toJSON(value) : CraftChatMessage.fromComponent(value, EnumChatFormat.DARK_PURPLE))); // SPIGOT-4935
}
return tagList;

View File

@@ -66,7 +66,7 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo
if (hasRecipes()) {
NBTTagList list = new NBTTagList();
for (NamespacedKey recipe : this.recipes) {
list.add(new NBTTagString(recipe.toString()));
list.add(NBTTagString.a(recipe.toString()));
}
itemData.set(BOOK_RECIPES.NBT, list);
}

View File

@@ -51,7 +51,7 @@ class CraftMetaLeatherArmor extends CraftMetaItem implements LeatherArmorMeta {
super.applyToItem(itemTag);
if (hasColor()) {
setDisplayTag(itemTag, COLOR.NBT, new NBTTagInt(color.asRGB()));
setDisplayTag(itemTag, COLOR.NBT, NBTTagInt.a(color.asRGB()));
}
}

View File

@@ -105,11 +105,11 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta {
}
if (hasLocationName()) {
setDisplayTag(tag, MAP_LOC_NAME.NBT, new NBTTagString(getLocationName()));
setDisplayTag(tag, MAP_LOC_NAME.NBT, NBTTagString.a(getLocationName()));
}
if (hasColor()) {
setDisplayTag(tag, MAP_COLOR.NBT, new NBTTagInt(color.asRGB()));
setDisplayTag(tag, MAP_COLOR.NBT, NBTTagInt.a(color.asRGB()));
}
}

View File

@@ -111,6 +111,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
boolean applicableTo(Material type) {
switch (type) {
case BAT_SPAWN_EGG:
case BEE_SPAWN_EGG:
case BLAZE_SPAWN_EGG:
case CAT_SPAWN_EGG:
case CAVE_SPIDER_SPAWN_EGG:

View File

@@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.inventory.util;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.DimensionManager;
import net.minecraft.server.IInventory;
import net.minecraft.server.MinecraftServer;
@@ -49,7 +50,7 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat
@Override
public IInventory getTileEntity() {
TileEntityFurnace furnace = new TileEntityFurnaceFurnace();
furnace.setWorld(MinecraftServer.getServer().getWorldServer(DimensionManager.OVERWORLD)); // TODO: customize this if required
furnace.setLocation(MinecraftServer.getServer().getWorldServer(DimensionManager.OVERWORLD), BlockPosition.ZERO); // TODO: customize this if required
return furnace;
}

View File

@@ -110,29 +110,29 @@ public final class CraftPersistentDataTypeRegistry {
Primitives
*/
if (Objects.equals(Byte.class, type)) {
return createAdapter(Byte.class, NBTTagByte.class, NBTTagByte::new, NBTTagByte::asByte);
return createAdapter(Byte.class, NBTTagByte.class, NBTTagByte::a, NBTTagByte::asByte);
}
if (Objects.equals(Short.class, type)) {
return createAdapter(Short.class, NBTTagShort.class, NBTTagShort::new, NBTTagShort::asShort);
return createAdapter(Short.class, NBTTagShort.class, NBTTagShort::a, NBTTagShort::asShort);
}
if (Objects.equals(Integer.class, type)) {
return createAdapter(Integer.class, NBTTagInt.class, NBTTagInt::new, NBTTagInt::asInt);
return createAdapter(Integer.class, NBTTagInt.class, NBTTagInt::a, NBTTagInt::asInt);
}
if (Objects.equals(Long.class, type)) {
return createAdapter(Long.class, NBTTagLong.class, NBTTagLong::new, NBTTagLong::asLong);
return createAdapter(Long.class, NBTTagLong.class, NBTTagLong::a, NBTTagLong::asLong);
}
if (Objects.equals(Float.class, type)) {
return createAdapter(Float.class, NBTTagFloat.class, NBTTagFloat::new, NBTTagFloat::asFloat);
return createAdapter(Float.class, NBTTagFloat.class, NBTTagFloat::a, NBTTagFloat::asFloat);
}
if (Objects.equals(Double.class, type)) {
return createAdapter(Double.class, NBTTagDouble.class, NBTTagDouble::new, NBTTagDouble::asDouble);
return createAdapter(Double.class, NBTTagDouble.class, NBTTagDouble::a, NBTTagDouble::asDouble);
}
/*
String
*/
if (Objects.equals(String.class, type)) {
return createAdapter(String.class, NBTTagString.class, NBTTagString::new, NBTTagString::asString);
return createAdapter(String.class, NBTTagString.class, NBTTagString::a, NBTTagString::asString);
}
/*

View File

@@ -33,7 +33,7 @@ public class BlockStateListPopulator extends DummyGeneratorAccess {
@Override
public Fluid getFluid(BlockPosition bp) {
CraftBlockState state = list.get(bp);
return (state != null) ? state.getHandle().p() : world.getFluid(bp);
return (state != null) ? state.getHandle().getFluid() : world.getFluid(bp);
}
@Override

View File

@@ -188,12 +188,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
* @return string
*/
public String getMappingsVersion() {
return "11ae498d9cf909730659b6357e7c2afa";
return "e50e3dd1d07234cc9c09cb516a951227";
}
@Override
public int getDataVersion() {
return SharedConstants.a().getWorldVersion();
return SharedConstants.getGameVersion().getWorldVersion();
}
@Override
@@ -247,7 +247,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
return file.delete();
}
private static final List<String> SUPPORTED_API = Arrays.asList("1.13", "1.14");
private static final List<String> SUPPORTED_API = Arrays.asList("1.13", "1.14", "1.15");
@Override
public void checkSupported(PluginDescriptionFile pdf) throws InvalidPluginException {

View File

@@ -77,16 +77,16 @@ public class CraftNBTTagConfigSerializer {
throw new RuntimeException("Could not deserialize found list ", e);
}
} else if (INTEGER.matcher(string).matches()) { //Read integers on our own
return new NBTTagInt(Integer.parseInt(string.substring(0, string.length() - 1)));
return NBTTagInt.a(Integer.parseInt(string.substring(0, string.length() - 1)));
} else if (DOUBLE.matcher(string).matches()) {
return new NBTTagDouble(Double.parseDouble(string.substring(0, string.length() - 1)));
return NBTTagDouble.a(Double.parseDouble(string.substring(0, string.length() - 1)));
} else {
NBTBase nbtBase = MOJANGSON_PARSER.parseLiteral(string);
if (nbtBase instanceof NBTTagInt) { // If this returns an integer, it did not use our method from above
return new NBTTagString(nbtBase.asString()); // It then is a string that was falsely read as an int
return NBTTagString.a(nbtBase.asString()); // It then is a string that was falsely read as an int
} else if (nbtBase instanceof NBTTagDouble) {
return new NBTTagString(String.valueOf(((NBTTagDouble) nbtBase).asDouble())); // Doubles add "d" at the end
return NBTTagString.a(String.valueOf(((NBTTagDouble) nbtBase).asDouble())); // Doubles add "d" at the end
} else {
return nbtBase;
}

View File

@@ -5,13 +5,13 @@ import java.util.Random;
import java.util.function.Predicate;
import net.minecraft.server.AxisAlignedBB;
import net.minecraft.server.BiomeBase;
import net.minecraft.server.BiomeManager;
import net.minecraft.server.Block;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.ChunkStatus;
import net.minecraft.server.DifficultyDamageScaler;
import net.minecraft.server.Entity;
import net.minecraft.server.EntityHuman;
import net.minecraft.server.EnumSkyBlock;
import net.minecraft.server.Fluid;
import net.minecraft.server.FluidType;
import net.minecraft.server.GeneratorAccess;
@@ -19,6 +19,7 @@ import net.minecraft.server.HeightMap;
import net.minecraft.server.IBlockData;
import net.minecraft.server.IChunkAccess;
import net.minecraft.server.IChunkProvider;
import net.minecraft.server.LightEngine;
import net.minecraft.server.ParticleParam;
import net.minecraft.server.SoundCategory;
import net.minecraft.server.SoundEffect;
@@ -111,21 +112,11 @@ public class DummyGeneratorAccess implements GeneratorAccess {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getLightLevel(BlockPosition bp, int i) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public IChunkAccess getChunkAt(int i, int i1, ChunkStatus cs, boolean bln) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public BlockPosition getHighestBlockYAt(HeightMap.Type type, BlockPosition bp) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int a(HeightMap.Type type, int i, int i1) {
throw new UnsupportedOperationException("Not supported yet.");
@@ -137,12 +128,17 @@ public class DummyGeneratorAccess implements GeneratorAccess {
}
@Override
public WorldBorder getWorldBorder() {
public BiomeManager d() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean e() {
public BiomeBase a(int i, int i1, int i2) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean p_() {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -157,27 +153,27 @@ public class DummyGeneratorAccess implements GeneratorAccess {
}
@Override
public BiomeBase getBiome(BlockPosition bp) {
public LightEngine e() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getBrightness(EnumSkyBlock esb, BlockPosition bp) {
public TileEntity getTileEntity(BlockPosition blockposition) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public TileEntity getTileEntity(BlockPosition bp) {
public IBlockData getType(BlockPosition blockposition) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public IBlockData getType(BlockPosition bp) {
public Fluid getFluid(BlockPosition blockposition) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Fluid getFluid(BlockPosition bp) {
public WorldBorder getWorldBorder() {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -197,7 +193,7 @@ public class DummyGeneratorAccess implements GeneratorAccess {
}
@Override
public boolean b(BlockPosition blockposition, boolean flag) {
public boolean a(BlockPosition blockposition, boolean flag, Entity entity) {
throw new UnsupportedOperationException("Not supported yet.");
}
}