Update to Minecraft 1.19.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-12-08 03:00:00 +11:00
parent a13136ada2
commit 8b26bb8f3e
305 changed files with 3331 additions and 2864 deletions
@@ -22,9 +22,9 @@
private final Map<EntityHuman, Vec3D> hitPlayers;
+ public boolean wasCanceled = false; // CraftBukkit - add field
public Explosion(World world, @Nullable Entity entity, double d0, double d1, double d2, float f) {
this(world, entity, d0, d1, d2, f, false, Explosion.Effect.DESTROY);
@@ -82,7 +92,7 @@
public Explosion(World world, @Nullable Entity entity, double d0, double d1, double d2, float f, List<BlockPosition> list) {
this(world, entity, d0, d1, d2, f, false, Explosion.Effect.DESTROY_WITH_DECAY, list);
@@ -78,7 +88,7 @@
this.hitPlayers = Maps.newHashMap();
this.level = world;
this.source = entity;
@@ -33,7 +33,7 @@
this.x = d0;
this.y = d1;
this.z = d2;
@@ -132,6 +142,11 @@
@@ -128,6 +138,11 @@
}
public void explode() {
@@ -45,7 +45,7 @@
this.level.gameEvent(this.source, GameEvent.EXPLODE, new Vec3D(this.x, this.y, this.z));
Set<BlockPosition> set = Sets.newHashSet();
boolean flag = true;
@@ -215,7 +230,35 @@
@@ -211,7 +226,35 @@
double d12 = (double) getSeenPercent(vec3d, entity);
double d13 = (1.0D - d7) * d12;
@@ -82,7 +82,7 @@
double d14 = d13;
if (entity instanceof EntityLiving) {
@@ -258,6 +301,51 @@
@@ -254,6 +297,51 @@
SystemUtils.shuffle(this.toBlow, this.level.random);
ObjectListIterator objectlistiterator = this.toBlow.iterator();
@@ -134,18 +134,18 @@
while (objectlistiterator.hasNext()) {
BlockPosition blockposition = (BlockPosition) objectlistiterator.next();
@@ -276,8 +364,8 @@
@@ -272,8 +360,8 @@
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.level.getBlockEntity(blockposition) : null;
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder(worldserver)).withRandom(this.level.random).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParameters.THIS_ENTITY, this.source);
- if (this.blockInteraction == Explosion.Effect.DESTROY) {
- if (this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY) {
- loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, this.radius);
+ if (this.blockInteraction == Explosion.Effect.DESTROY || yield < 1.0F) { // CraftBukkit - add yield
+ if (this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY || yield < 1.0F) { // CraftBukkit - add yield
+ loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield
}
iblockdata.spawnAfterBreak(worldserver, blockposition, ItemStack.EMPTY, flag2);
@@ -309,7 +397,11 @@
@@ -305,7 +393,11 @@
BlockPosition blockposition2 = (BlockPosition) objectlistiterator1.next();
if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockposition2).isAir() && this.level.getBlockState(blockposition2.below()).isSolidRender(this.level, blockposition2.below())) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/GameRules.java
+++ b/net/minecraft/world/level/GameRules.java
@@ -119,7 +119,7 @@
@@ -126,7 +126,7 @@
}
public <T extends GameRules.GameRuleValue<T>> T getRule(GameRules.GameRuleKey<T> gamerules_gamerulekey) {
@@ -9,7 +9,7 @@
}
public NBTTagCompound createTag() {
@@ -133,7 +133,7 @@
@@ -140,7 +140,7 @@
private void loadFromTag(DynamicLike<?> dynamiclike) {
this.rules.forEach((gamerules_gamerulekey, gamerules_gamerulevalue) -> {
@@ -18,7 +18,7 @@
Objects.requireNonNull(gamerules_gamerulevalue);
optional.ifPresent(gamerules_gamerulevalue::deserialize);
@@ -153,8 +153,8 @@
@@ -160,8 +160,8 @@
}
private static <T extends GameRules.GameRuleValue<T>> void callVisitorCap(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<?> gamerules_gamerulekey, GameRules.GameRuleDefinition<?> gamerules_gameruledefinition) {
@@ -29,7 +29,7 @@
}
public void assignFrom(GameRules gamerules, @Nullable MinecraftServer minecraftserver) {
@@ -246,7 +246,7 @@
@@ -253,7 +253,7 @@
}
public T createRule() {
@@ -38,7 +38,7 @@
}
public void callVisitor(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
@@ -276,7 +276,7 @@
@@ -283,7 +283,7 @@
}
@@ -47,7 +47,7 @@
public abstract String serialize();
@@ -342,7 +342,7 @@
@@ -349,7 +349,7 @@
}
@Override
@@ -56,7 +56,7 @@
this.value = Boolean.parseBoolean(s);
}
@@ -407,7 +407,7 @@
@@ -414,7 +414,7 @@
}
@Override
@@ -14,7 +14,7 @@
return new NextTickListEntry<>(t0, blockposition, this.getLevelData().getGameTime() + (long) i, this.nextSubTickCount());
}
@@ -110,4 +110,6 @@
@@ -114,4 +114,6 @@
default void gameEvent(GameEvent gameevent, BlockPosition blockposition, GameEvent.a gameevent_a) {
this.gameEvent(gameevent, Vec3D.atCenterOf(blockposition), gameevent_a);
}
@@ -1,14 +1,14 @@
--- a/net/minecraft/world/level/MobSpawnerAbstract.java
+++ b/net/minecraft/world/level/MobSpawnerAbstract.java
@@ -47,6 +47,7 @@
@@ -50,6 +50,7 @@
public void setEntityId(EntityTypes<?> entitytypes) {
this.nextSpawnData.getEntityToSpawn().putString("id", IRegistry.ENTITY_TYPE.getKey(entitytypes).toString());
public void setEntityId(EntityTypes<?> entitytypes, @Nullable World world, RandomSource randomsource, BlockPosition blockposition) {
this.getOrCreateNextSpawnData(world, randomsource, blockposition).getEntityToSpawn().putString("id", BuiltInRegistries.ENTITY_TYPE.getKey(entitytypes).toString());
+ this.spawnPotentials = SimpleWeightedRandomList.empty(); // CraftBukkit - SPIGOT-3496, MC-92282
}
private boolean isNearPlayer(World world, BlockPosition blockposition) {
@@ -148,7 +149,7 @@
@@ -152,7 +153,7 @@
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/SpawnerCreature.java
+++ b/net/minecraft/world/level/SpawnerCreature.java
@@ -48,6 +48,13 @@
@@ -49,6 +49,13 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -14,7 +14,7 @@
public final class SpawnerCreature {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -112,10 +119,25 @@
@@ -113,10 +120,25 @@
EnumCreatureType[] aenumcreaturetype = SpawnerCreature.SPAWNING_CATEGORIES;
int i = aenumcreaturetype.length;
@@ -41,7 +41,7 @@
Objects.requireNonNull(spawnercreature_d);
SpawnerCreature.c spawnercreature_c = spawnercreature_d::canSpawn;
@@ -200,10 +222,15 @@
@@ -201,10 +223,15 @@
entityinsentient.moveTo(d0, (double) i, d1, worldserver.random.nextFloat() * 360.0F, 0.0F);
if (isValidPositionForMob(worldserver, entityinsentient, d2)) {
groupdataentity = entityinsentient.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityinsentient.blockPosition()), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
@@ -61,7 +61,7 @@
if (j >= entityinsentient.getMaxSpawnClusterSize()) {
return;
}
@@ -384,7 +411,7 @@
@@ -390,7 +417,7 @@
if (entityinsentient.checkSpawnRules(worldaccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.checkSpawnObstruction(worldaccess)) {
groupdataentity = entityinsentient.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(entityinsentient.blockPosition()), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
@@ -70,7 +70,7 @@
flag = true;
}
}
@@ -505,8 +532,10 @@
@@ -511,8 +538,10 @@
return this.unmodifiableMobCategoryCounts;
}
@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/World.java
+++ b/net/minecraft/world/level/World.java
@@ -67,6 +67,31 @@
import net.minecraft.world.phys.AxisAlignedBB;
@@ -70,6 +70,31 @@
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.scores.Scoreboard;
+// CraftBukkit start
@@ -31,8 +31,8 @@
+
public abstract class World implements GeneratorAccess, AutoCloseable {
public static final Codec<ResourceKey<World>> RESOURCE_KEY_CODEC = ResourceKey.codec(IRegistry.DIMENSION_REGISTRY);
@@ -108,7 +133,43 @@
public static final Codec<ResourceKey<World>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION);
@@ -111,7 +136,43 @@
private final ResourceKey<World> dimension;
private long subTickCount;
@@ -77,7 +77,7 @@
this.profiler = supplier;
this.levelData = worlddatamutable;
this.dimensionTypeRegistration = holder;
@@ -123,12 +184,12 @@
@@ -126,12 +187,12 @@
this.worldBorder = new WorldBorder() {
@Override
public double getCenterX() {
@@ -92,7 +92,7 @@
}
};
} else {
@@ -139,6 +200,42 @@
@@ -142,6 +203,42 @@
this.biomeManager = new BiomeManager(this, i);
this.isDebug = flag1;
this.neighborUpdater = new CollectingNeighborUpdater(this, j);
@@ -135,7 +135,7 @@
}
@Override
@@ -196,6 +293,17 @@
@@ -199,6 +296,17 @@
@Override
public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
@@ -153,7 +153,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return false;
} else if (!this.isClientSide && this.isDebug()) {
@@ -203,9 +311,24 @@
@@ -206,9 +314,24 @@
} else {
Chunk chunk = this.getChunkAt(blockposition);
Block block = iblockdata.getBlock();
@@ -179,7 +179,7 @@
return false;
} else {
IBlockData iblockdata2 = this.getBlockState(blockposition);
@@ -216,6 +339,7 @@
@@ -219,6 +342,7 @@
this.getProfiler().pop();
}
@@ -187,7 +187,7 @@
if (iblockdata2 == iblockdata) {
if (iblockdata1 != iblockdata2) {
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
@@ -242,12 +366,69 @@
@@ -245,12 +369,69 @@
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
}
@@ -257,7 +257,7 @@
public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
@Override
@@ -333,6 +514,14 @@
@@ -336,6 +517,14 @@
@Override
public IBlockData getBlockState(BlockPosition blockposition) {
@@ -272,7 +272,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return Blocks.VOID_AIR.defaultBlockState();
} else {
@@ -470,6 +659,16 @@
@@ -527,6 +716,16 @@
@Nullable
@Override
public TileEntity getBlockEntity(BlockPosition blockposition) {
@@ -289,7 +289,7 @@
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
}
@@ -477,6 +676,12 @@
@@ -534,6 +733,12 @@
BlockPosition blockposition = tileentity.getBlockPos();
if (!this.isOutsideBuildHeight(blockposition)) {
@@ -302,10 +302,10 @@
this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity);
}
}
@@ -595,7 +800,7 @@
@@ -664,7 +869,7 @@
for (int j = 0; j < i; ++j) {
EntityComplexPart entitycomplexpart = aentitycomplexpart[j];
for (int k = 0; k < j; ++k) {
EntityComplexPart entitycomplexpart = aentitycomplexpart[k];
- T t0 = (Entity) entitytypetest.tryCast(entitycomplexpart);
+ T t0 = entitytypetest.tryCast(entitycomplexpart); // CraftBukkit - decompile error
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/Block.java
+++ b/net/minecraft/world/level/block/Block.java
@@ -356,7 +356,13 @@
@@ -354,7 +354,13 @@
EntityItem entityitem = (EntityItem) supplier.get();
entityitem.setDefaultPickUpDelay();
@@ -15,7 +15,7 @@
}
}
@@ -382,7 +388,7 @@
@@ -380,7 +386,7 @@
public void playerDestroy(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, @Nullable TileEntity tileentity, ItemStack itemstack) {
entityhuman.awardStat(StatisticList.BLOCK_MINED.get(this));
@@ -24,7 +24,7 @@
dropResources(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
}
@@ -522,16 +528,24 @@
@@ -516,16 +522,24 @@
return this.builtInRegistryHolder;
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBed.java
+++ b/net/minecraft/world/level/block/BlockBed.java
@@ -87,7 +87,8 @@
@@ -86,7 +86,8 @@
}
}
@@ -10,7 +10,7 @@
world.removeBlock(blockposition, false);
BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
@@ -104,7 +105,16 @@
@@ -105,7 +106,16 @@
return EnumInteractionResult.SUCCESS;
} else {
@@ -27,7 +27,7 @@
if (entityhuman_enumbedresult.getMessage() != null) {
entityhuman.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
}
@@ -115,8 +125,27 @@
@@ -116,8 +126,29 @@
}
}
@@ -42,7 +42,9 @@
+ world.removeBlock(blockposition1, false);
+ }
+
+ world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), (ExplosionDamageCalculator) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.Effect.DESTROY);
+ Vec3D vec3d = blockposition.getCenter();
+
+ world.explode((Entity) null, DamageSource.badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, World.a.BLOCK);
+ return EnumInteractionResult.SUCCESS;
+ }
+ }
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockButtonAbstract.java
+++ b/net/minecraft/world/level/block/BlockButtonAbstract.java
@@ -27,6 +27,11 @@
@@ -26,6 +26,11 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,10 +9,10 @@
+import org.bukkit.event.entity.EntityInteractEvent;
+// CraftBukkit end
+
public abstract class BlockButtonAbstract extends BlockAttachable {
public class BlockButtonAbstract extends BlockAttachable {
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
@@ -97,6 +102,19 @@
@@ -109,6 +114,19 @@
if ((Boolean) iblockdata.getValue(BlockButtonAbstract.POWERED)) {
return EnumInteractionResult.CONSUME;
} else {
@@ -32,46 +32,22 @@
this.press(iblockdata, world, blockposition);
this.playSound(entityhuman, world, blockposition, true);
world.gameEvent((Entity) entityhuman, GameEvent.BLOCK_ACTIVATE, blockposition);
@@ -148,6 +166,16 @@
if (this.sensitive) {
this.checkPressed(iblockdata, worldserver, blockposition);
} else {
+ // CraftBukkit start
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
+ worldserver.getCraftServer().getPluginManager().callEvent(eventRedstone);
+
+ if (eventRedstone.getNewCurrent() > 0) {
+ return;
+ }
+ // CraftBukkit end
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockButtonAbstract.POWERED, false), 3);
this.updateNeighbours(iblockdata, worldserver, blockposition);
this.playSound((EntityHuman) null, worldserver, blockposition, false);
@@ -169,11 +197,48 @@
boolean flag = !list.isEmpty();
@@ -171,11 +189,36 @@
}
protected void checkPressed(IBlockData iblockdata, World world, BlockPosition blockposition) {
- EntityArrow entityarrow = this.arrowsCanPress ? (EntityArrow) world.getEntitiesOfClass(EntityArrow.class, iblockdata.getShape(world, blockposition).bounds().move(blockposition)).stream().findFirst().orElse((Object) null) : null;
+ EntityArrow entityarrow = this.arrowsCanPress ? (EntityArrow) world.getEntitiesOfClass(EntityArrow.class, iblockdata.getShape(world, blockposition).bounds().move(blockposition)).stream().findFirst().orElse(null) : null; // CraftBukkit - decompile error
boolean flag = entityarrow != null;
boolean flag1 = (Boolean) iblockdata.getValue(BlockButtonAbstract.POWERED);
+ // CraftBukkit start - Call interact event when arrows turn on wooden buttons
+ if (flag1 != flag && flag) {
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ boolean allowed = false;
+ EntityInteractEvent event = new EntityInteractEvent(entityarrow.getBukkitEntity(), block);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ // If all of the events are cancelled block the button press, else allow
+ for (Object object : list) {
+ if (object != null) {
+ EntityInteractEvent event = new EntityInteractEvent(((Entity) object).getBukkitEntity(), block);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ allowed = true;
+ break;
+ }
+ }
+ }
+
+ if (!allowed) {
+ if (event.isCancelled()) {
+ return;
+ }
+ }
@@ -94,8 +70,3 @@
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockButtonAbstract.POWERED, flag), 3);
this.updateNeighbours(iblockdata, world, blockposition);
this.playSound((EntityHuman) null, world, blockposition, flag);
- world.gameEvent((Entity) list.stream().findFirst().orElse((Object) null), flag ? GameEvent.BLOCK_ACTIVATE : GameEvent.BLOCK_DEACTIVATE, blockposition);
+ world.gameEvent((Entity) list.stream().findFirst().orElse(null), flag ? GameEvent.BLOCK_ACTIVATE : GameEvent.BLOCK_DEACTIVATE, blockposition); // CraftBukkit - decompile error
}
if (flag) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockDoor.java
+++ b/net/minecraft/world/level/block/BlockDoor.java
@@ -33,6 +33,8 @@
@@ -35,6 +35,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,7 +9,7 @@
public class BlockDoor extends Block {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
@@ -191,9 +193,24 @@
@@ -189,9 +191,24 @@
@Override
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
@@ -34,5 +34,5 @@
+ boolean flag1 = eventRedstone.getNewCurrent() > 0;
+ // CraftBukkit end
if (flag1 != (Boolean) iblockdata.getValue(BlockDoor.OPEN)) {
this.playSound(world, blockposition, flag1);
this.playSound((Entity) null, world, blockposition, flag1);
world.gameEvent((Entity) null, flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, blockposition);
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockFenceGate.java
+++ b/net/minecraft/world/level/block/BlockFenceGate.java
@@ -129,6 +129,17 @@
@@ -142,6 +142,17 @@
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
if (!world.isClientSide) {
boolean flag1 = world.hasNeighborSignal(blockposition);
@@ -1,16 +1,16 @@
--- a/net/minecraft/world/level/block/BlockFungi.java
+++ b/net/minecraft/world/level/block/BlockFungi.java
@@ -51,6 +51,13 @@
@@ -59,6 +59,13 @@
@Override
public void performBonemeal(WorldServer worldserver, RandomSource randomsource, BlockPosition blockposition, IBlockData iblockdata) {
+ // CraftBukkit start
+ if (this == Blocks.WARPED_FUNGUS) {
+ BlockSapling.treeType = org.bukkit.TreeType.WARPED_FUNGUS;
+ } else if (this == Blocks.CRIMSON_FUNGUS) {
+ BlockSapling.treeType = org.bukkit.TreeType.CRIMSON_FUNGUS;
+ }
+ // CraftBukkit end
((WorldGenFeatureConfigured) ((Holder) this.feature.get()).value()).place(worldserver, worldserver.getChunkSource().getGenerator(), randomsource, blockposition);
this.getFeature(worldserver).ifPresent((holder) -> {
+ // CraftBukkit start
+ if (this == Blocks.WARPED_FUNGUS) {
+ BlockSapling.treeType = org.bukkit.TreeType.WARPED_FUNGUS;
+ } else if (this == Blocks.CRIMSON_FUNGUS) {
+ BlockSapling.treeType = org.bukkit.TreeType.CRIMSON_FUNGUS;
+ }
+ // CraftBukkit end
((WorldGenFeatureConfigured) holder.value()).place(worldserver, worldserver.getChunkSource().getGenerator(), randomsource, blockposition);
});
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockMobSpawner.java
+++ b/net/minecraft/world/level/block/BlockMobSpawner.java
@@ -33,12 +33,20 @@
@@ -43,12 +43,20 @@
@Override
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
@@ -9,12 +9,12 @@
public class BlockMonsterEggs extends Block {
private final Block hostBlock;
@@ -41,7 +43,7 @@
EntitySilverfish entitysilverfish = (EntitySilverfish) EntityTypes.SILVERFISH.create(worldserver);
@@ -42,7 +44,7 @@
entitysilverfish.moveTo((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);
- worldserver.addFreshEntity(entitysilverfish);
+ worldserver.addFreshEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
entitysilverfish.spawnAnim();
}
if (entitysilverfish != null) {
entitysilverfish.moveTo((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);
- worldserver.addFreshEntity(entitysilverfish);
+ worldserver.addFreshEntity(entitysilverfish, SpawnReason.SILVERFISH_BLOCK); // CraftBukkit - add SpawnReason
entitysilverfish.spawnAnim();
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockMushroom.java
+++ b/net/minecraft/world/level/block/BlockMushroom.java
@@ -16,6 +16,10 @@
@@ -18,6 +18,10 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -11,7 +11,7 @@
public class BlockMushroom extends BlockPlant implements IBlockFragilePlantElement {
protected static final float AABB_OFFSET = 3.0F;
@@ -61,7 +65,7 @@
@@ -63,7 +67,7 @@
}
if (worldserver.isEmptyBlock(blockposition2) && iblockdata.canSurvive(worldserver, blockposition2)) {
@@ -20,11 +20,11 @@
}
}
@@ -82,6 +86,7 @@
public boolean growMushroom(WorldServer worldserver, BlockPosition blockposition, IBlockData iblockdata, RandomSource randomsource) {
worldserver.removeBlock(blockposition, false);
+ BlockSapling.treeType = (this == Blocks.BROWN_MUSHROOM) ? TreeType.BROWN_MUSHROOM : TreeType.BROWN_MUSHROOM; // CraftBukkit
if (((WorldGenFeatureConfigured) ((Holder) this.featureSupplier.get()).value()).place(worldserver, worldserver.getChunkSource().getGenerator(), randomsource, blockposition)) {
return true;
@@ -89,6 +93,7 @@
return false;
} else {
worldserver.removeBlock(blockposition, false);
+ BlockSapling.treeType = (this == Blocks.BROWN_MUSHROOM) ? TreeType.BROWN_MUSHROOM : TreeType.BROWN_MUSHROOM; // CraftBukkit
if (((WorldGenFeatureConfigured) ((Holder) optional.get()).value()).place(worldserver, worldserver.getChunkSource().getGenerator(), randomsource, blockposition)) {
return true;
} else {
@@ -1,24 +1,19 @@
--- a/net/minecraft/world/level/block/BlockNote.java
+++ b/net/minecraft/world/level/block/BlockNote.java
@@ -51,7 +51,8 @@
@@ -77,6 +77,7 @@
if (flag1 != (Boolean) iblockdata.getValue(BlockNote.POWERED)) {
if (flag1) {
- this.playNote((Entity) null, world, blockposition);
+ this.playNote((Entity) null, world, blockposition, iblockdata); // CraftBukkit
this.playNote((Entity) null, iblockdata, world, blockposition);
+ iblockdata = world.getBlockState(blockposition); // CraftBukkit - SPIGOT-5617: update in case changed in event
}
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockNote.POWERED, flag1), 3);
@@ -59,11 +60,18 @@
@@ -86,6 +87,12 @@
}
- private void playNote(@Nullable Entity entity, World world, BlockPosition blockposition) {
+ private void playNote(@Nullable Entity entity, World world, BlockPosition blockposition, IBlockData data) { // CraftBukkit
if (world.getBlockState(blockposition.above()).isAir()) {
private void playNote(@Nullable Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
if (!((BlockPropertyInstrument) iblockdata.getValue(BlockNote.INSTRUMENT)).requiresAirAbove() || world.getBlockState(blockposition.above()).isAir()) {
+ // CraftBukkit start
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, data.getValue(BlockNote.INSTRUMENT), data.getValue(BlockNote.NOTE));
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, iblockdata.getValue(BlockNote.INSTRUMENT), iblockdata.getValue(BlockNote.NOTE));
+ if (event.isCancelled()) {
+ return;
+ }
@@ -26,25 +21,3 @@
world.blockEvent(blockposition, this, 0, 0);
world.gameEvent(entity, GameEvent.NOTE_BLOCK_PLAY, blockposition);
}
+
}
@Override
@@ -73,7 +81,7 @@
} else {
iblockdata = (IBlockData) iblockdata.cycle(BlockNote.NOTE);
world.setBlock(blockposition, iblockdata, 3);
- this.playNote(entityhuman, world, blockposition);
+ this.playNote(entityhuman, world, blockposition, iblockdata); // CraftBukkit
entityhuman.awardStat(StatisticList.TUNE_NOTEBLOCK);
return EnumInteractionResult.CONSUME;
}
@@ -82,7 +90,7 @@
@Override
public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
if (!world.isClientSide) {
- this.playNote(entityhuman, world, blockposition);
+ this.playNote(entityhuman, world, blockposition, iblockdata); // CraftBukkit
entityhuman.awardStat(StatisticList.PLAY_NOTEBLOCK);
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockNylium.java
+++ b/net/minecraft/world/level/block/BlockNylium.java
@@ -31,6 +31,11 @@
@@ -33,6 +33,11 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!canBeNylium(iblockdata, worldserver, blockposition)) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockPortal.java
+++ b/net/minecraft/world/level/block/BlockPortal.java
@@ -27,6 +27,10 @@
@@ -24,6 +24,10 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -11,17 +11,17 @@
public class BlockPortal extends Block {
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockProperties.HORIZONTAL_AXIS;
@@ -58,7 +62,8 @@
@@ -55,7 +59,8 @@
}
if (worldserver.getBlockState(blockposition).isValidSpawn(worldserver, blockposition, EntityTypes.ZOMBIFIED_PIGLIN)) {
- Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawn(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.above(), EnumMobSpawn.STRUCTURE, false, false);
- Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawn(worldserver, blockposition.above(), EnumMobSpawn.STRUCTURE);
+ // CraftBukkit - set spawn reason to NETHER_PORTAL
+ Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawn(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.above(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
+ Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawn(worldserver, blockposition.above(), EnumMobSpawn.STRUCTURE, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
if (entity != null) {
entity.setPortalCooldown();
@@ -80,6 +85,10 @@
@@ -77,6 +82,10 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (!entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions()) {
@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/block/BlockPressurePlateBinary.java
+++ b/net/minecraft/world/level/block/BlockPressurePlateBinary.java
@@ -18,6 +18,8 @@
import net.minecraft.world.level.material.Material;
@@ -17,6 +17,8 @@
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
import net.minecraft.world.phys.AxisAlignedBB;
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
@@ -9,7 +9,7 @@
public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
@@ -81,6 +83,26 @@
@@ -74,6 +76,26 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -9,7 +9,7 @@
public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
public static final BlockStateInteger POWER = BlockProperties.POWER;
@@ -27,7 +29,31 @@
@@ -31,7 +33,31 @@
@Override
protected int getSignalStrength(World world, BlockPosition blockposition) {
@@ -1,74 +1,30 @@
--- a/net/minecraft/world/level/block/BlockPumpkinCarved.java
+++ b/net/minecraft/world/level/block/BlockPumpkinCarved.java
@@ -26,6 +26,11 @@
@@ -26,6 +26,10 @@
import net.minecraft.world.level.block.state.properties.BlockStateDirection;
import net.minecraft.world.level.material.Material;
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+// CraftBukkit end
+
public class BlockPumpkinCarved extends BlockFacingHorizontal implements ItemWearable {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
@@ -64,19 +69,28 @@
EntityPlayer entityplayer;
int j;
@@ -82,9 +86,14 @@
}
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world); // CraftBukkit - Use BlockStateListPopulator
if (shapedetector_shapedetectorcollection != null) {
for (i = 0; i < this.getOrCreateSnowGolemFull().getHeight(); ++i) {
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.getBlock(0, i, 0);
private static void spawnGolemInWorld(World world, ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection, Entity entity, BlockPosition blockposition) {
- clearPatternBlocks(world, shapedetector_shapedetectorcollection);
+ // clearPatternBlocks(world, shapedetector_shapedetectorcollection); // CraftBukkit - moved down
entity.moveTo((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.05D, (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);
- world.addFreshEntity(entity);
+ // CraftBukkit start
+ if (!world.addFreshEntity(entity, SpawnReason.BUILD_IRONGOLEM)) {
+ return;
+ }
+ clearPatternBlocks(world, shapedetector_shapedetectorcollection); // CraftBukkit - from above
+ // CraftBukkit end
Iterator iterator = world.getEntitiesOfClass(EntityPlayer.class, entity.getBoundingBox().inflate(5.0D)).iterator();
- world.setBlock(shapedetectorblock.getPos(), Blocks.AIR.defaultBlockState(), 2);
- world.levelEvent(2001, shapedetectorblock.getPos(), Block.getId(shapedetectorblock.getState()));
+ blockList.setBlock(shapedetectorblock.getPos(), Blocks.AIR.defaultBlockState(), 2); // CraftBukkit
+ // world.levelEvent(2001, shapedetectorblock.getPos(), Block.getId(shapedetectorblock.getState())); // CraftBukkit
}
EntitySnowman entitysnowman = (EntitySnowman) EntityTypes.SNOW_GOLEM.create(world);
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.getBlock(0, 2, 0).getPos();
entitysnowman.moveTo((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.05D, (double) blockposition1.getZ() + 0.5D, 0.0F, 0.0F);
- world.addFreshEntity(entitysnowman);
+ // CraftBukkit start
+ if (!world.addFreshEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) {
+ return;
+ }
+ for (BlockPosition pos : blockList.getBlocks()) {
+ world.levelEvent(2001, pos, Block.getId(world.getBlockState(pos)));
+ }
+ blockList.updateList();
+ // CraftBukkit end
iterator = world.getEntitiesOfClass(EntityPlayer.class, entitysnowman.getBoundingBox().inflate(5.0D)).iterator();
while (iterator.hasNext()) {
@@ -96,8 +110,8 @@
for (int k = 0; k < this.getOrCreateIronGolemFull().getHeight(); ++k) {
ShapeDetectorBlock shapedetectorblock2 = shapedetector_shapedetectorcollection.getBlock(i, k, 0);
- world.setBlock(shapedetectorblock2.getPos(), Blocks.AIR.defaultBlockState(), 2);
- world.levelEvent(2001, shapedetectorblock2.getPos(), Block.getId(shapedetectorblock2.getState()));
+ blockList.setBlock(shapedetectorblock2.getPos(), Blocks.AIR.defaultBlockState(), 2); // CraftBukkit
+ // world.levelEvent(2001, shapedetectorblock2.getPos(), Block.getId(shapedetectorblock2.getState())); // CraftBukkit
}
}
@@ -106,7 +120,15 @@
entityirongolem.setPlayerCreated(true);
entityirongolem.moveTo((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F);
- world.addFreshEntity(entityirongolem);
+ // CraftBukkit start
+ if (!world.addFreshEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
+ return;
+ }
+ for (BlockPosition pos : blockList.getBlocks()) {
+ world.levelEvent(2001, pos, Block.getId(world.getBlockState(pos)));
+ }
+ blockList.updateList();
+ // CraftBukkit end
iterator = world.getEntitiesOfClass(EntityPlayer.class, entityirongolem.getBoundingBox().inflate(5.0D)).iterator();
while (iterator.hasNext()) {
while (iterator.hasNext()) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockRedstoneWire.java
+++ b/net/minecraft/world/level/block/BlockRedstoneWire.java
@@ -37,6 +37,8 @@
@@ -36,6 +36,8 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -9,7 +9,7 @@
public class BlockRedstoneWire extends Block {
public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.NORTH_REDSTONE;
@@ -255,7 +257,16 @@
@@ -254,7 +256,16 @@
private void updatePowerStrength(World world, BlockPosition blockposition, IBlockData iblockdata) {
int i = this.calculateTargetStrength(world, blockposition);
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSapling.java
+++ b/net/minecraft/world/level/block/BlockSapling.java
@@ -14,12 +14,20 @@
@@ -15,12 +15,20 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -21,7 +21,7 @@
protected BlockSapling(WorldGenTreeProvider worldgentreeprovider, BlockBase.Info blockbase_info) {
super(blockbase_info);
@@ -44,7 +52,32 @@
@@ -45,7 +53,32 @@
if ((Integer) iblockdata.getValue(BlockSapling.STAGE) == 0) {
worldserver.setBlock(blockposition, (IBlockData) iblockdata.cycle(BlockSapling.STAGE), 4);
} else {
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockStem.java
+++ b/net/minecraft/world/level/block/BlockStem.java
@@ -20,6 +20,8 @@
@@ -21,6 +21,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,7 +9,7 @@
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
public static final int MAX_AGE = 7;
@@ -56,14 +58,18 @@
@@ -57,14 +59,18 @@
if (i < 7) {
iblockdata = (IBlockData) iblockdata.setValue(BlockStem.AGE, i + 1);
@@ -30,7 +30,7 @@
worldserver.setBlockAndUpdate(blockposition, (IBlockData) this.fruit.getAttachedStem().defaultBlockState().setValue(BlockFacingHorizontal.FACING, enumdirection));
}
}
@@ -92,7 +98,7 @@
@@ -93,7 +99,7 @@
int i = Math.min(7, (Integer) iblockdata.getValue(BlockStem.AGE) + MathHelper.nextInt(worldserver.random, 2, 5));
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockStem.AGE, i);
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSweetBerryBush.java
+++ b/net/minecraft/world/level/block/BlockSweetBerryBush.java
@@ -27,6 +27,14 @@
@@ -28,6 +28,14 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -15,7 +15,7 @@
public class BlockSweetBerryBush extends BlockPlant implements IBlockFragilePlantElement {
private static final float HURT_SPEED_THRESHOLD = 0.003F;
@@ -62,7 +70,7 @@
@@ -63,7 +71,7 @@
if (i < 3 && randomsource.nextInt(5) == 0 && worldserver.getRawBrightness(blockposition.above(), 0) >= 9) {
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, i + 1);
@@ -24,7 +24,7 @@
worldserver.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
}
@@ -77,7 +85,9 @@
@@ -78,7 +86,9 @@
double d1 = Math.abs(entity.getZ() - entity.zOld);
if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) {
@@ -34,7 +34,7 @@
}
}
@@ -94,7 +104,15 @@
@@ -95,7 +105,15 @@
} else if (i > 1) {
int j = 1 + world.random.nextInt(2);
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTallPlant.java
+++ b/net/minecraft/world/level/block/BlockTallPlant.java
@@ -92,6 +92,11 @@
@@ -94,6 +94,11 @@
}
protected static void preventCreativeDropFromBottomPart(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTrapdoor.java
+++ b/net/minecraft/world/level/block/BlockTrapdoor.java
@@ -28,6 +28,8 @@
@@ -30,6 +30,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,7 +9,7 @@
public class BlockTrapdoor extends BlockFacingHorizontal implements IBlockWaterlogged {
public static final BlockStateBoolean OPEN = BlockProperties.OPEN;
@@ -116,6 +118,19 @@
@@ -113,6 +115,19 @@
boolean flag1 = world.hasNeighborSignal(blockposition);
if (flag1 != (Boolean) iblockdata.getValue(BlockTrapdoor.POWERED)) {
@@ -54,12 +54,12 @@
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + randomsource.nextFloat() * 0.2F);
worldserver.removeBlock(blockposition, false);
@@ -104,7 +133,7 @@
entityturtle.setAge(-24000);
entityturtle.setHomePos(blockposition);
entityturtle.moveTo((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F);
- worldserver.addFreshEntity(entityturtle);
+ worldserver.addFreshEntity(entityturtle, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // CraftBukkit
@@ -105,7 +134,7 @@
entityturtle.setAge(-24000);
entityturtle.setHomePos(blockposition);
entityturtle.moveTo((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F);
- worldserver.addFreshEntity(entityturtle);
+ worldserver.addFreshEntity(entityturtle, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // CraftBukkit
}
}
}
}
@@ -1,18 +1,17 @@
--- a/net/minecraft/world/level/block/BlockWitherSkull.java
+++ b/net/minecraft/world/level/block/BlockWitherSkull.java
@@ -26,6 +26,11 @@
@@ -26,6 +26,10 @@
import net.minecraft.world.level.block.state.predicate.MaterialPredicate;
import net.minecraft.world.level.material.Material;
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+// CraftBukkit end
+
public class BlockWitherSkull extends BlockSkull {
@Nullable
@@ -49,6 +54,7 @@
@@ -49,6 +53,7 @@
}
public static void checkSpawn(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
@@ -20,45 +19,32 @@
if (!world.isClientSide) {
IBlockData iblockdata = tileentityskull.getBlockState();
boolean flag = iblockdata.is(Blocks.WITHER_SKELETON_SKULL) || iblockdata.is(Blocks.WITHER_SKELETON_WALL_SKULL);
@@ -58,12 +64,14 @@
ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = shapedetector.find(world, blockposition);
@@ -60,12 +65,18 @@
EntityWither entitywither = (EntityWither) EntityTypes.WITHER.create(world);
if (shapedetector_shapedetectorcollection != null) {
+ // CraftBukkit start - Use BlockStateListPopulator
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world);
for (int i = 0; i < shapedetector.getWidth(); ++i) {
for (int j = 0; j < shapedetector.getHeight(); ++j) {
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.getBlock(i, j, 0);
if (entitywither != null) {
- BlockPumpkinCarved.clearPatternBlocks(world, shapedetector_shapedetectorcollection);
+ // BlockPumpkinCarved.clearPatternBlocks(world, shapedetector_shapedetectorcollection); // CraftBukkit - move down
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.getBlock(1, 2, 0).getPos();
- world.setBlock(shapedetectorblock.getPos(), Blocks.AIR.defaultBlockState(), 2);
- world.levelEvent(2001, shapedetectorblock.getPos(), Block.getId(shapedetectorblock.getState()));
+ blockList.setBlock(shapedetectorblock.getPos(), Blocks.AIR.defaultBlockState(), 2); // CraftBukkit
+ // world.levelEvent(2001, shapedetectorblock.getPos(), Block.getId(shapedetectorblock.getState())); // CraftBukkit
entitywither.moveTo((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getForwards().getAxis() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
entitywither.yBodyRot = shapedetector_shapedetectorcollection.getForwards().getAxis() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
entitywither.makeInvulnerable();
+ // CraftBukkit start
+ if (!world.addFreshEntity(entitywither, SpawnReason.BUILD_WITHER)) {
+ return;
+ }
+ BlockPumpkinCarved.clearPatternBlocks(world, shapedetector_shapedetectorcollection); // CraftBukkit - from above
+ // CraftBukkit end
Iterator iterator = world.getEntitiesOfClass(EntityPlayer.class, entitywither.getBoundingBox().inflate(50.0D)).iterator();
while (iterator.hasNext()) {
@@ -74,7 +85,7 @@
CriterionTriggers.SUMMONED_ENTITY.trigger(entityplayer, (Entity) entitywither);
}
- world.addFreshEntity(entitywither);
+ // world.addFreshEntity(entitywither); // CraftBukkit - moved up
BlockPumpkinCarved.updatePatternBlocks(world, shapedetector_shapedetectorcollection);
}
@@ -73,6 +81,15 @@
entitywither.moveTo((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getForwards().getAxis() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
entitywither.yBodyRot = shapedetector_shapedetectorcollection.getForwards().getAxis() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
entitywither.makeInvulnerable();
+ // CraftBukkit start
+ if (!world.addFreshEntity(entitywither, SpawnReason.BUILD_WITHER)) {
+ return;
+ }
+ for (BlockPosition pos : blockList.getBlocks()) {
+ world.levelEvent(2001, pos, Block.getId(world.getBlockState(pos)));
+ }
+ blockList.updateList();
+ // CraftBukkit end
Iterator iterator = world.getEntitiesOfClass(EntityPlayer.class, entitywither.getBoundingBox().inflate(50.0D)).iterator();
while (iterator.hasNext()) {
@@ -81,7 +98,7 @@
CriterionTriggers.SUMMONED_ENTITY.trigger(entityplayer, (Entity) entitywither);
}
- world.addFreshEntity(entitywither);
+ // world.addFreshEntity(entitywither); // CraftBukkit - moved up
for (int k = 0; k < shapedetector.getWidth(); ++k) {
for (int l = 0; l < shapedetector.getHeight(); ++l) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/CaveVinesBlock.java
+++ b/net/minecraft/world/level/block/CaveVinesBlock.java
@@ -57,7 +57,7 @@
@@ -58,7 +58,7 @@
@Override
public EnumInteractionResult use(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/CaveVinesPlantBlock.java
+++ b/net/minecraft/world/level/block/CaveVinesPlantBlock.java
@@ -40,7 +40,7 @@
@@ -41,7 +41,7 @@
@Override
public EnumInteractionResult use(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) {
@@ -31,12 +31,12 @@
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(LightningRodBlock.POWERED, true), 3);
this.updateNeighbours(iblockdata, world, blockposition);
world.scheduleTick(blockposition, (Block) this, 8);
@@ -134,7 +151,7 @@
Entity entity = iprojectile.getOwner();
@@ -135,7 +152,7 @@
Entity entity = iprojectile.getOwner();
entitylightning.setCause(entity instanceof EntityPlayer ? (EntityPlayer) entity : null);
- world.addFreshEntity(entitylightning);
+ ((WorldServer) world).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
}
entitylightning.setCause(entity instanceof EntityPlayer ? (EntityPlayer) entity : null);
- world.addFreshEntity(entitylightning);
+ ((WorldServer) world).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
world.playSound((EntityHuman) null, blockposition, SoundEffects.TRIDENT_THUNDER, SoundCategory.WEATHER, 5.0F, 1.0F);
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/SculkSensorBlock.java
+++ b/net/minecraft/world/level/block/SculkSensorBlock.java
@@ -42,6 +42,11 @@
@@ -38,6 +38,11 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -12,7 +12,7 @@
public class SculkSensorBlock extends BlockTileEntity implements IBlockWaterlogged {
public static final int ACTIVE_TICKS = 40;
@@ -135,6 +140,18 @@
@@ -87,6 +92,18 @@
@Override
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
if (!world.isClientSide() && canActivate(iblockdata) && entity.getType() != EntityTypes.WARDEN) {
@@ -31,7 +31,7 @@
TileEntity tileentity = world.getBlockEntity(blockposition);
if (tileentity instanceof SculkSensorBlockEntity) {
@@ -234,6 +251,15 @@
@@ -188,6 +205,15 @@
}
public static void deactivate(World world, BlockPosition blockposition, IBlockData iblockdata) {
@@ -47,7 +47,7 @@
world.setBlock(blockposition, (IBlockData) ((IBlockData) iblockdata.setValue(SculkSensorBlock.PHASE, SculkSensorPhase.COOLDOWN)).setValue(SculkSensorBlock.POWER, 0), 3);
world.scheduleTick(blockposition, iblockdata.getBlock(), 1);
if (!(Boolean) iblockdata.getValue(SculkSensorBlock.WATERLOGGED)) {
@@ -244,6 +270,15 @@
@@ -198,6 +224,15 @@
}
public static void activate(@Nullable Entity entity, World world, BlockPosition blockposition, IBlockData iblockdata, int i) {
@@ -63,7 +63,7 @@
world.setBlock(blockposition, (IBlockData) ((IBlockData) iblockdata.setValue(SculkSensorBlock.PHASE, SculkSensorPhase.ACTIVE)).setValue(SculkSensorBlock.POWER, i), 3);
world.scheduleTick(blockposition, iblockdata.getBlock(), 40);
updateNeighbours(world, blockposition);
@@ -306,9 +341,16 @@
@@ -260,9 +295,16 @@
@Override
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
@@ -0,0 +1,66 @@
--- a/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java
@@ -17,12 +17,54 @@
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
import org.slf4j.Logger;
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
public class ChiseledBookShelfBlockEntity extends TileEntity implements IInventory {
public static final int MAX_BOOKS_IN_STORAGE = 6;
private static final Logger LOGGER = LogUtils.getLogger();
private final NonNullList<ItemStack> items;
public int lastInteractedSlot;
+ // CraftBukkit start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<>();
+ private int maxStack = 1;
+
+ @Override
+ public List<ItemStack> getContents() {
+ return this.items;
+ }
+
+ @Override
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ @Override
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ @Override
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ @Override
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+
+ @Override
+ public Location getLocation() {
+ if (level == null) return null;
+ return new org.bukkit.Location(level.getWorld(), worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
+ }
+ // CraftBukkit end
public ChiseledBookShelfBlockEntity(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.CHISELED_BOOKSHELF, blockposition, iblockdata);
@@ -113,7 +155,7 @@
@Override
public int getMaxStackSize() {
- return 1;
+ return maxStack; // CraftBukkit
}
@Override
@@ -48,5 +48,5 @@
+ }
+ // CraftBukkit end
private NonNullList<ItemStack> items;
public ContainerOpenersCounter openersCounter;
public final ContainerOpenersCounter openersCounter;
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityBeacon.java
+++ b/net/minecraft/world/level/block/entity/TileEntityBeacon.java
@@ -37,6 +37,11 @@
@@ -38,6 +38,11 @@
import net.minecraft.world.level.levelgen.HeightMap;
import net.minecraft.world.phys.AxisAlignedBB;
@@ -9,10 +9,10 @@
+import org.bukkit.potion.PotionEffect;
+// CraftBukkit end
+
public class TileEntityBeacon extends TileEntity implements ITileInventory {
public class TileEntityBeacon extends TileEntity implements ITileInventory, INamableTileEntity {
private static final int MAX_LEVELS = 4;
@@ -59,6 +64,15 @@
@@ -61,6 +66,15 @@
public IChatBaseComponent name;
public ChestLock lockKey;
private final IContainerProperties dataAccess;
@@ -28,7 +28,7 @@
public TileEntityBeacon(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.BEACON, blockposition, iblockdata);
@@ -234,39 +248,78 @@
@@ -236,39 +250,78 @@
super.setRemoved();
}
@@ -117,7 +117,7 @@
public static void playSound(World world, BlockPosition blockposition, SoundEffect soundeffect) {
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
@@ -295,8 +348,11 @@
@@ -297,8 +350,11 @@
@Override
public void load(NBTTagCompound nbttagcompound) {
super.load(nbttagcompound);
@@ -13,24 +13,24 @@
public class TileEntityCampfire extends TileEntity implements Clearable {
private static final int BURN_COOL_SPEED = 2;
@@ -58,6 +64,20 @@
return recipecampfire.assemble(inventorysubcontainer);
@@ -59,6 +65,20 @@
}).orElse(itemstack);
+ // CraftBukkit start - fire BlockCookEvent
+ CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
+ org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
if (itemstack1.isItemEnabled(world.enabledFeatures())) {
+ // CraftBukkit start - fire BlockCookEvent
+ CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
+ org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
+
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, blockposition), source, result);
+ world.getCraftServer().getPluginManager().callEvent(blockCookEvent);
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, blockposition), source, result);
+ world.getCraftServer().getPluginManager().callEvent(blockCookEvent);
+
+ if (blockCookEvent.isCancelled()) {
+ return;
+ }
+ if (blockCookEvent.isCancelled()) {
+ return;
+ }
+
+ result = blockCookEvent.getResult();
+ itemstack1 = CraftItemStack.asNMSCopy(result);
+ // CraftBukkit end
InventoryUtils.dropItemStack(world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack1);
tileentitycampfire.items.set(i, ItemStack.EMPTY);
world.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
+ result = blockCookEvent.getResult();
+ itemstack1 = CraftItemStack.asNMSCopy(result);
+ // CraftBukkit end
InventoryUtils.dropItemStack(world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack1);
tileentitycampfire.items.set(i, ItemStack.EMPTY);
world.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityContainer.java
+++ b/net/minecraft/world/level/block/entity/TileEntityContainer.java
@@ -88,4 +88,12 @@
@@ -89,4 +89,12 @@
}
protected abstract Container createMenu(int i, PlayerInventory playerinventory);
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
+++ b/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
@@ -32,6 +32,14 @@
@@ -33,6 +33,14 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -15,7 +15,7 @@
public class TileEntityEndGateway extends TileEntityEnderPortal {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -168,7 +176,7 @@
@@ -169,7 +177,7 @@
tileentityendgateway.teleportCooldown = 100;
BlockPosition blockposition1;
@@ -24,7 +24,7 @@
blockposition1 = findOrCreateValidTeleportPos(worldserver, blockposition);
blockposition1 = blockposition1.above(10);
TileEntityEndGateway.LOGGER.debug("Creating portal at {}", blockposition1);
@@ -197,6 +205,27 @@
@@ -198,6 +206,27 @@
entity1 = entity.getRootVehicle();
}
@@ -30,7 +30,7 @@
}
public static Map<Item, Integer> getFuel() {
@@ -188,6 +202,40 @@
@@ -182,6 +196,40 @@
return map;
}
@@ -71,7 +71,7 @@
private static boolean isNeverAFurnaceFuel(Item item) {
return item.builtInRegistryHolder().is(TagsItem.NON_FLAMMABLE_WOOD);
}
@@ -276,7 +324,7 @@
@@ -270,7 +318,7 @@
IRecipe irecipe;
if (flag2) {
@@ -80,7 +80,7 @@
} else {
irecipe = null;
}
@@ -284,9 +332,20 @@
@@ -278,9 +326,20 @@
int i = tileentityfurnace.getMaxStackSize();
if (!tileentityfurnace.isLit() && canBurn(irecipe, tileentityfurnace.items, i)) {
@@ -103,7 +103,7 @@
flag1 = true;
if (flag3) {
Item item = itemstack.getItem();
@@ -302,11 +361,23 @@
@@ -296,11 +355,23 @@
}
if (tileentityfurnace.isLit() && canBurn(irecipe, tileentityfurnace.items, i)) {
@@ -128,7 +128,7 @@
tileentityfurnace.setRecipeUsed(irecipe);
}
@@ -345,17 +416,44 @@
@@ -339,17 +410,44 @@
}
}
@@ -174,7 +174,7 @@
if (itemstack.is(Blocks.WET_SPONGE.asItem()) && !((ItemStack) nonnulllist.get(1)).isEmpty() && ((ItemStack) nonnulllist.get(1)).is(Items.BUCKET)) {
nonnulllist.set(1, new ItemStack(Items.WATER_BUCKET));
@@ -379,7 +477,7 @@
@@ -373,7 +471,7 @@
}
private static int getTotalCookTime(World world, TileEntityFurnace tileentityfurnace) {
@@ -183,7 +183,7 @@
}
public static boolean isFuel(ItemStack itemstack) {
@@ -498,14 +596,20 @@
@@ -492,14 +590,20 @@
@Override
public void awardUsedRecipes(EntityHuman entityhuman) {}
@@ -206,7 +206,7 @@
List<IRecipe<?>> list = Lists.newArrayList();
ObjectIterator objectiterator = this.recipesUsed.object2IntEntrySet().iterator();
@@ -514,14 +618,14 @@
@@ -508,14 +612,14 @@
worldserver.getRecipeManager().byKey((MinecraftKey) entry.getKey()).ifPresent((irecipe) -> {
list.add(irecipe);
@@ -223,7 +223,7 @@
int j = MathHelper.floor((float) i * f);
float f1 = MathHelper.frac((float) i * f);
@@ -529,6 +633,17 @@
@@ -523,6 +627,17 @@
++j;
}
@@ -60,7 +60,7 @@
this.level.gameEvent((Entity) entityhuman, GameEvent.CONTAINER_OPEN, this.worldPosition);
@@ -175,6 +212,7 @@
public void stopOpen(EntityHuman entityhuman) {
if (!entityhuman.isSpectator()) {
if (!this.remove && !entityhuman.isSpectator()) {
--this.openCount;
+ if (opened) return; // CraftBukkit - only animate if the ShulkerBox hasn't been forced open already by an API call.
this.level.blockEvent(this.worldPosition, this.getBlockState().getBlock(), 1, this.openCount);
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntitySign.java
+++ b/net/minecraft/world/level/block/entity/TileEntitySign.java
@@ -24,7 +24,7 @@
@@ -25,7 +25,7 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
@@ -8,8 +8,8 @@
+public class TileEntitySign extends TileEntity implements ICommandListener { // CraftBukkit - implements
public static final int LINES = 4;
private static final String[] RAW_TEXT_FIELD_NAMES = new String[]{"Text1", "Text2", "Text3", "Text4"};
@@ -64,6 +64,12 @@
private static final int MAX_TEXT_LINE_WIDTH = 90;
@@ -83,6 +83,12 @@
}
}
@@ -22,7 +22,7 @@
nbttagcompound.putString("Color", this.color.getName());
nbttagcompound.putBoolean("GlowingText", this.hasGlowingText);
}
@@ -74,8 +80,24 @@
@@ -93,8 +99,24 @@
super.load(nbttagcompound);
this.color = EnumColor.byName(nbttagcompound.getString("Color"), EnumColor.BLACK);
@@ -47,7 +47,7 @@
IChatBaseComponent ichatbasecomponent = this.loadLine(s);
this.messages[i] = ichatbasecomponent;
@@ -113,6 +135,10 @@
@@ -132,6 +154,10 @@
if (ichatmutablecomponent != null) {
return ichatmutablecomponent;
}
@@ -58,7 +58,7 @@
} catch (Exception exception) {
;
}
@@ -204,11 +230,37 @@
@@ -240,11 +266,37 @@
return true;
}
@@ -97,7 +97,7 @@
}
public EnumColor getColor() {
@@ -241,6 +293,6 @@
@@ -277,6 +329,6 @@
private void markUpdated() {
this.setChanged();
@@ -1,10 +1,16 @@
--- a/net/minecraft/world/level/block/grower/WorldGenMegaTreeProvider.java
+++ b/net/minecraft/world/level/block/grower/WorldGenMegaTreeProvider.java
@@ -38,6 +38,7 @@
if (holder == null) {
@@ -40,11 +40,12 @@
if (resourcekey == null) {
return false;
} else {
+ setTreeType(holder); // CraftBukkit
WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured = (WorldGenFeatureConfigured) holder.value();
IBlockData iblockdata1 = Blocks.AIR.defaultBlockState();
- Holder<WorldGenFeatureConfigured<?, ?>> holder = (Holder) worldserver.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).getHolder(resourcekey).orElse((Object) null);
+ Holder<WorldGenFeatureConfigured<?, ?>> holder = (Holder) worldserver.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).getHolder(resourcekey).orElse(null); // CraftBukkit - decompile error
if (holder == null) {
return false;
} else {
+ setTreeType(holder); // CraftBukkit
WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured = (WorldGenFeatureConfigured) holder.value();
IBlockData iblockdata1 = Blocks.AIR.defaultBlockState();
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/grower/WorldGenTreeProvider.java
+++ b/net/minecraft/world/level/block/grower/WorldGenTreeProvider.java
@@ -12,6 +12,12 @@
@@ -14,6 +14,12 @@
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.WorldGenFeatureConfigured;
@@ -13,21 +13,28 @@
public abstract class WorldGenTreeProvider {
public WorldGenTreeProvider() {}
@@ -25,6 +31,7 @@
if (holder == null) {
@@ -27,11 +33,12 @@
if (resourcekey == null) {
return false;
} else {
+ setTreeType(holder); // CraftBukkit
WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured = (WorldGenFeatureConfigured) holder.value();
IBlockData iblockdata1 = worldserver.getFluidState(blockposition).createLegacyBlock();
- Holder<WorldGenFeatureConfigured<?, ?>> holder = (Holder) worldserver.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).getHolder(resourcekey).orElse((Object) null);
+ Holder<WorldGenFeatureConfigured<?, ?>> holder = (Holder) worldserver.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).getHolder(resourcekey).orElse(null); // CraftBukkit - decompile error
@@ -57,4 +64,52 @@
if (holder == null) {
return false;
} else {
+ setTreeType(holder); // CraftBukkit
WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured = (WorldGenFeatureConfigured) holder.value();
IBlockData iblockdata1 = worldserver.getFluidState(blockposition).createLegacyBlock();
@@ -65,4 +72,53 @@
return true;
}
+
+ // CraftBukkit start
+ protected void setTreeType(Holder<? extends WorldGenFeatureConfigured<?, ?>> worldgentreeabstract) {
+ protected void setTreeType(Holder<WorldGenFeatureConfigured<?, ?>> holder) {
+ ResourceKey<WorldGenFeatureConfigured<?, ?>> worldgentreeabstract = holder.unwrapKey().get();
+ if (worldgentreeabstract == TreeFeatures.OAK || worldgentreeabstract == TreeFeatures.OAK_BEES_005) {
+ BlockSapling.treeType = TreeType.TREE;
+ } else if (worldgentreeabstract == TreeFeatures.HUGE_RED_MUSHROOM) {
@@ -10,12 +10,12 @@
private Supplier<PlayerChunk.State> fullStatus;
@Nullable
@@ -94,7 +94,7 @@
super(chunkcoordintpair, chunkconverter, world, world.registryAccess().registryOrThrow(IRegistry.BIOME_REGISTRY), i, achunksection, blendingdata);
super(chunkcoordintpair, chunkconverter, world, world.registryAccess().registryOrThrow(Registries.BIOME), i, achunksection, blendingdata);
this.tickersInLevel = Maps.newHashMap();
this.clientLightReady = false;
- this.level = world;
+ this.level = (WorldServer) world; // CraftBukkit - type
this.gameEventDispatcherSections = new Int2ObjectOpenHashMap();
this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap();
HeightMap.Type[] aheightmap_type = HeightMap.Type.values();
int j = aheightmap_type.length;
@@ -110,8 +110,20 @@
@@ -174,7 +174,7 @@
public boolean isEmpty() {
return false;
}
@@ -684,7 +775,7 @@
@@ -682,7 +773,7 @@
private <T extends TileEntity> void updateBlockEntityTicker(T t0) {
IBlockData iblockdata = t0.getBlockState();
@@ -183,7 +183,7 @@
if (blockentityticker == null) {
this.removeBlockEntityTicker(t0.getBlockPos());
@@ -777,7 +868,7 @@
@@ -775,7 +866,7 @@
private boolean loggedInvalidBlockState;
a(TileEntity tileentity, BlockEntityTicker blockentityticker) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -417,7 +417,7 @@
@@ -306,7 +306,7 @@
}
}
@@ -9,7 +9,7 @@
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
if (!SharedConstants.debugVoidTerrain(chunkcoordintpair)) {
@@ -439,7 +439,7 @@
@@ -328,7 +328,7 @@
for (int k = 0; k < j; ++k) {
ChunkSection chunksection = achunksection[k];
@@ -18,7 +18,7 @@
Objects.requireNonNull(set);
palettedcontainerro.getAll(set::add);
@@ -465,7 +465,7 @@
@@ -354,7 +354,7 @@
Structure structure = (Structure) iterator.next();
seededrandom.setFeatureSeed(i, i1, l);
@@ -27,12 +27,12 @@
Optional optional = iregistry.getResourceKey(structure).map(Object::toString);
Objects.requireNonNull(structure);
@@ -550,6 +550,33 @@
@@ -439,6 +439,33 @@
}
}
+ // CraftBukkit start
+ public void applyBiomeDecoration(GeneratorAccessSeed generatoraccessseed, IChunkAccess ichunkaccess, StructureManager structuremanager) {
+ // CraftBukkit start
+ applyBiomeDecoration(generatoraccessseed, ichunkaccess, structuremanager, true);
+ }
+
@@ -55,9 +55,9 @@
+ limitedRegion.saveEntities();
+ limitedRegion.breakLink();
+ }
+ // CraftBukkit end
+ }
+ // CraftBukkit end
+
public boolean hasStructureChunkInRange(Holder<StructureSet> holder, RandomState randomstate, long i, int j, int k, int l) {
StructureSet structureset = (StructureSet) holder.value();
private static StructureBoundingBox getWritableArea(IChunkAccess ichunkaccess) {
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
int i = chunkcoordintpair.getMinBlockX();
@@ -0,0 +1,7 @@
--- a/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
+++ b/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
@@ -1,3 +1,4 @@
+// mc-dev import
package net.minecraft.world.level.chunk;
import com.google.common.base.Stopwatch;
@@ -1,11 +1,11 @@
--- a/net/minecraft/world/level/chunk/ChunkStatus.java
+++ b/net/minecraft/world/level/chunk/ChunkStatus.java
@@ -47,7 +47,7 @@
@@ -48,7 +48,7 @@
});
public static final ChunkStatus STRUCTURE_STARTS = register("structure_starts", ChunkStatus.EMPTY, 0, ChunkStatus.PRE_FEATURES, ChunkStatus.Type.PROTOCHUNK, (chunkstatus, executor, worldserver, chunkgenerator, structuretemplatemanager, lightenginethreaded, function, list, ichunkaccess, flag) -> {
if (!ichunkaccess.getStatus().isOrAfter(chunkstatus)) {
- if (worldserver.getServer().getWorldData().worldGenSettings().generateStructures()) {
+ if (worldserver.serverLevelData.worldGenSettings().generateStructures()) { // CraftBukkit
chunkgenerator.createStructures(worldserver.registryAccess(), worldserver.getChunkSource().randomState(), worldserver.structureManager(), ichunkaccess, structuretemplatemanager, worldserver.getSeed());
- if (worldserver.getServer().getWorldData().worldGenOptions().generateStructures()) {
+ if (worldserver.serverLevelData.worldGenOptions().generateStructures()) { // CraftBukkit
chunkgenerator.createStructures(worldserver.registryAccess(), worldserver.getChunkSource().getGeneratorState(), worldserver.structureManager(), ichunkaccess, structuretemplatemanager);
}
@@ -1,15 +1,15 @@
--- a/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
+++ b/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
@@ -100,7 +100,7 @@
@@ -102,7 +102,7 @@
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
LightEngine lightengine = chunkproviderserver.getLightEngine();
IRegistry<BiomeBase> iregistry = worldserver.registryAccess().registryOrThrow(IRegistry.BIOME_REGISTRY);
IRegistry<BiomeBase> iregistry = worldserver.registryAccess().registryOrThrow(Registries.BIOME);
- Codec<PalettedContainerRO<Holder<BiomeBase>>> codec = makeBiomeCodec(iregistry);
+ Codec<DataPaletteBlock<Holder<BiomeBase>>> codec = makeBiomeCodecRW(iregistry); // CraftBukkit - read/write
boolean flag2 = false;
DataResult dataresult;
@@ -120,12 +120,12 @@
@@ -122,12 +122,12 @@
});
logger = ChunkRegionLoader.LOGGER;
Objects.requireNonNull(logger);
@@ -24,7 +24,7 @@
if (nbttagcompound1.contains("biomes", 10)) {
dataresult = codec.parse(DynamicOpsNBT.INSTANCE, nbttagcompound1.getCompound("biomes")).promotePartial((s) -> {
@@ -133,12 +133,12 @@
@@ -135,12 +135,12 @@
});
logger = ChunkRegionLoader.LOGGER;
Objects.requireNonNull(logger);
@@ -39,7 +39,7 @@
achunksection[k] = chunksection;
villageplace.checkConsistencyWithBlocks(chunkcoordintpair, chunksection);
@@ -172,7 +172,7 @@
@@ -174,7 +174,7 @@
dataresult = BlendingData.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("blending_data")));
logger1 = ChunkRegionLoader.LOGGER;
Objects.requireNonNull(logger1);
@@ -48,7 +48,7 @@
} else {
blendingdata = null;
}
@@ -203,7 +203,7 @@
@@ -205,7 +205,7 @@
dataresult = BelowZeroRetrogen.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("below_zero_retrogen")));
logger1 = ChunkRegionLoader.LOGGER;
Objects.requireNonNull(logger1);
@@ -57,7 +57,7 @@
Objects.requireNonNull(protochunk);
optional.ifPresent(protochunk::setBelowZeroRetrogen);
@@ -232,6 +232,13 @@
@@ -234,6 +234,13 @@
}
}
@@ -71,7 +71,7 @@
((IChunkAccess) object1).setLightCorrect(flag);
NBTTagCompound nbttagcompound2 = nbttagcompound.getCompound("Heightmaps");
EnumSet<HeightMap.Type> enumset = EnumSet.noneOf(HeightMap.Type.class);
@@ -322,6 +329,12 @@
@@ -328,6 +335,12 @@
return DataPaletteBlock.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), DataPaletteBlock.d.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS));
}
@@ -84,7 +84,7 @@
public static NBTTagCompound write(WorldServer worldserver, IChunkAccess ichunkaccess) {
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
NBTTagCompound nbttagcompound = new NBTTagCompound();
@@ -334,7 +347,7 @@
@@ -340,7 +353,7 @@
nbttagcompound.putLong("InhabitedTime", ichunkaccess.getInhabitedTime());
nbttagcompound.putString("Status", ichunkaccess.getStatus().getName());
BlendingData blendingdata = ichunkaccess.getBlendingData();
@@ -93,7 +93,7 @@
Logger logger;
if (blendingdata != null) {
@@ -381,7 +394,7 @@
@@ -387,7 +400,7 @@
if (flag1) {
ChunkSection chunksection = achunksection[j];
@@ -102,7 +102,7 @@
Logger logger1 = ChunkRegionLoader.LOGGER;
Objects.requireNonNull(logger1);
@@ -465,6 +478,11 @@
@@ -471,6 +484,11 @@
nbttagcompound.put("Heightmaps", nbttagcompound3);
nbttagcompound.put("structures", packStructureData(StructurePieceSerializationContext.fromLevel(worldserver), chunkcoordintpair, ichunkaccess.getAllStarts(), ichunkaccess.getAllReferences()));
@@ -13,7 +13,7 @@
Path path = this.folder;
int j = chunkcoordintpair.getRegionX();
Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca");
+ if (existingOnly && !Files.exists(path1)) return null; // CraftBukkit
+ if (existingOnly && !java.nio.file.Files.exists(path1)) return null; // CraftBukkit
RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync);
this.regionCache.putAndMoveToFirst(i, regionfile1);
@@ -0,0 +1,32 @@
--- a/net/minecraft/world/level/gameevent/GameEventDispatcher.java
+++ b/net/minecraft/world/level/gameevent/GameEventDispatcher.java
@@ -11,6 +11,14 @@
import net.minecraft.world.level.chunk.Chunk;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import net.minecraft.core.registries.BuiltInRegistries;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
+import org.bukkit.event.world.GenericGameEvent;
+// CraftBukkit end
+
public class GameEventDispatcher {
private final WorldServer level;
@@ -22,6 +30,14 @@
public void post(GameEvent gameevent, Vec3D vec3d, GameEvent.a gameevent_a) {
int i = gameevent.getNotificationRadius();
BlockPosition blockposition = new BlockPosition(vec3d);
+ // CraftBukkit start
+ GenericGameEvent event = new GenericGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.GAME_EVENT.getKey(gameevent))), new Location(level.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()), (gameevent_a.sourceEntity() == null) ? null : gameevent_a.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread());
+ level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ i = event.getRadius();
+ // CraftBukkit end
int j = SectionPosition.blockToSectionCoord(blockposition.getX() - i);
int k = SectionPosition.blockToSectionCoord(blockposition.getY() - i);
int l = SectionPosition.blockToSectionCoord(blockposition.getZ() - i);
@@ -1,11 +1,11 @@
--- a/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java
+++ b/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java
@@ -28,6 +28,13 @@
@@ -29,6 +29,13 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import net.minecraft.core.IRegistry;
+import net.minecraft.core.registries.BuiltInRegistries;
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
+import org.bukkit.event.block.BlockReceiveGameEvent;
@@ -13,65 +13,38 @@
+
public class VibrationListener implements GameEventListener {
protected final PositionSource listenerSource;
@@ -51,7 +58,7 @@
@VisibleForTesting
@@ -96,7 +103,7 @@
}), ExtraCodecs.NON_NEGATIVE_INT.fieldOf("event_delay").orElse(0).forGetter((vibrationlistener) -> {
return vibrationlistener.travelTimeInTicks;
})).apply(instance, (positionsource, integer, optional, ofloat, integer1) -> {
- return new VibrationListener(positionsource, integer, vibrationlistener_b, (VibrationListener.a) optional.orElse((Object) null), ofloat, integer1);
+ return new VibrationListener(positionsource, integer, vibrationlistener_b, (VibrationListener.a) optional.orElse(null), ofloat, integer1); // CraftBukkit - decompile error
})).apply(instance, (positionsource, integer, optional, vibrationselector, integer1) -> {
- return new VibrationListener(positionsource, integer, vibrationlistener_a, (VibrationInfo) optional.orElse((Object) null), vibrationselector, integer1);
+ return new VibrationListener(positionsource, integer, vibrationlistener_a, (VibrationInfo) optional.orElse(null), vibrationselector, integer1); // CraftBukkit - decompile error
});
});
}
@@ -73,7 +80,7 @@
@@ -138,7 +145,7 @@
--this.travelTimeInTicks;
if (this.travelTimeInTicks <= 0) {
this.travelTimeInTicks = 0;
- this.config.onSignalReceive(worldserver, this, new BlockPosition(this.receivingEvent.pos), this.receivingEvent.gameEvent, (Entity) this.receivingEvent.getEntity(worldserver).orElse((Object) null), (Entity) this.receivingEvent.getProjectileOwner(worldserver).orElse((Object) null), this.receivingDistance);
+ this.config.onSignalReceive(worldserver, this, new BlockPosition(this.receivingEvent.pos), this.receivingEvent.gameEvent, (Entity) this.receivingEvent.getEntity(worldserver).orElse(null), (Entity) this.receivingEvent.getProjectileOwner(worldserver).orElse(null), this.receivingDistance); // CraftBukkit - decompile error
this.receivingEvent = null;
- this.config.onSignalReceive(worldserver, this, new BlockPosition(this.currentVibration.pos()), this.currentVibration.gameEvent(), (Entity) this.currentVibration.getEntity(worldserver).orElse((Object) null), (Entity) this.currentVibration.getProjectileOwner(worldserver).orElse((Object) null), this.currentVibration.distance());
+ this.config.onSignalReceive(worldserver, this, new BlockPosition(this.currentVibration.pos()), this.currentVibration.gameEvent(), (Entity) this.currentVibration.getEntity(worldserver).orElse(null), (Entity) this.currentVibration.getProjectileOwner(worldserver).orElse(null), this.currentVibration.distance()); // CraftBukkit - decompile error
this.currentVibration = null;
}
}
@@ -110,7 +117,14 @@
Vec3D vec3d = gameevent_b.source();
Vec3D vec3d1 = (Vec3D) optional.get();
@@ -170,7 +177,14 @@
} else {
Vec3D vec3d1 = (Vec3D) optional.get();
- if (!this.config.shouldListen(worldserver, this, new BlockPosition(vec3d), gameevent, gameevent_a)) {
+ // CraftBukkit start
+ boolean defaultCancel = !this.config.shouldListen(worldserver, this, new BlockPosition(vec3d), gameevent, gameevent_a);
+ Entity entity = gameevent_a.sourceEntity();
+ BlockReceiveGameEvent event = new BlockReceiveGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.GAME_EVENT.getKey(gameevent))), CraftBlock.at(worldserver, new BlockPosition(vec3d1)), (entity == null) ? null : entity.getBukkitEntity());
+ event.setCancelled(defaultCancel);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ // CraftBukkit end
return false;
} else if (isOccluded(worldserver, vec3d, vec3d1)) {
return false;
@@ -206,7 +220,7 @@
}), ExtraCodecs.UUID.optionalFieldOf("projectile_owner").forGetter((vibrationlistener_a) -> {
return Optional.ofNullable(vibrationlistener_a.projectileOwnerUuid());
})).apply(instance, (gameevent, ofloat, vec3d, optional, optional1) -> {
- return new VibrationListener.a(gameevent, ofloat, vec3d, (UUID) optional.orElse((Object) null), (UUID) optional1.orElse((Object) null));
+ return new VibrationListener.a(gameevent, ofloat, vec3d, (UUID) optional.orElse(null), (UUID) optional1.orElse(null)); // CraftBukkit - decompile error
});
});
@@ -233,7 +247,7 @@
public Optional<Entity> getEntity(WorldServer worldserver) {
return Optional.ofNullable(this.entity).or(() -> {
- Optional optional = Optional.ofNullable(this.uuid);
+ Optional<UUID> optional = Optional.ofNullable(this.uuid); // CraftBukkit - decompile error
Objects.requireNonNull(worldserver);
return optional.map(worldserver::getEntity);
@@ -246,7 +260,7 @@
}).map((entity) -> {
return (IProjectile) entity;
}).map(IProjectile::getOwner).or(() -> {
- Optional optional = Optional.ofNullable(this.projectileOwnerUuid);
+ Optional<UUID> optional = Optional.ofNullable(this.projectileOwnerUuid); // CraftBukkit - decompile error
Objects.requireNonNull(worldserver);
return optional.map(worldserver::getEntity);
- if (!this.config.shouldListen(worldserver, this, new BlockPosition(vec3d), gameevent, gameevent_a)) {
+ // CraftBukkit start
+ boolean defaultCancel = !this.config.shouldListen(worldserver, this, new BlockPosition(vec3d), gameevent, gameevent_a);
+ Entity entity = gameevent_a.sourceEntity();
+ BlockReceiveGameEvent event = new BlockReceiveGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.GAME_EVENT.getKey(gameevent))), CraftBlock.at(worldserver, new BlockPosition(vec3d1)), (entity == null) ? null : entity.getBukkitEntity());
+ event.setCancelled(defaultCancel);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ // CraftBukkit end
return false;
} else if (isOccluded(worldserver, vec3d, vec3d1)) {
return false;
@@ -1,23 +1,21 @@
--- a/net/minecraft/world/level/levelgen/ChunkProviderFlat.java
+++ b/net/minecraft/world/level/levelgen/ChunkProviderFlat.java
@@ -32,11 +32,17 @@
@@ -35,10 +35,16 @@
private final GeneratorSettingsFlat settings;
public ChunkProviderFlat(IRegistry<StructureSet> iregistry, GeneratorSettingsFlat generatorsettingsflat) {
- Optional optional = generatorsettingsflat.structureOverrides();
public ChunkProviderFlat(GeneratorSettingsFlat generatorsettingsflat) {
- WorldChunkManagerHell worldchunkmanagerhell = new WorldChunkManagerHell(generatorsettingsflat.getBiome());
+ // CraftBukkit start
+ // Optional optional = generatorsettingsflat.structureOverrides();
+ // WorldChunkManagerHell worldchunkmanagerhell = new WorldChunkManagerHell(generatorsettingsflat.getBiome());
- Objects.requireNonNull(generatorsettingsflat);
- super(iregistry, optional, worldchunkmanagerhell, SystemUtils.memoize(generatorsettingsflat::adjustGenerationSettings));
- super(worldchunkmanagerhell, SystemUtils.memoize(generatorsettingsflat::adjustGenerationSettings));
+ // Objects.requireNonNull(generatorsettingsflat);
+ this(iregistry, generatorsettingsflat, new WorldChunkManagerHell(generatorsettingsflat.getBiome()));
+ this(generatorsettingsflat, new WorldChunkManagerHell(generatorsettingsflat.getBiome()));
+ }
+
+ public ChunkProviderFlat(IRegistry<StructureSet> iregistry, GeneratorSettingsFlat generatorsettingsflat, net.minecraft.world.level.biome.WorldChunkManager worldchunkmanager) {
+ super(iregistry, generatorsettingsflat.structureOverrides(), worldchunkmanager, SystemUtils.memoize(generatorsettingsflat::adjustGenerationSettings));
+ public ChunkProviderFlat(GeneratorSettingsFlat generatorsettingsflat, net.minecraft.world.level.biome.WorldChunkManager worldchunkmanager) {
+ super(worldchunkmanager, SystemUtils.memoize(generatorsettingsflat::adjustGenerationSettings));
+ // CraftBukkit end
this.settings = generatorsettingsflat;
}
@@ -1,11 +1,11 @@
--- a/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java
+++ b/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java
@@ -75,7 +75,7 @@
entityphantom.moveTo(blockposition1, 0.0F, 0.0F);
groupdataentity = entityphantom.finalizeSpawn(worldserver, difficultydamagescaler, EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
- worldserver.addFreshEntityWithPassengers(entityphantom);
+ worldserver.addFreshEntityWithPassengers(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
@@ -76,7 +76,7 @@
if (entityphantom != null) {
entityphantom.moveTo(blockposition1, 0.0F, 0.0F);
groupdataentity = entityphantom.finalizeSpawn(worldserver, difficultydamagescaler, EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
- worldserver.addFreshEntityWithPassengers(entityphantom);
+ worldserver.addFreshEntityWithPassengers(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
++i;
}
}
i += k;
@@ -1,20 +1,20 @@
--- a/net/minecraft/world/level/levelgen/structure/structures/SwampHutPiece.java
+++ b/net/minecraft/world/level/levelgen/structure/structures/SwampHutPiece.java
@@ -99,7 +99,7 @@
entitywitch.setPersistenceRequired();
entitywitch.moveTo((double) blockposition_mutableblockposition.getX() + 0.5D, (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + 0.5D, 0.0F, 0.0F);
entitywitch.finalizeSpawn(generatoraccessseed, generatoraccessseed.getCurrentDifficultyAt(blockposition_mutableblockposition), EnumMobSpawn.STRUCTURE, (GroupDataEntity) null, (NBTTagCompound) null);
- generatoraccessseed.addFreshEntityWithPassengers(entitywitch);
+ generatoraccessseed.addFreshEntityWithPassengers(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
@@ -100,7 +100,7 @@
entitywitch.setPersistenceRequired();
entitywitch.moveTo((double) blockposition_mutableblockposition.getX() + 0.5D, (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + 0.5D, 0.0F, 0.0F);
entitywitch.finalizeSpawn(generatoraccessseed, generatoraccessseed.getCurrentDifficultyAt(blockposition_mutableblockposition), EnumMobSpawn.STRUCTURE, (GroupDataEntity) null, (NBTTagCompound) null);
- generatoraccessseed.addFreshEntityWithPassengers(entitywitch);
+ generatoraccessseed.addFreshEntityWithPassengers(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
}
}
}
@@ -118,7 +118,7 @@
entitycat.setPersistenceRequired();
entitycat.moveTo((double) blockposition_mutableblockposition.getX() + 0.5D, (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + 0.5D, 0.0F, 0.0F);
entitycat.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(blockposition_mutableblockposition), EnumMobSpawn.STRUCTURE, (GroupDataEntity) null, (NBTTagCompound) null);
- worldaccess.addFreshEntityWithPassengers(entitycat);
+ worldaccess.addFreshEntityWithPassengers(entitycat, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
@@ -121,7 +121,7 @@
entitycat.setPersistenceRequired();
entitycat.moveTo((double) blockposition_mutableblockposition.getX() + 0.5D, (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + 0.5D, 0.0F, 0.0F);
entitycat.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(blockposition_mutableblockposition), EnumMobSpawn.STRUCTURE, (GroupDataEntity) null, (NBTTagCompound) null);
- worldaccess.addFreshEntityWithPassengers(entitycat);
+ worldaccess.addFreshEntityWithPassengers(entitycat, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason
}
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
+++ b/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
@@ -51,6 +51,12 @@
@@ -52,6 +52,12 @@
import net.minecraft.world.phys.shapes.VoxelShapeBitSet;
import net.minecraft.world.phys.shapes.VoxelShapeDiscrete;
@@ -13,7 +13,7 @@
public class DefinedStructure {
public static final String PALETTE_TAG = "palette";
@@ -70,6 +76,11 @@
@@ -71,6 +77,11 @@
private BaseBlockPosition size;
private String author;
@@ -25,7 +25,7 @@
public DefinedStructure() {
this.size = BaseBlockPosition.ZERO;
this.author = "?";
@@ -143,7 +154,7 @@
@@ -144,7 +155,7 @@
}
private static List<DefinedStructure.BlockInfo> buildInfoList(List<DefinedStructure.BlockInfo> list, List<DefinedStructure.BlockInfo> list1, List<DefinedStructure.BlockInfo> list2) {
@@ -34,7 +34,7 @@
return definedstructure_blockinfo.pos.getY();
}).thenComparingInt((definedstructure_blockinfo) -> {
return definedstructure_blockinfo.pos.getX();
@@ -464,11 +475,13 @@
@@ -465,11 +476,13 @@
}
private static Optional<Entity> createEntityIgnoreException(WorldAccess worldaccess, NBTTagCompound nbttagcompound) {
@@ -52,7 +52,7 @@
}
public BaseBlockPosition getSize(EnumBlockRotation enumblockrotation) {
@@ -683,6 +696,13 @@
@@ -684,6 +697,13 @@
nbttagcompound.put("entities", nbttaglist3);
nbttagcompound.put("size", this.newIntegerList(this.size.getX(), this.size.getY(), this.size.getZ()));
nbttagcompound.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
@@ -66,7 +66,7 @@
return nbttagcompound;
}
@@ -722,6 +742,12 @@
@@ -723,6 +743,12 @@
}
}
@@ -78,8 +78,8 @@
+ // CraftBukkit end
}
private void loadPalette(NBTTagList nbttaglist, NBTTagList nbttaglist1) {
@@ -861,7 +887,7 @@
private void loadPalette(HolderGetter<Block> holdergetter, NBTTagList nbttaglist, NBTTagList nbttaglist1) {
@@ -862,7 +888,7 @@
public IBlockData stateFor(int i) {
IBlockData iblockdata = (IBlockData) this.ids.byId(i);
@@ -17,35 +17,35 @@
public static final BlockStateBoolean FALLING = BlockProperties.FALLING;
@@ -130,6 +139,15 @@
Fluid fluid1 = this.getNewLiquid(generatoraccess, blockposition1, iblockdata1);
Fluid fluid1 = this.getNewLiquid(world, blockposition1, iblockdata1);
if (this.canSpreadTo(generatoraccess, blockposition, iblockdata, EnumDirection.DOWN, blockposition1, iblockdata1, generatoraccess.getFluidState(blockposition1), fluid1.getType())) {
if (this.canSpreadTo(world, blockposition, iblockdata, EnumDirection.DOWN, blockposition1, iblockdata1, world.getFluidState(blockposition1), fluid1.getType())) {
+ // CraftBukkit start
+ org.bukkit.block.Block source = CraftBlock.at(generatoraccess, blockposition);
+ org.bukkit.block.Block source = CraftBlock.at(world, blockposition);
+ BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
+ generatoraccess.getMinecraftWorld().getCraftServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
this.spreadTo(generatoraccess, blockposition1, iblockdata1, EnumDirection.DOWN, fluid1);
if (this.sourceNeighborCount(generatoraccess, blockposition) >= 3) {
this.spreadToSides(generatoraccess, blockposition, fluid, iblockdata);
this.spreadTo(world, blockposition1, iblockdata1, EnumDirection.DOWN, fluid1);
if (this.sourceNeighborCount(world, blockposition) >= 3) {
this.spreadToSides(world, blockposition, fluid, iblockdata);
@@ -160,6 +178,15 @@
IBlockData iblockdata1 = generatoraccess.getBlockState(blockposition1);
IBlockData iblockdata1 = world.getBlockState(blockposition1);
if (this.canSpreadTo(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.getFluidState(blockposition1), fluid1.getType())) {
if (this.canSpreadTo(world, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, world.getFluidState(blockposition1), fluid1.getType())) {
+ // CraftBukkit start
+ org.bukkit.block.Block source = CraftBlock.at(generatoraccess, blockposition);
+ org.bukkit.block.Block source = CraftBlock.at(world, blockposition);
+ BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection));
+ generatoraccess.getMinecraftWorld().getCraftServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ continue;
+ }
+ // CraftBukkit end
this.spreadTo(generatoraccess, blockposition1, iblockdata1, enumdirection, fluid1);
this.spreadTo(world, blockposition1, iblockdata1, enumdirection, fluid1);
}
}
@@ -438,12 +465,23 @@
@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/portal/BlockPortalShape.java
+++ b/net/minecraft/world/level/portal/BlockPortalShape.java
@@ -18,6 +18,11 @@
import net.minecraft.world.level.block.state.properties.BlockProperties;
import net.minecraft.world.phys.Vec3D;
@@ -22,6 +22,11 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
@@ -12,7 +12,7 @@
public class BlockPortalShape {
private static final int MIN_WIDTH = 2;
@@ -35,6 +40,7 @@
@@ -41,6 +46,7 @@
private BlockPosition bottomLeft;
private int height;
private final int width;
@@ -20,7 +20,7 @@
public static Optional<BlockPortalShape> findEmptyPortalShape(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
return findPortalShape(generatoraccess, blockposition, (blockportalshape) -> {
@@ -55,6 +61,7 @@
@@ -61,6 +67,7 @@
}
public BlockPortalShape(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
@@ -28,7 +28,7 @@
this.level = generatoraccess;
this.axis = enumdirection_enumaxis;
this.rightDir = enumdirection_enumaxis == EnumDirection.EnumAxis.X ? EnumDirection.WEST : EnumDirection.SOUTH;
@@ -99,6 +106,7 @@
@@ -105,6 +112,7 @@
if (!isEmpty(iblockdata)) {
if (BlockPortalShape.FRAME.test(iblockdata, this.level, blockposition_mutableblockposition)) {
@@ -36,7 +36,7 @@
return i;
}
break;
@@ -109,6 +117,7 @@
@@ -115,6 +123,7 @@
if (!BlockPortalShape.FRAME.test(iblockdata1, this.level, blockposition_mutableblockposition)) {
break;
}
@@ -44,7 +44,7 @@
}
return 0;
@@ -128,6 +137,7 @@
@@ -134,6 +143,7 @@
if (!BlockPortalShape.FRAME.test(this.level.getBlockState(blockposition_mutableblockposition1), this.level, blockposition_mutableblockposition1)) {
return false;
}
@@ -52,7 +52,7 @@
}
return true;
@@ -157,6 +167,10 @@
@@ -163,6 +173,10 @@
++this.numPortalBlocks;
}
}
@@ -63,7 +63,7 @@
}
return 21;
@@ -170,12 +184,28 @@
@@ -176,12 +190,28 @@
return this.bottomLeft != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
}
@@ -93,20 +93,21 @@
}
public boolean isComplete() {
@@ -212,7 +242,7 @@
@@ -218,7 +248,7 @@
return new Vec3D(d2, d3, d4);
}
- public static ShapeDetectorShape createPortalInfo(WorldServer worldserver, BlockUtil.Rectangle blockutil_rectangle, EnumDirection.EnumAxis enumdirection_enumaxis, Vec3D vec3d, EntitySize entitysize, Vec3D vec3d1, float f, float f1) {
+ public static ShapeDetectorShape createPortalInfo(WorldServer worldserver, BlockUtil.Rectangle blockutil_rectangle, EnumDirection.EnumAxis enumdirection_enumaxis, Vec3D vec3d, EntitySize entitysize, Vec3D vec3d1, float f, float f1, CraftPortalEvent portalEventInfo) { // CraftBukkit
- public static ShapeDetectorShape createPortalInfo(WorldServer worldserver, BlockUtil.Rectangle blockutil_rectangle, EnumDirection.EnumAxis enumdirection_enumaxis, Vec3D vec3d, Entity entity, Vec3D vec3d1, float f, float f1) {
+ public static ShapeDetectorShape createPortalInfo(WorldServer worldserver, BlockUtil.Rectangle blockutil_rectangle, EnumDirection.EnumAxis enumdirection_enumaxis, Vec3D vec3d, Entity entity, Vec3D vec3d1, float f, float f1, CraftPortalEvent portalEventInfo) { // CraftBukkit
BlockPosition blockposition = blockutil_rectangle.minCorner;
IBlockData iblockdata = worldserver.getBlockState(blockposition);
EnumDirection.EnumAxis enumdirection_enumaxis1 = (EnumDirection.EnumAxis) iblockdata.getOptionalValue(BlockProperties.HORIZONTAL_AXIS).orElse(EnumDirection.EnumAxis.X);
@@ -226,6 +256,6 @@
boolean flag = enumdirection_enumaxis1 == EnumDirection.EnumAxis.X;
@@ -234,7 +264,7 @@
Vec3D vec3d3 = new Vec3D((double) blockposition.getX() + (flag ? d2 : d4), (double) blockposition.getY() + d3, (double) blockposition.getZ() + (flag ? d4 : d2));
Vec3D vec3d4 = findCollisionFreePosition(vec3d3, worldserver, entity, entitysize);
- return new ShapeDetectorShape(vec3d3, vec3d2, f + (float) i, f1);
+ return new ShapeDetectorShape(vec3d3, vec3d2, f + (float) i, f1, worldserver, portalEventInfo); // CraftBukkit
- return new ShapeDetectorShape(vec3d4, vec3d2, f + (float) i, f1);
+ return new ShapeDetectorShape(vec3d4, vec3d2, f + (float) i, f1, worldserver, portalEventInfo); // CraftBukkit
}
}
private static Vec3D findCollisionFreePosition(Vec3D vec3d, WorldServer worldserver, Entity entity, EntitySize entitysize) {
@@ -30,7 +30,7 @@
+
private WorldMap(int i, int j, byte b0, boolean flag, boolean flag1, boolean flag2, ResourceKey<World> resourcekey) {
this.scale = b0;
this.x = i;
this.centerX = i;
@@ -62,6 +79,10 @@
this.unlimitedTracking = flag1;
this.locked = flag2;
@@ -107,8 +107,8 @@
+ }
+ }
+ // CraftBukkit end
nbttagcompound.putInt("xCenter", this.x);
nbttagcompound.putInt("zCenter", this.z);
nbttagcompound.putInt("xCenter", this.centerX);
nbttagcompound.putInt("zCenter", this.centerZ);
nbttagcompound.putByte("scale", this.scale);
@@ -503,7 +561,7 @@
this.player = entityhuman;
@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/storage/Convertable.java
+++ b/net/minecraft/world/level/storage/Convertable.java
@@ -61,6 +61,10 @@
import net.minecraft.world.level.levelgen.presets.WorldPresets;
@@ -69,6 +69,10 @@
import net.minecraft.world.level.levelgen.WorldDimensions;
import org.slf4j.Logger;
+// CraftBukkit start
@@ -11,29 +11,24 @@
public class Convertable {
static final Logger LOGGER = LogUtils.getLogger();
@@ -114,7 +118,7 @@
@@ -115,7 +119,7 @@
}
private static DataPackConfiguration readDataPackConfig(Dynamic<?> dynamic) {
- DataResult dataresult = DataPackConfiguration.CODEC.parse(dynamic);
+ DataResult<DataPackConfiguration> dataresult = DataPackConfiguration.CODEC.parse(dynamic); // CraftBukkit - decompile error
private static WorldDataConfiguration readDataConfig(Dynamic<?> dynamic) {
- DataResult dataresult = WorldDataConfiguration.CODEC.parse(dynamic);
+ DataResult<WorldDataConfiguration> dataresult = WorldDataConfiguration.CODEC.parse(dynamic); // CraftBukkit - decompile error
Logger logger = Convertable.LOGGER;
Objects.requireNonNull(logger);
@@ -241,7 +245,11 @@
WorldSettings worldsettings = WorldSettings.parse(dynamic, datapackconfiguration);
Lifecycle lifecycle1 = ((Lifecycle) pair.getSecond()).add(lifecycle);
@@ -253,6 +257,7 @@
WorldDimensions.b worlddimensions_b = generatorsettings.dimensions().bake(iregistry);
Lifecycle lifecycle1 = worlddimensions_b.lifecycle().add(lifecycle);
WorldDataServer worlddataserver = WorldDataServer.parse(dynamic, datafixer, i, nbttagcompound2, worldsettings, levelversion, worlddimensions_b.specialWorldProperty(), generatorsettings.options(), lifecycle1);
+ worlddataserver.pdc = nbttagcompound1.get("BukkitValues"); // CraftBukkit - Add PDC to world
- return WorldDataServer.parse(dynamic, datafixer, i, nbttagcompound2, worldsettings, levelversion, (GeneratorSettings) pair.getFirst(), lifecycle1);
+ // CraftBukkit start - Add PDC to world
+ WorldDataServer worldDataServer = WorldDataServer.parse(dynamic, datafixer, i, nbttagcompound2, worldsettings, levelversion, (GeneratorSettings) pair.getFirst(), lifecycle1);
+ worldDataServer.pdc = nbttagcompound1.get("BukkitValues");
+ return worldDataServer;
+ // CraftBukkit end
} catch (Exception exception) {
Convertable.LOGGER.error("Exception reading {}", path, exception);
return null;
@@ -314,9 +322,23 @@
return Pair.of(worlddataserver, worlddimensions_b);
};
@@ -334,9 +339,23 @@
return this.backupDir;
}
@@ -59,7 +54,7 @@
public static record a(List<Convertable.b> levels) implements Iterable<Convertable.b> {
@@ -369,8 +391,12 @@
@@ -389,8 +408,12 @@
public final Convertable.b levelDirectory;
private final String levelId;
private final Map<SavedFile, Path> resources = Maps.newHashMap();
@@ -73,7 +68,7 @@
this.levelId = s;
this.levelDirectory = new Convertable.b(Convertable.this.baseDir.resolve(s));
this.lock = SessionLock.create(this.levelDirectory.path());
@@ -381,7 +407,7 @@
@@ -401,7 +424,7 @@
}
public Path getLevelPath(SavedFile savedfile) {
@@ -82,7 +77,7 @@
Convertable.b convertable_b = this.levelDirectory;
Objects.requireNonNull(this.levelDirectory);
@@ -389,7 +415,7 @@
@@ -409,7 +432,7 @@
}
public Path getDimensionPath(ResourceKey<World> resourcekey) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/storage/WorldDataServer.java
+++ b/net/minecraft/world/level/storage/WorldDataServer.java
@@ -42,6 +42,15 @@
@@ -43,6 +43,15 @@
import net.minecraft.world.level.timers.CustomFunctionCallbackTimers;
import org.slf4j.Logger;
@@ -16,7 +16,7 @@
public class WorldDataServer implements IWorldDataServer, SaveData {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -81,6 +90,19 @@
@@ -83,6 +92,19 @@
private final Set<String> knownServerBrands;
private boolean wasModded;
private final CustomFunctionCallbackTimerQueue<MinecraftServer> scheduledEvents;
@@ -34,9 +34,9 @@
+ }
+ // CraftBukkit end
private WorldDataServer(@Nullable DataFixer datafixer, int i, @Nullable NBTTagCompound nbttagcompound, boolean flag, int j, int k, int l, float f, long i1, long j1, int k1, int l1, int i2, boolean flag1, int j2, boolean flag2, boolean flag3, boolean flag4, WorldBorder.c worldborder_c, int k2, int l2, @Nullable UUID uuid, Set<String> set, CustomFunctionCallbackTimerQueue<MinecraftServer> customfunctioncallbacktimerqueue, @Nullable NBTTagCompound nbttagcompound1, NBTTagCompound nbttagcompound2, WorldSettings worldsettings, GeneratorSettings generatorsettings, Lifecycle lifecycle) {
if (!generatorsettings.dimensions().containsKey(WorldDimension.OVERWORLD)) {
@@ -128,7 +150,8 @@
private WorldDataServer(@Nullable DataFixer datafixer, int i, @Nullable NBTTagCompound nbttagcompound, boolean flag, int j, int k, int l, float f, long i1, long j1, int k1, int l1, int i2, boolean flag1, int j2, boolean flag2, boolean flag3, boolean flag4, WorldBorder.c worldborder_c, int k2, int l2, @Nullable UUID uuid, Set<String> set, CustomFunctionCallbackTimerQueue<MinecraftServer> customfunctioncallbacktimerqueue, @Nullable NBTTagCompound nbttagcompound1, NBTTagCompound nbttagcompound2, WorldSettings worldsettings, WorldOptions worldoptions, WorldDataServer.a worlddataserver_a, Lifecycle lifecycle) {
this.fixerUpper = datafixer;
@@ -127,7 +149,8 @@
return (NBTBase) dynamic.get("DimensionData").get("1").get("DragonFight").orElseEmptyMap().getValue();
});
@@ -44,9 +44,9 @@
+ // CraftBukkit - decompile error
+ return new WorldDataServer(datafixer, i, nbttagcompound, dynamic.get("WasModded").asBoolean(false), dynamic.get("SpawnX").asInt(0), dynamic.get("SpawnY").asInt(0), dynamic.get("SpawnZ").asInt(0), dynamic.get("SpawnAngle").asFloat(0.0F), j, dynamic.get("DayTime").asLong(j), levelversion.levelDataVersion(), dynamic.get("clearWeatherTime").asInt(0), dynamic.get("rainTime").asInt(0), dynamic.get("raining").asBoolean(false), dynamic.get("thunderTime").asInt(0), dynamic.get("thundering").asBoolean(false), dynamic.get("initialized").asBoolean(true), dynamic.get("DifficultyLocked").asBoolean(false), WorldBorder.c.read(dynamic, WorldBorder.DEFAULT_SETTINGS), dynamic.get("WanderingTraderSpawnDelay").asInt(0), dynamic.get("WanderingTraderSpawnChance").asInt(0), (UUID) dynamic.get("WanderingTraderId").read(UUIDUtil.CODEC).result().orElse(null), (Set) dynamic.get("ServerBrands").asStream().flatMap((dynamic1) -> {
return dynamic1.asString().result().stream();
}).collect(Collectors.toCollection(Sets::newLinkedHashSet)), new CustomFunctionCallbackTimerQueue<>(CustomFunctionCallbackTimers.SERVER_CALLBACKS, dynamic.get("ScheduledEvents").asStream()), (NBTTagCompound) dynamic.get("CustomBossEvents").orElseEmptyMap().getValue(), nbttagcompound1, worldsettings, generatorsettings, lifecycle);
}).collect(Collectors.toCollection(Sets::newLinkedHashSet)), new CustomFunctionCallbackTimerQueue<>(CustomFunctionCallbackTimers.SERVER_CALLBACKS, dynamic.get("ScheduledEvents").asStream()), (NBTTagCompound) dynamic.get("CustomBossEvents").orElseEmptyMap().getValue(), nbttagcompound1, worldsettings, worldoptions, worlddataserver_a, lifecycle);
}
@@ -148,7 +171,7 @@
@@ -147,7 +170,7 @@
private void setTagData(IRegistryCustom iregistrycustom, NBTTagCompound nbttagcompound, @Nullable NBTTagCompound nbttagcompound1) {
NBTTagList nbttaglist = new NBTTagList();
@@ -55,16 +55,16 @@
Objects.requireNonNull(nbttaglist);
stream.forEach(nbttaglist::add);
@@ -163,7 +186,7 @@
@@ -162,7 +185,7 @@
nbttagcompound.put("Version", nbttagcompound2);
nbttagcompound.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
DynamicOps<NBTBase> dynamicops = RegistryOps.create(DynamicOpsNBT.INSTANCE, iregistrycustom);
- DataResult dataresult = GeneratorSettings.CODEC.encodeStart(dynamicops, this.worldGenSettings);
+ DataResult<NBTBase> dataresult = GeneratorSettings.CODEC.encodeStart(dynamicops, this.worldGenSettings); // CraftBukkit - decompile error
DynamicOps<NBTBase> dynamicops = RegistryOps.create(DynamicOpsNBT.INSTANCE, (HolderLookup.b) iregistrycustom);
- DataResult dataresult = GeneratorSettings.encode(dynamicops, this.worldOptions, iregistrycustom);
+ DataResult<NBTBase> dataresult = GeneratorSettings.encode(dynamicops, this.worldOptions, iregistrycustom); // CraftBukkit - decompile error
Logger logger = WorldDataServer.LOGGER;
Objects.requireNonNull(logger);
@@ -211,6 +234,8 @@
@@ -214,6 +237,8 @@
nbttagcompound.putUUID("WanderingTraderId", this.wanderingTraderId);
}
@@ -73,7 +73,7 @@
}
@Override
@@ -328,6 +353,20 @@
@@ -331,6 +356,20 @@
@Override
public void setThundering(boolean flag) {
@@ -94,7 +94,7 @@
this.thundering = flag;
}
@@ -348,6 +387,20 @@
@@ -351,6 +390,20 @@
@Override
public void setRaining(boolean flag) {
@@ -115,7 +115,7 @@
this.raining = flag;
}
@@ -414,6 +467,12 @@
@@ -417,6 +470,12 @@
@Override
public void setDifficulty(EnumDifficulty enumdifficulty) {
this.settings = this.settings.withDifficulty(enumdifficulty);
@@ -128,11 +128,10 @@
}
@Override
@@ -534,4 +593,12 @@
public WorldSettings getLevelSettings() {
@@ -548,6 +607,14 @@
return this.settings.copy();
}
+
+ // CraftBukkit start - Check if the name stored in NBT is the correct one
+ public void checkName(String name) {
+ if (!this.settings.levelName.equals(name)) {
@@ -140,4 +139,7 @@
+ }
+ }
+ // CraftBukkit end
}
+
/** @deprecated */
@Deprecated
public static enum a {
@@ -14,7 +14,7 @@
public class LootTable {
static final Logger LOGGER = LogUtils.getLogger();
@@ -117,8 +124,21 @@
@@ -119,8 +126,21 @@
}
public void fill(IInventory iinventory, LootTableInfo loottableinfo) {