@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/Explosion.java
|
||||
+++ b/net/minecraft/world/level/Explosion.java
|
||||
@@ -40,6 +40,16 @@
|
||||
@@ -41,6 +41,16 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
public class Explosion {
|
||||
|
||||
private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
|
||||
@@ -61,6 +71,10 @@
|
||||
@@ -62,6 +72,10 @@
|
||||
private final Holder<SoundEffect> explosionSound;
|
||||
private final ObjectArrayList<BlockPosition> toBlow;
|
||||
private final Map<EntityHuman, Vec3D> hitPlayers;
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
public static DamageSource getDefaultDamageSource(World world, @Nullable Entity entity) {
|
||||
return world.damageSources().explosion(entity, getIndirectSourceEntityInternal(entity));
|
||||
@@ -86,7 +100,7 @@
|
||||
@@ -87,7 +101,7 @@
|
||||
this.hitPlayers = Maps.newHashMap();
|
||||
this.level = world;
|
||||
this.source = entity;
|
||||
@@ -37,7 +37,7 @@
|
||||
this.x = d0;
|
||||
this.y = d1;
|
||||
this.z = d2;
|
||||
@@ -97,6 +111,7 @@
|
||||
@@ -98,6 +112,7 @@
|
||||
this.smallExplosionParticles = particleparam;
|
||||
this.largeExplosionParticles = particleparam1;
|
||||
this.explosionSound = holder;
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
|
||||
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
|
||||
@@ -147,6 +162,11 @@
|
||||
@@ -148,6 +163,11 @@
|
||||
}
|
||||
|
||||
public void explode() {
|
||||
@@ -57,7 +57,7 @@
|
||||
this.level.gameEvent(this.source, (Holder) GameEvent.EXPLODE, new Vec3D(this.x, this.y, this.z));
|
||||
Set<BlockPosition> set = Sets.newHashSet();
|
||||
boolean flag = true;
|
||||
@@ -229,7 +249,35 @@
|
||||
@@ -230,7 +250,35 @@
|
||||
d9 /= d11;
|
||||
d10 /= d11;
|
||||
if (this.damageCalculator.shouldDamageEntity(this, entity)) {
|
||||
@@ -94,7 +94,7 @@
|
||||
}
|
||||
|
||||
double d12 = (1.0D - d7) * (double) getSeenPercent(vec3d, entity) * (double) this.damageCalculator.getKnockbackMultiplier(entity);
|
||||
@@ -248,6 +296,17 @@
|
||||
@@ -249,6 +297,17 @@
|
||||
d10 *= d13;
|
||||
Vec3D vec3d1 = new Vec3D(d8, d9, d10);
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d1));
|
||||
if (entity instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) entity;
|
||||
@@ -290,9 +349,65 @@
|
||||
@@ -291,9 +350,65 @@
|
||||
|
||||
SystemUtils.shuffle(this.toBlow, this.level.random);
|
||||
ObjectListIterator objectlistiterator = this.toBlow.iterator();
|
||||
@@ -178,7 +178,7 @@
|
||||
|
||||
this.level.getBlockState(blockposition).onExplosionHit(this.level, blockposition, this, (itemstack, blockposition1) -> {
|
||||
addOrAppendStack(list, itemstack, blockposition1);
|
||||
@@ -317,7 +432,11 @@
|
||||
@@ -318,7 +433,11 @@
|
||||
BlockPosition blockposition1 = (BlockPosition) objectlistiterator1.next();
|
||||
|
||||
if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockposition1).isAir() && this.level.getBlockState(blockposition1.below()).isSolidRender(this.level, blockposition1.below())) {
|
||||
@@ -191,7 +191,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -325,6 +444,7 @@
|
||||
@@ -326,6 +445,7 @@
|
||||
}
|
||||
|
||||
private static void addOrAppendStack(List<Pair<ItemStack, BlockPosition>> list, ItemStack itemstack, BlockPosition blockposition) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/World.java
|
||||
+++ b/net/minecraft/world/level/World.java
|
||||
@@ -77,6 +77,28 @@
|
||||
@@ -78,6 +78,28 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.scores.Scoreboard;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
||||
public static final Codec<ResourceKey<World>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION);
|
||||
@@ -118,7 +140,42 @@
|
||||
@@ -119,7 +141,42 @@
|
||||
private final DamageSources damageSources;
|
||||
private long subTickCount;
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
this.profiler = supplier;
|
||||
this.levelData = worlddatamutable;
|
||||
this.dimensionTypeRegistration = holder;
|
||||
@@ -127,15 +184,15 @@
|
||||
@@ -128,15 +185,15 @@
|
||||
this.dimension = resourcekey;
|
||||
this.isClientSide = flag;
|
||||
if (dimensionmanager.coordinateScale() != 1.0D) {
|
||||
@@ -92,7 +92,7 @@
|
||||
}
|
||||
};
|
||||
} else {
|
||||
@@ -148,6 +205,42 @@
|
||||
@@ -149,6 +206,42 @@
|
||||
this.neighborUpdater = new CollectingNeighborUpdater(this, j);
|
||||
this.registryAccess = iregistrycustom;
|
||||
this.damageSources = new DamageSources(iregistrycustom);
|
||||
@@ -135,7 +135,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -205,6 +298,18 @@
|
||||
@@ -206,6 +299,18 @@
|
||||
|
||||
@Override
|
||||
public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
|
||||
@@ -154,7 +154,7 @@
|
||||
if (this.isOutsideBuildHeight(blockposition)) {
|
||||
return false;
|
||||
} else if (!this.isClientSide && this.isDebug()) {
|
||||
@@ -212,13 +317,29 @@
|
||||
@@ -213,13 +318,29 @@
|
||||
} else {
|
||||
Chunk chunk = this.getChunkAt(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
@@ -185,7 +185,7 @@
|
||||
if (iblockdata2 == iblockdata) {
|
||||
if (iblockdata1 != iblockdata2) {
|
||||
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
|
||||
@@ -245,12 +366,69 @@
|
||||
@@ -246,12 +367,69 @@
|
||||
|
||||
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
@@ -255,7 +255,7 @@
|
||||
public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
|
||||
|
||||
@Override
|
||||
@@ -336,6 +514,14 @@
|
||||
@@ -337,6 +515,14 @@
|
||||
|
||||
@Override
|
||||
public IBlockData getBlockState(BlockPosition blockposition) {
|
||||
@@ -270,7 +270,7 @@
|
||||
if (this.isOutsideBuildHeight(blockposition)) {
|
||||
return Blocks.VOID_AIR.defaultBlockState();
|
||||
} else {
|
||||
@@ -518,6 +704,11 @@
|
||||
@@ -523,6 +709,11 @@
|
||||
case 4:
|
||||
explosion_effect = Explosion.Effect.TRIGGER_BLOCK;
|
||||
break;
|
||||
@@ -282,7 +282,7 @@
|
||||
default:
|
||||
throw new MatchException((String) null, (Throwable) null);
|
||||
}
|
||||
@@ -539,6 +730,16 @@
|
||||
@@ -544,6 +735,16 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity getBlockEntity(BlockPosition blockposition) {
|
||||
@@ -299,7 +299,7 @@
|
||||
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
|
||||
}
|
||||
|
||||
@@ -546,6 +747,12 @@
|
||||
@@ -551,6 +752,12 @@
|
||||
BlockPosition blockposition = tileentity.getBlockPos();
|
||||
|
||||
if (!this.isOutsideBuildHeight(blockposition)) {
|
||||
@@ -312,7 +312,7 @@
|
||||
this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity);
|
||||
}
|
||||
}
|
||||
@@ -675,7 +882,7 @@
|
||||
@@ -680,7 +887,7 @@
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
EntityComplexPart entitycomplexpart = aentitycomplexpart[k];
|
||||
@@ -321,12 +321,12 @@
|
||||
|
||||
if (t0 != null && predicate.test(t0)) {
|
||||
list.add(t0);
|
||||
@@ -953,7 +1160,7 @@
|
||||
@@ -958,7 +1165,7 @@
|
||||
|
||||
public static enum a {
|
||||
public static enum a implements INamable {
|
||||
|
||||
- NONE, BLOCK, MOB, TNT, BLOW;
|
||||
+ NONE, BLOCK, MOB, TNT, BLOW, STANDARD; // CraftBukkit - Add STANDARD which will always use Explosion.Effect.DESTROY
|
||||
- NONE("none"), BLOCK("block"), MOB("mob"), TNT("tnt"), TRIGGER("trigger");
|
||||
+ NONE("none"), BLOCK("block"), MOB("mob"), TNT("tnt"), TRIGGER("trigger"), STANDARD("standard"); // CraftBukkit - Add STANDARD which will always use Explosion.Effect.DESTROY
|
||||
|
||||
private a() {}
|
||||
}
|
||||
public static final Codec<World.a> CODEC = INamable.fromEnum(World.a::values);
|
||||
private final String id;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/Block.java
|
||||
+++ b/net/minecraft/world/level/block/Block.java
|
||||
@@ -341,7 +341,13 @@
|
||||
@@ -340,7 +340,13 @@
|
||||
EntityItem entityitem = (EntityItem) supplier.get();
|
||||
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +373,7 @@
|
||||
@@ -366,7 +372,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,21 +24,19 @@
|
||||
dropResources(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
|
||||
}
|
||||
|
||||
@@ -500,17 +506,25 @@
|
||||
@@ -499,15 +505,23 @@
|
||||
return this.builtInRegistryHolder;
|
||||
}
|
||||
|
||||
- protected void tryDropExperience(WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, IntProvider intprovider) {
|
||||
+ // CraftBukkit start
|
||||
+ 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);
|
||||
int i = EnchantmentManager.processBlockExperience(worldserver, itemstack, intprovider.sample(worldserver.getRandom()));
|
||||
|
||||
if (i > 0) {
|
||||
- this.popExperience(worldserver, blockposition, i);
|
||||
+ // this.popExperience(worldserver, blockposition, i);
|
||||
+ return i;
|
||||
}
|
||||
if (i > 0) {
|
||||
- this.popExperience(worldserver, blockposition, i);
|
||||
+ // this.popExperience(worldserver, blockposition, i);
|
||||
+ return i;
|
||||
}
|
||||
|
||||
+ return 0;
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.press(iblockdata, world, blockposition);
|
||||
this.playSound(entityhuman, world, blockposition, true);
|
||||
world.gameEvent((Entity) entityhuman, (Holder) GameEvent.BLOCK_ACTIVATE, blockposition);
|
||||
this.press(iblockdata, world, blockposition, entityhuman);
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
}
|
||||
@@ -195,11 +213,36 @@
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCake.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCake.java
|
||||
@@ -100,7 +100,18 @@
|
||||
@@ -97,7 +97,18 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
entityhuman.awardStat(StatisticList.EAT_CAKE_SLICE);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCampfire.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCampfire.java
|
||||
@@ -106,7 +106,7 @@
|
||||
@@ -105,7 +105,7 @@
|
||||
@Override
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if ((Boolean) iblockdata.getValue(BlockCampfire.LIT) && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
|
||||
- entity.hurt(world.damageSources().inFire(), (float) this.fireDamage);
|
||||
+ entity.hurt(world.damageSources().inFire().directBlock(world, blockposition), (float) this.fireDamage); // CraftBukkit
|
||||
if ((Boolean) iblockdata.getValue(BlockCampfire.LIT) && entity instanceof EntityLiving) {
|
||||
- entity.hurt(world.damageSources().campfire(), (float) this.fireDamage);
|
||||
+ entity.hurt(world.damageSources().campfire().directBlock(world, blockposition), (float) this.fireDamage); // CraftBukkit
|
||||
}
|
||||
|
||||
super.entityInside(iblockdata, world, blockposition, entity);
|
||||
@@ -216,6 +216,11 @@
|
||||
@@ -215,6 +215,11 @@
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
|
||||
|
||||
if (!world.isClientSide && iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition) && !(Boolean) iblockdata.getValue(BlockCampfire.LIT) && !(Boolean) iblockdata.getValue(BlockCampfire.WATERLOGGED)) {
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
if (iinventory == null) {
|
||||
itemstack1 = BlockDropper.DISPENSE_BEHAVIOUR.dispense(sourceblock, itemstack);
|
||||
} else {
|
||||
- itemstack1 = TileEntityHopper.addItem(tileentitydispenser, iinventory, itemstack.copy().split(1), enumdirection.getOpposite());
|
||||
- itemstack1 = TileEntityHopper.addItem(tileentitydispenser, iinventory, itemstack.copyWithCount(1), enumdirection.getOpposite());
|
||||
- if (itemstack1.isEmpty()) {
|
||||
+ // CraftBukkit start - Fire event when pushing items into other inventories
|
||||
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.copy().split(1));
|
||||
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.copyWithCount(1));
|
||||
+
|
||||
+ org.bukkit.inventory.Inventory destinationInventory;
|
||||
+ // Have to special case large chests as they work oddly
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--- a/net/minecraft/world/level/block/BlockEndGateway.java
|
||||
+++ b/net/minecraft/world/level/block/BlockEndGateway.java
|
||||
@@ -21,6 +21,10 @@
|
||||
import net.minecraft.world.level.portal.DimensionTransition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockEndGateway extends BlockTileEntity implements Portal {
|
||||
|
||||
public static final MapCodec<BlockEndGateway> CODEC = simpleCodec(BlockEndGateway::new);
|
||||
@@ -110,7 +114,7 @@
|
||||
if (tileentity instanceof TileEntityEndGateway tileentityendgateway) {
|
||||
Vec3D vec3d = tileentityendgateway.getPortalPosition(worldserver, blockposition);
|
||||
|
||||
- return vec3d != null ? new DimensionTransition(worldserver, vec3d, calculateExitMovement(entity), entity.getYRot(), entity.getXRot(), DimensionTransition.PLACE_PORTAL_TICKET) : null;
|
||||
+ return vec3d != null ? new DimensionTransition(worldserver, vec3d, calculateExitMovement(entity), entity.getYRot(), entity.getXRot(), DimensionTransition.PLACE_PORTAL_TICKET, PlayerTeleportEvent.TeleportCause.END_GATEWAY) : null; // CraftBukkit
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -1,41 +1,80 @@
|
||||
--- a/net/minecraft/world/level/block/BlockEnderPortal.java
|
||||
+++ b/net/minecraft/world/level/block/BlockEnderPortal.java
|
||||
@@ -21,6 +21,13 @@
|
||||
@@ -26,6 +26,19 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.List;
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.event.entity.EntityPortalEnterEvent;
|
||||
+import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockEnderPortal extends BlockTileEntity {
|
||||
public class BlockEnderPortal extends BlockTileEntity implements Portal {
|
||||
|
||||
public static final MapCodec<BlockEnderPortal> CODEC = simpleCodec(BlockEnderPortal::new);
|
||||
@@ -48,13 +55,22 @@
|
||||
@@ -53,6 +66,10 @@
|
||||
@Override
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (world instanceof WorldServer && entity.canChangeDimensions() && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
|
||||
- ResourceKey<World> resourcekey = world.dimension() == World.END ? World.OVERWORLD : World.END;
|
||||
+ ResourceKey<World> resourcekey = world.getTypeKey() == WorldDimension.END ? World.OVERWORLD : World.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
||||
WorldServer worldserver = ((WorldServer) world).getServer().getLevel(resourcekey);
|
||||
|
||||
if (worldserver == null) {
|
||||
- return;
|
||||
+ // return; // CraftBukkit - always fire event in case plugins wish to change it
|
||||
}
|
||||
|
||||
if (entity.canUsePortal(false) && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (entity instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entity.changeDimension(worldserver);
|
||||
}
|
||||
if (!world.isClientSide && world.dimension() == World.END && entity instanceof EntityPlayer) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
|
||||
@@ -69,11 +86,11 @@
|
||||
|
||||
@Override
|
||||
public DimensionTransition getPortalDestination(WorldServer worldserver, Entity entity, BlockPosition blockposition) {
|
||||
- ResourceKey<World> resourcekey = worldserver.dimension() == World.END ? World.OVERWORLD : World.END;
|
||||
+ ResourceKey<World> resourcekey = worldserver.getTypeKey() == WorldDimension.END ? World.OVERWORLD : World.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
||||
WorldServer worldserver1 = worldserver.getServer().getLevel(resourcekey);
|
||||
|
||||
if (worldserver1 == null) {
|
||||
- return null;
|
||||
+ return new DimensionTransition(PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit- always fire event in case plugins wish to change it
|
||||
} else {
|
||||
boolean flag = resourcekey == World.END;
|
||||
BlockPosition blockposition1 = flag ? WorldServer.END_SPAWN_POINT : worldserver1.getSharedSpawnPos();
|
||||
@@ -81,7 +98,7 @@
|
||||
float f = entity.getYRot();
|
||||
|
||||
if (flag) {
|
||||
- EndPlatformFeature.createEndPlatform(worldserver1, BlockPosition.containing(vec3d).below(), true);
|
||||
+ EndPlatformFeature.createEndPlatform(worldserver1, BlockPosition.containing(vec3d).below(), true, entity); // CraftBukkit
|
||||
f = EnumDirection.WEST.toYRot();
|
||||
if (entity instanceof EntityPlayer) {
|
||||
vec3d = vec3d.subtract(0.0D, 1.0D, 0.0D);
|
||||
@@ -90,13 +107,21 @@
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
|
||||
- return entityplayer.findRespawnPositionAndUseSpawnBlock(false, DimensionTransition.DO_NOTHING);
|
||||
+ return entityplayer.findRespawnPositionAndUseSpawnBlock(false, DimensionTransition.DO_NOTHING, PlayerRespawnEvent.RespawnReason.END_PORTAL); // CraftBukkit
|
||||
}
|
||||
|
||||
vec3d = entity.adjustSpawnLocation(worldserver1, blockposition1).getBottomCenter();
|
||||
}
|
||||
|
||||
- return new DimensionTransition(worldserver1, vec3d, entity.getDeltaMovement(), f, entity.getXRot(), DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET));
|
||||
+ // CraftBukkit start
|
||||
+ CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(vec3d, worldserver1.getWorld(), f, entity.getXRot()), PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
|
||||
+ if (event == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ Location to = event.getTo();
|
||||
+
|
||||
+ return new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), entity.getDeltaMovement(), to.getYaw(), to.getPitch(), DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET), PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
if (!entity.fireImmune()) {
|
||||
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
|
||||
if (entity.getRemainingFireTicks() == 0) {
|
||||
- entity.igniteForSeconds(8);
|
||||
- entity.igniteForSeconds(8.0F);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityCombustEvent event = new org.bukkit.event.entity.EntityCombustByBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition), entity.getBukkitEntity(), 8);
|
||||
+ org.bukkit.event.entity.EntityCombustEvent event = new org.bukkit.event.entity.EntityCombustByBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition), entity.getBukkitEntity(), 8.0F);
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockLectern.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLectern.java
|
||||
@@ -207,11 +207,12 @@
|
||||
@@ -208,11 +208,12 @@
|
||||
}
|
||||
|
||||
private void popBook(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockLever.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLever.java
|
||||
@@ -28,6 +28,8 @@
|
||||
@@ -29,6 +29,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -27,6 +27,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
iblockdata1 = this.pull(iblockdata, world, blockposition);
|
||||
float f = (Boolean) iblockdata1.getValue(BlockLever.POWERED) ? 0.6F : 0.5F;
|
||||
|
||||
this.pull(iblockdata, world, blockposition, (EntityHuman) null);
|
||||
return EnumInteractionResult.CONSUME;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/level/block/BlockMagma.java
|
||||
+++ b/net/minecraft/world/level/block/BlockMagma.java
|
||||
@@ -30,7 +30,7 @@
|
||||
@@ -29,7 +29,7 @@
|
||||
@Override
|
||||
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||
if (!entity.isSteppingCarefully() && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
|
||||
if (!entity.isSteppingCarefully() && entity instanceof EntityLiving) {
|
||||
- entity.hurt(world.damageSources().hotFloor(), 1.0F);
|
||||
+ entity.hurt(world.damageSources().hotFloor().directBlock(world, blockposition), 1.0F); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
--- a/net/minecraft/world/level/block/BlockPortal.java
|
||||
+++ b/net/minecraft/world/level/block/BlockPortal.java
|
||||
@@ -26,6 +26,10 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
@@ -38,6 +38,15 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.event.entity.EntityPortalEnterEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockPortal extends Block {
|
||||
public class BlockPortal extends Block implements Portal {
|
||||
|
||||
public static final MapCodec<BlockPortal> CODEC = simpleCodec(BlockPortal::new);
|
||||
@@ -63,7 +67,8 @@
|
||||
@@ -76,7 +85,8 @@
|
||||
}
|
||||
|
||||
if (worldserver.getBlockState(blockposition).isValidSpawn(worldserver, blockposition, EntityTypes.ZOMBIFIED_PIGLIN)) {
|
||||
@@ -21,14 +26,90 @@
|
||||
|
||||
if (entity != null) {
|
||||
entity.setPortalCooldown();
|
||||
@@ -85,6 +90,10 @@
|
||||
@@ -98,6 +108,10 @@
|
||||
@Override
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (entity.canChangeDimensions()) {
|
||||
if (entity.canUsePortal(false)) {
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ // CraftBukkit end
|
||||
entity.handleInsidePortal(blockposition);
|
||||
entity.setAsInsidePortal(this, blockposition);
|
||||
}
|
||||
|
||||
@@ -115,24 +129,34 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public DimensionTransition getPortalDestination(WorldServer worldserver, Entity entity, BlockPosition blockposition) {
|
||||
- ResourceKey<World> resourcekey = worldserver.dimension() == World.NETHER ? World.OVERWORLD : World.NETHER;
|
||||
+ // CraftBukkit start
|
||||
+ ResourceKey<World> resourcekey = worldserver.getTypeKey() == WorldDimension.NETHER ? World.OVERWORLD : World.NETHER;
|
||||
WorldServer worldserver1 = worldserver.getServer().getLevel(resourcekey);
|
||||
|
||||
if (worldserver1 == null) {
|
||||
- return null;
|
||||
+ return new DimensionTransition(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // always fire event in case plugins wish to change it
|
||||
} else {
|
||||
- boolean flag = worldserver1.dimension() == World.NETHER;
|
||||
+ boolean flag = worldserver1.getTypeKey() == WorldDimension.NETHER;
|
||||
+ // CraftBukkit end
|
||||
WorldBorder worldborder = worldserver1.getWorldBorder();
|
||||
double d0 = DimensionManager.getTeleportationScale(worldserver.dimensionType(), worldserver1.dimensionType());
|
||||
BlockPosition blockposition1 = worldborder.clampToBounds(entity.getX() * d0, entity.getY(), entity.getZ() * d0);
|
||||
+ // CraftBukkit start
|
||||
+ CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(blockposition1, worldserver1.getWorld()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag ? 16 : 128, 16);
|
||||
+ if (event == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ worldserver1 = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
||||
+ worldborder = worldserver1.getWorldBorder();
|
||||
+ blockposition1 = worldborder.clampToBounds(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
|
||||
- return this.getExitPortal(worldserver1, entity, blockposition, blockposition1, flag, worldborder);
|
||||
+ return this.getExitPortal(worldserver1, entity, blockposition, blockposition1, flag, worldborder, event.getSearchRadius(), event.getCanCreatePortal(), event.getCreationRadius());
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- private DimensionTransition getExitPortal(WorldServer worldserver, Entity entity, BlockPosition blockposition, BlockPosition blockposition1, boolean flag, WorldBorder worldborder) {
|
||||
- Optional<BlockPosition> optional = worldserver.getPortalForcer().findClosestPortalPosition(blockposition1, flag, worldborder);
|
||||
+ private DimensionTransition getExitPortal(WorldServer worldserver, Entity entity, BlockPosition blockposition, BlockPosition blockposition1, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) {
|
||||
+ Optional<BlockPosition> optional = worldserver.getPortalForcer().findClosestPortalPosition(blockposition1, worldborder, searchRadius);
|
||||
BlockUtil.Rectangle blockutil_rectangle;
|
||||
DimensionTransition.a dimensiontransition_a;
|
||||
|
||||
@@ -146,17 +170,22 @@
|
||||
dimensiontransition_a = DimensionTransition.PLAY_PORTAL_SOUND.then((entity1) -> {
|
||||
entity1.placePortalTicket(blockposition2);
|
||||
});
|
||||
- } else {
|
||||
+ } else if (canCreatePortal) {
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis = (EnumDirection.EnumAxis) entity.level().getBlockState(blockposition).getOptionalValue(BlockPortal.AXIS).orElse(EnumDirection.EnumAxis.X);
|
||||
- Optional<BlockUtil.Rectangle> optional1 = worldserver.getPortalForcer().createPortal(blockposition1, enumdirection_enumaxis);
|
||||
+ Optional<BlockUtil.Rectangle> optional1 = worldserver.getPortalForcer().createPortal(blockposition1, enumdirection_enumaxis, entity, createRadius);
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (optional1.isEmpty()) {
|
||||
- BlockPortal.LOGGER.error("Unable to create a portal, likely target out of worldborder");
|
||||
+ // BlockPortal.LOGGER.error("Unable to create a portal, likely target out of worldborder"); // CraftBukkit
|
||||
return null;
|
||||
}
|
||||
|
||||
blockutil_rectangle = (BlockUtil.Rectangle) optional1.get();
|
||||
dimensiontransition_a = DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET);
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ return null;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return getDimensionTransitionFromExit(entity, blockposition, blockutil_rectangle, worldserver, dimensiontransition_a);
|
||||
@@ -198,7 +227,7 @@
|
||||
Vec3D vec3d3 = new Vec3D((double) blockposition.getX() + (flag ? d2 : d4), (double) blockposition.getY() + d3, (double) blockposition.getZ() + (flag ? d4 : d2));
|
||||
Vec3D vec3d4 = BlockPortalShape.findCollisionFreePosition(vec3d3, worldserver, entity, entitysize);
|
||||
|
||||
- return new DimensionTransition(worldserver, vec3d4, vec3d2, f + (float) i, f1, dimensiontransition_a);
|
||||
+ return new DimensionTransition(worldserver, vec3d4, vec3d2, f + (float) i, f1, dimensiontransition_a, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockRedstoneOre.java
|
||||
+++ b/net/minecraft/world/level/block/BlockRedstoneOre.java
|
||||
@@ -22,6 +22,11 @@
|
||||
@@ -21,6 +21,11 @@
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class BlockRedstoneOre extends Block {
|
||||
|
||||
public static final MapCodec<BlockRedstoneOre> CODEC = simpleCodec(BlockRedstoneOre::new);
|
||||
@@ -39,14 +44,27 @@
|
||||
@@ -38,14 +43,27 @@
|
||||
|
||||
@Override
|
||||
protected void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
|
||||
super.stepOn(world, blockposition, iblockdata, entity);
|
||||
@@ -57,15 +75,20 @@
|
||||
@@ -56,15 +74,20 @@
|
||||
if (world.isClientSide) {
|
||||
spawnParticles(world, blockposition);
|
||||
} else {
|
||||
@@ -65,7 +65,7 @@
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneOre.LIT, true), 3);
|
||||
}
|
||||
|
||||
@@ -79,6 +102,11 @@
|
||||
@@ -78,6 +101,11 @@
|
||||
@Override
|
||||
protected void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if ((Boolean) iblockdata.getValue(BlockRedstoneOre.LIT)) {
|
||||
@@ -77,7 +77,7 @@
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneOre.LIT, false), 3);
|
||||
}
|
||||
|
||||
@@ -87,12 +115,20 @@
|
||||
@@ -86,10 +114,17 @@
|
||||
@Override
|
||||
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
@@ -86,12 +86,9 @@
|
||||
+
|
||||
+ @Override
|
||||
+ 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);
|
||||
+ // this.popExperience(worldserver, blockposition, i);
|
||||
+ return i;
|
||||
if (flag) {
|
||||
- this.tryDropExperience(worldserver, blockposition, itemstack, UniformInt.of(1, 5));
|
||||
+ return this.tryDropExperience(worldserver, blockposition, itemstack, UniformInt.of(1, 5));
|
||||
}
|
||||
|
||||
+ return 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSign.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSign.java
|
||||
@@ -142,7 +142,7 @@
|
||||
@@ -139,7 +139,7 @@
|
||||
} else if (flag1) {
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else if (!this.otherPlayerIsEditingSign(entityhuman, tileentitysign) && entityhuman.mayBuild() && this.hasEditableText(entityhuman, tileentitysign, flag)) {
|
||||
@@ -9,7 +9,7 @@
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
return EnumInteractionResult.PASS;
|
||||
@@ -188,6 +188,15 @@
|
||||
@@ -185,6 +185,15 @@
|
||||
}
|
||||
|
||||
public void openTextEdit(EntityHuman entityhuman, TileEntitySign tileentitysign, boolean flag) {
|
||||
@@ -25,7 +25,7 @@
|
||||
tileentitysign.setAllowedPlayerEditor(entityhuman.getUUID());
|
||||
entityhuman.openTextEdit(tileentitysign, flag);
|
||||
}
|
||||
@@ -201,6 +210,6 @@
|
||||
@@ -198,6 +207,6 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends TileEntity> BlockEntityTicker<T> getTicker(World world, IBlockData iblockdata, TileEntityTypes<T> tileentitytypes) {
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
explode(world, blockposition, entityhuman);
|
||||
world.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 11);
|
||||
Item item = itemstack.getItem();
|
||||
@@ -125,6 +135,11 @@
|
||||
@@ -123,6 +133,11 @@
|
||||
Entity entity = iprojectile.getOwner();
|
||||
|
||||
if (iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/DecoratedPotBlock.java
|
||||
+++ b/net/minecraft/world/level/block/DecoratedPotBlock.java
|
||||
@@ -238,6 +238,11 @@
|
||||
@@ -239,6 +239,11 @@
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
|
||||
|
||||
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile.mayBreak(world)) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/level/block/LightningRodBlock.java
|
||||
+++ b/net/minecraft/world/level/block/LightningRodBlock.java
|
||||
@@ -33,6 +33,11 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
@@ -22,6 +22,11 @@
|
||||
import net.minecraft.world.level.material.FluidType;
|
||||
import net.minecraft.world.level.material.FluidTypes;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
@@ -12,7 +12,7 @@
|
||||
public class LightningRodBlock extends RodBlock implements IBlockWaterlogged {
|
||||
|
||||
public static final MapCodec<LightningRodBlock> CODEC = simpleCodec(LightningRodBlock::new);
|
||||
@@ -85,6 +90,18 @@
|
||||
@@ -74,6 +79,18 @@
|
||||
}
|
||||
|
||||
public void onLightningStrike(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
@@ -31,12 +31,3 @@
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(LightningRodBlock.POWERED, true), 3);
|
||||
this.updateNeighbours(iblockdata, world, blockposition);
|
||||
world.scheduleTick(blockposition, (Block) this, 8);
|
||||
@@ -142,7 +159,7 @@
|
||||
Entity entity = iprojectile.getOwner();
|
||||
|
||||
entitylightning.setCause(entity instanceof EntityPlayer ? (EntityPlayer) entity : null);
|
||||
- world.addFreshEntity(entitylightning);
|
||||
+ ((WorldServer) world).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
|
||||
}
|
||||
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.TRIDENT_THUNDER, SoundCategory.WEATHER, 5.0F, 1.0F);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
@@ -34,10 +34,13 @@
|
||||
@@ -35,10 +35,13 @@
|
||||
public SculkCatalystBlockEntity(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.SCULK_CATALYST, blockposition, iblockdata);
|
||||
this.catalystListener = new SculkCatalystBlockEntity.CatalystListener(iblockdata, new BlockPositionSource(blockposition));
|
||||
@@ -14,7 +14,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,11 +66,13 @@
|
||||
@@ -64,11 +67,13 @@
|
||||
final SculkSpreader sculkSpreader;
|
||||
private final IBlockData blockState;
|
||||
private final PositionSource positionSource;
|
||||
|
||||
@@ -98,11 +98,11 @@
|
||||
if (flag2 && flag) {
|
||||
- doBrew(world, blockposition, tileentitybrewingstand.items);
|
||||
+ doBrew(world, blockposition, tileentitybrewingstand.items, tileentitybrewingstand); // CraftBukkit
|
||||
setChanged(world, blockposition, iblockdata);
|
||||
} else if (!flag || !itemstack1.is(tileentitybrewingstand.ingredient)) {
|
||||
tileentitybrewingstand.brewTime = 0;
|
||||
@@ -128,7 +188,11 @@
|
||||
}
|
||||
@@ -128,7 +188,11 @@
|
||||
setChanged(world, blockposition, iblockdata);
|
||||
} else if (flag && tileentitybrewingstand.fuel > 0) {
|
||||
--tileentitybrewingstand.fuel;
|
||||
- tileentitybrewingstand.brewTime = 400;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityCampfire.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityCampfire.java
|
||||
@@ -31,6 +31,14 @@
|
||||
@@ -30,6 +30,14 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
public class TileEntityCampfire extends TileEntity implements Clearable {
|
||||
|
||||
private static final int BURN_COOL_SPEED = 2;
|
||||
@@ -65,6 +73,20 @@
|
||||
@@ -64,6 +72,20 @@
|
||||
}).orElse(itemstack);
|
||||
|
||||
if (itemstack1.isItemEnabled(world.enabledFeatures())) {
|
||||
@@ -36,7 +36,7 @@
|
||||
InventoryUtils.dropItemStack(world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack1);
|
||||
tileentitycampfire.items.set(i, ItemStack.EMPTY);
|
||||
world.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
|
||||
@@ -177,7 +199,11 @@
|
||||
@@ -176,7 +198,11 @@
|
||||
ItemStack itemstack1 = (ItemStack) this.items.get(j);
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
@@ -47,5 +47,5 @@
|
||||
+ this.cookingTime[j] = event.getTotalCookTime(); // i -> event.getTotalCookTime()
|
||||
+ // CraftBukkit end
|
||||
this.cookingProgress[j] = 0;
|
||||
this.items.set(j, itemstack.split(1));
|
||||
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, this.getBlockPos(), GameEvent.a.of(entity, this.getBlockState()));
|
||||
this.items.set(j, itemstack.consumeAndReturn(1, entityliving));
|
||||
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, this.getBlockPos(), GameEvent.a.of(entityliving, this.getBlockState()));
|
||||
|
||||
@@ -1,72 +1,22 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
|
||||
@@ -34,6 +34,15 @@
|
||||
@@ -27,6 +27,10 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class TileEntityEndGateway extends TileEntityEnderPortal {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -163,7 +172,7 @@
|
||||
tileentityendgateway.teleportCooldown = 100;
|
||||
BlockPosition blockposition1;
|
||||
@@ -143,7 +147,7 @@
|
||||
public Vec3D getPortalPosition(WorldServer worldserver, BlockPosition blockposition) {
|
||||
BlockPosition blockposition1;
|
||||
|
||||
- if (tileentityendgateway.exitPortal == null && world.dimension() == World.END) {
|
||||
+ if (tileentityendgateway.exitPortal == null && world.getTypeKey() == WorldDimension.END) { // CraftBukkit - work in alternate worlds
|
||||
blockposition1 = findOrCreateValidTeleportPos(worldserver, blockposition);
|
||||
blockposition1 = blockposition1.above(10);
|
||||
TileEntityEndGateway.LOGGER.debug("Creating portal at {}", blockposition1);
|
||||
@@ -184,7 +193,7 @@
|
||||
|
||||
if (entity2 != null) {
|
||||
entity1 = entity2;
|
||||
- entity.discard();
|
||||
+ entity.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
} else {
|
||||
entity1 = entity;
|
||||
}
|
||||
@@ -192,8 +201,34 @@
|
||||
entity1 = entity.getRootVehicle();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Fire PlayerTeleportEvent/EntityTeleportEvent
|
||||
+ if (entity1 instanceof EntityPlayer) {
|
||||
+ org.bukkit.craftbukkit.entity.CraftPlayer player = (CraftPlayer) entity1.getBukkitEntity();
|
||||
+ org.bukkit.Location location = CraftLocation.toBukkit(blockposition1, world.getWorld()).add(0.5D, 0.5D, 0.5D);
|
||||
+ location.setPitch(player.getLocation().getPitch());
|
||||
+ location.setYaw(player.getLocation().getYaw());
|
||||
+
|
||||
+ PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.END_GATEWAY);
|
||||
+ Bukkit.getPluginManager().callEvent(teleEvent);
|
||||
+ if (teleEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ entity1.setPortalCooldown();
|
||||
+ ((EntityPlayer) entity1).connection.teleport(teleEvent.getTo());
|
||||
+ triggerCooldown(world, blockposition, iblockdata, tileentityendgateway); // CraftBukkit - call at end of method
|
||||
+ return;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.event.entity.EntityTeleportEvent teleEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTeleportEvent(entity1, blockposition1.getX() + 0.5, blockposition1.getY() + 0.5, blockposition1.getZ() + 0.5);
|
||||
+ if (teleEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
entity1.setPortalCooldown();
|
||||
- entity1.teleportToWithTicket((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D);
|
||||
+ entity1.teleportToWithTicket(teleEvent.getTo().getX(), teleEvent.getTo().getY(), teleEvent.getTo().getZ());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
triggerCooldown(world, blockposition, iblockdata, tileentityendgateway);
|
||||
- if (this.exitPortal == null && worldserver.dimension() == World.END) {
|
||||
+ if (this.exitPortal == null && worldserver.getTypeKey() == WorldDimension.END) { // CraftBukkit - work in alternate worlds
|
||||
blockposition1 = findOrCreateValidTeleportPos(worldserver, blockposition);
|
||||
blockposition1 = blockposition1.above(10);
|
||||
TileEntityEndGateway.LOGGER.debug("Creating portal at {}", blockposition1);
|
||||
|
||||
@@ -72,16 +72,16 @@
|
||||
private static boolean isNeverAFurnaceFuel(Item item) {
|
||||
return item.builtInRegistryHolder().is(TagsItem.NON_FLAMMABLE_WOOD);
|
||||
}
|
||||
@@ -285,7 +334,7 @@
|
||||
@@ -286,7 +335,7 @@
|
||||
RecipeHolder recipeholder;
|
||||
|
||||
if (flag2) {
|
||||
- recipeholder = (RecipeHolder) tileentityfurnace.quickCheck.getRecipeFor(tileentityfurnace, world).orElse((Object) null);
|
||||
+ recipeholder = (RecipeHolder) tileentityfurnace.quickCheck.getRecipeFor(tileentityfurnace, world).orElse(null); // CraftBukkit - decompile error
|
||||
- recipeholder = (RecipeHolder) tileentityfurnace.quickCheck.getRecipeFor(new SingleRecipeInput(itemstack1), world).orElse((Object) null);
|
||||
+ recipeholder = (RecipeHolder) tileentityfurnace.quickCheck.getRecipeFor(new SingleRecipeInput(itemstack1), world).orElse(null); // CraftBukkit - decompile error
|
||||
} else {
|
||||
recipeholder = null;
|
||||
}
|
||||
@@ -293,9 +342,20 @@
|
||||
@@ -294,9 +343,20 @@
|
||||
int i = tileentityfurnace.getMaxStackSize();
|
||||
|
||||
if (!tileentityfurnace.isLit() && canBurn(world.registryAccess(), recipeholder, tileentityfurnace.items, i)) {
|
||||
@@ -104,7 +104,7 @@
|
||||
flag1 = true;
|
||||
if (flag3) {
|
||||
Item item = itemstack.getItem();
|
||||
@@ -311,11 +371,23 @@
|
||||
@@ -312,11 +372,23 @@
|
||||
}
|
||||
|
||||
if (tileentityfurnace.isLit() && canBurn(world.registryAccess(), recipeholder, tileentityfurnace.items, i)) {
|
||||
@@ -129,7 +129,7 @@
|
||||
tileentityfurnace.setRecipeUsed(recipeholder);
|
||||
}
|
||||
|
||||
@@ -354,17 +426,44 @@
|
||||
@@ -355,17 +427,44 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,15 +175,15 @@
|
||||
|
||||
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));
|
||||
@@ -388,6 +487,7 @@
|
||||
@@ -389,6 +488,7 @@
|
||||
}
|
||||
|
||||
private static int getTotalCookTime(World world, TileEntityFurnace tileentityfurnace) {
|
||||
+ if (world == null) return 200; // CraftBukkit - SPIGOT-4302
|
||||
return (Integer) tileentityfurnace.quickCheck.getRecipeFor(tileentityfurnace, world).map((recipeholder) -> {
|
||||
return ((RecipeCooking) recipeholder.value()).getCookingTime();
|
||||
}).orElse(200);
|
||||
@@ -474,8 +574,8 @@
|
||||
SingleRecipeInput singlerecipeinput = new SingleRecipeInput(tileentityfurnace.getItem(0));
|
||||
|
||||
return (Integer) tileentityfurnace.quickCheck.getRecipeFor(singlerecipeinput, world).map((recipeholder) -> {
|
||||
@@ -477,8 +577,8 @@
|
||||
@Override
|
||||
public void awardUsedRecipes(EntityHuman entityhuman, List<ItemStack> list) {}
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
|
||||
entityplayer.awardRecipes(list);
|
||||
Iterator iterator = list.iterator();
|
||||
@@ -492,6 +592,12 @@
|
||||
@@ -495,6 +595,12 @@
|
||||
}
|
||||
|
||||
public List<RecipeHolder<?>> getRecipesToAwardAndPopExperience(WorldServer worldserver, Vec3D vec3d) {
|
||||
@@ -207,7 +207,7 @@
|
||||
List<RecipeHolder<?>> list = Lists.newArrayList();
|
||||
ObjectIterator objectiterator = this.recipesUsed.object2IntEntrySet().iterator();
|
||||
|
||||
@@ -500,14 +606,14 @@
|
||||
@@ -503,14 +609,14 @@
|
||||
|
||||
worldserver.getRecipeManager().byKey((MinecraftKey) entry.getKey()).ifPresent((recipeholder) -> {
|
||||
list.add(recipeholder);
|
||||
@@ -224,7 +224,7 @@
|
||||
int j = MathHelper.floor((float) i * f);
|
||||
float f1 = MathHelper.frac((float) i * f);
|
||||
|
||||
@@ -515,6 +621,17 @@
|
||||
@@ -518,6 +624,17 @@
|
||||
++j;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
|
||||
@@ -24,6 +24,14 @@
|
||||
@@ -20,12 +20,56 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.ticks.ContainerSingleItem;
|
||||
|
||||
@@ -14,11 +14,10 @@
|
||||
+
|
||||
public class TileEntityJukeBox extends TileEntity implements Clearable, ContainerSingleItem.a {
|
||||
|
||||
private static final int SONG_END_PADDING = 20;
|
||||
@@ -32,6 +40,42 @@
|
||||
public long tickCount;
|
||||
public long recordStartedTick;
|
||||
public boolean isPlaying;
|
||||
public static final String SONG_ITEM_TAG_ID = "RecordItem";
|
||||
public static final String TICKS_SINCE_SONG_STARTED_TAG_ID = "ticks_since_song_started";
|
||||
private ItemStack item;
|
||||
private final JukeboxSongPlayer jukeboxSongPlayer;
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
+ private int maxStack = MAX_STACK;
|
||||
@@ -58,7 +57,7 @@
|
||||
|
||||
public TileEntityJukeBox(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.JUKEBOX, blockposition, iblockdata);
|
||||
@@ -154,7 +198,7 @@
|
||||
@@ -134,7 +178,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
@@ -67,10 +66,18 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,7 +250,11 @@
|
||||
@@ -153,12 +197,17 @@
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void setRecordWithoutPlaying(ItemStack itemstack) {
|
||||
- public void setSongItemWithoutPlaying(ItemStack itemstack) {
|
||||
+ public void setSongItemWithoutPlaying(ItemStack itemstack, long ticksSinceSongStarted) { // CraftBukkit - add argument
|
||||
this.item = itemstack;
|
||||
+ this.jukeboxSongPlayer.song = null; // CraftBukkit - reset
|
||||
JukeboxSong.fromStack(this.level.registryAccess(), itemstack).ifPresent((holder) -> {
|
||||
- this.jukeboxSongPlayer.setSongWithoutPlaying(holder, 0L);
|
||||
+ this.jukeboxSongPlayer.setSongWithoutPlaying(holder, ticksSinceSongStarted); // CraftBukkit - add argument
|
||||
});
|
||||
- this.level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock());
|
||||
+ // CraftBukkit start - add null check for level
|
||||
+ if (level != null) {
|
||||
@@ -79,4 +86,4 @@
|
||||
+ // CraftBukkit end
|
||||
this.setChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
|
||||
+++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
|
||||
@@ -179,13 +179,13 @@
|
||||
@@ -206,7 +206,7 @@
|
||||
}
|
||||
|
||||
public void resetAfterBecomingOminous(TrialSpawner trialspawner, WorldServer worldserver) {
|
||||
@@ -9,8 +9,10 @@
|
||||
|
||||
Objects.requireNonNull(worldserver);
|
||||
stream.map(worldserver::getEntity).forEach((entity) -> {
|
||||
if (entity != null) {
|
||||
worldserver.levelEvent(3012, entity.blockPosition(), TrialSpawner.a.NORMAL.encode());
|
||||
@@ -218,7 +218,7 @@
|
||||
entityinsentient.dropPreservedEquipment();
|
||||
}
|
||||
|
||||
- entity.remove(Entity.RemovalReason.DISCARDED);
|
||||
+ entity.remove(Entity.RemovalReason.DISCARDED, org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - Add bukkit remove cause;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/state/BlockBase.java
|
||||
+++ b/net/minecraft/world/level/block/state/BlockBase.java
|
||||
@@ -174,8 +174,10 @@
|
||||
@@ -173,8 +173,10 @@
|
||||
TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition) : null;
|
||||
LootParams.a lootparams_a = (new LootParams.a(worldserver)).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParameters.THIS_ENTITY, explosion.getDirectSourceEntity());
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/border/WorldBorder.java
|
||||
+++ b/net/minecraft/world/level/border/WorldBorder.java
|
||||
@@ -29,6 +29,7 @@
|
||||
@@ -30,6 +30,7 @@
|
||||
int absoluteMaxSize = 29999984;
|
||||
private WorldBorder.a extent = new WorldBorder.d(5.9999968E7D);
|
||||
public static final WorldBorder.c DEFAULT_SETTINGS = new WorldBorder.c(0.0D, 0.0D, 0.2D, 5.0D, 5, 15, 5.9999968E7D, 0L, 0.0D);
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public WorldBorder() {}
|
||||
|
||||
@@ -164,6 +165,7 @@
|
||||
@@ -181,6 +182,7 @@
|
||||
}
|
||||
|
||||
public void addListener(IWorldBorderListener iworldborderlistener) {
|
||||
|
||||
@@ -82,21 +82,15 @@
|
||||
|
||||
if (tileentity == null) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) this.pendingBlockEntities.remove(blockposition);
|
||||
@@ -418,6 +440,13 @@
|
||||
tileentity1.setRemoved();
|
||||
}
|
||||
@@ -412,6 +434,7 @@
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.getBlockPos().getX() + "," + tileentity.getBlockPos().getY() + "," + tileentity.getBlockPos().getZ()
|
||||
+ + " (" + getBlockState(blockposition) + ") where there was no entity tile!");
|
||||
+ System.out.println("Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
|
||||
+ new Exception().printStackTrace();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
if (!iblockdata.hasBlockEntity()) {
|
||||
Chunk.LOGGER.warn("Trying to set block entity {} at position {}, but state {} does not allow it", new Object[]{tileentity, blockposition, iblockdata});
|
||||
+ new Exception().printStackTrace(); // CraftBukkit
|
||||
} else {
|
||||
IBlockData iblockdata1 = tileentity.getBlockState();
|
||||
|
||||
@@ -447,6 +476,12 @@
|
||||
@@ -465,6 +488,12 @@
|
||||
if (this.isInLevel()) {
|
||||
TileEntity tileentity = (TileEntity) this.blockEntities.remove(blockposition);
|
||||
|
||||
@@ -109,7 +103,7 @@
|
||||
if (tileentity != null) {
|
||||
World world = this.level;
|
||||
|
||||
@@ -500,6 +535,57 @@
|
||||
@@ -518,6 +547,57 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -167,7 +161,7 @@
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
@@ -695,7 +781,7 @@
|
||||
@@ -713,7 +793,7 @@
|
||||
|
||||
private <T extends TileEntity> void updateBlockEntityTicker(T t0) {
|
||||
IBlockData iblockdata = t0.getBlockState();
|
||||
@@ -176,7 +170,7 @@
|
||||
|
||||
if (blockentityticker == null) {
|
||||
this.removeBlockEntityTicker(t0.getBlockPos());
|
||||
@@ -780,7 +866,7 @@
|
||||
@@ -798,7 +878,7 @@
|
||||
private boolean loggedInvalidBlockState;
|
||||
|
||||
a(final TileEntity tileentity, final BlockEntityTicker blockentityticker) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -312,7 +312,7 @@
|
||||
@@ -311,7 +311,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
||||
|
||||
if (!SharedConstants.debugVoidTerrain(chunkcoordintpair)) {
|
||||
@@ -334,7 +334,7 @@
|
||||
@@ -333,7 +333,7 @@
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
ChunkSection chunksection = achunksection[k];
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
Objects.requireNonNull(set);
|
||||
palettedcontainerro.getAll(set::add);
|
||||
@@ -445,6 +445,33 @@
|
||||
@@ -444,6 +444,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
private static StructureBoundingBox getWritableArea(IChunkAccess ichunkaccess) {
|
||||
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
||||
int i = chunkcoordintpair.getMinBlockX();
|
||||
@@ -582,6 +609,14 @@
|
||||
@@ -581,6 +608,14 @@
|
||||
StructureStart structurestart = structure.generate(iregistrycustom, this, this.biomeSource, randomstate, structuretemplatemanager, i, chunkcoordintpair, j, ichunkaccess, predicate);
|
||||
|
||||
if (structurestart.isValid()) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
private static void replaceMissingSections(IRegistry<BiomeBase> iregistry, ChunkSection[] achunksection) {
|
||||
for (int i = 0; i < achunksection.length; ++i) {
|
||||
@@ -266,10 +275,11 @@
|
||||
@@ -270,10 +279,11 @@
|
||||
|
||||
public void setUnsaved(boolean flag) {
|
||||
this.unsaved = flag;
|
||||
@@ -36,8 +36,8 @@
|
||||
+ return this.unsaved || this.persistentDataContainer.dirty(); // CraftBukkit - SPIGOT-6814: chunk is unsaved if pdc was mutated
|
||||
}
|
||||
|
||||
public abstract ChunkStatus getStatus();
|
||||
@@ -445,6 +455,27 @@
|
||||
public abstract ChunkStatus getPersistedStatus();
|
||||
@@ -449,6 +459,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
|
||||
+++ b/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java
|
||||
@@ -33,7 +33,7 @@
|
||||
static CompletableFuture<IChunkAccess> generateStructureStarts(WorldGenContext worldgencontext, ChunkStatus chunkstatus, Executor executor, ToFullChunk tofullchunk, List<IChunkAccess> list, IChunkAccess ichunkaccess) {
|
||||
@@ -38,7 +38,7 @@
|
||||
static CompletableFuture<IChunkAccess> generateStructureStarts(WorldGenContext worldgencontext, ChunkStep chunkstep, StaticCache2D<GenerationChunkHolder> staticcache2d, IChunkAccess ichunkaccess) {
|
||||
WorldServer worldserver = worldgencontext.level();
|
||||
|
||||
- if (worldserver.getServer().getWorldData().worldGenOptions().generateStructures()) {
|
||||
@@ -9,3 +9,26 @@
|
||||
worldgencontext.generator().createStructures(worldserver.registryAccess(), worldserver.getChunkSource().getGeneratorState(), worldserver.structureManager(), ichunkaccess, worldgencontext.structureManager());
|
||||
}
|
||||
|
||||
@@ -177,7 +177,21 @@
|
||||
|
||||
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
|
||||
if (!list.isEmpty()) {
|
||||
- worldserver.addWorldGenChunkEntities(EntityTypes.loadEntitiesRecursive(list, worldserver));
|
||||
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
|
||||
+ worldserver.addWorldGenChunkEntities(EntityTypes.loadEntitiesRecursive(list, worldserver).filter((entity) -> {
|
||||
+ boolean needsRemoval = false;
|
||||
+ net.minecraft.server.dedicated.DedicatedServer server = worldserver.getCraftServer().getServer();
|
||||
+ if (!server.areNpcsEnabled() && entity instanceof net.minecraft.world.entity.npc.NPC) {
|
||||
+ entity.discard(null); // CraftBukkit - add Bukkit remove cause
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+ if (!server.isSpawningAnimals() && (entity instanceof net.minecraft.world.entity.animal.EntityAnimal || entity instanceof net.minecraft.world.entity.animal.EntityWaterAnimal)) {
|
||||
+ entity.discard(null); // CraftBukkit - add Bukkit remove cause
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+ return !needsRemoval;
|
||||
+ }));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
|
||||
+++ b/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
|
||||
@@ -104,7 +104,7 @@
|
||||
@@ -105,7 +105,7 @@
|
||||
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
|
||||
LevelLightEngine levellightengine = chunkproviderserver.getLightEngine();
|
||||
IRegistry<BiomeBase> iregistry = worldserver.registryAccess().registryOrThrow(Registries.BIOME);
|
||||
@@ -9,7 +9,7 @@
|
||||
boolean flag2 = false;
|
||||
|
||||
for (int j = 0; j < nbttaglist.size(); ++j) {
|
||||
@@ -123,17 +123,17 @@
|
||||
@@ -124,17 +124,17 @@
|
||||
datapaletteblock = new DataPaletteBlock<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), DataPaletteBlock.d.SECTION_STATES);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
achunksection[k] = chunksection;
|
||||
SectionPosition sectionposition = SectionPosition.of(chunkcoordintpair, b0);
|
||||
@@ -170,7 +170,7 @@
|
||||
@@ -171,7 +171,7 @@
|
||||
dataresult = BlendingData.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("blending_data")));
|
||||
logger = ChunkRegionLoader.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -39,7 +39,7 @@
|
||||
} else {
|
||||
blendingdata = null;
|
||||
}
|
||||
@@ -201,7 +201,7 @@
|
||||
@@ -202,7 +202,7 @@
|
||||
dataresult = BelowZeroRetrogen.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("below_zero_retrogen")));
|
||||
logger = ChunkRegionLoader.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
Objects.requireNonNull(protochunk);
|
||||
optional.ifPresent(protochunk::setBelowZeroRetrogen);
|
||||
@@ -215,6 +215,13 @@
|
||||
@@ -216,6 +216,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
((IChunkAccess) object1).setLightCorrect(flag);
|
||||
NBTTagCompound nbttagcompound2 = nbttagcompound.getCompound("Heightmaps");
|
||||
EnumSet<HeightMap.Type> enumset = EnumSet.noneOf(HeightMap.Type.class);
|
||||
@@ -294,6 +301,12 @@
|
||||
@@ -295,6 +302,12 @@
|
||||
return DataPaletteBlock.codecRO(iregistry.asHolderIdMap(), iregistry.holderByNameCodec(), DataPaletteBlock.d.SECTION_BIOMES, iregistry.getHolderOrThrow(Biomes.PLAINS));
|
||||
}
|
||||
|
||||
@@ -75,16 +75,16 @@
|
||||
public static NBTTagCompound write(WorldServer worldserver, IChunkAccess ichunkaccess) {
|
||||
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
||||
NBTTagCompound nbttagcompound = GameProfileSerializer.addCurrentDataVersion(new NBTTagCompound());
|
||||
@@ -305,7 +318,7 @@
|
||||
@@ -306,7 +319,7 @@
|
||||
nbttagcompound.putLong("InhabitedTime", ichunkaccess.getInhabitedTime());
|
||||
nbttagcompound.putString("Status", BuiltInRegistries.CHUNK_STATUS.getKey(ichunkaccess.getStatus()).toString());
|
||||
nbttagcompound.putString("Status", BuiltInRegistries.CHUNK_STATUS.getKey(ichunkaccess.getPersistedStatus()).toString());
|
||||
BlendingData blendingdata = ichunkaccess.getBlendingData();
|
||||
- DataResult dataresult;
|
||||
+ DataResult<NBTBase> dataresult; // CraftBukkit - decompile error
|
||||
Logger logger;
|
||||
|
||||
if (blendingdata != null) {
|
||||
@@ -429,6 +442,11 @@
|
||||
@@ -430,6 +443,11 @@
|
||||
|
||||
nbttagcompound.put("Heightmaps", nbttagcompound3);
|
||||
nbttagcompound.put("structures", packStructureData(StructurePieceSerializationContext.fromLevel(worldserver), chunkcoordintpair, ichunkaccess.getAllStarts(), ichunkaccess.getAllReferences()));
|
||||
@@ -96,7 +96,7 @@
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@@ -533,6 +551,12 @@
|
||||
@@ -534,6 +552,12 @@
|
||||
StructureStart structurestart = StructureStart.loadStaticStart(structurepieceserializationcontext, nbttagcompound1.getCompound(s), i);
|
||||
|
||||
if (structurestart != null) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
public class IChunkLoader implements AutoCloseable {
|
||||
|
||||
public static final int LAST_MONOLYTH_STRUCTURE_DATA_VERSION = 1493;
|
||||
@@ -39,10 +48,54 @@
|
||||
@@ -39,13 +48,57 @@
|
||||
return this.worker.isOldChunkAround(chunkcoordintpair, i);
|
||||
}
|
||||
|
||||
@@ -56,23 +56,26 @@
|
||||
+ // CraftBukkit end
|
||||
int i = getVersion(nbttagcompound);
|
||||
|
||||
try {
|
||||
+ // CraftBukkit start
|
||||
+ if (i < 1466) {
|
||||
+ NBTTagCompound level = nbttagcompound.getCompound("Level");
|
||||
+ if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
|
||||
+ ChunkProviderServer cps = (generatoraccess == null) ? null : ((WorldServer) generatoraccess).getChunkSource();
|
||||
+ if (check(cps, pos.x - 1, pos.z) && check(cps, pos.x - 1, pos.z - 1) && check(cps, pos.x, pos.z - 1)) {
|
||||
+ level.putBoolean("LightPopulated", true);
|
||||
if (i == SharedConstants.getCurrentVersion().getDataVersion().getVersion()) {
|
||||
return nbttagcompound;
|
||||
} else {
|
||||
try {
|
||||
+ // CraftBukkit start
|
||||
+ if (i < 1466) {
|
||||
+ NBTTagCompound level = nbttagcompound.getCompound("Level");
|
||||
+ if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
|
||||
+ ChunkProviderServer cps = (generatoraccess == null) ? null : ((WorldServer) generatoraccess).getChunkSource();
|
||||
+ if (check(cps, pos.x - 1, pos.z) && check(cps, pos.x - 1, pos.z - 1) && check(cps, pos.x, pos.z - 1)) {
|
||||
+ level.putBoolean("LightPopulated", true);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (i < 1493) {
|
||||
nbttagcompound = DataFixTypes.CHUNK.update(this.fixerUpper, nbttagcompound, i, 1493);
|
||||
if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
|
||||
@@ -69,7 +122,7 @@
|
||||
if (i < 1493) {
|
||||
nbttagcompound = DataFixTypes.CHUNK.update(this.fixerUpper, nbttagcompound, i, 1493);
|
||||
if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
|
||||
@@ -70,7 +123,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +84,7 @@
|
||||
PersistentStructureLegacy persistentstructurelegacy = this.legacyStructureHandler;
|
||||
|
||||
if (persistentstructurelegacy == null) {
|
||||
@@ -84,7 +137,7 @@
|
||||
@@ -85,7 +138,7 @@
|
||||
return persistentstructurelegacy;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/levelgen/ChunkProviderFlat.java
|
||||
+++ b/net/minecraft/world/level/levelgen/ChunkProviderFlat.java
|
||||
@@ -35,10 +35,16 @@
|
||||
@@ -34,10 +34,16 @@
|
||||
private final GeneratorSettingsFlat settings;
|
||||
|
||||
public ChunkProviderFlat(GeneratorSettingsFlat generatorsettingsflat) {
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
--- a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
@@ -8,6 +8,12 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.WorldGenFeatureEmptyConfiguration;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.List;
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.event.world.PortalCreateEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EndPlatformFeature extends WorldGenerator<WorldGenFeatureEmptyConfiguration> {
|
||||
|
||||
public EndPlatformFeature(Codec<WorldGenFeatureEmptyConfiguration> codec) {
|
||||
@@ -21,6 +27,13 @@
|
||||
}
|
||||
|
||||
public static void createEndPlatform(WorldAccess worldaccess, BlockPosition blockposition, boolean flag) {
|
||||
+ createEndPlatform(worldaccess, blockposition, flag, null);
|
||||
+ // CraftBukkit start
|
||||
+ }
|
||||
+
|
||||
+ public static void createEndPlatform(WorldAccess worldaccess, BlockPosition blockposition, boolean flag, Entity entity) {
|
||||
+ org.bukkit.craftbukkit.util.BlockStateListPopulator blockList = new org.bukkit.craftbukkit.util.BlockStateListPopulator(worldaccess);
|
||||
+ // CraftBukkit end
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.mutable();
|
||||
|
||||
for (int i = -2; i <= 2; ++i) {
|
||||
@@ -29,16 +42,27 @@
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition1 = blockposition_mutableblockposition.set(blockposition).move(j, k, i);
|
||||
Block block = k == -1 ? Blocks.OBSIDIAN : Blocks.AIR;
|
||||
|
||||
- if (!worldaccess.getBlockState(blockposition_mutableblockposition1).is(block)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!blockList.getBlockState(blockposition_mutableblockposition1).is(block)) {
|
||||
if (flag) {
|
||||
- worldaccess.destroyBlock(blockposition_mutableblockposition1, true, (Entity) null);
|
||||
+ blockList.destroyBlock(blockposition_mutableblockposition1, true, (Entity) null);
|
||||
}
|
||||
|
||||
- worldaccess.setBlock(blockposition_mutableblockposition1, block.defaultBlockState(), 3);
|
||||
+ blockList.setBlock(blockposition_mutableblockposition1, block.defaultBlockState(), 3);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = worldaccess.getLevel().getWorld();
|
||||
+ PortalCreateEvent portalEvent = new PortalCreateEvent((List<BlockState>) (List) blockList.getList(), bworld, (entity == null) ? null : entity.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.END_PLATFORM);
|
||||
+
|
||||
+ worldaccess.getLevel().getCraftServer().getPluginManager().callEvent(portalEvent);
|
||||
+ if (!portalEvent.isCancelled()) {
|
||||
+ blockList.updateList();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,25 +9,7 @@
|
||||
|
||||
protected StructurePiece(WorldGenFeatureStructurePieceType worldgenfeaturestructurepiecetype, int i, StructureBoundingBox structureboundingbox) {
|
||||
this.type = worldgenfeaturestructurepiecetype;
|
||||
@@ -60,14 +60,11 @@
|
||||
}
|
||||
|
||||
public StructurePiece(WorldGenFeatureStructurePieceType worldgenfeaturestructurepiecetype, NBTTagCompound nbttagcompound) {
|
||||
- int i = nbttagcompound.getInt("GD");
|
||||
- DataResult dataresult = StructureBoundingBox.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("BB"));
|
||||
- Logger logger = StructurePiece.LOGGER;
|
||||
-
|
||||
- Objects.requireNonNull(logger);
|
||||
- this(worldgenfeaturestructurepiecetype, i, (StructureBoundingBox) dataresult.resultOrPartial(logger::error).orElseThrow(() -> {
|
||||
+ // CraftBukkit start - decompile error
|
||||
+ this(worldgenfeaturestructurepiecetype, nbttagcompound.getInt("GD"), (StructureBoundingBox) StructureBoundingBox.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("BB")).resultOrPartial(Objects.requireNonNull(StructurePiece.LOGGER)::error).orElseThrow(() -> {
|
||||
return new IllegalArgumentException("Invalid boundingbox");
|
||||
}));
|
||||
+ // CraftBukkit end
|
||||
int j = nbttagcompound.getInt("O");
|
||||
|
||||
this.setOrientation(j == -1 ? null : EnumDirection.from2DDataValue(j));
|
||||
@@ -85,13 +82,11 @@
|
||||
@@ -80,13 +80,11 @@
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
nbttagcompound.putString("id", BuiltInRegistries.STRUCTURE_PIECE.getKey(this.getType()).toString());
|
||||
@@ -45,7 +27,7 @@
|
||||
EnumDirection enumdirection = this.getOrientation();
|
||||
|
||||
nbttagcompound.putInt("O", enumdirection == null ? -1 : enumdirection.get2DDataValue());
|
||||
@@ -191,6 +186,11 @@
|
||||
@@ -186,6 +184,11 @@
|
||||
}
|
||||
|
||||
generatoraccessseed.setBlock(blockposition_mutableblockposition, iblockdata, 2);
|
||||
@@ -57,7 +39,7 @@
|
||||
Fluid fluid = generatoraccessseed.getFluidState(blockposition_mutableblockposition);
|
||||
|
||||
if (!fluid.isEmpty()) {
|
||||
@@ -205,6 +205,38 @@
|
||||
@@ -200,6 +203,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +78,7 @@
|
||||
protected boolean canBeReplaced(IWorldReader iworldreader, int i, int j, int k, StructureBoundingBox structureboundingbox) {
|
||||
return true;
|
||||
}
|
||||
@@ -398,12 +430,20 @@
|
||||
@@ -393,12 +428,20 @@
|
||||
iblockdata = reorient(worldaccess, blockposition, Blocks.CHEST.defaultBlockState());
|
||||
}
|
||||
|
||||
@@ -117,7 +99,7 @@
|
||||
|
||||
return true;
|
||||
} else {
|
||||
@@ -415,12 +455,31 @@
|
||||
@@ -410,12 +453,31 @@
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = this.getWorldPos(i, j, k);
|
||||
|
||||
if (structureboundingbox.isInside(blockposition_mutableblockposition) && !generatoraccessseed.getBlockState(blockposition_mutableblockposition).is(Blocks.DISPENSER)) {
|
||||
@@ -149,7 +131,7 @@
|
||||
|
||||
return true;
|
||||
} else {
|
||||
@@ -433,7 +492,7 @@
|
||||
@@ -428,7 +490,7 @@
|
||||
}
|
||||
|
||||
public static StructureBoundingBox createBoundingBox(Stream<StructurePiece> stream) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/levelgen/structure/structures/IglooPieces.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/structures/IglooPieces.java
|
||||
@@ -85,11 +85,16 @@
|
||||
@@ -86,11 +86,16 @@
|
||||
protected void handleDataMarker(String s, BlockPosition blockposition, WorldAccess worldaccess, RandomSource randomsource, StructureBoundingBox structureboundingbox) {
|
||||
if ("chest".equals(s)) {
|
||||
worldaccess.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 3);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructureInfo.java
|
||||
+++ b/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructureInfo.java
|
||||
@@ -22,7 +22,7 @@
|
||||
private boolean keepLiquids;
|
||||
private LiquidSettings liquidSettings;
|
||||
@Nullable
|
||||
private RandomSource random;
|
||||
- private int palette;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/portal/BlockPortalShape.java
|
||||
+++ b/net/minecraft/world/level/portal/BlockPortalShape.java
|
||||
@@ -22,6 +22,11 @@
|
||||
@@ -21,6 +21,11 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class BlockPortalShape {
|
||||
|
||||
private static final int MIN_WIDTH = 2;
|
||||
@@ -41,6 +46,7 @@
|
||||
@@ -40,6 +45,7 @@
|
||||
private BlockPosition bottomLeft;
|
||||
private int height;
|
||||
private final int width;
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
public static Optional<BlockPortalShape> findEmptyPortalShape(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
return findPortalShape(generatoraccess, blockposition, (blockportalshape) -> {
|
||||
@@ -61,6 +67,7 @@
|
||||
@@ -60,6 +66,7 @@
|
||||
}
|
||||
|
||||
public BlockPortalShape(GeneratorAccess generatoraccess, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
@@ -28,7 +28,7 @@
|
||||
this.level = generatoraccess;
|
||||
this.axis = enumdirection_enumaxis;
|
||||
this.rightDir = enumdirection_enumaxis == EnumDirection.EnumAxis.X ? EnumDirection.WEST : EnumDirection.SOUTH;
|
||||
@@ -105,6 +112,7 @@
|
||||
@@ -104,6 +111,7 @@
|
||||
|
||||
if (!isEmpty(iblockdata)) {
|
||||
if (BlockPortalShape.FRAME.test(iblockdata, this.level, blockposition_mutableblockposition)) {
|
||||
@@ -36,7 +36,7 @@
|
||||
return i;
|
||||
}
|
||||
break;
|
||||
@@ -115,6 +123,7 @@
|
||||
@@ -114,6 +122,7 @@
|
||||
if (!BlockPortalShape.FRAME.test(iblockdata1, this.level, blockposition_mutableblockposition)) {
|
||||
break;
|
||||
}
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -134,6 +143,7 @@
|
||||
@@ -133,6 +142,7 @@
|
||||
if (!BlockPortalShape.FRAME.test(this.level.getBlockState(blockposition_mutableblockposition1), this.level, blockposition_mutableblockposition1)) {
|
||||
return false;
|
||||
}
|
||||
@@ -52,7 +52,7 @@
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -163,6 +173,10 @@
|
||||
@@ -162,6 +172,10 @@
|
||||
++this.numPortalBlocks;
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@
|
||||
}
|
||||
|
||||
return 21;
|
||||
@@ -176,12 +190,28 @@
|
||||
@@ -175,12 +189,28 @@
|
||||
return this.bottomLeft != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
|
||||
}
|
||||
|
||||
@@ -93,21 +93,3 @@
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
@@ -217,7 +247,7 @@
|
||||
return new Vec3D(d3, d2, d4);
|
||||
}
|
||||
|
||||
- public static ShapeDetectorShape createPortalInfo(WorldServer worldserver, BlockUtil.Rectangle blockutil_rectangle, EnumDirection.EnumAxis enumdirection_enumaxis, Vec3D vec3d, Entity entity, Vec3D vec3d1, float f, float f1) {
|
||||
+ public static ShapeDetectorShape createPortalInfo(WorldServer worldserver, BlockUtil.Rectangle blockutil_rectangle, EnumDirection.EnumAxis enumdirection_enumaxis, Vec3D vec3d, Entity entity, Vec3D vec3d1, float f, float f1, CraftPortalEvent portalEventInfo) { // CraftBukkit
|
||||
BlockPosition blockposition = blockutil_rectangle.minCorner;
|
||||
IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis1 = (EnumDirection.EnumAxis) iblockdata.getOptionalValue(BlockProperties.HORIZONTAL_AXIS).orElse(EnumDirection.EnumAxis.X);
|
||||
@@ -233,7 +263,7 @@
|
||||
Vec3D vec3d3 = new Vec3D((double) blockposition.getX() + (flag ? d2 : d4), (double) blockposition.getY() + d3, (double) blockposition.getZ() + (flag ? d4 : d2));
|
||||
Vec3D vec3d4 = findCollisionFreePosition(vec3d3, worldserver, entity, entitysize);
|
||||
|
||||
- return new ShapeDetectorShape(vec3d4, vec3d2, f + (float) i, f1);
|
||||
+ return new ShapeDetectorShape(vec3d4, vec3d2, f + (float) i, f1, worldserver, portalEventInfo); // CraftBukkit
|
||||
}
|
||||
|
||||
private static Vec3D findCollisionFreePosition(Vec3D vec3d, WorldServer worldserver, Entity entity, EntitySize entitysize) {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
--- a/net/minecraft/world/level/portal/DimensionTransition.java
|
||||
+++ b/net/minecraft/world/level/portal/DimensionTransition.java
|
||||
@@ -7,7 +7,19 @@
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
-public record DimensionTransition(WorldServer newLevel, Vec3D pos, Vec3D speed, float yRot, float xRot, boolean missingRespawnBlock, DimensionTransition.a postDimensionTransition) {
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+
|
||||
+public record DimensionTransition(WorldServer newLevel, Vec3D pos, Vec3D speed, float yRot, float xRot, boolean missingRespawnBlock, DimensionTransition.a postDimensionTransition, PlayerTeleportEvent.TeleportCause cause) {
|
||||
+
|
||||
+ public DimensionTransition(WorldServer newLevel, Vec3D pos, Vec3D speed, float yRot, float xRot, boolean missingRespawnBlock, DimensionTransition.a postDimensionTransition) {
|
||||
+ this(newLevel, pos, speed, yRot, xRot, missingRespawnBlock, postDimensionTransition, PlayerTeleportEvent.TeleportCause.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
+ public DimensionTransition(PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ this(null, Vec3D.ZERO, Vec3D.ZERO, 0.0F, 0.0F, false, DO_NOTHING, cause);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
public static final DimensionTransition.a DO_NOTHING = (entity) -> {
|
||||
};
|
||||
@@ -15,11 +27,21 @@
|
||||
public static final DimensionTransition.a PLACE_PORTAL_TICKET = DimensionTransition::placePortalTicket;
|
||||
|
||||
public DimensionTransition(WorldServer worldserver, Vec3D vec3d, Vec3D vec3d1, float f, float f1, DimensionTransition.a dimensiontransition_a) {
|
||||
- this(worldserver, vec3d, vec3d1, f, f1, false, dimensiontransition_a);
|
||||
+ // CraftBukkit start
|
||||
+ this(worldserver, vec3d, vec3d1, f, f1, dimensiontransition_a, PlayerTeleportEvent.TeleportCause.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
+ public DimensionTransition(WorldServer worldserver, Vec3D vec3d, Vec3D vec3d1, float f, float f1, DimensionTransition.a dimensiontransition_a, PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ this(worldserver, vec3d, vec3d1, f, f1, false, dimensiontransition_a, cause);
|
||||
}
|
||||
|
||||
public DimensionTransition(WorldServer worldserver, Entity entity, DimensionTransition.a dimensiontransition_a) {
|
||||
- this(worldserver, findAdjustedSharedSpawnPos(worldserver, entity), Vec3D.ZERO, 0.0F, 0.0F, false, dimensiontransition_a);
|
||||
+ this(worldserver, entity, dimensiontransition_a, PlayerTeleportEvent.TeleportCause.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
+ public DimensionTransition(WorldServer worldserver, Entity entity, DimensionTransition.a dimensiontransition_a, PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ this(worldserver, findAdjustedSharedSpawnPos(worldserver, entity), Vec3D.ZERO, 0.0F, 0.0F, false, dimensiontransition_a, cause);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
private static void playPortalSound(Entity entity) {
|
||||
@@ -1,30 +1,32 @@
|
||||
--- a/net/minecraft/world/level/portal/PortalTravelAgent.java
|
||||
+++ b/net/minecraft/world/level/portal/PortalTravelAgent.java
|
||||
@@ -42,15 +42,21 @@
|
||||
@@ -43,23 +43,35 @@
|
||||
}
|
||||
|
||||
public Optional<BlockUtil.Rectangle> findPortalAround(BlockPosition blockposition, boolean flag, WorldBorder worldborder) {
|
||||
public Optional<BlockPosition> findClosestPortalPosition(BlockPosition blockposition, boolean flag, WorldBorder worldborder) {
|
||||
+ // CraftBukkit start
|
||||
+ return findPortalAround(blockposition, worldborder, flag ? 16 : 128); // Search Radius
|
||||
+ return findClosestPortalPosition(blockposition, worldborder, flag ? 16 : 128); // Search Radius
|
||||
+ }
|
||||
+
|
||||
+ public Optional<BlockUtil.Rectangle> findPortalAround(BlockPosition blockposition, WorldBorder worldborder, int i) {
|
||||
+ public Optional<BlockPosition> findClosestPortalPosition(BlockPosition blockposition, WorldBorder worldborder, int i) {
|
||||
VillagePlace villageplace = this.level.getPoiManager();
|
||||
- int i = flag ? 16 : 128;
|
||||
+ // int i = flag ? 16 : 128;
|
||||
+ // CraftBukkit end
|
||||
|
||||
villageplace.ensureLoadedAndValid(this.level, blockposition, i);
|
||||
Optional<VillagePlaceRecord> optional = villageplace.getInSquare((holder) -> {
|
||||
- Stream stream = villageplace.getInSquare((holder) -> {
|
||||
+ Stream<BlockPosition> stream = villageplace.getInSquare((holder) -> { // CraftBukkit - decompile error
|
||||
return holder.is(PoiTypes.NETHER_PORTAL);
|
||||
}, blockposition, i, VillagePlace.Occupancy.ANY).filter((villageplacerecord) -> {
|
||||
return worldborder.isWithinBounds(villageplacerecord.getPos());
|
||||
- }).sorted(Comparator.comparingDouble((villageplacerecord) -> {
|
||||
+ }).sorted(Comparator.comparingDouble((VillagePlaceRecord villageplacerecord) -> { // CraftBukkit - decompile error
|
||||
return villageplacerecord.getPos().distSqr(blockposition);
|
||||
}).thenComparingInt((villageplacerecord) -> {
|
||||
return villageplacerecord.getPos().getY();
|
||||
@@ -71,6 +77,12 @@
|
||||
}, blockposition, i, VillagePlace.Occupancy.ANY).map(VillagePlaceRecord::getPos);
|
||||
|
||||
Objects.requireNonNull(worldborder);
|
||||
return stream.filter(worldborder::isWithinBounds).filter((blockposition1) -> {
|
||||
return this.level.getBlockState(blockposition1).hasProperty(BlockProperties.HORIZONTAL_AXIS);
|
||||
- }).min(Comparator.comparingDouble((blockposition1) -> {
|
||||
+ }).min(Comparator.comparingDouble((BlockPosition blockposition1) -> { // CraftBukkit - decompile error
|
||||
return blockposition1.distSqr(blockposition);
|
||||
}).thenComparingInt(BaseBlockPosition::getY));
|
||||
}
|
||||
|
||||
public Optional<BlockUtil.Rectangle> createPortal(BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) {
|
||||
@@ -37,16 +39,16 @@
|
||||
EnumDirection enumdirection = EnumDirection.get(EnumDirection.EnumAxisDirection.POSITIVE, enumdirection_enumaxis);
|
||||
double d0 = -1.0D;
|
||||
BlockPosition blockposition1 = null;
|
||||
@@ -79,7 +91,7 @@
|
||||
WorldBorder worldborder = this.level.getWorldBorder();
|
||||
@@ -69,7 +81,7 @@
|
||||
int i = Math.min(this.level.getMaxBuildHeight(), this.level.getMinBuildHeight() + this.level.getLogicalHeight()) - 1;
|
||||
boolean flag = true;
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.mutable();
|
||||
- Iterator iterator = BlockPosition.spiralAround(blockposition, 16, EnumDirection.EAST, EnumDirection.SOUTH).iterator();
|
||||
+ Iterator iterator = BlockPosition.spiralAround(blockposition, createRadius, EnumDirection.EAST, EnumDirection.SOUTH).iterator(); // CraftBukkit
|
||||
|
||||
int j;
|
||||
int k;
|
||||
@@ -134,6 +146,7 @@
|
||||
@@ -122,6 +134,7 @@
|
||||
int j1;
|
||||
int k1;
|
||||
|
||||
@@ -54,16 +56,16 @@
|
||||
if (d0 == -1.0D) {
|
||||
j1 = Math.max(this.level.getMinBuildHeight() - -1, 70);
|
||||
k1 = i - 9;
|
||||
@@ -154,7 +167,7 @@
|
||||
IBlockData iblockdata = l < 0 ? Blocks.OBSIDIAN.defaultBlockState() : Blocks.AIR.defaultBlockState();
|
||||
@@ -139,7 +152,7 @@
|
||||
IBlockData iblockdata = i1 < 0 ? Blocks.OBSIDIAN.defaultBlockState() : Blocks.AIR.defaultBlockState();
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset(blockposition1, k * enumdirection.getStepX() + l1 * enumdirection1.getStepX(), l, k * enumdirection.getStepZ() + l1 * enumdirection1.getStepZ());
|
||||
blockposition_mutableblockposition.setWithOffset(blockposition1, l * enumdirection.getStepX() + k * enumdirection1.getStepX(), i1, l * enumdirection.getStepZ() + k * enumdirection1.getStepZ());
|
||||
- this.level.setBlockAndUpdate(blockposition_mutableblockposition, iblockdata);
|
||||
+ blockList.setBlock(blockposition_mutableblockposition, iblockdata, 3); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +177,7 @@
|
||||
@@ -149,7 +162,7 @@
|
||||
for (k1 = -1; k1 < 4; ++k1) {
|
||||
if (j1 == -1 || j1 == 2 || k1 == -1 || k1 == 3) {
|
||||
blockposition_mutableblockposition.setWithOffset(blockposition1, j1 * enumdirection.getStepX(), k1, j1 * enumdirection.getStepZ());
|
||||
@@ -72,7 +74,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,10 +187,20 @@
|
||||
@@ -159,10 +172,20 @@
|
||||
for (k1 = 0; k1 < 2; ++k1) {
|
||||
for (j = 0; j < 3; ++j) {
|
||||
blockposition_mutableblockposition.setWithOffset(blockposition1, k1 * enumdirection.getStepX(), j, k1 * enumdirection.getStepZ());
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
--- a/net/minecraft/world/level/portal/ShapeDetectorShape.java
|
||||
+++ b/net/minecraft/world/level/portal/ShapeDetectorShape.java
|
||||
@@ -2,14 +2,25 @@
|
||||
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.level.WorldServer;
|
||||
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class ShapeDetectorShape {
|
||||
|
||||
public final Vec3D pos;
|
||||
public final Vec3D speed;
|
||||
public final float yRot;
|
||||
public final float xRot;
|
||||
+ // CraftBukkit start
|
||||
+ public final WorldServer world;
|
||||
+ public final CraftPortalEvent portalEventInfo;
|
||||
|
||||
- public ShapeDetectorShape(Vec3D vec3d, Vec3D vec3d1, float f, float f1) {
|
||||
+ public ShapeDetectorShape(Vec3D vec3d, Vec3D vec3d1, float f, float f1, WorldServer world, CraftPortalEvent portalEventInfo) {
|
||||
+ this.world = world;
|
||||
+ this.portalEventInfo = portalEventInfo;
|
||||
+ // CraftBukkit end
|
||||
this.pos = vec3d;
|
||||
this.speed = vec3d1;
|
||||
this.yRot = f;
|
||||
@@ -18,7 +18,7 @@
|
||||
public class WorldMap extends PersistentBase {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -66,6 +77,13 @@
|
||||
@@ -67,6 +78,13 @@
|
||||
private final Map<String, WorldMapFrame> frameMarkers = Maps.newHashMap();
|
||||
private int trackedDecorationCount;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
public static PersistentBase.a<WorldMap> factory() {
|
||||
return new PersistentBase.a<>(() -> {
|
||||
throw new IllegalStateException("Should never create an empty map saved data");
|
||||
@@ -81,6 +99,10 @@
|
||||
@@ -82,6 +100,10 @@
|
||||
this.unlimitedTracking = flag1;
|
||||
this.locked = flag2;
|
||||
this.setDirty();
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
|
||||
public static WorldMap createFresh(double d0, double d1, byte b0, boolean flag, boolean flag1, ResourceKey<World> resourcekey) {
|
||||
@@ -98,12 +120,30 @@
|
||||
@@ -99,12 +121,30 @@
|
||||
}
|
||||
|
||||
public static WorldMap load(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
|
||||
@@ -77,7 +77,7 @@
|
||||
});
|
||||
int i = nbttagcompound.getInt("xCenter");
|
||||
int j = nbttagcompound.getInt("zCenter");
|
||||
@@ -128,7 +168,8 @@
|
||||
@@ -129,7 +169,8 @@
|
||||
MapIconBanner mapiconbanner = (MapIconBanner) iterator.next();
|
||||
|
||||
worldmap.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
|
||||
@@ -87,7 +87,7 @@
|
||||
}
|
||||
|
||||
NBTTagList nbttaglist = nbttagcompound.getList("frames", 10);
|
||||
@@ -147,13 +188,32 @@
|
||||
@@ -148,13 +189,32 @@
|
||||
|
||||
@Override
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
|
||||
@@ -121,7 +121,7 @@
|
||||
nbttagcompound.putInt("xCenter", this.centerX);
|
||||
nbttagcompound.putInt("zCenter", this.centerZ);
|
||||
nbttagcompound.putByte("scale", this.scale);
|
||||
@@ -408,7 +468,7 @@
|
||||
@@ -409,7 +469,7 @@
|
||||
|
||||
if (!this.isTrackedCountOverLimit(256)) {
|
||||
this.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
|
||||
@@ -130,7 +130,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -514,7 +574,7 @@
|
||||
@@ -519,7 +579,7 @@
|
||||
this.player = entityhuman;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
int i = this.minDirtyX;
|
||||
int j = this.minDirtyY;
|
||||
int k = this.maxDirtyX + 1 - this.minDirtyX;
|
||||
@@ -523,7 +583,7 @@
|
||||
@@ -528,7 +588,7 @@
|
||||
|
||||
for (int i1 = 0; i1 < k; ++i1) {
|
||||
for (int j1 = 0; j1 < l; ++j1) {
|
||||
@@ -148,7 +148,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,19 +593,29 @@
|
||||
@@ -538,19 +598,29 @@
|
||||
@Nullable
|
||||
Packet<?> nextUpdatePacket(MapId mapid) {
|
||||
WorldMap.b worldmap_b;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/level/storage/loot/LootDataType.java
|
||||
+++ b/net/minecraft/world/level/storage/loot/LootDataType.java
|
||||
@@ -16,6 +16,11 @@
|
||||
import net.minecraft.world.level.storage.loot.predicates.LootItemConditions;
|
||||
@@ -15,6 +15,11 @@
|
||||
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
@@ -9,10 +9,10 @@
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public record LootDataType<T>(ResourceKey<IRegistry<T>> registryKey, Codec<T> codec, String directory, LootDataType.a<T> validator) {
|
||||
public record LootDataType<T>(ResourceKey<IRegistry<T>> registryKey, Codec<T> codec, LootDataType.a<T> validator) {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -49,6 +54,7 @@
|
||||
@@ -48,6 +53,7 @@
|
||||
private static LootDataType.a<LootTable> createLootTableValidator() {
|
||||
return (lootcollector, resourcekey, loottable) -> {
|
||||
loottable.validate(lootcollector.setParams(loottable.getParamSet()).enterElement("{" + String.valueOf(resourcekey.registry()) + "/" + String.valueOf(resourcekey.location()) + "}", resourcekey));
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
LootTable(LootContextParameterSet lootcontextparameterset, Optional<MinecraftKey> optional, List<LootSelector> list, List<LootItemFunction> list1) {
|
||||
this.paramSet = lootcontextparameterset;
|
||||
@@ -153,9 +161,22 @@
|
||||
@@ -157,9 +165,22 @@
|
||||
}
|
||||
|
||||
public void fill(IInventory iinventory, LootParams lootparams, long i) {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
--- a/net/minecraft/world/level/storage/loot/functions/LootEnchantFunction.java
|
||||
+++ b/net/minecraft/world/level/storage/loot/functions/LootEnchantFunction.java
|
||||
@@ -57,8 +57,13 @@
|
||||
|
||||
if (entity instanceof EntityLiving) {
|
||||
int i = EnchantmentManager.getMobLooting((EntityLiving) entity);
|
||||
+ // CraftBukkit start - use lootingModifier if set by plugin
|
||||
+ if (loottableinfo.hasParam(LootContextParameters.LOOTING_MOD)) {
|
||||
+ i = loottableinfo.getParamOrNull(LootContextParameters.LOOTING_MOD);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
- if (i == 0) {
|
||||
+ if (i <= 0) { // CraftBukkit - account for possible negative looting values from Bukkit
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
--- a/net/minecraft/world/level/storage/loot/parameters/LootContextParameters.java
|
||||
+++ b/net/minecraft/world/level/storage/loot/parameters/LootContextParameters.java
|
||||
@@ -21,6 +21,7 @@
|
||||
public static final LootContextParameter<TileEntity> BLOCK_ENTITY = create("block_entity");
|
||||
public static final LootContextParameter<ItemStack> TOOL = create("tool");
|
||||
public static final LootContextParameter<Float> EXPLOSION_RADIUS = create("explosion_radius");
|
||||
+ public static final LootContextParameter<Integer> LOOTING_MOD = new LootContextParameter<>(new MinecraftKey("bukkit:looting_mod")); // CraftBukkit
|
||||
|
||||
public LootContextParameters() {}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
--- a/net/minecraft/world/level/storage/loot/predicates/LootItemConditionRandomChanceWithLooting.java
|
||||
+++ b/net/minecraft/world/level/storage/loot/predicates/LootItemConditionRandomChanceWithLooting.java
|
||||
@@ -35,6 +35,11 @@
|
||||
if (entity instanceof EntityLiving) {
|
||||
i = EnchantmentManager.getMobLooting((EntityLiving) entity);
|
||||
}
|
||||
+ // CraftBukkit start - only use lootingModifier if set by Bukkit
|
||||
+ if (loottableinfo.hasParam(LootContextParameters.LOOTING_MOD)) {
|
||||
+ i = loottableinfo.getParamOrNull(LootContextParameters.LOOTING_MOD);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
return loottableinfo.getRandom().nextFloat() < this.percent + (float) i * this.lootingMultiplier;
|
||||
}
|
||||
Reference in New Issue
Block a user