13
0
geforkt von Mirrors/Paper

Update to Minecraft 1.18-pre8

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2021-11-25 08:00:00 +11:00
Ursprung 0d839e926c
Commit 799bfc92e2
30 geänderte Dateien mit 206 neuen und 758 gelöschten Zeilen

Datei anzeigen

@ -1,75 +0,0 @@
--- a/net/minecraft/core/IRegistryCustom.java
+++ b/net/minecraft/core/IRegistryCustom.java
@@ -80,7 +80,7 @@
public <E> Optional<? extends IRegistry<E>> registry(ResourceKey<? extends IRegistry<? extends E>> resourcekey) {
Optional<? extends IRegistry<E>> optional = this.ownedRegistry(resourcekey);
- return optional.isPresent() ? optional : IRegistry.REGISTRY.getOptional(resourcekey.location());
+ return optional.isPresent() ? optional : (Optional<? extends IRegistry<E>>) IRegistry.REGISTRY.getOptional(resourcekey.location()); // CraftBukkit - decompile error
}
public <E> IRegistry<E> registryOrThrow(ResourceKey<? extends IRegistry<? extends E>> resourcekey) {
@@ -138,7 +138,7 @@
}
private static <R extends IRegistry<?>> void copyBuiltin(IRegistryCustom.Dimension iregistrycustom_dimension, ResourceKey<R> resourcekey) {
- IRegistry<R> iregistry = RegistryGeneration.REGISTRY;
+ IRegistry<R> iregistry = (IRegistry<R>) RegistryGeneration.REGISTRY; // CraftBukkit - decompile error
IRegistry<?> iregistry1 = (IRegistry) iregistry.getOrThrow(resourcekey);
copy(iregistrycustom_dimension, iregistry1);
@@ -178,8 +178,10 @@
});
}
- public static final class RegistryData extends Record {
+ // CraftBukkit start
+ public static final record RegistryData<E>(ResourceKey<? extends IRegistry<E>> key, Codec<E> codec, @Nullable Codec<E> networkCodec) {
+ /*
private final ResourceKey<? extends IRegistry<E>> key;
private final Codec<E> codec;
@Nullable
@@ -190,11 +192,15 @@
this.codec = codec;
this.networkCodec = codec1;
}
+ */
+ // CraftBukkit end
public boolean sendToClient() {
return this.networkCodec != null;
}
+ // CraftBukkit start
+ /*
public final String toString() {
return this.toString < invokedynamic > (this);
}
@@ -219,6 +225,8 @@
public Codec<E> networkCodec() {
return this.networkCodec;
}
+ */
+ // CraftBukkit end
}
public static final class Dimension extends IRegistryCustom {
@@ -267,7 +275,7 @@
}
private static <E> RegistryMaterials<?> parseRegistry(ResourceKey<? extends IRegistry<?>> resourcekey, Dynamic<?> dynamic) {
- DataResult dataresult = RegistryLookupCodec.create(resourcekey).codec().parse(dynamic);
+ DataResult<?> dataresult = RegistryLookupCodec.create((ResourceKey) resourcekey).codec().parse(dynamic); // CraftBukkit - decompile error
String s = resourcekey + " registry: ";
Logger logger = IRegistryCustom.LOGGER;
@@ -282,7 +290,7 @@
}
private static <E> RegistryMaterials<?> createRegistry(ResourceKey<? extends IRegistry<?>> resourcekey) {
- return new RegistryMaterials<>(resourcekey, Lifecycle.stable());
+ return new RegistryMaterials(resourcekey, Lifecycle.stable()); // CraftBukkit - decompile error
}
@Override

Datei anzeigen

@ -1,40 +0,0 @@
--- a/net/minecraft/core/RegistryMaterials.java
+++ b/net/minecraft/core/RegistryMaterials.java
@@ -201,7 +201,7 @@
});
}
- return SystemUtils.getRandom(this.randomCache, random);
+ return (T) SystemUtils.getRandom(this.randomCache, random); // CraftBukkit - decompile error
}
@Override
@@ -228,7 +228,7 @@
return registrymaterials;
}, (registrymaterials) -> {
Builder<RegistryMaterials.a<T>> builder = ImmutableList.builder();
- Iterator iterator = registrymaterials.iterator();
+ Iterator<T> iterator = registrymaterials.iterator(); // CraftBukkit - decompile error
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -257,8 +257,10 @@
});
}
- private static final class a extends Record {
+ // CraftBukkit start
+ private static final record a<T>(ResourceKey<T> key, int id, T value) {
+ /*
private final ResourceKey<T> key;
private final int id;
private final T value;
@@ -292,5 +294,7 @@
public T value() {
return this.value;
}
+ */
+ // CraftBukkit end
}
}

Datei anzeigen

@ -1,61 +0,0 @@
--- a/net/minecraft/resources/RegistryResourceAccess.java
+++ b/net/minecraft/resources/RegistryResourceAccess.java
@@ -160,8 +160,10 @@
}));
}
- private static final class Entry extends Record {
+ // CraftBukkit start
+ private static final record Entry(JsonElement data, int id, Lifecycle lifecycle) {
+ /*
final JsonElement data;
final int id;
final Lifecycle lifecycle;
@@ -183,6 +185,8 @@
public final boolean equals(Object object) {
return this.equals<invokedynamic>(this, object);
}
+ */
+ // CraftBukkit end
public JsonElement data() {
return this.data;
@@ -198,8 +202,10 @@
}
}
- public static final class ParsedEntry extends Record {
+ // CraftBukkit start
+ public static final record ParsedEntry<E>(E value, OptionalInt fixedId) {
+ /*
private final E value;
private final OptionalInt fixedId;
@@ -207,6 +213,8 @@
this.value = e0;
this.fixedId = optionalint;
}
+ */
+ // CraftBukkit end
public static <E> RegistryResourceAccess.ParsedEntry<E> createWithoutId(E e0) {
return new RegistryResourceAccess.ParsedEntry(e0, OptionalInt.empty());
@@ -216,6 +224,8 @@
return new RegistryResourceAccess.ParsedEntry(e0, OptionalInt.of(i));
}
+ // CraftBukkit start
+ /*
public final String toString() {
return this.toString < invokedynamic > (this);
}
@@ -235,5 +245,7 @@
public OptionalInt fixedId() {
return this.fixedId;
}
+ */
+ // CraftBukkit end
}
}

Datei anzeigen

@ -667,7 +667,7 @@
}
public SystemReport fillSystemReport(SystemReport systemreport) {
@@ -1351,16 +1647,17 @@
@@ -1354,16 +1650,17 @@
public CompletableFuture<Void> reloadResources(Collection<String> collection) {
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
@ -687,7 +687,7 @@
this.packRepository.setSelected(collection);
this.worldData.setDataPackConfig(getSelectedPacks(this.packRepository));
datapackresources.updateGlobals();
@@ -1714,7 +2011,7 @@
@@ -1717,7 +2014,7 @@
try {
label51:
{
@ -696,7 +696,7 @@
try {
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
@@ -1764,6 +2061,22 @@
@@ -1767,6 +2064,22 @@
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ChunkProviderServer.java
+++ b/net/minecraft/server/level/ChunkProviderServer.java
@@ -83,6 +83,24 @@
@@ -86,6 +86,24 @@
this.clearCache();
}
@ -25,7 +25,7 @@
@Override
public LightEngineThreaded getLightEngine() {
return this.lightEngine;
@@ -127,7 +145,7 @@
@@ -130,7 +148,7 @@
for (int l = 0; l < 4; ++l) {
if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
ichunkaccess = this.lastChunk[l];
@ -34,7 +34,7 @@
return ichunkaccess;
}
}
@@ -175,12 +193,12 @@
@@ -178,12 +196,12 @@
if (playerchunk == null) {
return null;
} else {
@ -49,7 +49,7 @@
if (ichunkaccess1 != null) {
this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
@@ -228,7 +246,15 @@
@@ -231,7 +249,15 @@
int l = 33 + ChunkStatus.getDistance(chunkstatus);
PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
@ -66,7 +66,7 @@
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
if (this.chunkAbsent(playerchunk, l)) {
GameProfilerFiller gameprofilerfiller = this.level.getProfiler();
@@ -247,7 +273,7 @@
@@ -250,7 +276,7 @@
}
private boolean chunkAbsent(@Nullable PlayerChunk playerchunk, int i) {
@ -75,7 +75,7 @@
}
@Override
@@ -314,7 +340,7 @@
@@ -317,7 +343,7 @@
} else if (!this.level.shouldTickBlocksAt(i)) {
return false;
} else {
@ -84,7 +84,7 @@
return either != null && either.left().isPresent();
}
@@ -327,11 +353,31 @@
@@ -330,11 +356,31 @@
@Override
public void close() throws IOException {
@ -117,7 +117,7 @@
@Override
public void tick(BooleanSupplier booleansupplier) {
this.level.getProfiler().push("purge");
@@ -360,7 +406,7 @@
@@ -363,7 +409,7 @@
gameprofilerfiller.push("pollingChunks");
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
@ -126,7 +126,7 @@
gameprofilerfiller.push("naturalSpawnCount");
int l = this.distanceManager.getNaturalSpawnChunkCount();
@@ -381,7 +427,7 @@
@@ -384,7 +430,7 @@
}
gameprofilerfiller.popPush("spawnAndTick");
@ -135,7 +135,7 @@
Collections.shuffle(list);
Iterator iterator1 = list.iterator();
@@ -571,18 +617,26 @@
@@ -579,18 +625,26 @@
}
@Override
@ -156,20 +156,19 @@
}
}
- private static final class a extends Record {
- private static record a(Chunk a, PlayerChunk b) {
+ // CraftBukkit start - decompile error
+ private static final record a(Chunk chunk, PlayerChunk holder) {
+ private static record a(Chunk chunk, PlayerChunk holder) {
+ /*
final Chunk chunk;
final PlayerChunk holder;
@@ -602,6 +656,8 @@
public final boolean equals(Object object) {
return this.equals<invokedynamic>(this, object);
@@ -606,5 +660,7 @@
public PlayerChunk holder() {
return this.holder;
}
+ */
+ // CraftBukkit end
public Chunk chunk() {
return this.chunk;
}
}

Datei anzeigen

@ -12,7 +12,7 @@
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.e {
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
@@ -133,6 +138,27 @@
@@ -134,6 +139,27 @@
private final Queue<Runnable> unloadQueue;
int viewDistance;
@ -40,7 +40,7 @@
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
super(convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag);
this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -326,9 +352,12 @@
@@ -327,9 +353,12 @@
return completablefuture1.thenApply((list1) -> {
List<IChunkAccess> list2 = Lists.newArrayList();
@ -55,16 +55,7 @@
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
Optional<IChunkAccess> optional = either.left();
@@ -435,7 +464,7 @@
this.flushWorker();
} else {
this.visibleChunkMap.values().stream().filter(PlayerChunk::wasAccessibleSinceLastSave).forEach((playerchunk) -> {
- IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkToSave().getNow((Object) null);
+ IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkToSave().getNow(null); // CraftBukkit - decompile error
if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) {
this.save(ichunkaccess);
@@ -488,7 +517,7 @@
@@ -490,7 +519,7 @@
private void scheduleUnload(long i, PlayerChunk playerchunk) {
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave();
@ -73,7 +64,7 @@
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave();
if (completablefuture1 != completablefuture) {
@@ -664,7 +693,21 @@
@@ -669,7 +698,21 @@
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
if (!list.isEmpty()) {
@ -96,7 +87,16 @@
}
}
@@ -894,7 +937,8 @@
@@ -767,7 +810,7 @@
if (!playerchunk.wasAccessibleSinceLastSave()) {
return false;
} else {
- IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkToSave().getNow((Object) null);
+ IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkToSave().getNow(null); // CraftBukkit - decompile error
boolean flag;
if (ichunkaccess instanceof ProtoChunkExtension) {
@@ -922,7 +965,8 @@
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
});
@ -106,7 +106,7 @@
return chunk.getBlockEntities().size();
}).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> {
return chunk.getBlockTicks().count();
@@ -907,7 +951,7 @@
@@ -935,7 +979,7 @@
private static String printFuture(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
try {
@ -115,7 +115,7 @@
return either != null ? (String) either.map((chunk) -> {
return "done";
@@ -925,7 +969,7 @@
@@ -953,7 +997,7 @@
private NBTTagCompound readChunk(ChunkCoordIntPair chunkcoordintpair) throws IOException {
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
@ -124,7 +124,7 @@
}
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
@@ -1349,7 +1393,7 @@
@@ -1377,7 +1421,7 @@
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
public EntityTracker(Entity entity, int i, int j, boolean flag) {
@ -133,7 +133,7 @@
this.entity = entity;
this.range = i;
this.lastSectionPos = SectionPosition.of(entity);
@@ -1402,12 +1446,20 @@
@@ -1430,12 +1474,20 @@
public void updatePlayer(EntityPlayer entityplayer) {
if (entityplayer != this.entity) {

Datei anzeigen

@ -471,7 +471,7 @@
++j;
}
}
@@ -1101,7 +1282,7 @@
@@ -1102,7 +1283,7 @@
@Nullable
public BlockPosition findNearestMapFeature(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
@ -480,7 +480,7 @@
}
@Nullable
@@ -1138,11 +1319,21 @@
@@ -1139,11 +1320,21 @@
@Nullable
@Override
public WorldMap getMapData(String s) {
@ -503,7 +503,7 @@
this.getServer().overworld().getDataStorage().set(s, worldmap);
}
@@ -1454,6 +1645,11 @@
@@ -1455,6 +1646,11 @@
@Override
public void blockUpdated(BlockPosition blockposition, Block block) {
if (!this.isDebug()) {
@ -515,7 +515,7 @@
this.updateNeighborsAt(blockposition, block);
}
@@ -1473,12 +1669,12 @@
@@ -1474,12 +1670,12 @@
}
public boolean isFlat() {
@ -530,7 +530,7 @@
}
@Nullable
@@ -1506,7 +1702,7 @@
@@ -1507,7 +1703,7 @@
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
try {
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
@ -539,7 +539,7 @@
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1515,7 +1711,7 @@
@@ -1516,7 +1712,7 @@
object2intopenhashmap.addTo(s, 1);
}
@ -548,7 +548,7 @@
String s1 = (String) entry.getKey();
return s1 + ":" + entry.getIntValue();
@@ -1526,17 +1722,33 @@
@@ -1527,17 +1723,33 @@
}
public static void makeObsidianPlatform(WorldServer worldserver) {
@ -584,7 +584,7 @@
}
@Override
@@ -1629,6 +1841,7 @@
@@ -1632,6 +1844,7 @@
}
}
@ -592,7 +592,7 @@
}
public void onTrackingEnd(Entity entity) {
@@ -1661,6 +1874,7 @@
@@ -1664,6 +1877,7 @@
gameeventlistenerregistrar.onListenerRemoved(entity.level);
}

Datei anzeigen

@ -1,47 +0,0 @@
--- a/net/minecraft/util/InclusiveRange.java
+++ b/net/minecraft/util/InclusiveRange.java
@@ -4,19 +4,23 @@
import com.mojang.serialization.DataResult;
import java.util.function.Function;
-public final class InclusiveRange extends Record {
+// CraftBukkit start - decompile error
+public final record InclusiveRange<T extends Comparable<T>>(T minInclusive, T maxInclusive) {
+ /*
private final T minInclusive;
private final T maxInclusive;
+ */
public static final Codec<InclusiveRange<Integer>> INT = codec(Codec.INT);
- public InclusiveRange(T t0, T t1) {
- if (t0.compareTo(t1) > 0) {
+ public InclusiveRange(T minInclusive, T maxInclusive) {
+ if (minInclusive.compareTo(maxInclusive) > 0) {
throw new IllegalArgumentException("min_inclusive must be less than or equal to max_inclusive");
} else {
- this.minInclusive = t0;
- this.maxInclusive = t1;
+ this.minInclusive = minInclusive;
+ this.maxInclusive = maxInclusive;
}
+ // CraftBukkit end
}
public static <T extends Comparable<T>> Codec<InclusiveRange<T>> codec(Codec<T> codec) {
@@ -47,6 +51,8 @@
return "[" + this.minInclusive + ", " + this.maxInclusive + "]";
}
+ // CraftBukkit start
+ /*
public final int hashCode() {
return this.hashCode < invokedynamic > (this);
}
@@ -62,4 +68,6 @@
public T maxInclusive() {
return this.maxInclusive;
}
+ */
+ // CraftBukkit end
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -117,8 +117,59 @@
@@ -116,8 +116,59 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -60,7 +60,7 @@
protected static final Logger LOGGER = LogManager.getLogger();
public static final String ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers";
@@ -229,6 +280,22 @@
@@ -228,6 +279,22 @@
public boolean hasVisualFire;
@Nullable
private IBlockData feetBlockState;
@ -83,7 +83,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -366,6 +433,12 @@
@@ -365,6 +432,12 @@
public void onClientRemoval() {}
public void setPose(EntityPose entitypose) {
@ -96,7 +96,7 @@
this.entityData.set(Entity.DATA_POSE, entitypose);
}
@@ -382,6 +455,33 @@
@@ -381,6 +454,33 @@
}
protected void setRot(float f, float f1) {
@ -130,7 +130,7 @@
this.setYRot(f % 360.0F);
this.setXRot(f1 % 360.0F);
}
@@ -423,6 +523,15 @@
@@ -422,6 +522,15 @@
this.baseTick();
}
@ -145,7 +145,7 @@
+
public void baseTick() {
this.level.getProfiler().push("entityBaseTick");
if (this.isPassenger() && this.getVehicle().isRemoved()) {
this.feetBlockState = null;
@@ -436,7 +545,7 @@
this.walkDistO = this.walkDist;
this.xRotO = this.getXRot();
@ -232,16 +232,7 @@
if (this.onGround && !this.isSteppingCarefully()) {
block.stepOn(this.level, blockposition, iblockdata, this);
}
@@ -846,7 +1009,7 @@
boolean flag4 = flag && flag1 || flag && flag2 || flag1 && flag2;
if (flag4) {
- List<VoxelShape> list1 = flag3 ? ImmutableList.builderWithExpectedSize(list.size() + 1).addAll(list).add(worldborder.getCollisionShape()).build() : list;
+ List<VoxelShape> list1 = flag3 ? ImmutableList.<VoxelShape>builderWithExpectedSize(list.size() + 1).addAll(list).add(worldborder.getCollisionShape()).build() : list; // CraftBukkit - decompile error
return collideBoundingBox(vec3d, axisalignedbb, world, voxelshapecollision, (List) list1);
} else {
@@ -1306,6 +1469,7 @@
@@ -1260,6 +1423,7 @@
this.yo = d1;
this.zo = d4;
this.setPos(d3, d1, d4);
@ -249,7 +240,7 @@
}
public void moveTo(Vec3D vec3d) {
@@ -1496,6 +1660,12 @@
@@ -1450,6 +1614,12 @@
return false;
}
@ -262,7 +253,7 @@
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
@@ -1529,7 +1699,7 @@
@@ -1483,7 +1653,7 @@
} else {
String s = this.getEncodeId();
@ -271,7 +262,7 @@
return false;
} else {
nbttagcompound.putString("id", s);
@@ -1554,6 +1724,18 @@
@@ -1508,6 +1678,18 @@
Vec3D vec3d = this.getDeltaMovement();
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
@ -290,7 +281,7 @@
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
nbttagcompound.putFloat("FallDistance", this.fallDistance);
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
@@ -1562,6 +1744,18 @@
@@ -1516,6 +1698,18 @@
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
nbttagcompound.putUUID("UUID", this.getUUID());
@ -309,7 +300,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1629,6 +1823,11 @@
@@ -1583,6 +1777,11 @@
}
}
@ -321,7 +312,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -1710,6 +1909,49 @@
@@ -1664,6 +1863,49 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@ -371,7 +362,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
@@ -1785,9 +2027,22 @@
@@ -1739,9 +1981,22 @@
} else if (this.level.isClientSide) {
return null;
} else {
@ -394,7 +385,7 @@
this.level.addFreshEntity(entityitem);
return entityitem;
}
@@ -1882,7 +2137,7 @@
@@ -1836,7 +2091,7 @@
this.setPose(EntityPose.STANDING);
this.vehicle = entity;
@ -403,7 +394,7 @@
entity.getIndirectPassengersStream().filter((entity2) -> {
return entity2 instanceof EntityPlayer;
}).forEach((entity2) -> {
@@ -1913,7 +2168,7 @@
@@ -1867,7 +2122,7 @@
Entity entity = this.vehicle;
this.vehicle = null;
@ -412,7 +403,7 @@
}
}
@@ -1922,10 +2177,31 @@
@@ -1876,10 +2131,31 @@
this.removeVehicle();
}
@ -445,7 +436,7 @@
if (this.passengers.isEmpty()) {
this.passengers = ImmutableList.of(entity);
} else {
@@ -1941,12 +2217,32 @@
@@ -1895,12 +2171,32 @@
}
}
@ -479,7 +470,7 @@
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
this.passengers = ImmutableList.of();
} else {
@@ -1957,6 +2253,7 @@
@@ -1911,6 +2207,7 @@
entity.boardingCooldown = 60;
}
@ -487,7 +478,7 @@
}
protected boolean canAddPassenger(Entity entity) {
@@ -2007,14 +2304,20 @@
@@ -1961,14 +2258,20 @@
if (this.isInsidePortal) {
MinecraftServer minecraftserver = worldserver.getServer();
@ -511,7 +502,7 @@
this.level.getProfiler().pop();
}
@@ -2132,6 +2435,13 @@
@@ -2086,6 +2389,13 @@
}
public void setSwimming(boolean flag) {
@ -525,7 +516,7 @@
this.setSharedFlag(4, flag);
}
@@ -2180,8 +2490,12 @@
@@ -2134,8 +2444,12 @@
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
}
@ -539,7 +530,7 @@
}
public boolean getSharedFlag(int i) {
@@ -2208,7 +2522,17 @@
@@ -2162,7 +2476,17 @@
}
public void setAirSupply(int i) {
@ -558,7 +549,7 @@
}
public int getTicksFrozen() {
@@ -2235,11 +2559,41 @@
@@ -2189,11 +2513,41 @@
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
this.setRemainingFireTicks(this.remainingFireTicks + 1);
@ -602,7 +593,7 @@
}
public void onAboveBubbleCol(boolean flag) {
@@ -2393,15 +2747,32 @@
@@ -2349,15 +2703,32 @@
@Nullable
public Entity changeDimension(WorldServer worldserver) {
@ -637,7 +628,7 @@
this.level.getProfiler().popPush("reloading");
Entity entity = this.getType().create(worldserver);
@@ -2410,9 +2781,17 @@
@@ -2366,9 +2737,17 @@
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
entity.setDeltaMovement(shapedetectorshape.speed);
worldserver.addDuringTeleport(entity);
@ -657,7 +648,7 @@
}
this.removeAfterChangingDimensions();
@@ -2433,20 +2812,33 @@
@@ -2389,20 +2768,33 @@
@Nullable
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
@ -696,7 +687,7 @@
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d;
@@ -2463,8 +2855,8 @@
@@ -2419,8 +2811,8 @@
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
}
@ -707,7 +698,7 @@
}
} else {
BlockPosition blockposition1;
@@ -2474,8 +2866,15 @@
@@ -2430,8 +2822,15 @@
} else {
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
}
@ -724,7 +715,7 @@
}
}
@@ -2483,8 +2882,23 @@
@@ -2439,8 +2838,23 @@
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
}
@ -750,7 +741,7 @@
}
public boolean canChangeDimensions() {
@@ -2693,7 +3107,26 @@
@@ -2649,7 +3063,26 @@
}
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {

Datei anzeigen

@ -857,34 +857,34 @@
@Override
protected void markHurt() {
this.hurtMarked = this.random.nextDouble() >= this.getAttributeValue(GenericAttributes.KNOCKBACK_RESISTANCE);
@@ -3106,7 +3548,25 @@
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.triggerItemUseEffects(this.useItem, 16);
- ItemStack itemstack = this.useItem.finishUsingItem(this.level, this);
+ // CraftBukkit start - fire PlayerItemConsumeEvent
+ ItemStack itemstack;
+ if (this instanceof EntityPlayer) {
+ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem);
+ PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem);
+ level.getCraftServer().getPluginManager().callEvent(event);
@@ -3107,7 +3549,25 @@
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.triggerItemUseEffects(this.useItem, 16);
- ItemStack itemstack = this.useItem.finishUsingItem(this.level, this);
+ // CraftBukkit start - fire PlayerItemConsumeEvent
+ ItemStack itemstack;
+ if (this instanceof EntityPlayer) {
+ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem);
+ PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem);
+ level.getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ // Update client
+ ((EntityPlayer) this).getBukkitEntity().updateInventory();
+ ((EntityPlayer) this).getBukkitEntity().updateScaledHealth();
+ return;
+ if (event.isCancelled()) {
+ // Update client
+ ((EntityPlayer) this).getBukkitEntity().updateInventory();
+ ((EntityPlayer) this).getBukkitEntity().updateScaledHealth();
+ return;
+ }
+
+ itemstack = (craftItem.equals(event.getItem())) ? this.useItem.finishUsingItem(this.level, this) : CraftItemStack.asNMSCopy(event.getItem()).finishUsingItem(level, this);
+ } else {
+ itemstack = this.useItem.finishUsingItem(this.level, this);
+ }
+
+ itemstack = (craftItem.equals(event.getItem())) ? this.useItem.finishUsingItem(this.level, this) : CraftItemStack.asNMSCopy(event.getItem()).finishUsingItem(level, this);
+ } else {
+ itemstack = this.useItem.finishUsingItem(this.level, this);
+ }
+ // CraftBukkit end
+ // CraftBukkit end
if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack);
@@ -3178,6 +3638,12 @@
if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack);
@@ -3180,6 +3640,12 @@
}
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
@ -897,7 +897,7 @@
double d3 = this.getX();
double d4 = this.getY();
double d5 = this.getZ();
@@ -3202,16 +3668,41 @@
@@ -3204,16 +3670,41 @@
}
if (flag2) {
@ -942,7 +942,7 @@
} else {
if (flag) {
world.broadcastEntityEvent(this, (byte) 46);
@@ -3221,7 +3712,7 @@
@@ -3223,7 +3714,7 @@
((EntityCreature) this).getNavigation().stop();
}
@ -951,7 +951,7 @@
}
}
@@ -3304,7 +3795,7 @@
@@ -3306,7 +3797,7 @@
}
public void stopSleeping() {
@ -960,7 +960,7 @@
World world = this.level;
java.util.Objects.requireNonNull(this.level);
@@ -3336,7 +3827,7 @@
@@ -3338,7 +3829,7 @@
@Nullable
public EnumDirection getBedOrientation() {
@ -969,7 +969,7 @@
return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null;
}
@@ -3385,7 +3876,7 @@
@@ -3387,7 +3878,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
@ -978,24 +978,23 @@
}
}
}
@@ -3488,8 +3979,10 @@
@@ -3490,8 +3981,10 @@
this.setDeltaMovement((double) ((float) packetplayoutspawnentityliving.getXd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getYd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getZd() / 8000.0F));
}
- public static final class a extends Record {
+ // CraftBukkit start
+ public static final record a(SoundEffect small, SoundEffect big) {
- public static record a(SoundEffect a, SoundEffect b) {
+ // CraftBukkit start - decompile error
+ public static record a(SoundEffect small, SoundEffect big) {
+ /*
private final SoundEffect small;
private final SoundEffect big;
@@ -3509,6 +4002,8 @@
public final boolean equals(Object object) {
return this.equals<invokedynamic>(this, object);
@@ -3507,5 +4000,7 @@
public SoundEffect big() {
return this.big;
}
+ */
+ // CraftBukkit end
public SoundEffect small() {
return this.small;
}
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java
@@ -62,7 +62,7 @@
@@ -67,7 +67,7 @@
@Override
public void start() {

Datei anzeigen

@ -15,7 +15,7 @@
public interface Bucketable {
boolean fromBucket();
@@ -92,10 +100,22 @@
@@ -94,10 +102,22 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.getItem() == Items.WATER_BUCKET && t0.isAlive()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntitySnowman.java
+++ b/net/minecraft/world/entity/animal/EntitySnowman.java
@@ -40,6 +40,10 @@
@@ -41,6 +41,10 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.Vec3D;
@ -11,25 +11,25 @@
public class EntitySnowman extends EntityGolem implements IShearable, IRangedEntity {
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
@@ -100,7 +104,7 @@
int k = MathHelper.floor(this.getZ());
@@ -103,7 +107,7 @@
BiomeBase biomebase = this.level.getBiome(blockposition);
if (this.level.getBiome(new BlockPosition(i, 0, k)).getTemperature(new BlockPosition(i, j, k)) > 1.0F) {
if (biomebase.shouldSnowGolemBurn(blockposition)) {
- this.hurt(DamageSource.ON_FIRE, 1.0F);
+ this.hurt(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
if (!this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
@@ -116,7 +120,7 @@
BlockPosition blockposition = new BlockPosition(i, j, k);
@@ -119,7 +123,7 @@
BlockPosition blockposition1 = new BlockPosition(i, j, k);
if (this.level.getBlockState(blockposition).isAir() && this.level.getBiome(blockposition).getTemperature(blockposition) < 0.8F && iblockdata.canSurvive(this.level, blockposition)) {
- this.level.setBlockAndUpdate(blockposition, iblockdata);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition, iblockdata, this); // CraftBukkit
if (this.level.getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level, blockposition1)) {
- this.level.setBlockAndUpdate(blockposition1, iblockdata);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition1, iblockdata, this); // CraftBukkit
}
}
}
@@ -147,6 +151,11 @@
@@ -150,6 +154,11 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
@ -41,7 +41,7 @@
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, (Entity) entityhuman);
if (!this.level.isClientSide) {
@@ -166,7 +175,9 @@
@@ -169,7 +178,9 @@
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
if (!this.level.isClientSide()) {
this.setPumpkin(false);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityPhantom.java
+++ b/net/minecraft/world/entity/monster/EntityPhantom.java
@@ -523,14 +523,14 @@
@@ -533,14 +533,14 @@
List<EntityHuman> list = EntityPhantom.this.level.getNearbyPlayers(this.attackTargeting, EntityPhantom.this, EntityPhantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
if (!list.isEmpty()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityRavager.java
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
@@ -168,7 +168,7 @@
@@ -170,7 +170,7 @@
IBlockData iblockdata = this.level.getBlockState(blockposition);
Block block = iblockdata.getBlock();

Datei anzeigen

@ -14,7 +14,7 @@
public class ItemBlock extends Item {
private static final String BLOCK_ENTITY_TAG = "BlockEntityTag";
@@ -68,6 +75,12 @@
@@ -69,6 +76,12 @@
return EnumInteractionResult.FAIL;
} else {
IBlockData iblockdata = this.getPlacementState(blockactioncontext1);
@ -27,7 +27,7 @@
if (iblockdata == null) {
return EnumInteractionResult.FAIL;
@@ -84,6 +97,19 @@
@@ -85,6 +98,19 @@
iblockdata1 = this.updateBlockStateFromTag(blockposition, world, itemstack, iblockdata1);
this.updateCustomBlockEntityTag(blockposition, world, entityhuman, itemstack, iblockdata1);
iblockdata1.getBlock().setPlacedBy(world, blockposition, iblockdata1, entityhuman, itemstack);
@ -47,7 +47,7 @@
if (entityhuman instanceof EntityPlayer) {
CriterionTriggers.PLACED_BLOCK.trigger((EntityPlayer) entityhuman, blockposition, itemstack);
}
@@ -91,9 +117,9 @@
@@ -92,9 +118,9 @@
SoundEffectType soundeffecttype = iblockdata1.getSoundType();
@ -59,7 +59,7 @@
itemstack.shrink(1);
}
@@ -129,6 +155,21 @@
@@ -130,6 +156,21 @@
if (nbttagcompound != null) {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("BlockStateTag");
@ -81,7 +81,7 @@
BlockStateList<Block, IBlockData> blockstatelist = iblockdata.getBlock().getStateDefinition();
Iterator iterator = nbttagcompound1.getAllKeys().iterator();
@@ -143,11 +184,6 @@
@@ -144,11 +185,6 @@
}
}
}
@ -93,7 +93,7 @@
return iblockdata1;
}
@@ -160,8 +196,15 @@
@@ -161,8 +197,15 @@
protected boolean canPlace(BlockActionContext blockactioncontext, IBlockData iblockdata) {
EntityHuman entityhuman = blockactioncontext.getPlayer();
VoxelShapeCollision voxelshapecollision = entityhuman == null ? VoxelShapeCollision.empty() : VoxelShapeCollision.of(entityhuman);
@ -110,7 +110,7 @@
}
protected boolean mustSurvive() {
@@ -244,7 +287,7 @@
@@ -245,7 +288,7 @@
if (nbttagcompound != null && nbttagcompound.contains("Items", 9)) {
NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);

Datei anzeigen

@ -41,7 +41,7 @@
public final class ItemStack {
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
@@ -139,16 +173,30 @@
@@ -140,16 +174,30 @@
this.updateEmptyCacheFlag();
}
@ -74,7 +74,7 @@
this.getItem().verifyTagAfterLoad(this.tag);
}
@@ -156,6 +204,11 @@
@@ -157,6 +205,11 @@
this.setDamageValue(this.getDamageValue());
}
@ -86,7 +86,7 @@
this.updateEmptyCacheFlag();
}
@@ -193,7 +246,7 @@
@@ -194,7 +247,7 @@
return this.getItem() == item;
}
@ -95,7 +95,7 @@
EntityHuman entityhuman = itemactioncontext.getPlayer();
BlockPosition blockposition = itemactioncontext.getClickedPos();
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getLevel(), blockposition, false);
@@ -201,12 +254,157 @@
@@ -202,12 +255,157 @@
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().getTagManager(), shapedetectorblock)) {
return EnumInteractionResult.PASS;
} else {
@ -254,7 +254,7 @@
return enuminteractionresult;
}
@@ -287,6 +485,21 @@
@@ -288,6 +486,21 @@
}
i -= k;
@ -276,7 +276,7 @@
if (i <= 0) {
return false;
}
@@ -308,6 +521,11 @@
@@ -309,6 +522,11 @@
if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
consumer.accept(t0);
Item item = this.getItem();
@ -288,7 +288,7 @@
this.shrink(1);
if (t0 instanceof EntityHuman) {
@@ -463,6 +681,17 @@
@@ -464,6 +682,17 @@
return this.tag;
}
@ -306,7 +306,7 @@
public NBTTagCompound getOrCreateTag() {
if (this.tag == null) {
this.setTag(new NBTTagCompound());
@@ -843,6 +1072,12 @@
@@ -844,6 +1073,12 @@
}
public void setRepairCost(int i) {
@ -319,7 +319,7 @@
this.getOrCreateTag().putInt("RepairCost", i);
}
@@ -892,6 +1127,13 @@
@@ -893,6 +1128,13 @@
nbttaglist.add(nbttagcompound);
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/crafting/CraftingManager.java
+++ b/net/minecraft/world/item/crafting/CraftingManager.java
@@ -34,11 +34,13 @@
@@ -33,11 +33,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -12,9 +12,9 @@
private static final Logger LOGGER = LogManager.getLogger();
- public Map<Recipes<?>, Map<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of();
+ public Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of(); // CraftBukkit
private Map<MinecraftKey, IRecipe<?>> byName = ImmutableMap.of();
private boolean hasErrors;
public CraftingManager() {
@@ -47,7 +49,12 @@
protected void apply(Map<MinecraftKey, JsonElement> map, IResourceManager iresourcemanager, GameProfilerFiller gameprofilerfiller) {
@ -26,10 +26,10 @@
+ map1.put(recipeType, new Object2ObjectLinkedOpenHashMap<>());
+ }
+ // CraftBukkit end
Builder<MinecraftKey, IRecipe<?>> builder = ImmutableMap.builder();
Iterator iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
@@ -57,8 +64,10 @@
@@ -58,8 +65,10 @@
try {
IRecipe<?> irecipe = fromJson(minecraftkey, ChatDeserializer.convertToJsonObject((JsonElement) entry.getValue(), "top element"));
@ -40,15 +40,17 @@
+ return new Object2ObjectLinkedOpenHashMap<>();
+ // CraftBukkit end
})).put(minecraftkey, irecipe);
builder.put(minecraftkey, irecipe);
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
CraftingManager.LOGGER.error("Parsing error loading recipe {}", minecraftkey, jsonparseexception);
@@ -66,19 +75,35 @@
@@ -68,20 +77,37 @@
}
this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> {
- return ((Builder) entry1.getValue()).build();
+ return (entry1.getValue()); // CraftBukkit
}));
- this.byName = builder.build();
+ this.byName = Maps.newHashMap(builder.build()); // CraftBukkit
CraftingManager.LOGGER.info("Loaded {} recipes", map1.size());
}
@ -56,10 +58,11 @@
+ public void addRecipe(IRecipe<?> irecipe) {
+ Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> map = this.recipes.get(irecipe.getType()); // CraftBukkit
+
+ if (map.containsKey(irecipe.getId())) {
+ if (byName.containsKey(irecipe.getId()) || map.containsKey(irecipe.getId())) {
+ throw new IllegalStateException("Duplicate recipe ignored with ID " + irecipe.getId());
+ } else {
+ map.putAndMoveToFirst(irecipe.getId(), irecipe); // CraftBukkit - SPIGOT-4638: last recipe gets priority
+ byName.put(irecipe.getId(), irecipe);
+ }
+ }
+ // CraftBukkit end
@ -80,7 +83,7 @@
}
public <C extends IInventory, T extends IRecipe<C>> List<T> getAllRecipesFor(Recipes<T> recipes) {
@@ -96,7 +121,7 @@
@@ -99,7 +125,7 @@
}
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> byType(Recipes<T> recipes) {
@ -89,33 +92,37 @@
}
public <C extends IInventory, T extends IRecipe<C>> NonNullList<ItemStack> getRemainingItemsFor(Recipes<T> recipes, C c0, World world) {
@@ -117,7 +142,7 @@
public Optional<? extends IRecipe<?>> byKey(MinecraftKey minecraftkey) {
return this.recipes.values().stream().map((map) -> {
- return (IRecipe) map.get(minecraftkey);
+ return map.get(minecraftkey); // CraftBukkit - decompile error
}).filter(Objects::nonNull).findFirst();
@@ -119,7 +145,7 @@
}
@@ -143,11 +168,11 @@
public Optional<? extends IRecipe<?>> byKey(MinecraftKey minecraftkey) {
- return Optional.ofNullable((IRecipe) this.byName.get(minecraftkey));
+ return Optional.ofNullable(this.byName.get(minecraftkey)); // CraftBukkit - decompile error
}
public Collection<IRecipe<?>> getRecipes() {
@@ -144,12 +170,12 @@
public void replaceRecipes(Iterable<IRecipe<?>> iterable) {
this.hasErrors = false;
- Map<Recipes<?>, Map<MinecraftKey, IRecipe<?>>> map = Maps.newHashMap();
+ Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> map = Maps.newHashMap(); // CraftBukkit
Builder<MinecraftKey, IRecipe<?>> builder = ImmutableMap.builder();
iterable.forEach((irecipe) -> {
Map<MinecraftKey, IRecipe<?>> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes) -> {
- return Maps.newHashMap();
+ return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit
});
IRecipe<?> irecipe1 = (IRecipe) map1.put(irecipe.getId(), irecipe);
@@ -157,4 +182,14 @@
MinecraftKey minecraftkey = irecipe.getId();
IRecipe<?> irecipe1 = (IRecipe) map1.put(minecraftkey, irecipe);
@@ -160,6 +186,18 @@
}
});
this.recipes = ImmutableMap.copyOf(map);
}
- this.byName = builder.build();
+ this.byName = Maps.newHashMap(builder.build()); // CraftBukkit
+ }
+
+ // CraftBukkit start
+ public void clearRecipes() {
@ -124,6 +131,8 @@
+ for (Recipes<?> recipeType : IRegistry.RECIPE_TYPE) {
+ this.recipes.put(recipeType, new Object2ObjectLinkedOpenHashMap<>());
+ }
+ }
+
+ this.byName = Maps.newHashMap();
}
+ // CraftBukkit end
}

Datei anzeigen

@ -6,12 +6,12 @@
- private default <T> NextTickListEntry<T> createTick(BlockPosition blockposition, T t0, int i, TickListPriority ticklistpriority) {
+ default <T> NextTickListEntry<T> createTick(BlockPosition blockposition, T t0, int i, TickListPriority ticklistpriority) { // CraftBukkit - decompile error
return new NextTickListEntry(t0, blockposition, this.getLevelData().getGameTime() + (long) i, ticklistpriority, this.nextSubTickCount());
return new NextTickListEntry<>(t0, blockposition, this.getLevelData().getGameTime() + (long) i, ticklistpriority, this.nextSubTickCount());
}
- private default <T> NextTickListEntry<T> createTick(BlockPosition blockposition, T t0, int i) {
+ default <T> NextTickListEntry<T> createTick(BlockPosition blockposition, T t0, int i) { // CraftBukkit - decompile error
return new NextTickListEntry(t0, blockposition, this.getLevelData().getGameTime() + (long) i, this.nextSubTickCount());
return new NextTickListEntry<>(t0, blockposition, this.getLevelData().getGameTime() + (long) i, this.nextSubTickCount());
}
@@ -102,4 +102,6 @@

Datei anzeigen

@ -49,7 +49,7 @@
return nbttagcompound;
}
@@ -201,4 +225,15 @@
@@ -202,4 +226,15 @@
public void setBlockState(IBlockData iblockdata) {
this.blockState = iblockdata;
}

Datei anzeigen

@ -1,63 +0,0 @@
--- a/net/minecraft/world/level/block/state/properties/IBlockState.java
+++ b/net/minecraft/world/level/block/state/properties/IBlockState.java
@@ -21,7 +21,7 @@
protected IBlockState(String s, Class<T> oclass) {
this.codec = Codec.STRING.comapFlatMap((s1) -> {
- return (DataResult) this.getValue(s1).map(DataResult::success).orElseGet(() -> {
+ return this.getValue(s1).map(DataResult::success).orElseGet(() -> { // CraftBukkit - decompile error
return DataResult.error("Unable to read property: " + this + " with value: " + s1);
});
}, this::getName);
@@ -96,23 +96,27 @@
DataResult<T> dataresult = this.codec.parse(dynamicops, u0);
return dataresult.map((comparable) -> {
- return (IBlockDataHolder) s0.setValue(this, comparable);
+ return s0.setValue(this, comparable); // CraftBukkit - decompile error
}).setPartial(s0);
}
- public static final class a extends Record {
+ // CraftBukkit start
+ public static final record a<T extends Comparable<T>>(IBlockState<T> property, T value) {
+ /*
private final IBlockState<T> property;
private final T value;
+ */
- public a(IBlockState<T> iblockstate, T t0) {
- if (!iblockstate.getPossibleValues().contains(t0)) {
- throw new IllegalArgumentException("Value " + t0 + " does not belong to property " + iblockstate);
+ public a(IBlockState<T> property, T value) {
+ if (!property.getPossibleValues().contains(value)) {
+ throw new IllegalArgumentException("Value " + value + " does not belong to property " + property);
} else {
- this.property = iblockstate;
- this.value = t0;
+ this.property = property;
+ this.value = value;
}
}
+ // CraftBukkit end
public String toString() {
String s = this.property.getName();
@@ -120,6 +124,8 @@
return s + "=" + this.property.getName(this.value);
}
+ // CraftBukkit start
+ /*
public final int hashCode() {
return this.hashCode < invokedynamic > (this);
}
@@ -135,5 +141,7 @@
public T value() {
return this.value;
}
+ */
+ // CraftBukkit end
}
}

Datei anzeigen

@ -76,7 +76,7 @@
iblockdata.onPlace(this.level, blockposition, iblockdata1, flag);
}
@@ -323,7 +346,12 @@
@@ -324,7 +347,12 @@
@Nullable
public TileEntity getBlockEntity(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
@ -90,7 +90,7 @@
if (tileentity == null) {
NBTTagCompound nbttagcompound = (NBTTagCompound) this.pendingBlockEntities.remove(blockposition);
@@ -394,6 +422,13 @@
@@ -395,6 +423,13 @@
tileentity1.setRemoved();
}
@ -104,7 +104,7 @@
}
}
@@ -423,6 +458,12 @@
@@ -424,6 +459,12 @@
if (this.isInLevel()) {
TileEntity tileentity = (TileEntity) this.blockEntities.remove(blockposition);
@ -117,7 +117,7 @@
if (tileentity != null) {
this.removeGameEventListener(tileentity);
tileentity.setRemoved();
@@ -470,6 +511,55 @@
@@ -471,6 +512,55 @@
}
@ -173,7 +173,7 @@
public boolean isEmpty() {
return false;
}
@@ -658,7 +748,7 @@
@@ -659,7 +749,7 @@
private <T extends TileEntity> void updateBlockEntityTicker(T t0) {
IBlockData iblockdata = t0.getBlockState();
@ -182,7 +182,7 @@
if (blockentityticker == null) {
this.removeBlockEntityTicker(t0.getBlockPos());
@@ -751,7 +841,7 @@
@@ -752,7 +842,7 @@
private boolean loggedInvalidBlockState;
a(TileEntity tileentity, BlockEntityTicker blockentityticker) {
@ -191,7 +191,7 @@
this.ticker = blockentityticker;
}
@@ -774,7 +864,7 @@
@@ -775,7 +865,7 @@
this.loggedInvalidBlockState = true;
Chunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new org.apache.logging.log4j.util.Supplier[]{this::getType, this::getPos, () -> {
return iblockdata;

Datei anzeigen

@ -27,7 +27,7 @@
Optional optional = iregistry1.getResourceKey(structuregenerator).map(Object::toString);
Objects.requireNonNull(structuregenerator);
@@ -364,6 +364,33 @@
@@ -363,6 +363,33 @@
}
}
@ -48,7 +48,7 @@
+ int x = ichunkaccess.getPos().x;
+ int z = ichunkaccess.getPos().z;
+ for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) {
+ SeededRandom seededrandom = new SeededRandom(new LegacyRandomSource(generatoraccessseed.getSeed()));
+ SeededRandom seededrandom = new SeededRandom(new net.minecraft.world.level.levelgen.LegacyRandomSource(generatoraccessseed.getSeed()));
+ seededrandom.setDecorationSeed(generatoraccessseed.getSeed(), x, z);
+ populator.populate(world, seededrandom, x, z, limitedRegion);
+ }
@ -61,7 +61,7 @@
private static StructureBoundingBox getWritableArea(IChunkAccess ichunkaccess) {
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
int i = chunkcoordintpair.getMinBlockX();
@@ -439,7 +466,7 @@
@@ -438,7 +465,7 @@
Entry<StructureFeature<?, ?>, Collection<ResourceKey<BiomeBase>>> entry = (Entry) unmodifiableiterator.next();

Datei anzeigen

@ -1,152 +0,0 @@
--- a/net/minecraft/world/level/chunk/DataPaletteBlock.java
+++ b/net/minecraft/world/level/chunk/DataPaletteBlock.java
@@ -54,7 +54,7 @@
}
public static <T> Codec<DataPaletteBlock<T>> codec(Registry<T> registry, Codec<T> codec, DataPaletteBlock.e datapaletteblock_e, T t0) {
- return RecordCodecBuilder.create((instance) -> {
+ return RecordCodecBuilder.<DataPaletteBlock.d<T>>create((instance) -> { // CraftBukkit - decompile error
return instance.group(codec.mapResult(ExtraCodecs.orElsePartial(t0)).listOf().fieldOf("palette").forGetter(DataPaletteBlock.d::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(DataPaletteBlock.d::storage)).apply(instance, DataPaletteBlock.d::new);
}).comapFlatMap((datapaletteblock_d) -> {
return read(registry, datapaletteblock_e, datapaletteblock_d);
@@ -97,7 +97,7 @@
public T getAndSet(int i, int j, int k, T t0) {
this.acquire();
- Object object;
+ T object; // CraftBukkit - decompile error
try {
object = this.getAndSet(this.strategy.getIndex(i, j, k), t0);
@@ -309,19 +309,19 @@
switch (i) {
case 0:
- datapaletteblock_a = new DataPaletteBlock.a<>(null.SINGLE_VALUE_PALETTE_FACTORY, i);
+ datapaletteblock_a = new DataPaletteBlock.a<>(SINGLE_VALUE_PALETTE_FACTORY, i); // CraftBukkit - decompile error
break;
case 1:
case 2:
case 3:
case 4:
- datapaletteblock_a = new DataPaletteBlock.a<>(null.LINEAR_PALETTE_FACTORY, 4);
+ datapaletteblock_a = new DataPaletteBlock.a<>(LINEAR_PALETTE_FACTORY, 4); // CraftBukkit - decompile error
break;
case 5:
case 6:
case 7:
case 8:
- datapaletteblock_a = new DataPaletteBlock.a<>(null.HASHMAP_PALETTE_FACTORY, i);
+ datapaletteblock_a = new DataPaletteBlock.a<>(HASHMAP_PALETTE_FACTORY, i); // CraftBukkit - decompile error
break;
default:
datapaletteblock_a = new DataPaletteBlock.a<>(DataPaletteBlock.e.GLOBAL_PALETTE_FACTORY, MathHelper.ceillog2(registry.size()));
@@ -337,12 +337,12 @@
switch (i) {
case 0:
- datapaletteblock_a = new DataPaletteBlock.a<>(null.SINGLE_VALUE_PALETTE_FACTORY, i);
+ datapaletteblock_a = new DataPaletteBlock.a<>(SINGLE_VALUE_PALETTE_FACTORY, i); // CraftBukkit - decompile error
break;
case 1:
case 2:
case 3:
- datapaletteblock_a = new DataPaletteBlock.a<>(null.LINEAR_PALETTE_FACTORY, i);
+ datapaletteblock_a = new DataPaletteBlock.a<>(LINEAR_PALETTE_FACTORY, i); // CraftBukkit - decompile error
break;
default:
datapaletteblock_a = new DataPaletteBlock.a<>(DataPaletteBlock.e.GLOBAL_PALETTE_FACTORY, MathHelper.ceillog2(registry.size()));
@@ -375,8 +375,10 @@
}
}
- private static final class a<T> extends Record {
+ // CraftBukkit start
+ private static final record a<T>(DataPalette.a factory, int bits) {
+ /*
private final DataPalette.a factory;
private final int bits;
@@ -384,6 +386,8 @@
this.factory = datapalette_a;
this.bits = i;
}
+ */
+ // CraftBukkit end
public DataPaletteBlock.c<T> createData(Registry<T> registry, DataPaletteExpandable<T> datapaletteexpandable, int i) {
Object object = this.bits == 0 ? new ZeroBitStorage(i) : new SimpleBitStorage(this.bits, i);
@@ -392,6 +396,8 @@
return new DataPaletteBlock.c(this, (DataBits) object, datapalette);
}
+ // CraftBukkit start
+ /*
public final String toString() {
return this.toString < invokedynamic > (this);
}
@@ -403,6 +409,8 @@
public final boolean equals(Object object) {
return this.equals<invokedynamic>(this, object);
}
+ */
+ // CraftBukkit end
public DataPalette.a factory() {
return this.factory;
@@ -413,8 +421,10 @@
}
}
- private static final class c extends Record {
+ // CraftBukkit start
+ private static final record c<T>(DataPaletteBlock.a<T> configuration, DataBits storage, DataPalette<T> palette) {
+ /*
private final DataPaletteBlock.a<T> configuration;
final DataBits storage;
final DataPalette<T> palette;
@@ -424,6 +434,8 @@
this.storage = databits;
this.palette = datapalette;
}
+ */
+ // CraftBukkit end
public void copyFrom(DataPalette<T> datapalette, DataBits databits) {
for (int i = 0; i < databits.getSize(); ++i) {
@@ -444,6 +456,8 @@
packetdataserializer.writeLongArray(this.storage.getRaw());
}
+ // CraftBukkit start
+ /*
public final String toString() {
return this.toString < invokedynamic > (this);
}
@@ -467,10 +481,14 @@
public DataPalette<T> palette() {
return this.palette;
}
+ */
+ // CraftBukkit end
}
- private static final class d extends Record {
+ // CraftBukkit start
+ private static final record d<T>(List<T> paletteEntries, Optional<LongStream> storage) {
+ /*
private final List<T> paletteEntries;
private final Optional<LongStream> storage;
@@ -498,6 +516,8 @@
public Optional<LongStream> storage() {
return this.storage;
}
+ */
+ // CraftBukkit end
}
@FunctionalInterface

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/IChunkAccess.java
+++ b/net/minecraft/world/level/chunk/IChunkAccess.java
@@ -93,7 +93,11 @@
@@ -94,7 +94,11 @@
}
replaceMissingSections(levelheightaccessor, iregistry, this.sections);
@ -12,7 +12,7 @@
private static void replaceMissingSections(LevelHeightAccessor levelheightaccessor, IRegistry<BiomeBase> iregistry, ChunkSection[] achunksection) {
for (int i = 0; i < achunksection.length; ++i) {
@@ -392,6 +396,27 @@
@@ -394,6 +398,27 @@
}
}
@ -40,24 +40,23 @@
public void fillBiomesFromNoise(BiomeResolver biomeresolver, Climate.Sampler climate_sampler) {
ChunkCoordIntPair chunkcoordintpair = this.getPos();
int i = QuartPos.fromBlock(chunkcoordintpair.getMinBlockX());
@@ -423,8 +448,10 @@
@@ -425,8 +450,10 @@
return this;
}
- public static final class a extends Record {
+ // CraftBukkit start
+ public static final record a(SerializableTickContainer<Block> blocks, SerializableTickContainer<FluidType> fluids) {
- public static record a(SerializableTickContainer<Block> a, SerializableTickContainer<FluidType> b) {
+ // CraftBukkit start - decompile error
+ public static record a(SerializableTickContainer<Block> blocks, SerializableTickContainer<FluidType> fluids) {
+ /*
private final SerializableTickContainer<Block> blocks;
private final SerializableTickContainer<FluidType> fluids;
@@ -444,6 +471,8 @@
public final boolean equals(Object object) {
return this.equals<invokedynamic>(this, object);
@@ -442,5 +469,7 @@
public SerializableTickContainer<FluidType> fluids() {
return this.fluids;
}
+ */
+ // CraftBukkit end
public SerializableTickContainer<Block> blocks() {
return this.blocks;
}
}

Datei anzeigen

@ -34,7 +34,7 @@
}
}
@@ -246,7 +251,7 @@
@@ -256,7 +261,7 @@
switch (b0) {
case 0:
JsonObject jsonobject = !s.isEmpty() ? ChatDeserializer.parse(s) : new JsonObject();

Datei anzeigen

@ -1,59 +0,0 @@
--- a/net/minecraft/world/ticks/NextTickListEntry.java
+++ b/net/minecraft/world/ticks/NextTickListEntry.java
@@ -5,13 +5,17 @@
import javax.annotation.Nullable;
import net.minecraft.core.BlockPosition;
-public final class NextTickListEntry extends Record {
+// CraftBukkit start
+public final record NextTickListEntry<T>(T type, BlockPosition pos, long triggerTick, TickListPriority priority, long subTickOrder) {
+ /*
private final T type;
private final BlockPosition pos;
private final long triggerTick;
private final TickListPriority priority;
private final long subTickOrder;
+ */
+ // CraftBukkit end
public static final Comparator<NextTickListEntry<?>> DRAIN_ORDER = (nextticklistentry, nextticklistentry1) -> {
int i = Long.compare(nextticklistentry.triggerTick, nextticklistentry1.triggerTick);
@@ -41,19 +45,23 @@
this(t0, blockposition, i, TickListPriority.NORMAL, j);
}
- public NextTickListEntry(T t0, BlockPosition blockposition, long i, TickListPriority ticklistpriority, long j) {
- blockposition = blockposition.immutable();
- this.type = t0;
- this.pos = blockposition;
- this.triggerTick = i;
- this.priority = ticklistpriority;
- this.subTickOrder = j;
+ // CraftBukkit start
+ public NextTickListEntry(T type, BlockPosition pos, long triggerTick, TickListPriority priority, long subTickOrder) {
+ pos = pos.immutable();
+ this.type = type;
+ this.pos = pos;
+ this.triggerTick = triggerTick;
+ this.priority = priority;
+ this.subTickOrder = subTickOrder;
+ // CraftBukkit end
}
public static <T> NextTickListEntry<T> probe(T t0, BlockPosition blockposition) {
return new NextTickListEntry(t0, blockposition, 0L, TickListPriority.NORMAL, 0L);
}
+ // CraftBukkit start
+ /*
public final String toString() {
return this.toString < invokedynamic > (this);
}
@@ -85,4 +93,6 @@
public long subTickOrder() {
return this.subTickOrder;
}
+ */
+ // CraftBukkit end
}

Datei anzeigen

@ -1,53 +0,0 @@
--- a/net/minecraft/world/ticks/TickListChunk.java
+++ b/net/minecraft/world/ticks/TickListChunk.java
@@ -10,12 +10,16 @@
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.level.ChunkCoordIntPair;
-final class TickListChunk extends Record {
+// CraftBukkit start
+final record TickListChunk<T>(T type, BlockPosition pos, int delay, TickListPriority priority) {
+ /*
private final T type;
private final BlockPosition pos;
private final int delay;
private final TickListPriority priority;
+ */
+ // CraftBukkit end
private static final String TAG_ID = "i";
private static final String TAG_X = "x";
private static final String TAG_Y = "y";
@@ -32,12 +36,16 @@
}
};
+ // CraftBukkit start
+ /*
TickListChunk(T t0, BlockPosition blockposition, int i, TickListPriority ticklistpriority) {
this.type = t0;
this.pos = blockposition;
this.delay = i;
this.priority = ticklistpriority;
}
+ */
+ // CraftBukkit end
public static <T> void loadTickList(NBTTagList nbttaglist, Function<String, Optional<T>> function, ChunkCoordIntPair chunkcoordintpair, Consumer<TickListChunk<T>> consumer) {
long i = chunkcoordintpair.toLong();
@@ -85,6 +93,8 @@
return new TickListChunk(t0, blockposition, 0, TickListPriority.NORMAL);
}
+ // CraftBukkit start
+ /*
public final String toString() {
return this.toString < invokedynamic > (this);
}
@@ -112,4 +122,6 @@
public TickListPriority priority() {
return this.priority;
}
+ */
+ // CraftBukkit end
}

Datei anzeigen

@ -4,7 +4,7 @@
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<packaging>jar</packaging>
<version>1.18-pre5-R0.1-SNAPSHOT</version>
<version>1.18-pre8-R0.1-SNAPSHOT</version>
<name>CraftBukkit</name>
<url>https://www.spigotmc.org/</url>
@ -340,6 +340,7 @@
<algorithms>
<algorithm>SHA-256</algorithm>
</algorithms>
<quiet>true</quiet>
<scopes>
<scope>compile</scope>
<scope>runtime</scope>

Datei anzeigen

@ -224,7 +224,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
* @return string
*/
public String getMappingsVersion() {
return "f926f0531f0874c1b0bcb6f1f7655751";
return "cacad4c83144be72fddd1739b88fc3a6";
}
@Override