13
0
geforkt von Mirrors/Paper

Updated Upstream (Bukkit/CraftBukkit) (#6638)

Dieser Commit ist enthalten in:
Jake Potrebic 2021-10-02 10:21:49 -07:00
Ursprung 2712aae889
Commit 6ef714345f
18 geänderte Dateien mit 80 neuen und 307 gelöschten Zeilen

Datei anzeigen

@ -9,33 +9,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/Tag.java
+++ b/src/main/java/org/bukkit/Tag.java
@@ -0,0 +0,0 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla fluid tag representing water and flowing water.
* Vanilla tag representing entities extra susceptible to freezing.
*/
Tag<Fluid> FLUIDS_WATER = Bukkit.getTag(REGISTRY_FLUIDS, NamespacedKey.minecraft("water"), Fluid.class);
Tag<EntityType> ENTITY_TYPES_FREEZE_HURTS_EXTRA_TYPES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("freeze_hurts_extra_types"), EntityType.class);
+ // Paper start
+ /**
+ * Key for the build in entity registry
+ * Key for the built-in entity registry
+ * @deprecated use {@link #REGISTRY_ENTITY_TYPES}
+ */
+ @Deprecated(forRemoval = true)
+ String REGISTRY_ENTITIES = "entities";
+ /**
+ * Vanilla entity tag representing arrow entities.
+ * @deprecated use {@link #ENTITY_TYPES_ARROWS}
+ */
+ @Deprecated(forRemoval = true)
+ Tag<org.bukkit.entity.EntityType> ARROWS = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("arrows"), org.bukkit.entity.EntityType.class);
+ /**
+ * Vanilla entity tag representing entities that live in beehives
+ * @deprecated use {@link #ENTITY_TYPES_BEEHIVE_INHABITORS}
+ */
+ @Deprecated(forRemoval = true)
+ Tag<org.bukkit.entity.EntityType> BEEHIVE_INHABITORS = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("beehive_inhabitors"), org.bukkit.entity.EntityType.class);
+ /**
+ * Vanilla entity tag representing projectiles that impact
+ * @deprecated use {@link #ENTITY_TYPES_IMPACT_PROJECTILES}
+ */
+ @Deprecated(forRemoval = true)
+ Tag<org.bukkit.entity.EntityType> IMPACT_PROJECTILES = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("impact_projectiles"), org.bukkit.entity.EntityType.class);
+ /**
+ * Vanilla entity tag for village raiders
+ * @deprecated use {@link #ENTITY_TYPES_RAIDERS}
+ */
+ @Deprecated(forRemoval = true)
+ Tag<org.bukkit.entity.EntityType> RAIDERS = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("raiders"), org.bukkit.entity.EntityType.class);
+ /**
+ * Vanilla entity tag for skeleton types
+ * @deprecated use {@link #ENTITY_TYPES_SKELETONS}
+ */
+ @Deprecated(forRemoval = true)
+ Tag<org.bukkit.entity.EntityType> SKELETONS = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("skeletons"), org.bukkit.entity.EntityType.class);
+ // Paper end

Datei anzeigen

@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public boolean isCancellable() {
+ return isCancellable;
+ // paper end
+ // Paper end
+ }
+
@NotNull

Datei anzeigen

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.type = type;
this.worldPosition = pos.immutable();
this.blockState = state;
+ persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY); // Paper - always init
+ this.persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY); // Paper - always init
}
// Paper start
@ -29,25 +29,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start - read container
public void load(CompoundTag nbt) {
- this.persistentDataContainer = new CraftPersistentDataContainer(BlockEntity.DATA_TYPE_REGISTRY);
+ this.persistentDataContainer.clear();
+ this.persistentDataContainer.clear(); // Paper - clear instead of init
net.minecraft.nbt.Tag persistentDataTag = nbt.get("PublicBukkitValues");
if (persistentDataTag instanceof CompoundTag) {
@@ -0,0 +0,0 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
}
// CraftBukkit start - add method
+ // Paper start
public InventoryHolder getOwner() {
- if (this.level == null) return null;
+ // Paper start
+ return getOwner(true);
+ }
+ public InventoryHolder getOwner(boolean useSnapshot) {
+ // Paper end
+ if (level == null) return null;
if (this.level == null) return null;
// Spigot start
org.bukkit.block.Block block = this.level.getWorld().getBlockAt(this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ());
if (block == null) {
@@ -0,0 +0,0 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
return null;
}
@ -65,69 +62,50 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public BlockState getState() {
- Material material = this.getType();
+ // Paper start - allow disabling the use of snapshots
+ return getState(true);
+ // Paper start
+ return this.getState(true);
+ }
+
+ @Override
+ public BlockState getState(boolean useSnapshot) {
+ boolean prev = CraftBlockEntityState.DISABLE_SNAPSHOT;
+ CraftBlockEntityState.DISABLE_SNAPSHOT = !useSnapshot;
+ try {
+ return getState0();
return CraftBlockStates.getBlockState(this);
+ } finally {
+ CraftBlockEntityState.DISABLE_SNAPSHOT = prev;
+ }
+ }
+ public BlockState getState0() {
+ // Paper end
+ Material material = getType();
switch (material) {
case ACACIA_SIGN:
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -0,0 +0,0 @@ public class CraftBlockEntityState<T extends BlockEntity> extends CraftBlockStat
this.tileEntity = tileEntityClass.cast(getWorldHandle().getBlockEntity(this.getPosition()));
Preconditions.checkState(this.tileEntity != null, "Tile is null, asynchronous access? %s", block);
+ // Paper start
+ this.snapshotDisabled = DISABLE_SNAPSHOT;
+ if (DISABLE_SNAPSHOT) {
+ this.snapshot = this.tileEntity;
+ } else {
+ this.snapshot = this.createSnapshot(this.tileEntity);
+ }
// copy tile entity data:
- this.snapshot = this.createSnapshot(tileEntity);
- this.load(snapshot);
+ if(this.snapshot != null) {
+ this.load(this.snapshot);
+ }
+ // Paper end
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -0,0 +0,0 @@ public abstract class CraftBlockEntityState<T extends BlockEntity> extends Craft
private final T tileEntity;
private final T snapshot;
+ public final boolean snapshotDisabled; // Paper
+ public static boolean DISABLE_SNAPSHOT = false; // Paper
+
public CraftBlockEntityState(Material material, T tileEntity) {
super(material);
this.tileEntityClass = (Class<T>) tileEntity.getClass();
public CraftBlockEntityState(World world, T tileEntity) {
super(world, tileEntity.getBlockPos(), tileEntity.getBlockState());
this.tileEntity = tileEntity;
-
+ // Paper start
+ this.snapshotDisabled = DISABLE_SNAPSHOT;
+ if (DISABLE_SNAPSHOT) {
+ this.snapshot = this.tileEntity;
+ } else {
+ this.snapshot = this.createSnapshot(this.tileEntity);
+ this.snapshot = this.createSnapshot(tileEntity);
+ }
// copy tile entity data:
- this.snapshot = this.createSnapshot(tileEntity);
- this.load(snapshot);
+ if(this.snapshot != null) {
+ if (this.snapshot != null) {
+ this.load(this.snapshot);
+ }
+ // Paper end

Datei anzeigen

@ -108,8 +108,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public <T extends Entity> @NotNull T spawn(@NotNull Vector location, @NotNull Class<T> clazz, @Nullable Consumer<T> function, CreatureSpawnEvent.@NotNull SpawnReason reason) throws IllegalArgumentException {
+ net.minecraft.world.entity.Entity entity = getDelegate().getMinecraftWorld().getWorld().createEntity(location.toLocation(getWorld()), clazz);
+ Objects.requireNonNull(entity, "Cannot spawn null entity");
+ if (entity instanceof Mob) {
+ ((Mob) entity).finalizeSpawn(getDelegate(), getDelegate().getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.COMMAND, (SpawnGroupData) null, null);
+ if (entity instanceof Mob mob) {
+ mob.finalizeSpawn(getDelegate(), getDelegate().getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.COMMAND, (SpawnGroupData) null, null);
+ }
+
+ if (function != null) {
@ -219,25 +219,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
@@ -0,0 +0,0 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
return this.blockEntityTag != null;
}
+ // Paper start - Delegate to utility method
@Override
public BlockState getBlockState() {
- Material stateMaterial = (this.material != Material.SHIELD) ? this.material : CraftMetaBlockState.shieldToBannerHack(this.blockEntityTag); // Only actually used for jigsaws
- if (this.blockEntityTag != null) {
- switch (this.material) {
+ // Paper start
+ return createBlockState(this.material, this.blockEntityTag);
+ }
+
+ public static BlockState createBlockState(Material material, CompoundTag blockEntityTag) {
+ Material stateMaterial = (material != Material.SHIELD) ? material : CraftMetaBlockState.shieldToBannerHack(blockEntityTag); // Only actually used for jigsaws
+ if (blockEntityTag != null) {
+ switch (material) {
+ // Paper end
case SHIELD:
- this.blockEntityTag.putString("id", "banner");
+ blockEntityTag.putString("id", "banner");
+ blockEntityTag.putString("id", "banner"); // Paper
break;
case SHULKER_BOX:
case WHITE_SHULKER_BOX:
@ -246,225 +244,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
case RED_SHULKER_BOX:
case BLACK_SHULKER_BOX:
- this.blockEntityTag.putString("id", "shulker_box");
+ blockEntityTag.putString("id", "shulker_box");
+ blockEntityTag.putString("id", "shulker_box"); // Paper
break;
case BEE_NEST:
case BEEHIVE:
- this.blockEntityTag.putString("id", "beehive");
+ blockEntityTag.putString("id", "beehive");
+ blockEntityTag.putString("id", "beehive"); // Paper
break;
}
}
BlockPos blockposition = BlockPos.ZERO;
net.minecraft.world.level.block.state.BlockState iblockdata = CraftMagicNumbers.getBlock(stateMaterial).defaultBlockState();
- BlockEntity te = (this.blockEntityTag == null) ? null : BlockEntity.loadStatic(blockposition, iblockdata, blockEntityTag);
+ BlockEntity te = (blockEntityTag == null) ? null : BlockEntity.loadStatic(blockposition, iblockdata, blockEntityTag);
- switch (this.material) {
+ switch (material) {
case ACACIA_SIGN:
case ACACIA_WALL_SIGN:
case BIRCH_SIGN:
@@ -0,0 +0,0 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
if (te == null) {
te = new SignBlockEntity(blockposition, iblockdata);
}
- return new CraftSign(this.material, (SignBlockEntity) te);
+ return new CraftSign(material, (SignBlockEntity) te);
case CHEST:
case TRAPPED_CHEST:
if (te == null) {
te = new ChestBlockEntity(blockposition, iblockdata);
}
- return new CraftChest(this.material, (ChestBlockEntity) te);
+ return new CraftChest(material, (ChestBlockEntity) te);
case FURNACE:
if (te == null) {
te = new FurnaceBlockEntity(blockposition, iblockdata);
}
- return new CraftFurnaceFurnace(this.material, (FurnaceBlockEntity) te);
+ return new CraftFurnaceFurnace(material, (FurnaceBlockEntity) te);
case DISPENSER:
if (te == null) {
te = new DispenserBlockEntity(blockposition, iblockdata);
}
- return new CraftDispenser(this.material, (DispenserBlockEntity) te);
+ return new CraftDispenser(material, (DispenserBlockEntity) te);
case DROPPER:
if (te == null) {
te = new DropperBlockEntity(blockposition, iblockdata);
}
- return new CraftDropper(this.material, (DropperBlockEntity) te);
+ return new CraftDropper(material, (DropperBlockEntity) te);
case END_GATEWAY:
if (te == null) {
te = new TheEndGatewayBlockEntity(blockposition, iblockdata);
}
- return new CraftEndGateway(this.material, (TheEndGatewayBlockEntity) te);
+ return new CraftEndGateway(material, (TheEndGatewayBlockEntity) te);
case HOPPER:
if (te == null) {
te = new HopperBlockEntity(blockposition, iblockdata);
}
- return new CraftHopper(this.material, (HopperBlockEntity) te);
+ return new CraftHopper(material, (HopperBlockEntity) te);
case SPAWNER:
if (te == null) {
te = new SpawnerBlockEntity(blockposition, iblockdata);
}
- return new CraftCreatureSpawner(this.material, (SpawnerBlockEntity) te);
+ return new CraftCreatureSpawner(material, (SpawnerBlockEntity) te);
case JUKEBOX:
if (te == null) {
te = new JukeboxBlockEntity(blockposition, iblockdata);
}
- return new CraftJukebox(this.material, (JukeboxBlockEntity) te);
+ return new CraftJukebox(material, (JukeboxBlockEntity) te);
case BREWING_STAND:
if (te == null) {
te = new BrewingStandBlockEntity(blockposition, iblockdata);
}
- return new CraftBrewingStand(this.material, (BrewingStandBlockEntity) te);
+ return new CraftBrewingStand(material, (BrewingStandBlockEntity) te);
case CREEPER_HEAD:
case CREEPER_WALL_HEAD:
case DRAGON_HEAD:
@@ -0,0 +0,0 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
if (te == null) {
te = new SkullBlockEntity(blockposition, iblockdata);
}
- return new CraftSkull(this.material, (SkullBlockEntity) te);
+ return new CraftSkull(material, (SkullBlockEntity) te);
case COMMAND_BLOCK:
case REPEATING_COMMAND_BLOCK:
case CHAIN_COMMAND_BLOCK:
if (te == null) {
te = new CommandBlockEntity(blockposition, iblockdata);
}
- return new CraftCommandBlock(this.material, (CommandBlockEntity) te);
+ return new CraftCommandBlock(material, (CommandBlockEntity) te);
case BEACON:
if (te == null) {
te = new BeaconBlockEntity(blockposition, iblockdata);
}
- return new CraftBeacon(this.material, (BeaconBlockEntity) te);
+ return new CraftBeacon(material, (BeaconBlockEntity) te);
case SHIELD:
if (te == null) {
te = new BannerBlockEntity(blockposition, iblockdata);
}
- ((BannerBlockEntity) te).baseColor = (this.blockEntityTag == null) ? DyeColor.WHITE : DyeColor.byId(this.blockEntityTag.getInt(CraftMetaBanner.BASE.NBT));
+ ((BannerBlockEntity) te).baseColor = (blockEntityTag == null) ? DyeColor.WHITE : DyeColor.byId(blockEntityTag.getInt(CraftMetaBanner.BASE.NBT));
case BLACK_BANNER:
case BLACK_WALL_BANNER:
case BLUE_BANNER:
@@ -0,0 +0,0 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
if (te == null) {
te = new BannerBlockEntity(blockposition, iblockdata);
}
- return new CraftBanner(this.material == Material.SHIELD ? CraftMetaBlockState.shieldToBannerHack(this.blockEntityTag) : this.material, (BannerBlockEntity) te);
+ return new CraftBanner(material == Material.SHIELD ? CraftMetaBlockState.shieldToBannerHack(blockEntityTag) : material, (BannerBlockEntity) te);
case STRUCTURE_BLOCK:
if (te == null) {
te = new StructureBlockEntity(blockposition, iblockdata);
}
- return new CraftStructureBlock(this.material, (StructureBlockEntity) te);
+ return new CraftStructureBlock(material, (StructureBlockEntity) te);
case SHULKER_BOX:
case WHITE_SHULKER_BOX:
case ORANGE_SHULKER_BOX:
@@ -0,0 +0,0 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
if (te == null) {
te = new ShulkerBoxBlockEntity(blockposition, iblockdata);
}
- return new CraftShulkerBox(this.material, (ShulkerBoxBlockEntity) te);
+ return new CraftShulkerBox(material, (ShulkerBoxBlockEntity) te);
case ENCHANTING_TABLE:
if (te == null) {
te = new EnchantmentTableBlockEntity(blockposition, iblockdata);
}
- return new CraftEnchantingTable(this.material, (EnchantmentTableBlockEntity) te);
+ return new CraftEnchantingTable(material, (EnchantmentTableBlockEntity) te);
case ENDER_CHEST:
if (te == null) {
te = new EnderChestBlockEntity(blockposition, iblockdata);
}
- return new CraftEnderChest(this.material, (EnderChestBlockEntity) te);
+ return new CraftEnderChest(material, (EnderChestBlockEntity) te);
case DAYLIGHT_DETECTOR:
if (te == null) {
te = new DaylightDetectorBlockEntity(blockposition, iblockdata);
}
- return new CraftDaylightDetector(this.material, (DaylightDetectorBlockEntity) te);
+ return new CraftDaylightDetector(material, (DaylightDetectorBlockEntity) te);
case COMPARATOR:
if (te == null) {
te = new ComparatorBlockEntity(blockposition, iblockdata);
}
- return new CraftComparator(this.material, (ComparatorBlockEntity) te);
+ return new CraftComparator(material, (ComparatorBlockEntity) te);
case BARREL:
if (te == null) {
te = new BarrelBlockEntity(blockposition, iblockdata);
}
- return new CraftBarrel(this.material, (BarrelBlockEntity) te);
+ return new CraftBarrel(material, (BarrelBlockEntity) te);
case BELL:
if (te == null) {
te = new BellBlockEntity(blockposition, iblockdata);
}
- return new CraftBell(this.material, (BellBlockEntity) te);
+ return new CraftBell(material, (BellBlockEntity) te);
case BLAST_FURNACE:
if (te == null) {
te = new BlastFurnaceBlockEntity(blockposition, iblockdata);
}
- return new CraftBlastFurnace(this.material, (BlastFurnaceBlockEntity) te);
+ return new CraftBlastFurnace(material, (BlastFurnaceBlockEntity) te);
case CAMPFIRE:
case SOUL_CAMPFIRE:
if (te == null) {
te = new CampfireBlockEntity(blockposition, iblockdata);
}
- return new CraftCampfire(this.material, (CampfireBlockEntity) te);
+ return new CraftCampfire(material, (CampfireBlockEntity) te);
case JIGSAW:
if (te == null) {
te = new JigsawBlockEntity(blockposition, iblockdata);
}
- return new CraftJigsaw(this.material, (JigsawBlockEntity) te);
+ return new CraftJigsaw(material, (JigsawBlockEntity) te);
case LECTERN:
if (te == null) {
te = new LecternBlockEntity(blockposition, iblockdata);
}
- return new CraftLectern(this.material, (LecternBlockEntity) te);
+ return new CraftLectern(material, (LecternBlockEntity) te);
case SMOKER:
if (te == null) {
te = new SmokerBlockEntity(blockposition, iblockdata);
}
- return new CraftSmoker(this.material, (SmokerBlockEntity) te);
+ return new CraftSmoker(material, (SmokerBlockEntity) te);
case BEE_NEST:
case BEEHIVE:
if (te == null) {
te = new BeehiveBlockEntity(blockposition, iblockdata);
}
- return new CraftBeehive(this.material, (BeehiveBlockEntity) te);
+ return new CraftBeehive(material, (BeehiveBlockEntity) te);
case SCULK_SENSOR:
if (te == null) {
te = new SculkSensorBlockEntity(blockposition, iblockdata);
}
- return new CraftSculkSensor(this.material, (SculkSensorBlockEntity) te);
+ return new CraftSculkSensor(material, (SculkSensorBlockEntity) te);
default:
- throw new IllegalStateException("Missing blockState for " + this.material);
+ throw new IllegalStateException("Missing blockState for " + material);
}
}
+ // Paper end
@Override
public void setBlockState(BlockState blockState) {

Datei anzeigen

@ -22,6 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.tags.TagCollection;
+
+@Deprecated(forRemoval = true)
+public class CraftEntityTag extends CraftTag<net.minecraft.world.entity.EntityType<?>, EntityType> {
+
+ public CraftEntityTag(TagCollection<net.minecraft.world.entity.EntityType<?>> registry, ResourceLocation tag) {
@ -43,9 +44,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
Preconditions.checkArgument(clazz == org.bukkit.Fluid.class, "Fluid namespace must have fluid type");
Preconditions.checkArgument(clazz == org.bukkit.entity.EntityType.class, "Entity type namespace must have entity type");
return (org.bukkit.Tag<T>) new CraftFluidTag(FluidTags.getAllTags(), key);
return (org.bukkit.Tag<T>) new CraftEntityTag(EntityTypeTags.getAllTags(), key);
+ // Paper start
+ case org.bukkit.Tag.REGISTRY_ENTITIES:
+ Preconditions.checkArgument(clazz == org.bukkit.entity.EntityType.class, "Entity namespace must have entitytype type");

Datei anzeigen

@ -1976,7 +1976,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftEnchantingTable.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEnchantingTable.java
@@ -0,0 +0,0 @@ public class CraftEnchantingTable extends CraftBlockEntityState<EnchantmentTable
super(material, te);
super(world, tileEntity);
}
+ // Paper start
@ -2010,10 +2010,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private java.util.ArrayList<net.kyori.adventure.text.Component> lines = null; // ArrayList for RandomAccess
+ // Paper end
public CraftSign(final Block block) {
super(block, SignBlockEntity.class);
@@ -0,0 +0,0 @@ public class CraftSign extends CraftBlockEntityState<SignBlockEntity> implements
super(material, te);
public CraftSign(World world, SignBlockEntity tileEntity) {
super(world, tileEntity);
}
+ // Paper start

Datei anzeigen

@ -243,7 +243,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else {
- // TODO: doesn't work well if spawn changed....
- this.world.getChunkSource().removeRegionTicket(TicketType.START, new ChunkPos(chunkcoordinates), 11, Unit.INSTANCE);
+ // TODO: doesn't work well if spawn changed.... // paper - resolved
+ // TODO: doesn't work well if spawn changed.... // Paper - resolved
+ this.world.removeTicketsForSpawn(this.world.paperConfig.keepLoadedRange, chunkcoordinates);
}
+ // Paper end

Datei anzeigen

@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ minWaitTime = world.paperConfig.fishingMinTicks;
+ maxWaitTime = world.paperConfig.fishingMaxTicks;
+ // paper end
+ // Paper end
}
public FishingHook(EntityType<? extends FishingHook> type, Level world) {

Datei anzeigen

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ location.setPitch(bukkitEntity.getLocation().getPitch());
+ location.setYaw(bukkitEntity.getLocation().getYaw());
+
+ com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent event = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(bukkitEntity, bukkitEntity.getLocation(), location, new org.bukkit.craftbukkit.block.CraftEndGateway(MCUtil.toLocation(world, blockEntity.getBlockPos()).getBlock()));
+ com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent event = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(bukkitEntity, bukkitEntity.getLocation(), location, new org.bukkit.craftbukkit.block.CraftEndGateway(world.getWorld(), blockEntity));
+ if (!event.callEvent()) {
+ return;
+ }

Datei anzeigen

@ -654,8 +654,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-public class CraftChest extends CraftLootable<ChestBlockEntity> implements Chest {
+public class CraftChest extends CraftLootable<ChestBlockEntity> implements Chest, PaperLootableBlockInventory { // Paper
public CraftChest(final Block block) {
super(block, ChestBlockEntity.class);
public CraftChest(World world, ChestBlockEntity tileEntity) {
super(world, tileEntity);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
@ -667,8 +667,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-public abstract class CraftLootable<T extends RandomizableContainerBlockEntity> extends CraftContainer<T> implements Nameable, Lootable {
+public abstract class CraftLootable<T extends RandomizableContainerBlockEntity> extends CraftContainer<T> implements Nameable, Lootable, com.destroystokyo.paper.loottable.PaperLootableBlockInventory { // Paper
public CraftLootable(Block block, Class<T> tileEntityClass) {
super(block, tileEntityClass);
public CraftLootable(World world, T tileEntity) {
super(world, tileEntity);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java

Datei anzeigen

@ -47,15 +47,15 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
@@ -0,0 +0,0 @@ import org.bukkit.block.Block;
@@ -0,0 +0,0 @@ import org.bukkit.World;
import org.bukkit.block.CommandBlock;
import org.bukkit.craftbukkit.util.CraftChatMessage;
-public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity> implements CommandBlock {
+public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity> implements CommandBlock, io.papermc.paper.commands.PaperCommandBlockHolder {
public CraftCommandBlock(Block block) {
super(block, CommandBlockEntity.class);
public CraftCommandBlock(World world, CommandBlockEntity tileEntity) {
super(world, tileEntity);
@@ -0,0 +0,0 @@ public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity>
public void name(net.kyori.adventure.text.Component name) {
getSnapshot().getCommandBlock().setName(name == null ? new net.minecraft.network.chat.TextComponent("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));

Datei anzeigen

@ -41,8 +41,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java
@@ -0,0 +0,0 @@ public class CraftEnderChest extends CraftBlockEntityState<EnderChestBlockEntity
public CraftEnderChest(final Material material, final EnderChestBlockEntity te) {
super(material, te);
public CraftEnderChest(World world, EnderChestBlockEntity tileEntity) {
super(world, tileEntity);
}
+
+ // Paper start - More Lidded Block API
@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
@@ -0,0 +0,0 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
if (getTileEntity().opened && getWorldHandle() instanceof net.minecraft.world.level.Level) {
Level world = getTileEntity().getLevel();
net.minecraft.world.level.Level world = getTileEntity().getLevel();
world.blockEvent(getPosition(), getTileEntity().getBlockState().getBlock(), 1, 0);
- world.playSound(null, getPosition(), SoundEvents.SHULKER_BOX_OPEN, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
+ world.playSound(null, getPosition(), SoundEvents.SHULKER_BOX_CLOSE, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); // Paper - More Lidded Block API (Wrong sound)

Datei anzeigen

@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
location.setYaw(player.getLocation().getYaw());
- PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.END_GATEWAY);
+ PlayerTeleportEvent teleEvent = new com.destroystokyo.paper.event.player.PlayerTeleportEndGatewayEvent(player, player.getLocation(), location, new org.bukkit.craftbukkit.block.CraftEndGateway(net.minecraft.server.MCUtil.toLocation(worldserver, blockEntity.getBlockPos()).getBlock())); // Paper
+ PlayerTeleportEvent teleEvent = new com.destroystokyo.paper.event.player.PlayerTeleportEndGatewayEvent(player, player.getLocation(), location, new org.bukkit.craftbukkit.block.CraftEndGateway(worldserver.getWorld(), blockEntity)); // Paper
Bukkit.getPluginManager().callEvent(teleEvent);
if (teleEvent.isCancelled()) {
return;

Datei anzeigen

@ -8,16 +8,15 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -0,0 +0,0 @@ public class CraftBlockEntityState<T extends BlockEntity> extends CraftBlockStat
public CraftBlockEntityState(Block block, Class<T> tileEntityClass) {
super(block);
@@ -0,0 +0,0 @@ public abstract class CraftBlockEntityState<T extends BlockEntity> extends Craft
+ try {// Paper - show location on failure
+
this.tileEntityClass = tileEntityClass;
this.tileEntity = tileEntity;
// get tile entity from block:
@@ -0,0 +0,0 @@ public class CraftBlockEntityState<T extends BlockEntity> extends CraftBlockStat
+ try { // Paper - show location on failure
// Paper start
this.snapshotDisabled = DISABLE_SNAPSHOT;
if (DISABLE_SNAPSHOT) {
@@ -0,0 +0,0 @@ public abstract class CraftBlockEntityState<T extends BlockEntity> extends Craft
this.load(this.snapshot);
}
// Paper end
@ -26,9 +25,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (thr instanceof ThreadDeath) {
+ throw (ThreadDeath)thr;
+ }
+ throw new RuntimeException("Failed to read BlockState at: world: " + block.getWorld().getName() + " location: (" + block.getX() + ", " + block.getY() + ", " + block.getZ() + ")", thr);
+ throw new RuntimeException("Failed to read BlockState at: world: " + this.getWorld().getName() + " location: (" + this.getX() + ", " + this.getY() + ", " + this.getZ() + ")", thr);
+ }
+ // Paper end
}
public final boolean snapshotDisabled; // Paper
public void refreshSnapshot() {

Datei anzeigen

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - DragonEggFormEvent
+ BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION);
+ org.bukkit.craftbukkit.block.CraftBlock eggBlock = org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition);
+ org.bukkit.craftbukkit.block.CraftBlockState eggState = new org.bukkit.craftbukkit.block.CraftBlockState(eggBlock);
+ org.bukkit.craftbukkit.block.CraftBlockState eggState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(this.level, eggPosition);
+ eggState.setData(Blocks.DRAGON_EGG.defaultBlockState());
+ io.papermc.paper.event.block.DragonEggFormEvent eggEvent = new io.papermc.paper.event.block.DragonEggFormEvent(eggBlock, eggState,
+ new org.bukkit.craftbukkit.boss.CraftDragonBattle(this));

Datei anzeigen

@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ @Override public void stopRiding() { stopRiding(false); }
+ @Override public void stopRiding(boolean suppressCancellation) {
+ // paper end
+ // Paper end
Entity entity = this.getVehicle();
- super.stopRiding();

@ -1 +1 @@
Subproject commit 44cfe1432dda2c12c919dcf63536d12cde650fe0
Subproject commit 19e985ecaf424e77845a8e136b7e17b94e8a65ee

@ -1 +1 @@
Subproject commit 149282611823e75c181316159665e9d2b54bf3de
Subproject commit dc764e7a2f9272e72a3f37c6770c9c0f7ea83d43