Update to Minecraft 1.18-pre5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-11-22 09:00:00 +11:00
parent a852b81a69
commit 43702a9e10
700 changed files with 10286 additions and 10098 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
@@ -22,6 +22,11 @@
@@ -21,6 +21,11 @@
import net.minecraft.world.level.block.BlockFireAbstract;
import net.minecraft.world.level.dimension.end.EnderDragonBattle;
@@ -11,21 +11,21 @@
+
public class EntityEnderCrystal extends Entity {
private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS);
@@ -57,7 +62,11 @@
BlockPosition blockposition = this.getChunkCoordinates();
private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.defineId(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS);
@@ -56,7 +61,11 @@
BlockPosition blockposition = this.blockPosition();
if (((WorldServer) this.level).getDragonBattle() != null && this.level.getType(blockposition).isAir()) {
- this.level.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) this.level, blockposition));
if (((WorldServer) this.level).dragonFight() != null && this.level.getBlockState(blockposition).isAir()) {
- this.level.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level, blockposition));
+ // CraftBukkit start
+ if (!CraftEventFactory.callBlockIgniteEvent(this.level, blockposition, this).isCancelled()) {
+ this.level.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) this.level, blockposition));
+ this.level.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level, blockposition));
+ }
+ // CraftBukkit end
}
}
@@ -97,9 +106,22 @@
@@ -96,9 +105,22 @@
return false;
} else {
if (!this.isRemoved() && !this.level.isClientSide) {
@@ -34,9 +34,9 @@
+ return false;
+ }
+ // CraftBukkit end
this.a(Entity.RemovalReason.KILLED);
this.remove(Entity.RemovalReason.KILLED);
if (!damagesource.isExplosion()) {
- this.level.explode((Entity) null, this.locX(), this.locY(), this.locZ(), 6.0F, Explosion.Effect.DESTROY);
- this.level.explode((Entity) null, this.getX(), this.getY(), this.getZ(), 6.0F, Explosion.Effect.DESTROY);
+ // CraftBukkit start
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
@@ -44,8 +44,8 @@
+ this.unsetRemoved();
+ return false;
+ }
+ this.level.createExplosion(this, this.locX(), this.locY(), this.locZ(), event.getRadius(), event.getFire(), Explosion.Effect.DESTROY);
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Explosion.Effect.DESTROY);
+ // CraftBukkit end
}
this.a(damagesource);
this.onDestroyedBy(damagesource);

View File

@@ -29,13 +29,13 @@
super(EntityTypes.ENDER_DRAGON, world);
@@ -236,7 +249,7 @@
Vec3D vec3d1 = idragoncontroller.g();
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
- if (vec3d1 != null) {
+ if (vec3d1 != null && idragoncontroller.getControllerPhase() != DragonControllerPhase.HOVERING) { // CraftBukkit - Don't move when hovering
d0 = vec3d1.x - this.locX();
d1 = vec3d1.y - this.locY();
d2 = vec3d1.z - this.locZ();
+ if (vec3d1 != null && idragoncontroller.getPhase() != DragonControllerPhase.HOVERING) { // CraftBukkit - Don't move when hovering
d0 = vec3d1.x - this.getX();
d1 = vec3d1.y - this.getY();
d2 = vec3d1.z - this.getZ();
@@ -378,7 +391,14 @@
if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null;
@@ -65,10 +65,10 @@
@@ -462,7 +485,11 @@
if (!iblockdata.isAir() && iblockdata.getMaterial() != Material.FIRE) {
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.a((Tag) TagsBlock.DRAGON_IMMUNE)) {
- flag1 = this.level.a(blockposition, false) || flag1;
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is((Tag) TagsBlock.DRAGON_IMMUNE)) {
- flag1 = this.level.removeBlock(blockposition, false) || flag1;
+ // CraftBukkit start - Add blocks to list rather than destroying them
+ // flag1 = this.level.a(blockposition, false) || flag1;
+ // flag1 = this.level.removeBlock(blockposition, false) || flag1;
+ flag1 = true;
+ destroyedBlocks.add(CraftBlock.at(level, blockposition));
+ // CraftBukkit end
@@ -95,7 +95,7 @@
+ } else if (event.getYield() == 0F) {
+ // Yield zero ==> no drops
+ for (org.bukkit.block.Block block : event.blockList()) {
+ this.level.a(new BlockPosition(block.getX(), block.getY(), block.getZ()), false);
+ this.level.removeBlock(new BlockPosition(block.getX(), block.getY(), block.getZ()), false);
+ }
+ } else {
+ for (org.bukkit.block.Block block : event.blockList()) {
@@ -108,18 +108,18 @@
+ BlockPosition blockposition = craftBlock.getPosition();
+
+ Block nmsBlock = craftBlock.getNMS().getBlock();
+ if (nmsBlock.a(explosionSource)) {
+ TileEntity tileentity = craftBlock.getNMS().isTileEntity() ? this.level.getTileEntity(blockposition) : null;
+ LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.level)).a(this.level.random).set(LootContextParameters.ORIGIN, Vec3D.a(blockposition)).set(LootContextParameters.TOOL, ItemStack.EMPTY).set(LootContextParameters.EXPLOSION_RADIUS, 1.0F / event.getYield()).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity);
+ if (nmsBlock.dropFromExplosion(explosionSource)) {
+ TileEntity tileentity = craftBlock.getNMS().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).withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / event.getYield()).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity);
+
+ craftBlock.getNMS().a(loottableinfo_builder).forEach((itemstack) -> {
+ Block.a(level, blockposition, itemstack);
+ craftBlock.getNMS().getDrops(loottableinfo_builder).forEach((itemstack) -> {
+ Block.popResource(level, blockposition, itemstack);
+ });
+ craftBlock.getNMS().dropNaturally((WorldServer) level, blockposition, ItemStack.EMPTY);
+ craftBlock.getNMS().spawnAfterBreak((WorldServer) level, blockposition, ItemStack.EMPTY);
+ }
+ nmsBlock.wasExploded(level, blockposition, explosionSource);
+
+ this.level.a(blockposition, false);
+ this.level.removeBlock(blockposition, false);
+ }
+ }
+ // CraftBukkit end

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerManager.java
+++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerManager.java
@@ -4,6 +4,11 @@
@@ -5,6 +5,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -12,14 +12,14 @@
public class DragonControllerManager {
private static final Logger LOGGER = LogManager.getLogger();
@@ -22,6 +27,19 @@
this.currentPhase.e();
@@ -24,6 +29,19 @@
this.currentPhase.end();
}
+ // CraftBukkit start - Call EnderDragonChangePhaseEvent
+ EnderDragonChangePhaseEvent event = new EnderDragonChangePhaseEvent(
+ (CraftEnderDragon) this.dragon.getBukkitEntity(),
+ (this.currentPhase == null) ? null : CraftEnderDragon.getBukkitPhase(this.currentPhase.getControllerPhase()),
+ (this.currentPhase == null) ? null : CraftEnderDragon.getBukkitPhase(this.currentPhase.getPhase()),
+ CraftEnderDragon.getBukkitPhase(dragoncontrollerphase)
+ );
+ this.dragon.level.getCraftServer().getPluginManager().callEvent(event);
@@ -29,11 +29,11 @@
+ dragoncontrollerphase = CraftEnderDragon.getMinecraftPhase(event.getNewPhase());
+ // CraftBukkit end
+
this.currentPhase = this.b(dragoncontrollerphase);
this.currentPhase = this.getPhase(dragoncontrollerphase);
if (!this.dragon.level.isClientSide) {
this.dragon.getDataWatcher().set(EntityEnderDragon.DATA_PHASE, dragoncontrollerphase.b());
@@ -43,6 +61,6 @@
this.phases[i] = dragoncontrollerphase.a(this.dragon);
this.dragon.getEntityData().set(EntityEnderDragon.DATA_PHASE, dragoncontrollerphase.getId());
@@ -45,6 +63,6 @@
this.phases[i] = dragoncontrollerphase.createInstance(this.dragon);
}
- return this.phases[i];