Update to Minecraft 1.19

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-06-08 02:00:00 +10:00
parent 91d9aa9a89
commit 25f3b50f6b
332 changed files with 3628 additions and 2559 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/CommandBlockListenerAbstract.java
+++ b/net/minecraft/world/level/CommandBlockListenerAbstract.java
@@ -31,6 +31,10 @@
@@ -30,6 +30,10 @@
private IChatBaseComponent lastOutput;
private String command = "";
private IChatBaseComponent name;
@@ -11,11 +11,11 @@
public CommandBlockListenerAbstract() {
this.name = CommandBlockListenerAbstract.DEFAULT_NAME;
@@ -127,7 +131,7 @@
@@ -126,7 +130,7 @@
});
- minecraftserver.getCommands().performCommand(commandlistenerwrapper, this.command);
- minecraftserver.getCommands().performPrefixedCommand(commandlistenerwrapper, this.command);
+ minecraftserver.getCommands().dispatchServerCommand(commandlistenerwrapper, this.command); // CraftBukkit
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Executing command block");

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/Explosion.java
+++ b/net/minecraft/world/level/Explosion.java
@@ -42,6 +42,15 @@
@@ -40,6 +40,15 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.Vec3D;
@@ -16,15 +16,15 @@
public class Explosion {
private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
@@ -60,6 +69,7 @@
@@ -58,6 +67,7 @@
private final ExplosionDamageCalculator damageCalculator;
private final List<BlockPosition> toBlow;
private final ObjectArrayList<BlockPosition> toBlow;
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);
@@ -84,7 +94,7 @@
@@ -82,7 +92,7 @@
this.hitPlayers = Maps.newHashMap();
this.level = world;
this.source = entity;
@@ -33,7 +33,7 @@
this.x = d0;
this.y = d1;
this.z = d2;
@@ -134,6 +144,11 @@
@@ -132,6 +142,11 @@
}
public void explode() {
@@ -42,10 +42,10 @@
+ return;
+ }
+ // CraftBukkit end
this.level.gameEvent(this.source, GameEvent.EXPLODE, new BlockPosition(this.x, this.y, this.z));
this.level.gameEvent(this.source, GameEvent.EXPLODE, new Vec3D(this.x, this.y, this.z));
Set<BlockPosition> set = Sets.newHashSet();
boolean flag = true;
@@ -217,7 +232,35 @@
@@ -215,7 +230,35 @@
double d12 = (double) getSeenPercent(vec3d, entity);
double d13 = (1.0D - d7) * d12;
@@ -82,16 +82,16 @@
double d14 = d13;
if (entity instanceof EntityLiving) {
@@ -259,6 +302,51 @@
@@ -258,6 +301,51 @@
Collections.shuffle(this.toBlow, this.level.random);
Iterator iterator = this.toBlow.iterator();
SystemUtils.shuffle(this.toBlow, this.level.random);
ObjectListIterator objectlistiterator = this.toBlow.iterator();
+ // CraftBukkit start
+ org.bukkit.World bworld = this.level.getWorld();
+ org.bukkit.entity.Entity explode = this.source == null ? null : this.source.getBukkitEntity();
+ Location location = new Location(bworld, this.x, this.y, this.z);
+
+ List<org.bukkit.block.Block> blockList = Lists.newArrayList();
+ List<org.bukkit.block.Block> blockList = new ObjectArrayList<>();
+ for (int i1 = this.toBlow.size() - 1; i1 >= 0; i1--) {
+ BlockPosition cpos = (BlockPosition) this.toBlow.get(i1);
+ org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.getX(), cpos.getY(), cpos.getZ());
@@ -130,23 +130,23 @@
+ return;
+ }
+ // CraftBukkit end
+ iterator = this.toBlow.iterator();
+ objectlistiterator = this.toBlow.iterator();
while (iterator.hasNext()) {
BlockPosition blockposition = (BlockPosition) iterator.next();
@@ -273,8 +361,8 @@
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.level.getBlockEntity(blockposition) : null;
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.level)).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);
while (objectlistiterator.hasNext()) {
BlockPosition blockposition = (BlockPosition) objectlistiterator.next();
@@ -276,8 +364,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) {
- loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, this.radius);
+ if (this.blockInteraction == Explosion.Effect.DESTROY || yield < 1.0F) { // CraftBukkit - add yield
+ loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield
}
- if (this.blockInteraction == Explosion.Effect.DESTROY) {
- loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, this.radius);
+ if (this.blockInteraction == Explosion.Effect.DESTROY || yield < 1.0F) { // CraftBukkit - add yield
+ loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield
}
iblockdata.getDrops(loottableinfo_builder).forEach((itemstack) -> {
@@ -304,7 +392,11 @@
BlockPosition blockposition2 = (BlockPosition) iterator1.next();
iblockdata.spawnAfterBreak(worldserver, blockposition, ItemStack.EMPTY, flag2);
@@ -309,7 +397,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())) {
- this.level.setBlockAndUpdate(blockposition2, BlockFireAbstract.getState(this.level, blockposition2));
@@ -158,7 +158,7 @@
}
}
}
@@ -312,6 +404,7 @@
@@ -317,6 +409,7 @@
}
private static void addBlockDrops(ObjectArrayList<Pair<ItemStack, BlockPosition>> objectarraylist, ItemStack itemstack, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/GameRules.java
+++ b/net/minecraft/world/level/GameRules.java
@@ -118,7 +118,7 @@
@@ -119,7 +119,7 @@
}
public <T extends GameRules.GameRuleValue<T>> T getRule(GameRules.GameRuleKey<T> gamerules_gamerulekey) {
@@ -9,7 +9,7 @@
}
public NBTTagCompound createTag() {
@@ -132,7 +132,7 @@
@@ -133,7 +133,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);
@@ -152,8 +152,8 @@
@@ -153,8 +153,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) {
@@ -245,7 +245,7 @@
@@ -246,7 +246,7 @@
}
public T createRule() {
@@ -38,7 +38,7 @@
}
public void callVisitor(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
@@ -275,7 +275,7 @@
@@ -276,7 +276,7 @@
}
@@ -47,7 +47,7 @@
public abstract String serialize();
@@ -341,7 +341,7 @@
@@ -342,7 +342,7 @@
}
@Override
@@ -56,7 +56,7 @@
this.value = Boolean.parseBoolean(s);
}
@@ -406,7 +406,7 @@
@@ -407,7 +407,7 @@
}
@Override

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/GeneratorAccess.java
+++ b/net/minecraft/world/level/GeneratorAccess.java
@@ -31,11 +31,11 @@
@@ -35,11 +35,11 @@
LevelTickAccess<Block> getBlockTicks();
@@ -14,9 +14,9 @@
return new NextTickListEntry<>(t0, blockposition, this.getLevelData().getGameTime() + (long) i, this.nextSubTickCount());
}
@@ -102,4 +102,6 @@
default void gameEvent(@Nullable Entity entity, GameEvent gameevent, Entity entity1) {
this.gameEvent(entity, gameevent, entity1.blockPosition());
@@ -110,4 +110,6 @@
default void gameEvent(GameEvent gameevent, BlockPosition blockposition, GameEvent.a gameevent_a) {
this.gameEvent(gameevent, Vec3D.atCenterOf(blockposition), gameevent_a);
}
+
+ net.minecraft.server.level.WorldServer getMinecraftWorld(); // CraftBukkit

View File

@@ -8,7 +8,7 @@
}
private boolean isNearPlayer(World world, BlockPosition blockposition) {
@@ -146,7 +147,7 @@
@@ -148,7 +149,7 @@
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/SpawnerCreature.java
+++ b/net/minecraft/world/level/SpawnerCreature.java
@@ -47,6 +47,13 @@
@@ -48,6 +48,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();
@@ -111,10 +118,25 @@
@@ -112,10 +119,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;
@@ -199,10 +221,14 @@
@@ -200,10 +222,14 @@
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);
@@ -60,7 +60,7 @@
if (j >= entityinsentient.getMaxSpawnClusterSize()) {
return;
}
@@ -383,7 +409,7 @@
@@ -384,7 +410,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);
@@ -69,7 +69,7 @@
flag = true;
}
}
@@ -504,8 +530,10 @@
@@ -505,8 +531,10 @@
return this.unmodifiableMobCategoryCounts;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/World.java
+++ b/net/minecraft/world/level/World.java
@@ -65,6 +65,31 @@
@@ -67,6 +67,31 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.scores.Scoreboard;
@@ -31,12 +31,12 @@
+
public abstract class World implements GeneratorAccess, AutoCloseable {
public static final Codec<ResourceKey<World>> RESOURCE_KEY_CODEC = MinecraftKey.CODEC.xmap(ResourceKey.elementKey(IRegistry.DIMENSION_REGISTRY), ResourceKey::location);
@@ -102,7 +127,43 @@
public static final Codec<ResourceKey<World>> RESOURCE_KEY_CODEC = ResourceKey.codec(IRegistry.DIMENSION_REGISTRY);
@@ -108,7 +133,43 @@
private final ResourceKey<World> dimension;
private long subTickCount;
- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i) {
- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j) {
+ // CraftBukkit start Added the following
+ private final CraftWorld world;
+ public boolean pvpMode;
@@ -62,7 +62,7 @@
+
+ public abstract ResourceKey<WorldDimension> getTypeKey();
+
+ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
+ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
+ this.generator = gen;
+ this.world = new CraftWorld((WorldServer) this, gen, biomeProvider, env);
+
@@ -77,25 +77,25 @@
this.profiler = supplier;
this.levelData = worlddatamutable;
this.dimensionTypeRegistration = holder;
@@ -113,12 +174,12 @@
@@ -123,12 +184,12 @@
this.worldBorder = new WorldBorder() {
@Override
public double getCenterX() {
- return super.getCenterX() / World.this.dimensionType.coordinateScale();
- return super.getCenterX() / dimensionmanager.coordinateScale();
+ return super.getCenterX(); // CraftBukkit
}
@Override
public double getCenterZ() {
- return super.getCenterZ() / World.this.dimensionType.coordinateScale();
- return super.getCenterZ() / dimensionmanager.coordinateScale();
+ return super.getCenterZ(); // CraftBukkit
}
};
} else {
@@ -128,6 +189,42 @@
this.thread = Thread.currentThread();
@@ -139,6 +200,42 @@
this.biomeManager = new BiomeManager(this, i);
this.isDebug = flag1;
this.neighborUpdater = new CollectingNeighborUpdater(this, j);
+ // CraftBukkit start
+ getWorldBorder().world = (WorldServer) this;
+ // From PlayerList.setPlayerFileData
@@ -135,7 +135,7 @@
}
@Override
@@ -185,6 +282,17 @@
@@ -196,6 +293,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()) {
@@ -192,9 +300,24 @@
@@ -203,9 +311,24 @@
} else {
Chunk chunk = this.getChunkAt(blockposition);
Block block = iblockdata.getBlock();
@@ -179,7 +179,7 @@
return false;
} else {
IBlockData iblockdata2 = this.getBlockState(blockposition);
@@ -205,6 +328,7 @@
@@ -216,6 +339,7 @@
this.getProfiler().pop();
}
@@ -187,7 +187,7 @@
if (iblockdata2 == iblockdata) {
if (iblockdata1 != iblockdata2) {
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
@@ -231,12 +355,69 @@
@@ -242,12 +366,69 @@
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
}
@@ -257,25 +257,7 @@
public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
@Override
@@ -326,6 +507,17 @@
IBlockData iblockdata = this.getBlockState(blockposition);
try {
+ // CraftBukkit start
+ CraftWorld world = ((WorldServer) this).getWorld();
+ if (world != null) {
+ BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata), world.getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()));
+ this.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
+ }
+ }
+ // CraftBukkit end
iblockdata.neighborChanged(this, blockposition, block, blockposition1, false);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception while updating neighbours");
@@ -368,6 +560,14 @@
@@ -333,6 +514,14 @@
@Override
public IBlockData getBlockState(BlockPosition blockposition) {
@@ -290,7 +272,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return Blocks.VOID_AIR.defaultBlockState();
} else {
@@ -493,6 +693,16 @@
@@ -470,6 +659,16 @@
@Nullable
@Override
public TileEntity getBlockEntity(BlockPosition blockposition) {
@@ -307,7 +289,7 @@
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
}
@@ -500,6 +710,12 @@
@@ -477,6 +676,12 @@
BlockPosition blockposition = tileentity.getBlockPos();
if (!this.isOutsideBuildHeight(blockposition)) {
@@ -320,7 +302,7 @@
this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity);
}
}
@@ -604,7 +820,7 @@
@@ -595,7 +800,7 @@
for (int j = 0; j < i; ++j) {
EntityComplexPart entitycomplexpart = aentitycomplexpart[j];
@@ -329,18 +311,3 @@
if (t0 != null && predicate.test(t0)) {
list.add(t0);
@@ -932,6 +1148,14 @@
public abstract LevelEntityGetter<Entity> getEntities();
protected void postGameEventInRadius(@Nullable Entity entity, GameEvent gameevent, BlockPosition blockposition, int i) {
+ // CraftBukkit start
+ GenericGameEvent event = new GenericGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.GAME_EVENT.getKey(gameevent))), new Location(this.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()), (entity == null) ? null : entity.getBukkitEntity(), i);
+ 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.getZ() - i);
int l = SectionPosition.blockToSectionCoord(blockposition.getX() + i);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/AbstractCandleBlock.java
+++ b/net/minecraft/world/level/block/AbstractCandleBlock.java
@@ -37,6 +37,11 @@
@@ -38,6 +38,11 @@
@Override
public void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
if (!world.isClientSide && iprojectile.isOnFire() && this.canBeLit(iblockdata)) {

View File

@@ -68,7 +68,7 @@
if (soundeffect != null) {
playTiltSound(world, blockposition, soundeffect);
}
@@ -225,19 +245,27 @@
@@ -225,14 +245,21 @@
}
private static void resetTilt(IBlockData iblockdata, World world, BlockPosition blockposition) {
@@ -89,9 +89,11 @@
+ }
+ }
+ // CraftBukkit end
Tilt tilt1 = (Tilt) iblockdata.getValue(BigDripleafBlock.TILT);
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BigDripleafBlock.TILT, tilt), 2);
if (tilt.causesVibration()) {
world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition);
@@ -240,6 +267,7 @@
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, blockposition);
}
+ return true; // CraftBukkit

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/Block.java
+++ b/net/minecraft/world/level/block/Block.java
@@ -354,7 +354,13 @@
@@ -356,7 +356,13 @@
EntityItem entityitem = (EntityItem) supplier.get();
entityitem.setDefaultPickUpDelay();
@@ -15,7 +15,7 @@
}
}
@@ -380,7 +386,7 @@
@@ -382,7 +388,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,16 +24,30 @@
dropResources(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
}
@@ -520,6 +526,12 @@
@@ -522,16 +528,24 @@
return this.builtInRegistryHolder;
}
- protected void tryDropExperience(WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, IntProvider intprovider) {
+ // CraftBukkit start
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
+ protected int tryDropExperience(WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, IntProvider intprovider) {
if (EnchantmentManager.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
int i = intprovider.sample(worldserver.random);
if (i > 0) {
- this.popExperience(worldserver, blockposition, i);
+ // this.popExperience(worldserver, blockposition, i);
+ return i;
}
}
+ return 0;
+ }
+ // CraftBukkit end
+
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
+ return 0;
}
+ // CraftBukkit end
public static final class a {
private final IBlockData first;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBamboo.java
+++ b/net/minecraft/world/level/block/BlockBamboo.java
@@ -185,7 +185,7 @@
@@ -180,7 +180,7 @@
BlockPosition blockposition1 = blockposition.above(i);
IBlockData iblockdata1 = worldserver.getBlockState(blockposition1);
@@ -9,7 +9,7 @@
return;
}
@@ -206,14 +206,18 @@
@@ -201,14 +201,18 @@
BlockPosition blockposition1 = blockposition.below(2);
IBlockData iblockdata2 = world.getBlockState(blockposition1);
BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE;
@@ -30,9 +30,9 @@
}
}
} else {
@@ -224,7 +228,14 @@
@@ -219,7 +223,14 @@
int j = (Integer) iblockdata.getValue(BlockBamboo.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1;
int k = (i < 11 || random.nextFloat() >= 0.25F) && i != 15 ? 0 : 1;
int k = (i < 11 || randomsource.nextFloat() >= 0.25F) && i != 15 ? 0 : 1;
- world.setBlock(blockposition.above(), (IBlockData) ((IBlockData) ((IBlockData) this.defaultBlockState().setValue(BlockBamboo.AGE, j)).setValue(BlockBamboo.LEAVES, blockpropertybamboosize)).setValue(BlockBamboo.STAGE, k), 3);
+ // CraftBukkit start

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBambooSapling.java
+++ b/net/minecraft/world/level/block/BlockBambooSapling.java
@@ -93,6 +93,6 @@
@@ -88,6 +88,6 @@
}
protected void growBamboo(World world, BlockPosition blockposition) {

View File

@@ -24,7 +24,7 @@
+ this.explodeBed(finaliblockdata, world, finalblockposition);
+ } else
+ // CraftBukkit end
if (entityhuman_enumbedresult != null) {
if (entityhuman_enumbedresult.getMessage() != null) {
entityhuman.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
}
@@ -115,8 +125,27 @@

View File

@@ -31,7 +31,7 @@
+ // CraftBukkit end
this.press(iblockdata, world, blockposition);
this.playSound(entityhuman, world, blockposition, true);
world.gameEvent(entityhuman, GameEvent.BLOCK_PRESS, blockposition);
world.gameEvent((Entity) entityhuman, GameEvent.BLOCK_ACTIVATE, blockposition);
@@ -148,6 +166,16 @@
if (this.sensitive) {
this.checkPressed(iblockdata, worldserver, blockposition);
@@ -94,8 +94,8 @@
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_PRESS : GameEvent.BLOCK_UNPRESS, blockposition);
+ world.gameEvent((Entity) list.stream().findFirst().orElse(null), flag ? GameEvent.BLOCK_PRESS : GameEvent.BLOCK_UNPRESS, blockposition); // CraftBukkit - decompile error
- 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) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCake.java
+++ b/net/minecraft/world/level/block/BlockCake.java
@@ -84,7 +84,18 @@
@@ -85,7 +85,18 @@
return EnumInteractionResult.PASS;
} else {
entityhuman.awardStat(StatisticList.EAT_CAKE_SLICE);
@@ -19,4 +19,4 @@
+ // CraftBukkit end
int i = (Integer) iblockdata.getValue(BlockCake.BITES);
generatoraccess.gameEvent(entityhuman, GameEvent.EAT, blockposition);
generatoraccess.gameEvent((Entity) entityhuman, GameEvent.EAT, blockposition);

View File

@@ -14,7 +14,7 @@
@@ -91,7 +95,9 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (!entity.fireImmune() && (Boolean) iblockdata.getValue(BlockCampfire.LIT) && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
if ((Boolean) iblockdata.getValue(BlockCampfire.LIT) && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit
entity.hurt(DamageSource.IN_FIRE, (float) this.fireDamage);
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; // CraftBukkit

View File

@@ -11,17 +11,19 @@
public class BlockCauldron extends AbstractCauldronBlock {
private static final float RAIN_FILL_CHANCE = 0.05F;
@@ -51,11 +55,11 @@
@Override
protected void receiveStalactiteDrip(IBlockData iblockdata, World world, BlockPosition blockposition, FluidType fluidtype) {
@@ -54,13 +58,11 @@
if (fluidtype == FluidTypes.WATER) {
- world.setBlockAndUpdate(blockposition, Blocks.WATER_CAULDRON.defaultBlockState());
+ LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
iblockdata1 = Blocks.WATER_CAULDRON.defaultBlockState();
- world.setBlockAndUpdate(blockposition, iblockdata1);
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
+ LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
world.levelEvent(1047, blockposition, 0);
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
} else if (fluidtype == FluidTypes.LAVA) {
- world.setBlockAndUpdate(blockposition, Blocks.LAVA_CAULDRON.defaultBlockState());
+ LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.LAVA_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
iblockdata1 = Blocks.LAVA_CAULDRON.defaultBlockState();
- world.setBlockAndUpdate(blockposition, iblockdata1);
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
+ LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
world.levelEvent(1046, blockposition, 0);
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockChest.java
+++ b/net/minecraft/world/level/block/BlockChest.java
@@ -88,24 +88,7 @@
@@ -87,24 +87,7 @@
public Optional<ITileInventory> acceptDouble(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
final InventoryLargeChest inventorylargechest = new InventoryLargeChest(tileentitychest, tileentitychest1);
@@ -19,14 +19,14 @@
-
- @Override
- public IChatBaseComponent getDisplayName() {
- return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getDisplayName() : new ChatMessage("container.chestDouble")));
- return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getDisplayName() : IChatBaseComponent.translatable("container.chestDouble")));
- }
- });
+ return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest)); // CraftBukkit
}
public Optional<ITileInventory> acceptSingle(TileEntityChest tileentitychest) {
@@ -118,6 +101,38 @@
@@ -117,6 +100,38 @@
}
};
@@ -57,7 +57,7 @@
+
+ @Override
+ public IChatBaseComponent getDisplayName() {
+ return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getDisplayName() : new ChatMessage("container.chestDouble")));
+ return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getDisplayName() : IChatBaseComponent.translatable("container.chestDouble")));
+ }
+ };
+ // CraftBukkit end
@@ -65,7 +65,7 @@
protected BlockChest(BlockBase.Info blockbase_info, Supplier<TileEntityTypes<? extends TileEntityChest>> supplier) {
super(blockbase_info, supplier);
this.registerDefaultState((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(BlockChest.FACING, EnumDirection.NORTH)).setValue(BlockChest.TYPE, BlockPropertyChestType.SINGLE)).setValue(BlockChest.WATERLOGGED, false));
@@ -276,7 +291,7 @@
@@ -275,7 +290,7 @@
@Override
public DoubleBlockFinder.Result<? extends TileEntityChest> combine(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) {
@@ -74,7 +74,7 @@
if (flag) {
bipredicate = (generatoraccess, blockposition1) -> {
@@ -292,7 +307,14 @@
@@ -291,7 +306,14 @@
@Nullable
@Override
public ITileInventory getMenuProvider(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -22,7 +22,7 @@
+ }
+ // CraftBukkit end
} else if (i < 4) {
j = random.nextInt(4);
j = randomsource.nextInt(4);
if (flag1) {
@@ -97,18 +103,30 @@
BlockPosition blockposition2 = blockposition.relative(enumdirection);

View File

@@ -21,7 +21,7 @@
@@ -124,7 +126,7 @@
@Override
public void performBonemeal(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
public void performBonemeal(WorldServer worldserver, RandomSource randomsource, BlockPosition blockposition, IBlockData iblockdata) {
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockCocoa.AGE, (Integer) iblockdata.getValue(BlockCocoa.AGE) + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.setValue(BlockCocoa.AGE, (Integer) iblockdata.getValue(BlockCocoa.AGE) + 1), 2); // CraftBukkit
}

View File

@@ -13,7 +13,7 @@
public class BlockComposter extends Block implements IInventoryHolder {
public static final int READY = 8;
@@ -224,18 +230,25 @@
@@ -227,18 +233,25 @@
return EnumInteractionResult.sidedSuccess(world.isClientSide);
} else if (i == 8) {
@@ -42,7 +42,7 @@
itemstack.shrink(1);
return iblockdata1;
@@ -244,7 +257,15 @@
@@ -247,7 +260,15 @@
}
}
@@ -59,7 +59,7 @@
if (!world.isClientSide) {
float f = 0.7F;
double d0 = (double) (world.random.nextFloat() * 0.7F) + 0.15000000596046448D;
@@ -270,10 +291,16 @@
@@ -273,10 +294,16 @@
}
static IBlockData addItem(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack) {
@@ -77,7 +77,7 @@
return iblockdata;
} else {
int j = i + 1;
@@ -321,7 +348,8 @@
@@ -324,7 +351,8 @@
public IWorldInventory getContainer(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
int i = (Integer) iblockdata.getValue(BlockComposter.LEVEL);
@@ -87,7 +87,7 @@
}
public static class ContainerOutput extends InventorySubcontainer implements IWorldInventory {
@@ -336,6 +364,7 @@
@@ -339,6 +367,7 @@
this.state = iblockdata;
this.level = generatoraccess;
this.pos = blockposition;
@@ -95,7 +95,7 @@
}
@Override
@@ -360,8 +389,15 @@
@@ -363,8 +392,15 @@
@Override
public void setChanged() {
@@ -113,7 +113,7 @@
}
}
@@ -374,6 +410,7 @@
@@ -377,6 +413,7 @@
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
super(1);
@@ -121,7 +121,7 @@
this.state = iblockdata;
this.level = generatoraccess;
this.pos = blockposition;
@@ -416,8 +453,9 @@
@@ -419,8 +456,9 @@
public static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory {

View File

@@ -2,7 +2,7 @@
+++ b/net/minecraft/world/level/block/BlockCoral.java
@@ -25,6 +25,11 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!this.scanForWater(worldserver, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.defaultBlockState()).isCancelled()) {

View File

@@ -2,7 +2,7 @@
+++ b/net/minecraft/world/level/block/BlockCoralFan.java
@@ -28,6 +28,11 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!scanForWater(iblockdata, worldserver, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.defaultBlockState().setValue(BlockCoralFan.WATERLOGGED, false)).isCancelled()) {

View File

@@ -2,7 +2,7 @@
+++ b/net/minecraft/world/level/block/BlockCoralFanWall.java
@@ -28,6 +28,11 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!scanForWater(iblockdata, worldserver, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.defaultBlockState().setValue(BlockCoralFanWall.WATERLOGGED, false).setValue(BlockCoralFanWall.FACING, iblockdata.getValue(BlockCoralFanWall.FACING))).isCancelled()) {

View File

@@ -2,7 +2,7 @@
+++ b/net/minecraft/world/level/block/BlockCoralPlant.java
@@ -33,6 +33,11 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!scanForWater(iblockdata, worldserver, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.defaultBlockState().setValue(BlockCoralPlant.WATERLOGGED, false)).isCancelled()) {

View File

@@ -12,7 +12,7 @@
@@ -76,7 +78,7 @@
float f = getGrowthSpeed(this, worldserver, blockposition);
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
if (randomsource.nextInt((int) (25.0F / f) + 1) == 0) {
- worldserver.setBlock(blockposition, this.getStateForAge(i + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.getStateForAge(i + 1), 2); // CraftBukkit
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockDaylightDetector.java
+++ b/net/minecraft/world/level/block/BlockDaylightDetector.java
@@ -66,6 +66,7 @@
@@ -67,6 +67,7 @@
i = MathHelper.clamp(i, (int) 0, (int) 15);
if ((Integer) iblockdata.getValue(BlockDaylightDetector.POWER) != i) {

View File

@@ -2,7 +2,7 @@
+++ b/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
@@ -40,6 +40,11 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!canBeGrass(iblockdata, worldserver, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.DIRT.defaultBlockState()).isCancelled()) {
@@ -13,7 +13,7 @@
} else {
if (worldserver.getMaxLocalRawBrightness(blockposition.above()) >= 9) {
@@ -49,7 +54,7 @@
BlockPosition blockposition1 = blockposition.offset(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
BlockPosition blockposition1 = blockposition.offset(randomsource.nextInt(3) - 1, randomsource.nextInt(5) - 3, randomsource.nextInt(3) - 1);
if (worldserver.getBlockState(blockposition1).is(Blocks.DIRT) && canPropagate(iblockdata1, worldserver, blockposition1)) {
- worldserver.setBlockAndUpdate(blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, worldserver.getBlockState(blockposition1.above()).is(Blocks.SNOW)));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockDispenser.java
+++ b/net/minecraft/world/level/block/BlockDispenser.java
@@ -46,6 +46,7 @@
@@ -47,6 +47,7 @@
object2objectopenhashmap.defaultReturnValue(new DispenseBehaviorItem());
});
private static final int TRIGGER_DURATION = 4;
@@ -8,7 +8,7 @@
public static void registerBehavior(IMaterial imaterial, IDispenseBehavior idispensebehavior) {
BlockDispenser.DISPENSER_REGISTRY.put(imaterial.asItem(), idispensebehavior);
@@ -89,6 +90,7 @@
@@ -90,6 +91,7 @@
IDispenseBehavior idispensebehavior = this.getDispenseMethod(itemstack);
if (idispensebehavior != IDispenseBehavior.NOOP) {

View File

@@ -35,4 +35,4 @@
+ // CraftBukkit end
if (flag1 != (Boolean) iblockdata.getValue(BlockDoor.OPEN)) {
this.playSound(world, blockposition, flag1);
world.gameEvent(flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, blockposition);
world.gameEvent((Entity) null, flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, blockposition);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockFenceGate.java
+++ b/net/minecraft/world/level/block/BlockFenceGate.java
@@ -128,6 +128,17 @@
@@ -129,6 +129,17 @@
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
if (!world.isClientSide) {
boolean flag1 = world.hasNeighborSignal(blockposition);

View File

@@ -53,11 +53,11 @@
@@ -149,7 +174,7 @@
int i = (Integer) iblockdata.getValue(BlockFire.AGE);
if (!flag && worldserver.isRaining() && this.isNearRain(worldserver, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) {
if (!flag && worldserver.isRaining() && this.isNearRain(worldserver, blockposition) && randomsource.nextFloat() < 0.2F + (float) i * 0.03F) {
- worldserver.removeBlock(blockposition, false);
+ fireExtinguished(worldserver, blockposition); // CraftBukkit - extinguished by rain
} else {
int j = Math.min(15, i + random.nextInt(3) / 2);
int j = Math.min(15, i + randomsource.nextInt(3) / 2);
@@ -163,14 +188,14 @@
BlockPosition blockposition1 = blockposition.below();
@@ -70,7 +70,7 @@
return;
}
if (i == 15 && random.nextInt(4) == 0 && !this.canBurn(worldserver.getBlockState(blockposition.below()))) {
if (i == 15 && randomsource.nextInt(4) == 0 && !this.canBurn(worldserver.getBlockState(blockposition.below()))) {
- worldserver.removeBlock(blockposition, false);
+ fireExtinguished(worldserver, blockposition); // CraftBukkit
return;
@@ -80,26 +80,26 @@
boolean flag1 = worldserver.isHumidAt(blockposition);
int k = flag1 ? -50 : 0;
- this.checkBurnOut(worldserver, blockposition.east(), 300 + k, random, i);
- this.checkBurnOut(worldserver, blockposition.west(), 300 + k, random, i);
- this.checkBurnOut(worldserver, blockposition.below(), 250 + k, random, i);
- this.checkBurnOut(worldserver, blockposition.above(), 250 + k, random, i);
- this.checkBurnOut(worldserver, blockposition.north(), 300 + k, random, i);
- this.checkBurnOut(worldserver, blockposition.south(), 300 + k, random, i);
- this.checkBurnOut(worldserver, blockposition.east(), 300 + k, randomsource, i);
- this.checkBurnOut(worldserver, blockposition.west(), 300 + k, randomsource, i);
- this.checkBurnOut(worldserver, blockposition.below(), 250 + k, randomsource, i);
- this.checkBurnOut(worldserver, blockposition.above(), 250 + k, randomsource, i);
- this.checkBurnOut(worldserver, blockposition.north(), 300 + k, randomsource, i);
- this.checkBurnOut(worldserver, blockposition.south(), 300 + k, randomsource, i);
+ // CraftBukkit start - add source blockposition to burn calls
+ this.trySpread(worldserver, blockposition.east(), 300 + k, random, i, blockposition);
+ this.trySpread(worldserver, blockposition.west(), 300 + k, random, i, blockposition);
+ this.trySpread(worldserver, blockposition.below(), 250 + k, random, i, blockposition);
+ this.trySpread(worldserver, blockposition.above(), 250 + k, random, i, blockposition);
+ this.trySpread(worldserver, blockposition.north(), 300 + k, random, i, blockposition);
+ this.trySpread(worldserver, blockposition.south(), 300 + k, random, i, blockposition);
+ this.trySpread(worldserver, blockposition.east(), 300 + k, randomsource, i, blockposition);
+ this.trySpread(worldserver, blockposition.west(), 300 + k, randomsource, i, blockposition);
+ this.trySpread(worldserver, blockposition.below(), 250 + k, randomsource, i, blockposition);
+ this.trySpread(worldserver, blockposition.above(), 250 + k, randomsource, i, blockposition);
+ this.trySpread(worldserver, blockposition.north(), 300 + k, randomsource, i, blockposition);
+ this.trySpread(worldserver, blockposition.south(), 300 + k, randomsource, i, blockposition);
+ // CraftBukkit end
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
for (int l = -1; l <= 1; ++l) {
@@ -209,7 +236,15 @@
if (i2 > 0 && random.nextInt(k1) <= i2 && (!worldserver.isRaining() || !this.isNearRain(worldserver, blockposition_mutableblockposition))) {
int j2 = Math.min(15, i + random.nextInt(5) / 4);
if (i2 > 0 && randomsource.nextInt(k1) <= i2 && (!worldserver.isRaining() || !this.isNearRain(worldserver, blockposition_mutableblockposition))) {
int j2 = Math.min(15, i + randomsource.nextInt(5) / 4);
- worldserver.setBlock(blockposition_mutableblockposition, this.getStateWithAge(worldserver, blockposition_mutableblockposition, j2), 3);
+ // CraftBukkit start - Call to stop spread of fire
@@ -115,14 +115,14 @@
}
}
@@ -233,12 +268,24 @@
return iblockdata.hasProperty(BlockProperties.WATERLOGGED) && (Boolean) iblockdata.getValue(BlockProperties.WATERLOGGED) ? 0 : this.flameOdds.getInt(iblockdata.getBlock());
return iblockdata.hasProperty(BlockProperties.WATERLOGGED) && (Boolean) iblockdata.getValue(BlockProperties.WATERLOGGED) ? 0 : this.igniteOdds.getInt(iblockdata.getBlock());
}
- private void checkBurnOut(World world, BlockPosition blockposition, int i, Random random, int j) {
+ private void trySpread(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition
int k = this.getBurnOdd(world.getBlockState(blockposition));
- private void checkBurnOut(World world, BlockPosition blockposition, int i, RandomSource randomsource, int j) {
+ private void trySpread(World world, BlockPosition blockposition, int i, RandomSource randomsource, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition
int k = this.getBurnOdds(world.getBlockState(blockposition));
if (random.nextInt(i) < k) {
if (randomsource.nextInt(i) < k) {
IBlockData iblockdata = world.getBlockState(blockposition);
+ // CraftBukkit start
@@ -137,6 +137,6 @@
+ }
+ // CraftBukkit end
+
if (random.nextInt(j + 10) < 5 && !world.isRainingAt(blockposition)) {
int l = Math.min(j + random.nextInt(5) / 4, 15);
if (randomsource.nextInt(j + 10) < 5 && !world.isRainingAt(blockposition)) {
int l = Math.min(j + randomsource.nextInt(5) / 4, 15);

View File

@@ -14,9 +14,9 @@
+ }
+ // CraftBukkit end
}
}
entity.hurt(DamageSource.IN_FIRE, this.fireDamage);
@@ -146,14 +153,14 @@
@@ -145,14 +152,14 @@
}
if (!iblockdata.canSurvive(world, blockposition)) {
@@ -33,7 +33,7 @@
}
@Override
@@ -201,4 +208,12 @@
@@ -200,4 +207,12 @@
}
}
}

View File

@@ -3,7 +3,7 @@
@@ -51,6 +51,13 @@
@Override
public void performBonemeal(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
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;
@@ -11,6 +11,6 @@
+ BlockSapling.treeType = org.bukkit.TreeType.CRIMSON_FUNGUS;
+ }
+ // CraftBukkit end
((WorldGenFeatureConfigured) ((Holder) this.feature.get()).value()).place(worldserver, worldserver.getChunkSource().getGenerator(), random, blockposition);
((WorldGenFeatureConfigured) ((Holder) this.feature.get()).value()).place(worldserver, worldserver.getChunkSource().getGenerator(), randomsource, blockposition);
}
}

View File

@@ -3,7 +3,7 @@
@@ -43,6 +43,11 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
+ // CraftBukkit start - do not fade if the block is valid here
+ if (iblockdata.canSurvive(worldserver, blockposition)) {
+ return;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockJukeBox.java
+++ b/net/minecraft/world/level/block/BlockJukeBox.java
@@ -59,7 +59,13 @@
@@ -62,7 +62,13 @@
TileEntity tileentity = generatoraccess.getBlockEntity(blockposition);
if (tileentity instanceof TileEntityJukeBox) {
@@ -13,5 +13,5 @@
+ ((TileEntityJukeBox) tileentity).setRecord(itemstack);
+ // CraftBukkit end
generatoraccess.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockJukeBox.HAS_RECORD, true), 2);
generatoraccess.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entity, iblockdata));
}
}

View File

@@ -1,18 +1,18 @@
--- a/net/minecraft/world/level/block/BlockLeaves.java
+++ b/net/minecraft/world/level/block/BlockLeaves.java
@@ -19,6 +19,8 @@
@@ -22,6 +22,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
+
public class BlockLeaves extends Block {
public class BlockLeaves extends Block implements IBlockWaterlogged {
public static final int DECAY_DISTANCE = 7;
@@ -44,6 +46,14 @@
@@ -48,6 +50,14 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (!(Boolean) iblockdata.getValue(BlockLeaves.PERSISTENT) && (Integer) iblockdata.getValue(BlockLeaves.DISTANCE) == 7) {
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (this.decaying(iblockdata)) {
+ // CraftBukkit start
+ LeavesDecayEvent event = new LeavesDecayEvent(worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ worldserver.getCraftServer().getPluginManager().callEvent(event);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockLectern.java
+++ b/net/minecraft/world/level/block/BlockLectern.java
@@ -197,12 +197,13 @@
@@ -198,12 +198,13 @@
}
private void popBook(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockLever.java
+++ b/net/minecraft/world/level/block/BlockLever.java
@@ -23,6 +23,8 @@
@@ -24,6 +24,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,7 +9,7 @@
public class BlockLever extends BlockAttachable {
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
@@ -90,6 +92,20 @@
@@ -91,6 +93,20 @@
return EnumInteractionResult.SUCCESS;
} else {

View File

@@ -3,7 +3,7 @@
@@ -29,7 +29,9 @@
@Override
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
if (!entity.fireImmune() && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
if (!entity.isSteppingCarefully() && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
entity.hurt(DamageSource.HOT_FLOOR, 1.0F);
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; // CraftBukkit

View File

@@ -1,19 +1,23 @@
--- a/net/minecraft/world/level/block/BlockMobSpawner.java
+++ b/net/minecraft/world/level/block/BlockMobSpawner.java
@@ -33,9 +33,16 @@
@@ -33,12 +33,20 @@
@Override
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack);
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
+ // CraftBukkit start - Delegate to getExpDrop
+ }
+
+ @Override
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
int i = 15 + worldserver.random.nextInt(15) + worldserver.random.nextInt(15);
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
if (flag) {
int i = 15 + worldserver.random.nextInt(15) + worldserver.random.nextInt(15);
- this.popExperience(worldserver, blockposition, i);
+ // this.popExperience(worldserver, blockposition, i);
+ return i;
- this.popExperience(worldserver, blockposition, i);
+ // this.popExperience(worldserver, blockposition, i);
+ return i;
}
+ return 0;
+ // CraftBukkit end
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockMonsterEggs.java
+++ b/net/minecraft/world/level/block/BlockMonsterEggs.java
@@ -18,6 +18,8 @@
@@ -16,6 +16,8 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.block.state.properties.IBlockState;
@@ -9,7 +9,7 @@
public class BlockMonsterEggs extends Block {
private final Block hostBlock;
@@ -43,7 +45,7 @@
@@ -41,7 +43,7 @@
EntitySilverfish entitysilverfish = (EntitySilverfish) EntityTypes.SILVERFISH.create(worldserver);
entitysilverfish.moveTo((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);

View File

@@ -22,9 +22,9 @@
@@ -82,6 +86,7 @@
public boolean growMushroom(WorldServer worldserver, BlockPosition blockposition, IBlockData iblockdata, Random random) {
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(), random, blockposition)) {
if (((WorldGenFeatureConfigured) ((Holder) this.featureSupplier.get()).value()).place(worldserver, worldserver.getChunkSource().getGenerator(), randomsource, blockposition)) {
return true;
} else {

View File

@@ -2,7 +2,7 @@
+++ b/net/minecraft/world/level/block/BlockNetherWart.java
@@ -46,7 +46,7 @@
if (i < 3 && random.nextInt(10) == 0) {
if (i < 3 && randomsource.nextInt(10) == 0) {
iblockdata = (IBlockData) iblockdata.setValue(BlockNetherWart.AGE, i + 1);
- worldserver.setBlock(blockposition, iblockdata, 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata, 2); // CraftBukkit

View File

@@ -1,47 +1,50 @@
--- a/net/minecraft/world/level/block/BlockNote.java
+++ b/net/minecraft/world/level/block/BlockNote.java
@@ -48,7 +48,8 @@
@@ -51,7 +51,8 @@
if (flag1 != (Boolean) iblockdata.getValue(BlockNote.POWERED)) {
if (flag1) {
- this.playNote(world, blockposition);
+ this.playNote(world, blockposition, iblockdata); // CraftBukkit
- this.playNote((Entity) null, world, blockposition);
+ this.playNote((Entity) null, world, blockposition, iblockdata); // CraftBukkit
+ iblockdata = world.getBlockState(blockposition); // CraftBukkit - SPIGOT-5617: update in case changed in event
}
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockNote.POWERED, flag1), 3);
@@ -56,9 +57,14 @@
@@ -59,11 +60,18 @@
}
- private void playNote(World world, BlockPosition blockposition) {
+ private void playNote(World world, BlockPosition blockposition, IBlockData data) { // CraftBukkit
- 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()) {
- world.blockEvent(blockposition, this, 0, 0);
+ // CraftBukkit start
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, data.getValue(BlockNote.INSTRUMENT), data.getValue(BlockNote.NOTE));
+ if (!event.isCancelled()) {
+ world.blockEvent(blockposition, this, 0, 0);
+ if (event.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.blockEvent(blockposition, this, 0, 0);
world.gameEvent(entity, GameEvent.NOTE_BLOCK_PLAY, blockposition);
}
+
}
@@ -70,7 +76,7 @@
@Override
@@ -73,7 +81,7 @@
} else {
iblockdata = (IBlockData) iblockdata.cycle(BlockNote.NOTE);
world.setBlock(blockposition, iblockdata, 3);
- this.playNote(world, blockposition);
+ this.playNote(world, blockposition, iblockdata); // CraftBukkit
- this.playNote(entityhuman, world, blockposition);
+ this.playNote(entityhuman, world, blockposition, iblockdata); // CraftBukkit
entityhuman.awardStat(StatisticList.TUNE_NOTEBLOCK);
return EnumInteractionResult.CONSUME;
}
@@ -79,7 +85,7 @@
@@ -82,7 +90,7 @@
@Override
public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
if (!world.isClientSide) {
- this.playNote(world, blockposition);
+ this.playNote(world, blockposition, iblockdata); // CraftBukkit
- this.playNote(entityhuman, world, blockposition);
+ this.playNote(entityhuman, world, blockposition, iblockdata); // CraftBukkit
entityhuman.awardStat(StatisticList.PLAY_NOTEBLOCK);
}
}

View File

@@ -2,7 +2,7 @@
+++ b/net/minecraft/world/level/block/BlockNylium.java
@@ -31,6 +31,11 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!canBeNylium(iblockdata, worldserver, blockposition)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.NETHERRACK.defaultBlockState()).isCancelled()) {

View File

@@ -11,7 +11,7 @@
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
@@ -41,8 +43,18 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if ((Boolean) iblockdata.getValue(BlockObserver.POWERED)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {

View File

@@ -1,24 +0,0 @@
--- a/net/minecraft/world/level/block/BlockOre.java
+++ b/net/minecraft/world/level/block/BlockOre.java
@@ -25,13 +25,20 @@
@Override
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack);
+ // CraftBukkit start - Delegated to getExpDrop
+ }
+
+ @Override
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
+ // CraftBukkit end
if (EnchantmentManager.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
int i = this.xpRange.sample(worldserver.random);
if (i > 0) {
- this.popExperience(worldserver, blockposition, i);
+ return i; // CraftBukkit
}
}
+ return 0; // CraftBukkit
}
}

View File

@@ -23,7 +23,7 @@
}
@@ -45,6 +52,11 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if ((Boolean) iblockdata.getValue(BlockRedstoneLamp.LIT) && !worldserver.hasNeighborSignal(blockposition)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {

View File

@@ -12,7 +12,7 @@
public class BlockRedstoneOre extends Block {
public static final BlockStateBoolean LIT = BlockRedstoneTorch.LIT;
@@ -32,14 +37,30 @@
@@ -32,14 +37,27 @@
@Override
public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
@@ -23,30 +23,26 @@
@Override
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
- interact(iblockdata, world, blockposition);
- super.stepOn(world, blockposition, iblockdata, entity);
+ // CraftBukkit start
+ // interact(iblockdata, world, blockposition);
+ // super.stepOn(world, blockposition, iblockdata, entity);
+ if (entity instanceof EntityHuman) {
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
+ if (!event.isCancelled()) {
+ interact(world.getBlockState(blockposition), world, blockposition, entity); // add entity
+ super.stepOn(world, blockposition, iblockdata, entity);
if (!entity.isSteppingCarefully()) {
- interact(iblockdata, world, blockposition);
+ // CraftBukkit start
+ if (entity instanceof EntityHuman) {
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
+ if (!event.isCancelled()) {
+ interact(world.getBlockState(blockposition), world, blockposition, entity); // add entity
+ }
+ } else {
+ EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getCraftServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ interact(world.getBlockState(blockposition), world, blockposition, entity); // add entity
+ }
+ }
+ } else {
+ EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getCraftServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ interact(world.getBlockState(blockposition), world, blockposition, entity); // add entity
+ super.stepOn(world, blockposition, iblockdata, entity);
+ }
+ }
+ // CraftBukkit end
}
+ // CraftBukkit end
}
@Override
@@ -47,7 +68,7 @@
super.stepOn(world, blockposition, iblockdata, entity);
@@ -50,7 +68,7 @@
if (world.isClientSide) {
spawnParticles(world, blockposition);
} else {
@@ -55,7 +51,7 @@
}
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
@@ -55,9 +76,14 @@
@@ -58,9 +76,14 @@
return itemstack.getItem() instanceof ItemBlock && (new BlockActionContext(entityhuman, enumhand, itemstack, movingobjectpositionblock)).canPlace() ? EnumInteractionResult.PASS : EnumInteractionResult.SUCCESS;
}
@@ -71,9 +67,9 @@
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneOre.LIT, true), 3);
}
@@ -71,6 +97,11 @@
@@ -74,6 +97,11 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if ((Boolean) iblockdata.getValue(BlockRedstoneOre.LIT)) {
+ // CraftBukkit start
+ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, iblockdata.setValue(BlockRedstoneOre.LIT, false)).isCancelled()) {
@@ -83,16 +79,16 @@
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneOre.LIT, false), 3);
}
@@ -79,12 +110,20 @@
@@ -82,12 +110,20 @@
@Override
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack);
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
+ // CraftBukkit start - Delegated to getExpDrop
+ }
+
+ @Override
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack) {
if (EnchantmentManager.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
if (flag && EnchantmentManager.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
int i = 1 + worldserver.random.nextInt(5);
- this.popExperience(worldserver, blockposition, i);

View File

@@ -9,7 +9,7 @@
public class BlockRedstoneWire extends Block {
public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.NORTH_REDSTONE;
@@ -257,7 +259,16 @@
@@ -255,7 +257,16 @@
private void updatePowerStrength(World world, BlockPosition blockposition, IBlockData iblockdata) {
int i = this.calculateTargetStrength(world, blockposition);

View File

@@ -23,12 +23,12 @@
super(blockbase_info);
@@ -35,7 +43,30 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
if (worldserver.getMaxLocalRawBrightness(blockposition.above()) >= 9 && random.nextInt(7) == 0) {
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (worldserver.getMaxLocalRawBrightness(blockposition.above()) >= 9 && randomsource.nextInt(7) == 0) {
+ // CraftBukkit start
+ worldserver.captureTreeGeneration = true;
+ // CraftBukkit end
this.advanceTree(worldserver, blockposition, iblockdata, random);
this.advanceTree(worldserver, blockposition, iblockdata, randomsource);
+ // CraftBukkit start
+ worldserver.captureTreeGeneration = false;
+ if (worldserver.capturedBlockStates.size() > 0) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/block/BlockSnow.java
+++ b/net/minecraft/world/level/block/BlockSnow.java
@@ -86,6 +86,11 @@
@@ -92,6 +92,11 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (worldserver.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {

View File

@@ -16,7 +16,7 @@
- worldserver.setBlock(blockposition, iblockdata, 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata, 2); // CraftBukkit
} else {
EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.getRandomDirection(random);
EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.getRandomDirection(randomsource);
BlockPosition blockposition1 = blockposition.relative(enumdirection);
IBlockData iblockdata1 = worldserver.getBlockState(blockposition1.below());

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSweetBerryBush.java
+++ b/net/minecraft/world/level/block/BlockSweetBerryBush.java
@@ -26,6 +26,14 @@
@@ -27,6 +27,14 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -15,16 +15,16 @@
public class BlockSweetBerryBush extends BlockPlant implements IBlockFragilePlantElement {
private static final float HURT_SPEED_THRESHOLD = 0.003F;
@@ -59,7 +67,7 @@
int i = (Integer) iblockdata.getValue(BlockSweetBerryBush.AGE);
@@ -62,7 +70,7 @@
if (i < 3 && randomsource.nextInt(5) == 0 && worldserver.getRawBrightness(blockposition.above(), 0) >= 9) {
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, i + 1);
if (i < 3 && random.nextInt(5) == 0 && worldserver.getRawBrightness(blockposition.above(), 0) >= 9) {
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, i + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, i + 1), 2); // CraftBukkit
- worldserver.setBlock(blockposition, iblockdata1, 2);
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata1, 2)) return; // CraftBukkit
worldserver.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
}
}
@@ -73,7 +81,9 @@
@@ -77,7 +85,9 @@
double d1 = Math.abs(entity.getZ() - entity.zOld);
if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) {
@@ -34,7 +34,7 @@
}
}
@@ -90,7 +100,15 @@
@@ -94,7 +104,15 @@
} else if (i > 1) {
int j = 1 + world.random.nextInt(2);
@@ -49,5 +49,5 @@
+ }
+ // CraftBukkit end
world.playSound((EntityHuman) null, blockposition, SoundEffects.SWEET_BERRY_BUSH_PICK_BERRIES, SoundCategory.BLOCKS, 1.0F, 0.8F + world.random.nextFloat() * 0.4F);
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, 1), 2);
return EnumInteractionResult.sidedSuccess(world.isClientSide);
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, 1);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTrapdoor.java
+++ b/net/minecraft/world/level/block/BlockTrapdoor.java
@@ -27,6 +27,8 @@
@@ -28,6 +28,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;
@@ -115,6 +117,19 @@
@@ -116,6 +118,19 @@
boolean flag1 = world.hasNeighborSignal(blockposition);
if (flag1 != (Boolean) iblockdata.getValue(BlockTrapdoor.POWERED)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTripwireHook.java
+++ b/net/minecraft/world/level/block/BlockTripwireHook.java
@@ -26,6 +26,8 @@
@@ -27,6 +27,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,8 +9,8 @@
public class BlockTripwireHook extends Block {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
@@ -160,6 +162,17 @@
this.playSound(world, blockposition1, flag4, flag5, flag2, flag3);
@@ -161,6 +163,17 @@
this.emitState(world, blockposition1, flag4, flag5, flag2, flag3);
}
+ // CraftBukkit start
@@ -24,6 +24,6 @@
+ }
+ // CraftBukkit end
+
this.playSound(world, blockposition, flag4, flag5, flag2, flag3);
this.emitState(world, blockposition, flag4, flag5, flag2, flag3);
if (!flag) {
world.setBlock(blockposition, (IBlockData) iblockdata3.setValue(BlockTripwireHook.FACING, enumdirection), 3);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTurtleEgg.java
+++ b/net/minecraft/world/level/block/BlockTurtleEgg.java
@@ -28,6 +28,12 @@
@@ -29,6 +29,12 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -13,7 +13,7 @@
public class BlockTurtleEgg extends Block {
public static final int MAX_HATCH_LEVEL = 2;
@@ -61,6 +67,19 @@
@@ -65,6 +71,19 @@
private void destroyEgg(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, int i) {
if (this.canDestroyEgg(world, entity)) {
if (!world.isClientSide && world.random.nextInt(i) == 0 && iblockdata.is(Blocks.TURTLE_EGG)) {
@@ -33,7 +33,7 @@
this.decreaseEggs(world, blockposition, iblockdata);
}
@@ -86,9 +105,19 @@
@@ -91,9 +110,19 @@
int i = (Integer) iblockdata.getValue(BlockTurtleEgg.HATCH);
if (i < 2) {
@@ -42,7 +42,7 @@
+ return;
+ }
+ // CraftBukkit end
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_EGG_CRACK, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_EGG_CRACK, SoundCategory.BLOCKS, 0.7F, 0.9F + randomsource.nextFloat() * 0.2F);
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockTurtleEgg.HATCH, i + 1), 2);
+ // worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockTurtleEgg.HATCH, i + 1), 2); // CraftBukkit - handled above
} else {
@@ -51,10 +51,10 @@
+ return;
+ }
+ // CraftBukkit end
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F);
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + randomsource.nextFloat() * 0.2F);
worldserver.removeBlock(blockposition, false);
@@ -99,7 +128,7 @@
@@ -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);

View File

@@ -9,7 +9,7 @@
public class BlockVine extends Block {
public static final BlockStateBoolean UP = BlockSprawling.UP;
@@ -196,20 +198,24 @@
@@ -194,20 +196,24 @@
BlockPosition blockposition3 = blockposition2.relative(enumdirection1);
BlockPosition blockposition4 = blockposition2.relative(enumdirection2);
@@ -31,7 +31,7 @@
} else if (flag1 && worldserver.isEmptyBlock(blockposition4) && isAcceptableNeighbour(worldserver, blockposition.relative(enumdirection2), enumdirection3)) {
- worldserver.setBlock(blockposition4, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition4, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
} else if ((double) random.nextFloat() < 0.05D && isAcceptableNeighbour(worldserver, blockposition2.above(), EnumDirection.UP)) {
} else if ((double) randomsource.nextFloat() < 0.05D && isAcceptableNeighbour(worldserver, blockposition2.above(), EnumDirection.UP)) {
- worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(BlockVine.UP, true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(BlockVine.UP, true), 2);
}
@@ -39,7 +39,7 @@
}
} else if (isAcceptableNeighbour(worldserver, blockposition2, enumdirection)) {
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(getPropertyForFace(enumdirection), true), 2);
@@ -239,7 +245,7 @@
@@ -237,7 +243,7 @@
}
if (this.hasHorizontalConnection(iblockdata2)) {
@@ -48,8 +48,8 @@
}
return;
@@ -254,7 +260,7 @@
IBlockData iblockdata4 = this.copyRandomFaces(iblockdata, iblockdata3, random);
@@ -252,7 +258,7 @@
IBlockData iblockdata4 = this.copyRandomFaces(iblockdata, iblockdata3, randomsource);
if (iblockdata3 != iblockdata4 && this.hasHorizontalConnection(iblockdata4)) {
- worldserver.setBlock(blockposition2, iblockdata4, 2);

View File

@@ -2,7 +2,7 @@
+++ b/net/minecraft/world/level/block/ChangeOverTimeBlock.java
@@ -69,7 +69,7 @@
if (random.nextFloat() < f1) {
if (randomsource.nextFloat() < f1) {
this.getNext(iblockdata).ifPresent((iblockdata2) -> {
- worldserver.setBlockAndUpdate(blockposition, iblockdata2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(worldserver, blockposition, iblockdata2); // CraftBukkit

View File

@@ -0,0 +1,20 @@
--- a/net/minecraft/world/level/block/DropExperienceBlock.java
+++ b/net/minecraft/world/level/block/DropExperienceBlock.java
@@ -24,9 +24,16 @@
@Override
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
+ // CraftBukkit start - Delegate to getExpDrop
+ }
+
+ @Override
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
if (flag) {
- this.tryDropExperience(worldserver, blockposition, itemstack, this.xpRange);
+ return this.tryDropExperience(worldserver, blockposition, itemstack, this.xpRange);
}
+ return 0;
+ // CraftBukkit end
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -16,6 +16,12 @@
@@ -17,6 +17,12 @@
import net.minecraft.world.level.material.FluidType;
import net.minecraft.world.level.material.FluidTypes;
@@ -13,7 +13,7 @@
public class LayeredCauldronBlock extends AbstractCauldronBlock {
public static final int MIN_FILL_LEVEL = 1;
@@ -55,10 +61,14 @@
@@ -56,10 +62,14 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (!world.isClientSide && entity.isOnFire() && this.isEntityInsideContent(iblockdata, blockposition, entity)) {
@@ -30,7 +30,7 @@
}
}
@@ -68,15 +78,38 @@
@@ -69,20 +79,42 @@
}
public static void lowerFillLevel(IBlockData iblockdata, World world, BlockPosition blockposition) {
@@ -40,9 +40,11 @@
+
+ public static boolean lowerFillLevel(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) {
int i = (Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) - 1;
IBlockData iblockdata1 = i == 0 ? Blocks.CAULDRON.defaultBlockState() : (IBlockData) iblockdata.setValue(LayeredCauldronBlock.LEVEL, i);
- world.setBlockAndUpdate(blockposition, i == 0 ? Blocks.CAULDRON.defaultBlockState() : (IBlockData) iblockdata.setValue(LayeredCauldronBlock.LEVEL, i));
+ return changeLevel(iblockdata, world, blockposition, i == 0 ? Blocks.CAULDRON.defaultBlockState() : iblockdata.setValue(LayeredCauldronBlock.LEVEL, i), entity, reason);
- world.setBlockAndUpdate(blockposition, iblockdata1);
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
+ return changeLevel(iblockdata, world, blockposition, iblockdata1, entity, reason);
}
+ // CraftBukkit start
@@ -59,6 +61,7 @@
+ return false;
+ }
+ newState.update(true);
+ world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(newBlock));
+ return true;
+ }
+ // CraftBukkit end
@@ -66,18 +69,22 @@
@Override
public void handlePrecipitation(IBlockData iblockdata, World world, BlockPosition blockposition, BiomeBase.Precipitation biomebase_precipitation) {
if (BlockCauldron.shouldHandlePrecipitation(world, biomebase_precipitation) && (Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) != 3 && this.fillPredicate.test(biomebase_precipitation)) {
- world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL));
+ changeLevel(iblockdata, world, blockposition, (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
IBlockData iblockdata1 = (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL);
- world.setBlockAndUpdate(blockposition, iblockdata1);
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
+ changeLevel(iblockdata, world, blockposition, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
}
}
@@ -93,7 +126,11 @@
@Override
protected void receiveStalactiteDrip(IBlockData iblockdata, World world, BlockPosition blockposition, FluidType fluidtype) {
@@ -101,8 +133,11 @@
if (!this.isFull(iblockdata)) {
- world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(LayeredCauldronBlock.LEVEL, (Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) + 1));
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(LayeredCauldronBlock.LEVEL, (Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) + 1);
- world.setBlockAndUpdate(blockposition, iblockdata1);
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
+ // CraftBukkit start
+ if (!changeLevel(iblockdata, world, blockposition, (IBlockData) iblockdata.setValue(LayeredCauldronBlock.LEVEL, (Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) + 1), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) {
+ if (!changeLevel(iblockdata, world, blockposition, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) {
+ return;
+ }
+ // CraftBukkit end

View File

@@ -1,38 +0,0 @@
--- a/net/minecraft/world/level/block/MultifaceBlock.java
+++ b/net/minecraft/world/level/block/MultifaceBlock.java
@@ -133,7 +133,7 @@
return (IBlockData) Arrays.stream(blockactioncontext.getNearestLookingDirections()).map((enumdirection) -> {
return this.getStateForPlacement(iblockdata, world, blockposition, enumdirection);
- }).filter(Objects::nonNull).findFirst().orElse((Object) null);
+ }).filter(Objects::nonNull).findFirst().orElse(null); // CraftBukkit - decompile error
}
@Nullable
@@ -225,7 +225,7 @@
if (optional.isPresent()) {
Pair<BlockPosition, EnumDirection> pair = (Pair) optional.get();
- return this.spreadToFace(generatoraccess, (BlockPosition) pair.getFirst(), (EnumDirection) pair.getSecond(), flag);
+ return this.spreadToFace(generatoraccess, (BlockPosition) pair.getFirst(), (EnumDirection) pair.getSecond(), flag, blockposition); // CraftBukkit
} else {
return false;
}
@@ -270,7 +270,7 @@
}
}
- private boolean spreadToFace(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection enumdirection, boolean flag) {
+ private boolean spreadToFace(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection enumdirection, boolean flag, BlockPosition source) { // CraftBukkit
IBlockData iblockdata = generatoraccess.getBlockState(blockposition);
IBlockData iblockdata1 = this.getStateForPlacement(iblockdata, generatoraccess, blockposition, enumdirection);
@@ -279,7 +279,7 @@
generatoraccess.getChunk(blockposition).markPosForPostprocessing(blockposition);
}
- return generatoraccess.setBlock(blockposition, iblockdata1, 2);
+ return org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(generatoraccess, source, blockposition, iblockdata1, 2); // CraftBukkit
} else {
return false;
}

View File

@@ -0,0 +1,43 @@
--- a/net/minecraft/world/level/block/MultifaceSpreader.java
+++ b/net/minecraft/world/level/block/MultifaceSpreader.java
@@ -156,7 +156,7 @@
generatoraccess.getChunk(multifacespreader_c.pos()).markPosForPostprocessing(multifacespreader_c.pos());
}
- return generatoraccess.setBlock(multifacespreader_c.pos(), iblockdata1, 2);
+ return org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(generatoraccess, multifacespreader_c.source(), multifacespreader_c.pos(), iblockdata1, 2); // CraftBukkit
} else {
return false;
}
@@ -174,19 +174,19 @@
SAME_POSITION {
@Override
public MultifaceSpreader.c getSpreadPos(BlockPosition blockposition, EnumDirection enumdirection, EnumDirection enumdirection1) {
- return new MultifaceSpreader.c(blockposition, enumdirection);
+ return new MultifaceSpreader.c(blockposition, enumdirection, blockposition); // CraftBukkit
}
},
SAME_PLANE {
@Override
public MultifaceSpreader.c getSpreadPos(BlockPosition blockposition, EnumDirection enumdirection, EnumDirection enumdirection1) {
- return new MultifaceSpreader.c(blockposition.relative(enumdirection), enumdirection1);
+ return new MultifaceSpreader.c(blockposition.relative(enumdirection), enumdirection1, blockposition); // CraftBukkit
}
},
WRAP_AROUND {
@Override
public MultifaceSpreader.c getSpreadPos(BlockPosition blockposition, EnumDirection enumdirection, EnumDirection enumdirection1) {
- return new MultifaceSpreader.c(blockposition.relative(enumdirection).relative(enumdirection1), enumdirection.getOpposite());
+ return new MultifaceSpreader.c(blockposition.relative(enumdirection).relative(enumdirection1), enumdirection.getOpposite(), blockposition); // CraftBukkit
}
};
@@ -195,7 +195,7 @@
public abstract MultifaceSpreader.c getSpreadPos(BlockPosition blockposition, EnumDirection enumdirection, EnumDirection enumdirection1);
}
- public static record c(BlockPosition pos, EnumDirection face) {
+ public static record c(BlockPosition pos, EnumDirection face, BlockPosition source) { // CraftBukkit
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/PointedDripstoneBlock.java
+++ b/net/minecraft/world/level/block/PointedDripstoneBlock.java
@@ -43,6 +43,11 @@
@@ -44,6 +44,11 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -12,7 +12,7 @@
public class PointedDripstoneBlock extends Block implements Fallable, IBlockWaterlogged {
public static final BlockStateDirection TIP_DIRECTION = BlockProperties.VERTICAL_DIRECTION;
@@ -125,6 +130,11 @@
@@ -126,6 +131,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile instanceof EntityThrownTrident && iprojectile.getDeltaMovement().length() > 0.6D) {
@@ -24,7 +24,7 @@
world.destroyBlock(blockposition, true);
}
@@ -133,7 +143,9 @@
@@ -134,7 +144,9 @@
@Override
public void fallOn(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, float f) {
if (iblockdata.getValue(PointedDripstoneBlock.TIP_DIRECTION) == EnumDirection.UP && iblockdata.getValue(PointedDripstoneBlock.THICKNESS) == DripstoneThickness.TIP) {
@@ -34,7 +34,7 @@
} else {
super.fallOn(world, iblockdata, blockposition, entity, f);
}
@@ -380,15 +392,15 @@
@@ -389,15 +401,15 @@
if (isUnmergedTipWithDirection(iblockdata, enumdirection.getOpposite())) {
createMergedTips(iblockdata, worldserver, blockposition1);
} else if (iblockdata.isAir() || iblockdata.is(Blocks.WATER)) {
@@ -53,7 +53,7 @@
}
private static void createMergedTips(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
@@ -403,8 +415,8 @@
@@ -412,8 +424,8 @@
blockposition1 = blockposition.below();
}
@@ -64,7 +64,7 @@
}
public static void spawnDripParticle(World world, BlockPosition blockposition, IBlockData iblockdata) {
@@ -437,7 +449,7 @@
@@ -446,7 +458,7 @@
return (BlockPosition) findBlockVertical(generatoraccess, blockposition, enumdirection.getAxisDirection(), bipredicate, (iblockdata1) -> {
return isTip(iblockdata1, flag);
@@ -73,7 +73,7 @@
}
}
@@ -553,7 +565,7 @@
@@ -562,7 +574,7 @@
return canDripThrough(world, blockposition1, iblockdata);
};
@@ -82,7 +82,7 @@
}
@Nullable
@@ -562,7 +574,7 @@
@@ -571,7 +583,7 @@
return canDripThrough(world, blockposition1, iblockdata);
};
@@ -90,4 +90,4 @@
+ return (BlockPosition) findBlockVertical(world, blockposition, EnumDirection.UP.getAxisDirection(), bipredicate, PointedDripstoneBlock::canDrip, 11).orElse(null); // CraftBukkit - decompile error
}
public static FluidType getCauldronFillFluidType(World world, BlockPosition blockposition) {
public static FluidType getCauldronFillFluidType(WorldServer worldserver, BlockPosition blockposition) {

View File

@@ -3,7 +3,7 @@
@@ -26,6 +26,6 @@
@Override
public void performBonemeal(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
public void performBonemeal(WorldServer worldserver, RandomSource randomsource, BlockPosition blockposition, IBlockData iblockdata) {
- worldserver.setBlockAndUpdate(blockposition.below(), Blocks.HANGING_ROOTS.defaultBlockState());
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition.below(), Blocks.HANGING_ROOTS.defaultBlockState()); // CraftBukkit
}

View File

@@ -0,0 +1,20 @@
--- a/net/minecraft/world/level/block/SculkCatalystBlock.java
+++ b/net/minecraft/world/level/block/SculkCatalystBlock.java
@@ -86,9 +86,16 @@
@Override
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
+ // CraftBukkit start - Delegate to getExpDrop
+ }
+
+ @Override
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
if (flag) {
- this.tryDropExperience(worldserver, blockposition, itemstack, this.xpRange);
+ return this.tryDropExperience(worldserver, blockposition, itemstack, this.xpRange);
}
+ return 0;
+ // CraftBukkit end
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/SculkSensorBlock.java
+++ b/net/minecraft/world/level/block/SculkSensorBlock.java
@@ -38,6 +38,11 @@
@@ -42,6 +42,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;
@@ -216,6 +221,15 @@
@@ -234,6 +239,15 @@
}
public static void deactivate(World world, BlockPosition blockposition, IBlockData iblockdata) {
@@ -26,12 +26,12 @@
+ }
+ // CraftBukkit end
world.setBlock(blockposition, (IBlockData) ((IBlockData) iblockdata.setValue(SculkSensorBlock.PHASE, SculkSensorPhase.COOLDOWN)).setValue(SculkSensorBlock.POWER, 0), 3);
world.scheduleTick(new BlockPosition(blockposition), iblockdata.getBlock(), 1);
world.scheduleTick(blockposition, iblockdata.getBlock(), 1);
if (!(Boolean) iblockdata.getValue(SculkSensorBlock.WATERLOGGED)) {
@@ -226,6 +240,15 @@
@@ -244,6 +258,15 @@
}
public static void activate(World world, BlockPosition blockposition, IBlockData iblockdata, int i) {
public static void activate(@Nullable Entity entity, World world, BlockPosition blockposition, IBlockData iblockdata, int i) {
+ // CraftBukkit start
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(CraftBlock.at(world, blockposition), iblockdata.getValue(SculkSensorBlock.POWER), i);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
@@ -42,5 +42,23 @@
+ i = eventRedstone.getNewCurrent();
+ // CraftBukkit end
world.setBlock(blockposition, (IBlockData) ((IBlockData) iblockdata.setValue(SculkSensorBlock.PHASE, SculkSensorPhase.ACTIVE)).setValue(SculkSensorBlock.POWER, i), 3);
world.scheduleTick(new BlockPosition(blockposition), iblockdata.getBlock(), 40);
world.scheduleTick(blockposition, iblockdata.getBlock(), 40);
updateNeighbours(world, blockposition);
@@ -306,9 +329,16 @@
@Override
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
+ // CraftBukkit start - Delegate to getExpDrop
+ }
+
+ @Override
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
if (flag) {
- this.tryDropExperience(worldserver, blockposition, itemstack, ConstantInt.of(5));
+ return this.tryDropExperience(worldserver, blockposition, itemstack, ConstantInt.of(5));
}
+ return 0;
+ // CraftBukkit end
}
}

View File

@@ -0,0 +1,21 @@
--- a/net/minecraft/world/level/block/SculkShriekerBlock.java
+++ b/net/minecraft/world/level/block/SculkShriekerBlock.java
@@ -140,10 +140,17 @@
@Override
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
+ // CraftBukkit start - Delegate to getExpDrop
+ }
+
+ @Override
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
if (flag) {
- this.tryDropExperience(worldserver, blockposition, itemstack, ConstantInt.of(5));
+ return this.tryDropExperience(worldserver, blockposition, itemstack, ConstantInt.of(5));
}
+ return 0;
+ // CraftBukkit end
}
@Nullable

View File

@@ -27,7 +27,7 @@
+
if (i == 0) {
this.onOpen(world, blockposition, iblockdata);
world.gameEvent(entityhuman, GameEvent.CONTAINER_OPEN, blockposition);
world.gameEvent((Entity) entityhuman, GameEvent.CONTAINER_OPEN, blockposition);
@@ -37,8 +49,19 @@
}
@@ -47,7 +47,7 @@
+
if (this.openCount == 0) {
this.onClose(world, blockposition, iblockdata);
world.gameEvent(entityhuman, GameEvent.CONTAINER_CLOSE, blockposition);
world.gameEvent((Entity) entityhuman, GameEvent.CONTAINER_CLOSE, blockposition);
@@ -59,6 +82,7 @@
public void recheckOpeners(World world, BlockPosition blockposition, IBlockData iblockdata) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityBanner.java
+++ b/net/minecraft/world/level/block/entity/TileEntityBanner.java
@@ -101,6 +101,11 @@
@@ -102,6 +102,11 @@
}
this.itemPatterns = nbttagcompound.getList("Patterns", 10);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityBarrel.java
+++ b/net/minecraft/world/level/block/entity/TileEntityBarrel.java
@@ -21,8 +21,49 @@
@@ -20,8 +20,49 @@
import net.minecraft.world.level.block.BlockBarrel;
import net.minecraft.world.level.block.state.IBlockData;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityBeacon.java
+++ b/net/minecraft/world/level/block/entity/TileEntityBeacon.java
@@ -38,6 +38,11 @@
@@ -37,6 +37,11 @@
import net.minecraft.world.level.levelgen.HeightMap;
import net.minecraft.world.phys.AxisAlignedBB;
@@ -12,7 +12,7 @@
public class TileEntityBeacon extends TileEntity implements ITileInventory {
private static final int MAX_LEVELS = 4;
@@ -60,6 +65,15 @@
@@ -59,6 +64,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);
@@ -228,39 +242,78 @@
@@ -234,39 +248,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);
}
@@ -289,8 +342,11 @@
@@ -295,8 +348,11 @@
@Override
public void load(NBTTagCompound nbttagcompound) {
super.load(nbttagcompound);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityBeehive.java
+++ b/net/minecraft/world/level/block/entity/TileEntityBeehive.java
@@ -42,6 +42,7 @@
@@ -43,6 +43,7 @@
private final List<TileEntityBeehive.HiveBee> stored = Lists.newArrayList();
@Nullable
public BlockPosition savedFlowerPos;
@@ -8,7 +8,7 @@
public TileEntityBeehive(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.BEEHIVE, blockposition, iblockdata);
@@ -81,7 +82,7 @@
@@ -82,7 +83,7 @@
}
public boolean isFull() {
@@ -17,7 +17,7 @@
}
public void emptyAllLivingFromHive(@Nullable EntityHuman entityhuman, IBlockData iblockdata, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus) {
@@ -98,7 +99,7 @@
@@ -99,7 +100,7 @@
if (entityhuman.position().distanceToSqr(entity.position()) <= 16.0D) {
if (!this.isSedated()) {
@@ -26,7 +26,7 @@
} else {
entitybee.setStayOutOfHiveCountdown(400);
}
@@ -110,10 +111,16 @@
@@ -111,10 +112,16 @@
}
private List<Entity> releaseAllOccupants(IBlockData iblockdata, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus) {
@@ -44,7 +44,7 @@
});
if (!list.isEmpty()) {
super.setChanged();
@@ -141,7 +148,19 @@
@@ -142,7 +149,19 @@
}
public void addOccupantWithPresetTicks(Entity entity, boolean flag, int i) {
@@ -65,7 +65,7 @@
entity.stopRiding();
entity.ejectPassengers();
NBTTagCompound nbttagcompound = new NBTTagCompound();
@@ -172,7 +191,13 @@
@@ -174,7 +193,13 @@
}
private static boolean releaseOccupant(World world, BlockPosition blockposition, IBlockData iblockdata, TileEntityBeehive.HiveBee tileentitybeehive_hivebee, @Nullable List<Entity> list, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus, @Nullable BlockPosition blockposition1) {
@@ -80,7 +80,7 @@
return false;
} else {
NBTTagCompound nbttagcompound = tileentitybeehive_hivebee.entityData.copy();
@@ -195,6 +220,18 @@
@@ -197,6 +222,18 @@
if (!entity.getType().is(TagsEntity.BEEHIVE_INHABITORS)) {
return false;
} else {
@@ -99,7 +99,7 @@
if (entity instanceof EntityBee) {
EntityBee entitybee = (EntityBee) entity;
@@ -226,6 +263,7 @@
@@ -228,6 +265,7 @@
list.add(entitybee);
}
@@ -107,7 +107,7 @@
float f = entity.getBbWidth();
double d0 = flag ? 0.0D : 0.55D + (double) (f / 2.0F);
double d1 = (double) blockposition.getX() + 0.5D + d0 * (double) enumdirection.getStepX();
@@ -233,10 +271,11 @@
@@ -235,11 +273,12 @@
double d3 = (double) blockposition.getZ() + 0.5D + d0 * (double) enumdirection.getStepZ();
entity.moveTo(d1, d2, d3, entity.getYRot(), entity.getXRot());
@@ -115,12 +115,13 @@
}
world.playSound((EntityHuman) null, blockposition, SoundEffects.BEEHIVE_EXIT, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entity, world.getBlockState(blockposition)));
- return world.addFreshEntity(entity);
+ return true; // return this.world.addFreshEntity(entity); // CraftBukkit - moved up
}
} else {
return false;
@@ -285,6 +324,10 @@
@@ -288,6 +327,10 @@
if (releaseOccupant(world, blockposition, iblockdata, tileentitybeehive_hivebee, (List) null, tileentitybeehive_releasestatus, blockposition1)) {
flag = true;
iterator.remove();
@@ -131,7 +132,7 @@
}
}
}
@@ -326,6 +369,11 @@
@@ -329,6 +372,11 @@
this.savedFlowerPos = GameProfileSerializer.readBlockPos(nbttagcompound.getCompound("FlowerPos"));
}
@@ -143,7 +144,7 @@
}
@Override
@@ -335,6 +383,7 @@
@@ -338,6 +386,7 @@
if (this.hasSavedFlowerPos()) {
nbttagcompound.put("FlowerPos", GameProfileSerializer.writeBlockPos(this.savedFlowerPos));
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityBrewingStand.java
+++ b/net/minecraft/world/level/block/entity/TileEntityBrewingStand.java
@@ -25,6 +25,19 @@
@@ -24,6 +24,19 @@
import net.minecraft.world.level.block.BlockBrewingStand;
import net.minecraft.world.level.block.state.IBlockData;
@@ -20,7 +20,7 @@
public class TileEntityBrewingStand extends TileEntityContainer implements IWorldInventory {
private static final int INGREDIENT_SLOT = 3;
@@ -42,6 +55,36 @@
@@ -41,6 +54,36 @@
private Item ingredient;
public int fuel;
protected final IContainerProperties dataAccess;
@@ -57,7 +57,7 @@
public TileEntityBrewingStand(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.BREWING_STAND, blockposition, iblockdata);
@@ -109,8 +152,19 @@
@@ -108,8 +151,19 @@
ItemStack itemstack = (ItemStack) tileentitybrewingstand.items.get(4);
if (tileentitybrewingstand.fuel <= 0 && itemstack.is(Items.BLAZE_POWDER)) {
@@ -79,7 +79,7 @@
setChanged(world, blockposition, iblockdata);
}
@@ -118,12 +172,17 @@
@@ -117,12 +171,17 @@
boolean flag1 = tileentitybrewingstand.brewTime > 0;
ItemStack itemstack1 = (ItemStack) tileentitybrewingstand.items.get(3);
@@ -100,7 +100,7 @@
setChanged(world, blockposition, iblockdata);
} else if (!flag || !itemstack1.is(tileentitybrewingstand.ingredient)) {
tileentitybrewingstand.brewTime = 0;
@@ -187,11 +246,33 @@
@@ -186,11 +245,33 @@
}
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/block/entity/TileEntityCampfire.java
+++ b/net/minecraft/world/level/block/entity/TileEntityCampfire.java
@@ -20,6 +20,12 @@
import net.minecraft.world.level.block.BlockCampfire;
@@ -25,6 +25,12 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.gameevent.GameEvent;
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlock;
@@ -13,7 +13,7 @@
public class TileEntityCampfire extends TileEntity implements Clearable {
private static final int BURN_COOL_SPEED = 2;
@@ -51,6 +57,20 @@
@@ -58,6 +64,20 @@
return recipecampfire.assemble(inventorysubcontainer);
}).orElse(itemstack);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityChest.java
+++ b/net/minecraft/world/level/block/entity/TileEntityChest.java
@@ -24,6 +24,12 @@
@@ -23,6 +23,12 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.block.state.properties.BlockPropertyChestType;
@@ -13,7 +13,7 @@
public class TileEntityChest extends TileEntityLootable implements LidBlockEntity {
private static final int EVENT_SET_OPEN_COUNT = 1;
@@ -31,6 +37,36 @@
@@ -30,6 +36,36 @@
public final ContainerOpenersCounter openersCounter;
private final ChestLidController chestLidController;
@@ -50,7 +50,7 @@
protected TileEntityChest(TileEntityTypes<?> tileentitytypes, BlockPosition blockposition, IBlockData iblockdata) {
super(tileentitytypes, blockposition, iblockdata);
this.items = NonNullList.withSize(27, ItemStack.EMPTY);
@@ -199,4 +235,11 @@
@@ -198,4 +234,11 @@
world.blockEvent(blockposition, block, 1, j);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityContainer.java
+++ b/net/minecraft/world/level/block/entity/TileEntityContainer.java
@@ -89,4 +89,12 @@
@@ -88,4 +88,12 @@
}
protected abstract Container createMenu(int i, PlayerInventory playerinventory);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityDispenser.java
+++ b/net/minecraft/world/level/block/entity/TileEntityDispenser.java
@@ -14,12 +14,48 @@
@@ -13,11 +13,47 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.IBlockData;
@@ -12,7 +12,6 @@
+
public class TileEntityDispenser extends TileEntityLootable {
private static final Random RANDOM = new Random();
public static final int CONTAINER_SIZE = 9;
private NonNullList<ItemStack> items;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityFurnace.java
+++ b/net/minecraft/world/level/block/entity/TileEntityFurnace.java
@@ -45,6 +45,20 @@
@@ -46,6 +46,20 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@@ -21,7 +21,16 @@
public abstract class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeHolder, AutoRecipeOutput {
protected static final int SLOT_INPUT = 0;
@@ -184,6 +198,40 @@
@@ -114,7 +128,7 @@
}
};
this.recipesUsed = new Object2IntOpenHashMap();
- this.quickCheck = CraftingManager.createCheck(recipes);
+ this.quickCheck = CraftingManager.createCheck((Recipes<RecipeCooking>) recipes); // CraftBukkit - decompile error // Eclipse fail
}
public static Map<Item, Integer> getFuel() {
@@ -188,6 +202,40 @@
return map;
}
@@ -62,12 +71,16 @@
private static boolean isNeverAFurnaceFuel(Item item) {
return item.builtInRegistryHolder().is(TagsItem.NON_FLAMMABLE_WOOD);
}
@@ -267,13 +315,24 @@
tileentityfurnace.cookingProgress = MathHelper.clamp(tileentityfurnace.cookingProgress - 2, (int) 0, tileentityfurnace.cookingTotalTime);
@@ -276,7 +324,7 @@
IRecipe irecipe;
if (flag2) {
- irecipe = (IRecipe) tileentityfurnace.quickCheck.getRecipeFor(tileentityfurnace, world).orElse((Object) null);
+ irecipe = (IRecipe) tileentityfurnace.quickCheck.getRecipeFor(tileentityfurnace, world).orElse(null); // CraftBukkit - decompile error
} else {
irecipe = null;
}
} else {
- IRecipe<?> irecipe = (IRecipe) world.getRecipeManager().getRecipeFor(tileentityfurnace.recipeType, tileentityfurnace, world).orElse((Object) null);
+ IRecipe<?> irecipe = (IRecipe) world.getRecipeManager().getRecipeFor((Recipes<RecipeCooking>) tileentityfurnace.recipeType, tileentityfurnace, world).orElse(null); // CraftBukkit - decompile error // Eclipse fail
@@ -284,9 +332,20 @@
int i = tileentityfurnace.getMaxStackSize();
if (!tileentityfurnace.isLit() && canBurn(irecipe, tileentityfurnace.items, i)) {
@@ -88,9 +101,9 @@
+ if (tileentityfurnace.isLit() && furnaceBurnEvent.isBurning()) {
+ // CraftBukkit end
flag1 = true;
if (!itemstack.isEmpty()) {
if (flag3) {
Item item = itemstack.getItem();
@@ -289,11 +348,23 @@
@@ -302,11 +361,23 @@
}
if (tileentityfurnace.isLit() && canBurn(irecipe, tileentityfurnace.items, i)) {
@@ -109,13 +122,13 @@
++tileentityfurnace.cookingProgress;
if (tileentityfurnace.cookingProgress == tileentityfurnace.cookingTotalTime) {
tileentityfurnace.cookingProgress = 0;
tileentityfurnace.cookingTotalTime = getTotalCookTime(world, tileentityfurnace.recipeType, tileentityfurnace);
tileentityfurnace.cookingTotalTime = getTotalCookTime(world, tileentityfurnace);
- if (burn(irecipe, tileentityfurnace.items, i)) {
+ if (burn(tileentityfurnace.level, tileentityfurnace.worldPosition, irecipe, tileentityfurnace.items, i)) { // CraftBukkit
tileentityfurnace.setRecipeUsed(irecipe);
}
@@ -332,17 +403,44 @@
@@ -345,17 +416,44 @@
}
}
@@ -161,16 +174,16 @@
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));
@@ -366,7 +464,7 @@
@@ -379,7 +477,7 @@
}
private static int getTotalCookTime(World world, Recipes<? extends RecipeCooking> recipes, IInventory iinventory) {
- return (Integer) world.getRecipeManager().getRecipeFor(recipes, iinventory, world).map(RecipeCooking::getCookingTime).orElse(200);
+ return (world != null) ? (Integer) world.getRecipeManager().getRecipeFor((Recipes<RecipeCooking>) recipes, iinventory, world).map(RecipeCooking::getCookingTime).orElse(200) : 200; // CraftBukkit - SPIGOT-4302 // Eclipse fail
private static int getTotalCookTime(World world, TileEntityFurnace tileentityfurnace) {
- return (Integer) tileentityfurnace.quickCheck.getRecipeFor(tileentityfurnace, world).map(RecipeCooking::getCookingTime).orElse(200);
+ return (world != null) ? (Integer) tileentityfurnace.quickCheck.getRecipeFor(tileentityfurnace, world).map(RecipeCooking::getCookingTime).orElse(200) : 200; // CraftBukkit - SPIGOT-4302
}
public static boolean isFuel(ItemStack itemstack) {
@@ -485,14 +583,20 @@
@@ -498,14 +596,20 @@
@Override
public void awardUsedRecipes(EntityHuman entityhuman) {}
@@ -193,7 +206,7 @@
List<IRecipe<?>> list = Lists.newArrayList();
ObjectIterator objectiterator = this.recipesUsed.object2IntEntrySet().iterator();
@@ -501,14 +605,14 @@
@@ -514,14 +618,14 @@
worldserver.getRecipeManager().byKey((MinecraftKey) entry.getKey()).ifPresent((irecipe) -> {
list.add(irecipe);
@@ -210,7 +223,7 @@
int j = MathHelper.floor((float) i * f);
float f1 = MathHelper.frac((float) i * f);
@@ -516,6 +620,17 @@
@@ -529,6 +633,17 @@
++j;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityHopper.java
+++ b/net/minecraft/world/level/block/entity/TileEntityHopper.java
@@ -33,6 +33,18 @@
@@ -32,6 +32,18 @@
import net.minecraft.world.phys.shapes.OperatorBoolean;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -19,7 +19,7 @@
public class TileEntityHopper extends TileEntityLootable implements IHopper {
public static final int MOVE_ITEM_SPEED = 8;
@@ -41,6 +53,36 @@
@@ -40,6 +52,36 @@
private int cooldownTime;
private long tickedGameTime;
@@ -56,7 +56,7 @@
public TileEntityHopper(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.HOPPER, blockposition, iblockdata);
this.items = NonNullList.withSize(5, ItemStack.EMPTY);
@@ -114,7 +156,7 @@
@@ -113,7 +155,7 @@
boolean flag = false;
if (!tileentityhopper.isEmpty()) {
@@ -65,7 +65,7 @@
}
if (!tileentityhopper.inventoryFull()) {
@@ -148,7 +190,7 @@
@@ -147,7 +189,7 @@
return false;
}
@@ -74,7 +74,7 @@
IInventory iinventory1 = getAttachedContainer(world, blockposition, iblockdata);
if (iinventory1 == null) {
@@ -162,7 +204,28 @@
@@ -161,7 +203,28 @@
for (int i = 0; i < iinventory.getContainerSize(); ++i) {
if (!iinventory.getItem(i).isEmpty()) {
ItemStack itemstack = iinventory.getItem(i).copy();
@@ -104,7 +104,7 @@
if (itemstack1.isEmpty()) {
iinventory1.setChanged();
@@ -227,7 +290,34 @@
@@ -226,7 +289,34 @@
if (!itemstack.isEmpty() && canTakeItemFromContainer(iinventory, itemstack, i, enumdirection)) {
ItemStack itemstack1 = itemstack.copy();
@@ -140,7 +140,7 @@
if (itemstack2.isEmpty()) {
iinventory.setChanged();
@@ -242,6 +332,13 @@
@@ -241,6 +331,13 @@
public static boolean addItem(IInventory iinventory, EntityItem entityitem) {
boolean flag = false;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityLectern.java
+++ b/net/minecraft/world/level/block/entity/TileEntityLectern.java
@@ -26,13 +26,71 @@
@@ -24,13 +24,71 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
@@ -74,7 +74,7 @@
@Override
public int getContainerSize() {
return 1;
@@ -77,11 +135,20 @@
@@ -75,11 +133,20 @@
}
@Override
@@ -97,7 +97,7 @@
}
@Override
@@ -161,7 +228,7 @@
@@ -159,7 +226,7 @@
if (j != this.page) {
this.page = j;
this.setChanged();
@@ -106,13 +106,13 @@
}
}
@@ -184,6 +251,32 @@
@@ -182,6 +249,32 @@
return itemstack;
}
+ // CraftBukkit start
+ @Override
+ public void sendMessage(IChatBaseComponent ichatbasecomponent, UUID uuid) {
+ public void sendSystemMessage(IChatBaseComponent ichatbasecomponent) {
+ }
+
+ @Override
@@ -139,7 +139,7 @@
private CommandListenerWrapper createCommandSourceStack(@Nullable EntityHuman entityhuman) {
String s;
Object object;
@@ -198,7 +291,8 @@
@@ -196,7 +289,8 @@
Vec3D vec3d = Vec3D.atCenterOf(this.worldPosition);
@@ -149,7 +149,7 @@
}
@Override
@@ -236,7 +330,7 @@
@@ -234,7 +328,7 @@
@Override
public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityShulkerBox.java
+++ b/net/minecraft/world/level/block/entity/TileEntityShulkerBox.java
@@ -32,6 +32,11 @@
@@ -31,6 +31,11 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -12,7 +12,7 @@
public class TileEntityShulkerBox extends TileEntityLootable implements IWorldInventory {
public static final int COLUMNS = 9;
@@ -51,6 +56,37 @@
@@ -50,6 +55,37 @@
@Nullable
private final EnumColor color;
@@ -50,19 +50,19 @@
public TileEntityShulkerBox(@Nullable EnumColor enumcolor, BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.SHULKER_BOX, blockposition, iblockdata);
this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
@@ -163,6 +199,7 @@
@@ -162,6 +198,7 @@
}
++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);
if (this.openCount == 1) {
this.level.gameEvent(entityhuman, GameEvent.CONTAINER_OPEN, this.worldPosition);
@@ -176,6 +213,7 @@
this.level.gameEvent((Entity) entityhuman, GameEvent.CONTAINER_OPEN, this.worldPosition);
@@ -175,6 +212,7 @@
public void stopOpen(EntityHuman entityhuman) {
if (!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);
if (this.openCount <= 0) {
this.level.gameEvent(entityhuman, GameEvent.CONTAINER_CLOSE, this.worldPosition);
this.level.gameEvent((Entity) entityhuman, GameEvent.CONTAINER_CLOSE, this.worldPosition);

View File

@@ -53,7 +53,7 @@
}
+ // CraftBukkit start
+ } catch (com.google.gson.JsonParseException jsonparseexception) {
+ return new ChatComponentText(s);
+ return IChatBaseComponent.empty();
+ // CraftBukkit end
} catch (Exception exception) {
;
@@ -64,7 +64,7 @@
+ // CraftBukkit start
+ @Override
+ public void sendMessage(IChatBaseComponent ichatbasecomponent, java.util.UUID uuid) {}
+ public void sendSystemMessage(IChatBaseComponent ichatbasecomponent) {}
+
+ @Override
+ public org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
@@ -89,7 +89,7 @@
+
public CommandListenerWrapper createCommandSourceStack(@Nullable EntityPlayer entityplayer) {
String s = entityplayer == null ? "Sign" : entityplayer.getName().getString();
Object object = entityplayer == null ? new ChatComponentText("Sign") : entityplayer.getDisplayName();
Object object = entityplayer == null ? IChatBaseComponent.literal("Sign") : entityplayer.getDisplayName();
- return new CommandListenerWrapper(ICommandListener.NULL, Vec3D.atCenterOf(this.worldPosition), Vec2F.ZERO, (WorldServer) this.level, 2, s, (IChatBaseComponent) object, this.level.getServer(), entityplayer);
+ // CraftBukkit - this

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/grower/WorldGenTreeProvider.java
+++ b/net/minecraft/world/level/block/grower/WorldGenTreeProvider.java
@@ -13,6 +13,12 @@
@@ -12,6 +12,12 @@
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.WorldGenFeatureConfigured;
@@ -13,15 +13,15 @@
public abstract class WorldGenTreeProvider {
public WorldGenTreeProvider() {}
@@ -26,6 +32,7 @@
@@ -25,6 +31,7 @@
if (holder == null) {
return false;
} else {
+ setTreeType(holder); // CraftBukkit
WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured = (WorldGenFeatureConfigured) holder.value();
IBlockData iblockdata1 = worldserver.getFluidState(blockposition).createLegacyBlock();
worldserver.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 4);
@@ -53,4 +60,48 @@
@@ -57,4 +64,52 @@
return true;
}
@@ -64,6 +64,10 @@
+ BlockSapling.treeType = TreeType.JUNGLE;
+ } else if (worldgentreeabstract == TreeFeatures.AZALEA_TREE) {
+ BlockSapling.treeType = TreeType.AZALEA;
+ } else if (worldgentreeabstract == TreeFeatures.MANGROVE) {
+ BlockSapling.treeType = TreeType.MANGROVE;
+ } else if (worldgentreeabstract == TreeFeatures.TALL_MANGROVE) {
+ BlockSapling.treeType = TreeType.TALL_MANGROVE;
+ } else {
+ throw new IllegalArgumentException("Unknown tree generator " + worldgentreeabstract);
+ }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/piston/BlockPiston.java
+++ b/net/minecraft/world/level/block/piston/BlockPiston.java
@@ -37,6 +37,14 @@
@@ -38,6 +38,14 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -15,7 +15,7 @@
public class BlockPiston extends BlockDirectional {
public static final BlockStateBoolean EXTENDED = BlockProperties.EXTENDED;
@@ -137,6 +145,18 @@
@@ -138,6 +146,18 @@
}
}
@@ -34,7 +34,7 @@
world.blockEvent(blockposition, this, b0, enumdirection.get3DDataValue());
}
@@ -315,6 +335,48 @@
@@ -316,6 +336,48 @@
IBlockData[] aiblockdata = new IBlockData[list.size() + list2.size()];
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.getOpposite();
int j = 0;

View File

@@ -1,18 +0,0 @@
--- a/net/minecraft/world/level/block/state/properties/BlockStateInteger.java
+++ b/net/minecraft/world/level/block/state/properties/BlockStateInteger.java
@@ -9,9 +9,15 @@
public class BlockStateInteger extends IBlockState<Integer> {
private final ImmutableSet<Integer> values;
+ // CraftBukkit start
+ public final int min;
+ public final int max;
protected BlockStateInteger(String s, int i, int j) {
super(s, Integer.class);
+ this.min = i;
+ this.max = j;
+ // CraftBukkit end
if (i < 0) {
throw new IllegalArgumentException("Min value of " + s + " must be 0 or greater");
} else if (j <= i) {

View File

@@ -50,7 +50,7 @@
}
@Override
@@ -238,9 +254,16 @@
@@ -246,9 +262,16 @@
}
}
@@ -67,7 +67,7 @@
int i = blockposition.getY();
ChunkSection chunksection = this.getSection(this.getSectionIndex(i));
boolean flag1 = chunksection.hasOnlyAir();
@@ -279,7 +302,8 @@
@@ -287,7 +310,8 @@
if (!chunksection.getBlockState(j, k, l).is(block)) {
return null;
} else {
@@ -77,7 +77,7 @@
iblockdata.onPlace(this.level, blockposition, iblockdata1, flag);
}
@@ -324,7 +348,12 @@
@@ -332,7 +356,12 @@
@Nullable
public TileEntity getBlockEntity(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
@@ -91,7 +91,7 @@
if (tileentity == null) {
NBTTagCompound nbttagcompound = (NBTTagCompound) this.pendingBlockEntities.remove(blockposition);
@@ -395,6 +424,13 @@
@@ -410,6 +439,13 @@
tileentity1.setRemoved();
}
@@ -105,7 +105,7 @@
}
}
@@ -424,6 +460,12 @@
@@ -439,6 +475,12 @@
if (this.isInLevel()) {
TileEntity tileentity = (TileEntity) this.blockEntities.remove(blockposition);
@@ -116,9 +116,9 @@
+ // CraftBukkit end
+
if (tileentity != null) {
this.removeGameEventListener(tileentity);
tileentity.setRemoved();
@@ -471,6 +513,55 @@
World world = this.level;
@@ -491,6 +533,55 @@
}
@@ -174,7 +174,7 @@
public boolean isEmpty() {
return false;
}
@@ -659,7 +750,7 @@
@@ -684,7 +775,7 @@
private <T extends TileEntity> void updateBlockEntityTicker(T t0) {
IBlockData iblockdata = t0.getBlockState();
@@ -183,7 +183,7 @@
if (blockentityticker == null) {
this.removeBlockEntityTicker(t0.getBlockPos());
@@ -752,7 +843,7 @@
@@ -777,7 +868,7 @@
private boolean loggedInvalidBlockState;
a(TileEntity tileentity, BlockEntityTicker blockentityticker) {

View File

@@ -1,16 +1,7 @@
--- a/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -261,7 +261,7 @@
while (iterator.hasNext()) {
Holder<StructureFeature<?, ?>> holder = (Holder) iterator.next();
- Stream stream = set1.stream();
+ Stream<Holder<BiomeBase>> stream = set1.stream(); // CraftBukkit - decompile error
HolderSet holderset1 = ((StructureFeature) holder.value()).biomes();
Objects.requireNonNull(holderset1);
@@ -411,7 +411,7 @@
return null;
@@ -414,7 +414,7 @@
}
}
- public void applyBiomeDecoration(GeneratorAccessSeed generatoraccessseed, IChunkAccess ichunkaccess, StructureManager structuremanager) {
@@ -18,25 +9,25 @@
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
if (!SharedConstants.debugVoidTerrain(chunkcoordintpair)) {
@@ -427,7 +427,7 @@
Set<BiomeBase> set = new ObjectArraySet();
@@ -436,7 +436,7 @@
if (this instanceof ChunkProviderFlat) {
- Stream stream = this.biomeSource.possibleBiomes().stream().map(Holder::value);
+ Stream<BiomeBase> stream = this.biomeSource.possibleBiomes().stream().map(Holder::value); // CraftBukkit - decompile error
for (int k = 0; k < j; ++k) {
ChunkSection chunksection = achunksection[k];
- PalettedContainerRO palettedcontainerro = chunksection.getBiomes();
+ PalettedContainerRO<Holder<BiomeBase>> palettedcontainerro = chunksection.getBiomes(); // CraftBukkit - decompile error
Objects.requireNonNull(set);
stream.forEach(set::add);
@@ -467,7 +467,7 @@
StructureFeature<?, ?> structurefeature = (StructureFeature) iterator.next();
Objects.requireNonNull(set);
palettedcontainerro.getAll(set::add);
@@ -462,7 +462,7 @@
Structure structure = (Structure) iterator.next();
seededrandom.setFeatureSeed(i, i1, l);
- Supplier supplier = () -> {
+ Supplier<String> supplier = () -> { // CraftBukkit - decompile error
Optional optional = iregistry.getResourceKey(structurefeature).map(Object::toString);
Optional optional = iregistry.getResourceKey(structure).map(Object::toString);
Objects.requireNonNull(structurefeature);
@@ -552,6 +552,33 @@
Objects.requireNonNull(structure);
@@ -547,6 +547,33 @@
}
}
@@ -59,7 +50,7 @@
+ for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) {
+ SeededRandom seededrandom = new SeededRandom(new net.minecraft.world.level.levelgen.LegacyRandomSource(generatoraccessseed.getSeed()));
+ seededrandom.setDecorationSeed(generatoraccessseed.getSeed(), x, z);
+ populator.populate(world, seededrandom, x, z, limitedRegion);
+ populator.populate(world, new org.bukkit.craftbukkit.util.RandomSourceWrapper.RandomWrapper(seededrandom), x, z, limitedRegion);
+ }
+ limitedRegion.saveEntities();
+ limitedRegion.breakLink();
@@ -67,6 +58,6 @@
+ // CraftBukkit end
+ }
+
public boolean hasFeatureChunkInRange(ResourceKey<StructureSet> resourcekey, long i, int j, int k, int l) {
StructureSet structureset = (StructureSet) this.structureSets.get(resourcekey);
public boolean hasStructureChunkInRange(Holder<StructureSet> holder, RandomState randomstate, long i, int j, int k, int l) {
StructureSet structureset = (StructureSet) holder.value();

View File

@@ -1,6 +1,20 @@
--- a/net/minecraft/world/level/chunk/ChunkSection.java
+++ b/net/minecraft/world/level/chunk/ChunkSection.java
@@ -190,6 +190,12 @@
@@ -25,9 +25,11 @@
private short tickingBlockCount;
private short tickingFluidCount;
private final DataPaletteBlock<IBlockData> states;
- private PalettedContainerRO<Holder<BiomeBase>> biomes;
+ // CraftBukkit start - read/write
+ private DataPaletteBlock<Holder<BiomeBase>> biomes;
- public ChunkSection(int i, DataPaletteBlock<IBlockData> datapaletteblock, PalettedContainerRO<Holder<BiomeBase>> palettedcontainerro) {
+ public ChunkSection(int i, DataPaletteBlock<IBlockData> datapaletteblock, DataPaletteBlock<Holder<BiomeBase>> palettedcontainerro) {
+ // CraftBukkit end
this.bottomBlockY = getBottomBlockY(i);
this.states = datapaletteblock;
this.biomes = palettedcontainerro;
@@ -193,6 +195,12 @@
return (Holder) this.biomes.get(i, j, k);
}
@@ -11,5 +25,5 @@
+ // CraftBukkit end
+
public void fillBiomesFromNoise(BiomeResolver biomeresolver, Climate.Sampler climate_sampler, int i, int j) {
DataPaletteBlock<Holder<BiomeBase>> datapaletteblock = this.getBiomes();
DataPaletteBlock<Holder<BiomeBase>> datapaletteblock = this.biomes.recreate();
int k = QuartPos.fromBlock(this.bottomBlockY());

View File

@@ -2,10 +2,10 @@
+++ b/net/minecraft/world/level/chunk/ChunkStatus.java
@@ -47,7 +47,7 @@
});
public static final ChunkStatus STRUCTURE_STARTS = register("structure_starts", ChunkStatus.EMPTY, 0, ChunkStatus.PRE_FEATURES, ChunkStatus.Type.PROTOCHUNK, (chunkstatus, executor, worldserver, chunkgenerator, definedstructuremanager, lightenginethreaded, function, list, ichunkaccess, flag) -> {
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().generateFeatures()) {
+ if (worldserver.serverLevelData.worldGenSettings().generateFeatures()) { // CraftBukkit
chunkgenerator.createStructures(worldserver.registryAccess(), worldserver.structureFeatureManager(), ichunkaccess, definedstructuremanager, worldserver.getSeed());
- 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());
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/IChunkAccess.java
+++ b/net/minecraft/world/level/chunk/IChunkAccess.java
@@ -80,6 +80,11 @@
@@ -77,6 +77,11 @@
protected final LevelHeightAccessor levelHeightAccessor;
protected final ChunkSection[] sections;
@@ -12,7 +12,7 @@
public IChunkAccess(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter, LevelHeightAccessor levelheightaccessor, IRegistry<BiomeBase> iregistry, long i, @Nullable ChunkSection[] achunksection, @Nullable BlendingData blendingdata) {
this.chunkPos = chunkcoordintpair;
this.upgradeData = chunkconverter;
@@ -97,7 +102,11 @@
@@ -94,7 +99,11 @@
}
replaceMissingSections(levelheightaccessor, iregistry, this.sections);
@@ -24,7 +24,7 @@
private static void replaceMissingSections(LevelHeightAccessor levelheightaccessor, IRegistry<BiomeBase> iregistry, ChunkSection[] achunksection) {
for (int i = 0; i < achunksection.length; ++i) {
@@ -259,10 +268,11 @@
@@ -256,10 +265,11 @@
public void setUnsaved(boolean flag) {
this.unsaved = flag;
@@ -37,7 +37,7 @@
}
public abstract ChunkStatus getStatus();
@@ -395,6 +405,27 @@
@@ -392,6 +402,27 @@
}
}
@@ -65,23 +65,3 @@
public void fillBiomesFromNoise(BiomeResolver biomeresolver, Climate.Sampler climate_sampler) {
ChunkCoordIntPair chunkcoordintpair = this.getPos();
int i = QuartPos.fromBlock(chunkcoordintpair.getMinBlockX());
@@ -426,8 +457,10 @@
return this;
}
- public static record a(SerializableTickContainer<Block> a, SerializableTickContainer<FluidType> b) {
+ // CraftBukkit start - decompile error
+ public static record a(SerializableTickContainer<Block> blocks, SerializableTickContainer<FluidType> fluids) {
+ /*
private final SerializableTickContainer<Block> blocks;
private final SerializableTickContainer<FluidType> fluids;
@@ -443,5 +476,7 @@
public SerializableTickContainer<FluidType> fluids() {
return this.fluids;
}
+ */
+ // CraftBukkit end
}
}

View File

@@ -1,24 +1,45 @@
--- a/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
+++ b/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
@@ -117,7 +117,7 @@
@@ -100,7 +100,7 @@
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
LightEngine lightengine = chunkproviderserver.getLightEngine();
IRegistry<BiomeBase> iregistry = worldserver.registryAccess().registryOrThrow(IRegistry.BIOME_REGISTRY);
- 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 @@
});
logger = ChunkRegionLoader.LOGGER;
Objects.requireNonNull(logger);
- datapaletteblock = (DataPaletteBlock) dataresult.getOrThrow(false, logger::error);
+ datapaletteblock = (DataPaletteBlock) ((DataResult<DataPaletteBlock<IBlockData>>) dataresult).getOrThrow(false, logger::error); // CraftBukkit - decompile error
} else {
datapaletteblock = new DataPaletteBlock<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), DataPaletteBlock.e.SECTION_STATES);
datapaletteblock = new DataPaletteBlock<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), DataPaletteBlock.d.SECTION_STATES);
}
@@ -130,7 +130,7 @@
- Object object;
+ DataPaletteBlock object; // CraftBukkit - read/write
if (nbttagcompound1.contains("biomes", 10)) {
dataresult = codec.parse(DynamicOpsNBT.INSTANCE, nbttagcompound1.getCompound("biomes")).promotePartial((s) -> {
@@ -133,12 +133,12 @@
});
logger = ChunkRegionLoader.LOGGER;
Objects.requireNonNull(logger);
- datapaletteblock1 = (DataPaletteBlock) dataresult.getOrThrow(false, logger::error);
+ datapaletteblock1 = (DataPaletteBlock) ((DataResult<DataPaletteBlock<Holder<BiomeBase>>>) dataresult).getOrThrow(false, logger::error); // CraftBukkit - decompile error
- object = (PalettedContainerRO) dataresult.getOrThrow(false, logger::error);
+ object = ((DataResult<DataPaletteBlock<Holder<BiomeBase>>>) dataresult).getOrThrow(false, logger::error); // CraftBukkit - decompile error
} else {
datapaletteblock1 = new DataPaletteBlock<>(iregistry.asHolderIdMap(), iregistry.getHolderOrThrow(Biomes.PLAINS), DataPaletteBlock.e.SECTION_BIOMES);
object = new DataPaletteBlock<>(iregistry.asHolderIdMap(), iregistry.getHolderOrThrow(Biomes.PLAINS), DataPaletteBlock.d.SECTION_BIOMES);
}
@@ -161,7 +161,7 @@
- ChunkSection chunksection = new ChunkSection(b0, datapaletteblock, (PalettedContainerRO) object);
+ ChunkSection chunksection = new ChunkSection(b0, datapaletteblock, (DataPaletteBlock) object); // CraftBukkit - read/write
achunksection[k] = chunksection;
villageplace.checkConsistencyWithBlocks(chunkcoordintpair, chunksection);
@@ -172,7 +172,7 @@
dataresult = BlendingData.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("blending_data")));
logger1 = ChunkRegionLoader.LOGGER;
Objects.requireNonNull(logger1);
@@ -27,7 +48,7 @@
} else {
blendingdata = null;
}
@@ -192,7 +192,7 @@
@@ -203,7 +203,7 @@
dataresult = BelowZeroRetrogen.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("below_zero_retrogen")));
logger1 = ChunkRegionLoader.LOGGER;
Objects.requireNonNull(logger1);
@@ -36,21 +57,34 @@
Objects.requireNonNull(protochunk);
optional.ifPresent(protochunk::setBelowZeroRetrogen);
@@ -221,6 +221,13 @@
@@ -232,6 +232,13 @@
}
}
+ // CraftBukkit start - load chunk persistent data from nbt - SPIGOT-6814: Already load PDC here to account for 1.17 to 1.18 chunk upgrading.
+ net.minecraft.nbt.NBTBase persistentBase = nbttagcompound.get("ChunkBukkitValues");
+ if (persistentBase instanceof NBTTagCompound) {
+ ((IChunkAccess) object).persistentDataContainer.putAll((NBTTagCompound) persistentBase);
+ ((IChunkAccess) object1).persistentDataContainer.putAll((NBTTagCompound) persistentBase);
+ }
+ // CraftBukkit end
+
((IChunkAccess) object).setLightCorrect(flag);
((IChunkAccess) object1).setLightCorrect(flag);
NBTTagCompound nbttagcompound2 = nbttagcompound.getCompound("Heightmaps");
EnumSet<HeightMap.Type> enumset = EnumSet.noneOf(HeightMap.Type.class);
@@ -323,7 +330,7 @@
@@ -322,6 +329,12 @@
return DataPaletteBlock.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), DataPaletteBlock.d.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS));
}
+ // CraftBukkit start - read/write
+ private static Codec<DataPaletteBlock<Holder<BiomeBase>>> makeBiomeCodecRW(IRegistry<BiomeBase> iregistry) {
+ return DataPaletteBlock.codecRW(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), DataPaletteBlock.d.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS));
+ }
+ // CraftBukkit end
+
public static NBTTagCompound write(WorldServer worldserver, IChunkAccess ichunkaccess) {
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
NBTTagCompound nbttagcompound = new NBTTagCompound();
@@ -334,7 +347,7 @@
nbttagcompound.putLong("InhabitedTime", ichunkaccess.getInhabitedTime());
nbttagcompound.putString("Status", ichunkaccess.getStatus().getName());
BlendingData blendingdata = ichunkaccess.getBlendingData();
@@ -59,7 +93,7 @@
Logger logger;
if (blendingdata != null) {
@@ -370,7 +377,7 @@
@@ -381,7 +394,7 @@
if (flag1) {
ChunkSection chunksection = achunksection[j];
@@ -68,7 +102,7 @@
Logger logger1 = ChunkRegionLoader.LOGGER;
Objects.requireNonNull(logger1);
@@ -454,6 +461,11 @@
@@ -465,6 +478,11 @@
nbttagcompound.put("Heightmaps", nbttagcompound3);
nbttagcompound.put("structures", packStructureData(StructurePieceSerializationContext.fromLevel(worldserver), chunkcoordintpair, ichunkaccess.getAllStarts(), ichunkaccess.getAllReferences()));

View File

@@ -1,10 +1,11 @@
--- a/net/minecraft/world/level/chunk/storage/IChunkLoader.java
+++ b/net/minecraft/world/level/chunk/storage/IChunkLoader.java
@@ -18,6 +18,14 @@
@@ -19,6 +19,15 @@
import net.minecraft.world.level.levelgen.structure.PersistentStructureLegacy;
import net.minecraft.world.level.storage.WorldPersistentData;
+// CraftBukkit start
+import java.util.concurrent.ExecutionException;
+import net.minecraft.server.level.ChunkProviderServer;
+import net.minecraft.server.level.WorldServer;
+import net.minecraft.world.level.GeneratorAccess;
@@ -15,13 +16,13 @@
public class IChunkLoader implements AutoCloseable {
public static final int LAST_MONOLYTH_STRUCTURE_DATA_VERSION = 1493;
@@ -31,9 +39,48 @@
this.worker = new IOWorker(path, flag, "chunk");
@@ -36,9 +45,53 @@
return this.worker.isOldChunkAround(chunkcoordintpair, i);
}
- public NBTTagCompound upgradeChunkTag(ResourceKey<World> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional) {
+ // CraftBukkit start
+ private boolean check(ChunkProviderServer cps, int x, int z) throws IOException {
+ private boolean check(ChunkProviderServer cps, int x, int z) {
+ ChunkCoordIntPair pos = new ChunkCoordIntPair(x, z);
+ if (cps != null) {
+ com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread");
@@ -30,7 +31,12 @@
+ }
+ }
+
+ NBTTagCompound nbt = read(pos);
+ NBTTagCompound nbt;
+ try {
+ nbt = read(pos).get().orElse(null);
+ } catch (InterruptedException | ExecutionException ex) {
+ throw new RuntimeException(ex);
+ }
+ if (nbt != null) {
+ NBTTagCompound level = nbt.getCompound("Level");
+ if (level.getBoolean("TerrainPopulated")) {
@@ -46,7 +52,7 @@
+ return false;
+ }
+
+ public NBTTagCompound upgradeChunkTag(ResourceKey<WorldDimension> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional, ChunkCoordIntPair pos, @Nullable GeneratorAccess generatoraccess) throws IOException {
+ public NBTTagCompound upgradeChunkTag(ResourceKey<WorldDimension> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional, ChunkCoordIntPair pos, @Nullable GeneratorAccess generatoraccess) {
+ // CraftBukkit end
int i = getVersion(nbttagcompound);
@@ -65,10 +71,19 @@
if (i < 1493) {
nbttagcompound = GameProfileSerializer.update(this.fixerUpper, DataFixTypes.CHUNK, nbttagcompound, i, 1493);
if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
@@ -55,7 +102,7 @@
@@ -58,7 +111,7 @@
return nbttagcompound;
}
- private PersistentStructureLegacy getLegacyStructureHandler(ResourceKey<World> resourcekey, Supplier<WorldPersistentData> supplier) {
+ private PersistentStructureLegacy getLegacyStructureHandler(ResourceKey<WorldDimension> resourcekey, Supplier<WorldPersistentData> supplier) { // CraftBukkit
PersistentStructureLegacy persistentstructurelegacy = this.legacyStructureHandler;
if (persistentstructurelegacy == null) {
@@ -73,7 +126,7 @@
return persistentstructurelegacy;
}
- public static void injectDatafixingContext(NBTTagCompound nbttagcompound, ResourceKey<World> resourcekey, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional) {
+ public static void injectDatafixingContext(NBTTagCompound nbttagcompound, ResourceKey<WorldDimension> resourcekey, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> optional) { // CraftBukkit
NBTTagCompound nbttagcompound1 = new NBTTagCompound();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java
+++ b/net/minecraft/world/level/gameevent/vibrations/VibrationListener.java
@@ -16,6 +16,13 @@
@@ -28,6 +28,13 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.Vec3D;
@@ -14,18 +14,64 @@
public class VibrationListener implements GameEventListener {
protected final PositionSource listenerSource;
@@ -65,7 +72,13 @@
} else {
BlockPosition blockposition1 = (BlockPosition) optional.get();
@@ -51,7 +58,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
});
});
}
@@ -73,7 +80,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;
}
}
@@ -110,7 +117,14 @@
Vec3D vec3d = gameevent_b.source();
Vec3D vec3d1 = (Vec3D) optional.get();
- if (!this.config.shouldListen(world, this, blockposition, gameevent, entity)) {
+ // CraftBukkit start
+ boolean defaultCancel = !this.config.shouldListen(world, this, blockposition, gameevent, entity);
+ BlockReceiveGameEvent event = new BlockReceiveGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.GAME_EVENT.getKey(gameevent))), CraftBlock.at(world, blockposition1), (entity == null) ? null : entity.getBukkitEntity());
+ event.setCancelled(defaultCancel);
+ world.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ // CraftBukkit end
return false;
} else if (this.isOccluded(world, blockposition, blockposition1)) {
return false;
- 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);

View File

@@ -4,4 +4,4 @@
+// keep
package net.minecraft.world.level.levelgen;
import com.google.common.collect.Sets;
import com.google.common.annotations.VisibleForTesting;

View File

@@ -1,62 +0,0 @@
--- a/net/minecraft/world/level/levelgen/GeneratorSettings.java
+++ b/net/minecraft/world/level/levelgen/GeneratorSettings.java
@@ -22,6 +22,7 @@
import net.minecraft.core.IRegistryWritable;
import net.minecraft.core.RegistryCodecs;
import net.minecraft.core.RegistryMaterials;
+import net.minecraft.resources.RegistryOps;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.dedicated.DedicatedServerProperties;
import net.minecraft.world.level.World;
@@ -38,7 +39,7 @@
public class GeneratorSettings {
- public static final Codec<GeneratorSettings> CODEC = RecordCodecBuilder.create((instance) -> {
+ public static final Codec<GeneratorSettings> CODEC = RecordCodecBuilder.<GeneratorSettings>create((instance) -> { // CraftBukkit - decompile error
return instance.group(Codec.LONG.fieldOf("seed").stable().forGetter(GeneratorSettings::seed), Codec.BOOL.fieldOf("generate_features").orElse(true).stable().forGetter(GeneratorSettings::generateFeatures), Codec.BOOL.fieldOf("bonus_chest").orElse(false).stable().forGetter(GeneratorSettings::generateBonusChest), RegistryCodecs.dataPackAwareCodec(IRegistry.LEVEL_STEM_REGISTRY, Lifecycle.stable(), WorldDimension.CODEC).xmap(WorldDimension::sortMap, Function.identity()).fieldOf("dimensions").forGetter(GeneratorSettings::dimensions), Codec.STRING.optionalFieldOf("legacy_custom_options").stable().forGetter((generatorsettings) -> {
return generatorsettings.legacyCustomOptions;
})).apply(instance, instance.stable(GeneratorSettings::new));
@@ -132,7 +133,7 @@
public static IRegistry<WorldDimension> withOverworld(IRegistry<WorldDimension> iregistry, Holder<DimensionManager> holder, ChunkGenerator chunkgenerator) {
IRegistryWritable<WorldDimension> iregistrywritable = new RegistryMaterials<>(IRegistry.LEVEL_STEM_REGISTRY, Lifecycle.experimental(), (Function) null);
- iregistrywritable.register(WorldDimension.OVERWORLD, (Object) (new WorldDimension(holder, chunkgenerator)), Lifecycle.stable());
+ iregistrywritable.register(WorldDimension.OVERWORLD, new WorldDimension(holder, chunkgenerator), Lifecycle.stable()); // CraftBukkit - decompile error
Iterator iterator = iregistry.entrySet().iterator();
while (iterator.hasNext()) {
@@ -140,7 +141,7 @@
ResourceKey<WorldDimension> resourcekey = (ResourceKey) entry.getKey();
if (resourcekey != WorldDimension.OVERWORLD) {
- iregistrywritable.register(resourcekey, (Object) ((WorldDimension) entry.getValue()), iregistry.lifecycle((WorldDimension) entry.getValue()));
+ iregistrywritable.register(resourcekey, entry.getValue(), iregistry.lifecycle(entry.getValue())); // CraftBukkit - decompile error
}
}
@@ -230,13 +231,13 @@
switch (b0) {
case 0:
- Dynamic<JsonElement> dynamic = new Dynamic(JsonOps.INSTANCE, dedicatedserverproperties_a.generatorSettings());
+ Dynamic<JsonElement> dynamic = new Dynamic(RegistryOps.create(JsonOps.INSTANCE, iregistrycustom), dedicatedserverproperties_a.generatorSettings()); // CraftBukkit - Incorrect Ops
boolean flag = dedicatedserverproperties_a.generateStructures();
DataResult dataresult = GeneratorSettingsFlat.CODEC.parse(dynamic);
Logger logger = GeneratorSettings.LOGGER;
Objects.requireNonNull(logger);
- return new GeneratorSettings(i, flag, false, withOverworld(iregistry, iregistry3, new ChunkProviderFlat(iregistry2, (GeneratorSettingsFlat) dataresult.resultOrPartial(logger::error).orElseGet(() -> {
+ return new GeneratorSettings(i, flag, false, withOverworld(iregistry, iregistry3, new ChunkProviderFlat(iregistry2, (GeneratorSettingsFlat) dataresult.resultOrPartial(s1 -> logger.error(String.valueOf(s1))).orElseGet(() -> { // CraftBukkit - decompile error
return GeneratorSettingsFlat.getDefault(iregistry1, iregistry2);
}))));
case 1:
@@ -263,7 +264,7 @@
Entry<ResourceKey<WorldDimension>, WorldDimension> entry = (Entry) iterator.next();
ResourceKey<WorldDimension> resourcekey = (ResourceKey) entry.getKey();
- iregistrywritable.register(resourcekey, (Object) (new WorldDimension(((WorldDimension) entry.getValue()).typeHolder(), ((WorldDimension) entry.getValue()).generator().withSeed(j))), this.dimensions.lifecycle((WorldDimension) entry.getValue()));
+ iregistrywritable.register(resourcekey, new WorldDimension(entry.getValue().typeHolder(), entry.getValue().generator().withSeed(j)), this.dimensions.lifecycle(entry.getValue())); // CraftBukkit - decompile error
}
object = iregistrywritable;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/levelgen/structure/WorldGenWitchHut.java
+++ b/net/minecraft/world/level/levelgen/structure/WorldGenWitchHut.java
@@ -97,7 +97,7 @@
--- 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);
@@ -9,7 +9,7 @@
}
}
@@ -116,7 +116,7 @@
@@ -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);

View File

@@ -41,7 +41,7 @@
- try {
+ // CraftBukkit start
+ // try {
return EntityTypes.create(nbttagcompound, (World) worldaccess.getLevel());
return EntityTypes.create(nbttagcompound, worldaccess.getLevel());
- } catch (Exception exception) {
- return Optional.empty();
- }

View File

@@ -3,7 +3,7 @@
@@ -22,7 +22,7 @@
private boolean keepLiquids;
@Nullable
private Random random;
private RandomSource random;
- private int palette;
+ public int palette = -1; // CraftBukkit - Set initial value so we know if the palette has been set forcefully
private final List<DefinedStructureProcessor> processors;

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