Skip to content

Commit

Permalink
initial 1.19.1 update - compile restrictions and new ReflectionsMappi…
Browse files Browse the repository at this point in the history
…ng generator
  • Loading branch information
mcmonkey4eva committed Jul 28, 2022
1 parent 3ff9c36 commit f6d0c8f
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 78 deletions.
2 changes: 1 addition & 1 deletion paper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<version>1.19.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static class FakeProfile implements PlayerProfile {
@Override public boolean removeProperty(@Nullable String s) { return false; }
@Override public void clearProperties() { }
@Override public boolean isComplete() { return false; }
@Override public @NotNull CompletableFuture<org.bukkit.profile.PlayerProfile> update() { return null; }
@Override public @NotNull CompletableFuture<PlayerProfile> update() { return null; }
@Override public org.bukkit.profile.@NotNull PlayerProfile clone() { return null; }
@Override public boolean completeFromCache() { return false; }
@Override public boolean completeFromCache(boolean b) { return false; }
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<craftbukkit.version>1.19-R0.1-SNAPSHOT</craftbukkit.version>
<craftbukkit.version>1.19.1-R0.1-SNAPSHOT</craftbukkit.version>
<citizens.version>2.0.30-SNAPSHOT</citizens.version>
<dcore.version>1.90.1-SNAPSHOT</dcore.version>
<BUILD_NUMBER>Unknown</BUILD_NUMBER>
Expand Down
12 changes: 6 additions & 6 deletions v1_19/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.19.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.19.1-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
Expand All @@ -48,9 +48,9 @@
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<srgIn>org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedDependencies>org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
Expand All @@ -63,8 +63,8 @@
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
<srgIn>org.spigotmc:minecraft-server:1.19.1-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void undisableAsyncCatcher() {

@Override
public boolean isCorrectMappingsCode() {
return ((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion().equals("7b9de0da1357e5b251eddde9aa762916");
return ((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion().equals("4cc0cc97cac491651bff3af8b124a214");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class ReflectionMappingsInfo {

// Contents gathered via https://minidigger.github.io/MiniMappingViewer/#/mojang/server/1.19
// Content generated by ReflectionMappingsGenerator - https://github.com/DenizenScript/ReflectionMappingsGenerator

// net.minecraft.advancements.AdvancementList
public static String AdvancementList_roots = "c";
Expand All @@ -29,7 +29,7 @@ public class ReflectionMappingsInfo {
// net.minecraft.world.entity.LivingEntity
public static String LivingEntity_attackStrengthTicker = "aQ";
public static String LivingEntity_autoSpinAttackTicks = "bC";
public static String LivingEntity_setLivingEntityFlag = "c";
public static String LivingEntity_setLivingEntityFlag_method = "c";

// net.minecraft.world.entity.player.Player
public static String Player_DATA_PLAYER_ABSORPTION_ID = "e";
Expand All @@ -51,26 +51,28 @@ public class ReflectionMappingsInfo {
public static String Level_isClientSide = "y";

// net.minecraft.server.level.ThreadedLevelLightEngine
public static String ThreadedLevelLightEngine_addTask = "a";
public static String ThreadedLevelLightEngine_addTask_method = "a";

// net.minecraft.server.level.ThreadedLevelLightEngine$TaskType
public static String ThreadedLevelLightEngine_TaskType_PRE_UPDATE = "a";
public static String ThreadedLevelLightEngineTaskType_PRE_UPDATE = "a";

// net.minecraft.world.entity.item.ItemEntity
public static String ItemEntity_DATA_ITEM = "c";

// net.minecraft.world.level.biome.Biome
public static String Biome_climateSettings = "i";

// net.minecraft.world.level.biome.Biome$ClimateSettings
public static String Biome_ClimateSettings_precipitation = "a";
public static String Biome_ClimateSettings_temperature = "b";
public static String Biome_ClimateSettings_downfall = "d";
public static String BiomeClimateSettings_precipitation = "b";
public static String BiomeClimateSettings_temperature = "c";
public static String BiomeClimateSettings_downfall = "e";

// net.minecraft.network.Connection
public static String Connection_receiving = "k";

// net.minecraft.server.network.ServerGamePacketListenerImpl
public static String ServerGamePacketListenerImpl_aboveGroundTickCount = "F";
public static String ServerGamePacketListenerImpl_aboveGroundVehicleTickCount = "H";
public static String ServerGamePacketListenerImpl_aboveGroundTickCount = "G";
public static String ServerGamePacketListenerImpl_aboveGroundVehicleTickCount = "I";
public static String ServerGamePacketListenerImpl_connection = "b";

// net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket
Expand Down Expand Up @@ -103,29 +105,30 @@ public class ReflectionMappingsInfo {
public static String ClientboundTeleportEntityPacket_xRot = "f";

// net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData$BlockEntityInfo
public static String ClientboundLevelChunkPacketData_BlockEntityInfo_packedXZ = "a";
public static String ClientboundLevelChunkPacketData_BlockEntityInfo_y = "b";
public static String ClientboundLevelChunkPacketDataBlockEntityInfo_packedXZ = "a";
public static String ClientboundLevelChunkPacketDataBlockEntityInfo_y = "b";

// net.minecraft.world.entity.projectile.FishingHook
public static String FishingHook_nibble = "ar";
public static String FishingHook_timeUntilLured = "as";
public static String FishingHook_timeUntilHooked = "at";

// net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase
public static String BlockBehaviour_BlockStateBase_getFluidState = "p";
public static String BlockBehaviourBlockStateBase_getFluidState_method = "p";

// net.minecraft.world.level.material.FluidState
public static String FluidState_isRandomlyTicking = "f";
public static String FluidState_isEmpty = "c";
public static String FluidState_createLegacyBlock = "g";
public static String FluidState_animateTick = "a";
public static String FluidState_isRandomlyTicking_method = "f";
public static String FluidState_isEmpty_method = "c";
public static String FluidState_createLegacyBlock_method = "g";
public static String FluidState_animateTick_method = "a";

// net.minecraft.tags.TagNetworkSerialization$NetworkPayload
public static String TagNetworkSerialization_NetworkPayload_tags = "a";
public static String TagNetworkSerializationNetworkPayload_tags = "a";

// net.minecraft.core.HolderSet$Named
public static String HolderSet_Named_bind = "b";
public static String HolderSetNamed_bind_method = "b";

// net.minecraft.core.Holder$Reference
public static String Holder_Reference_bindTags = "a";
public static String HolderReference_bindTags_method = "a";

}
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ public void setBlockStrength(Material mat, float strength) {
// TODO: 1.18: This might be fixed by Spigot and can be switched to raw method calls
// Relevant issue: https://hub.spigotmc.org/jira/browse/SPIGOT-6696
// NOTE: Not fixed as of 1.19 initial update
public static MethodHandle BLOCKSTATEBASE_GETFLUIDSTATE = ReflectionHelper.getMethodHandle(BlockBehaviour.BlockStateBase.class, ReflectionMappingsInfo.BlockBehaviour_BlockStateBase_getFluidState);
public static MethodHandle FLUIDSTATE_ISRANDOMLYTICKING = ReflectionHelper.getMethodHandle(BLOCKSTATEBASE_GETFLUIDSTATE.type().returnType(), ReflectionMappingsInfo.FluidState_isRandomlyTicking);
public static MethodHandle FLUIDSTATE_ISEMPTY = ReflectionHelper.getMethodHandle(BLOCKSTATEBASE_GETFLUIDSTATE.type().returnType(), ReflectionMappingsInfo.FluidState_isEmpty);
public static MethodHandle FLUIDSTATE_CREATELEGACYBLOCK = ReflectionHelper.getMethodHandle(BLOCKSTATEBASE_GETFLUIDSTATE.type().returnType(), ReflectionMappingsInfo.FluidState_createLegacyBlock);
public static MethodHandle FLUIDSTATE_ANIMATETICK = ReflectionHelper.getMethodHandle(BLOCKSTATEBASE_GETFLUIDSTATE.type().returnType(), ReflectionMappingsInfo.FluidState_animateTick, Level.class, BlockPos.class, RandomSource.class);
public static MethodHandle BLOCKSTATEBASE_GETFLUIDSTATE = ReflectionHelper.getMethodHandle(BlockBehaviour.BlockStateBase.class, ReflectionMappingsInfo.BlockBehaviourBlockStateBase_getFluidState_method);
public static MethodHandle FLUIDSTATE_ISRANDOMLYTICKING = ReflectionHelper.getMethodHandle(BLOCKSTATEBASE_GETFLUIDSTATE.type().returnType(), ReflectionMappingsInfo.FluidState_isRandomlyTicking_method);
public static MethodHandle FLUIDSTATE_ISEMPTY = ReflectionHelper.getMethodHandle(BLOCKSTATEBASE_GETFLUIDSTATE.type().returnType(), ReflectionMappingsInfo.FluidState_isEmpty_method);
public static MethodHandle FLUIDSTATE_CREATELEGACYBLOCK = ReflectionHelper.getMethodHandle(BLOCKSTATEBASE_GETFLUIDSTATE.type().returnType(), ReflectionMappingsInfo.FluidState_createLegacyBlock_method);
public static MethodHandle FLUIDSTATE_ANIMATETICK = ReflectionHelper.getMethodHandle(BLOCKSTATEBASE_GETFLUIDSTATE.type().returnType(), ReflectionMappingsInfo.FluidState_animateTick_method, Level.class, BlockPos.class, RandomSource.class);

@Override
public void doRandomTick(Location location) {
Expand Down Expand Up @@ -363,8 +363,8 @@ public Color getMapColor(Block block) {
return Color.fromRGB(craftBlock.getNMS().getMapColor(craftBlock.getHandle(), craftBlock.getPosition()).col);
}

public static MethodHandle HolderSet_Named_bind = ReflectionHelper.getMethodHandle(HolderSet.Named.class, ReflectionMappingsInfo.HolderSet_Named_bind, List.class);
public static MethodHandle Holder_Reference_bindTags = ReflectionHelper.getMethodHandle(Holder.Reference.class, ReflectionMappingsInfo.Holder_Reference_bindTags, Collection.class);
public static MethodHandle HolderSet_Named_bind = ReflectionHelper.getMethodHandle(HolderSet.Named.class, ReflectionMappingsInfo.HolderSetNamed_bind_method, List.class);
public static MethodHandle Holder_Reference_bindTags = ReflectionHelper.getMethodHandle(Holder.Reference.class, ReflectionMappingsInfo.HolderReference_bindTags_method, Collection.class);

@Override
public void setVanillaTags(Material material, Set<String> tags) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void setArrowPickupStatus(Entity entity, String status) {
}

public static final MethodHandle LIVINGENTITY_AUTOSPINATTACK_SETTER = ReflectionHelper.getFinalSetter(net.minecraft.world.entity.LivingEntity.class, ReflectionMappingsInfo.LivingEntity_autoSpinAttackTicks);
public static final MethodHandle LIVINGENTITY_SETLIVINGENTITYFLAG = ReflectionHelper.getMethodHandle(net.minecraft.world.entity.LivingEntity.class, ReflectionMappingsInfo.LivingEntity_setLivingEntityFlag, int.class, boolean.class);
public static final MethodHandle LIVINGENTITY_SETLIVINGENTITYFLAG = ReflectionHelper.getMethodHandle(net.minecraft.world.entity.LivingEntity.class, ReflectionMappingsInfo.LivingEntity_setLivingEntityFlag_method, int.class, boolean.class);

@Override
public void setRiptide(Entity entity, boolean state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ public void sendPlayerRemovePacket(Player player, UUID id) {
public void sendClimbableMaterials(Player player, List<Material> materials) {
Map<ResourceKey<? extends Registry<?>>, TagNetworkSerialization.NetworkPayload> packetInput = TagNetworkSerialization.serializeTagsToNetwork(((CraftServer) Bukkit.getServer()).getServer().registryAccess());
TagNetworkSerialization.NetworkPayload payload = packetInput.get(Registry.BLOCK_REGISTRY);
Map<ResourceLocation, IntList> tags = ReflectionHelper.getFieldValue(TagNetworkSerialization.NetworkPayload.class, ReflectionMappingsInfo.TagNetworkSerialization_NetworkPayload_tags, payload);
Map<ResourceLocation, IntList> tags = ReflectionHelper.getFieldValue(TagNetworkSerialization.NetworkPayload.class, ReflectionMappingsInfo.TagNetworkSerializationNetworkPayload_tags, payload);
IntList intList = tags.get(BlockTags.CLIMBABLE.location());
intList.clear();
for (Material material : materials) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ public Object getClimate() {
@Override
public void setHumidity(float humidity) {
Object climate = getClimate();
ReflectionHelper.setFieldValue(climate.getClass(), ReflectionMappingsInfo.Biome_ClimateSettings_downfall, climate, humidity);
ReflectionHelper.setFieldValue(climate.getClass(), ReflectionMappingsInfo.BiomeClimateSettings_downfall, climate, humidity);
}

@Override
public void setTemperature(float temperature) {
Object climate = getClimate();
ReflectionHelper.setFieldValue(climate.getClass(), ReflectionMappingsInfo.Biome_ClimateSettings_temperature, climate, temperature);
ReflectionHelper.setFieldValue(climate.getClass(), ReflectionMappingsInfo.BiomeClimateSettings_temperature, climate, temperature);
}

@Override
Expand All @@ -113,7 +113,7 @@ public void setPrecipitation(DownfallType type) {
throw new UnsupportedOperationException();
}
Object climate = getClimate();
ReflectionHelper.setFieldValue(climate.getClass(), ReflectionMappingsInfo.Biome_ClimateSettings_precipitation, climate, nmsType);
ReflectionHelper.setFieldValue(climate.getClass(), ReflectionMappingsInfo.BiomeClimateSettings_precipitation, climate, nmsType);
}

private List<EntityType> getSpawnableEntities(MobCategory creatureType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ public class BlockLightImpl extends BlockLight {
static {
Object preObj = null;
try {
preObj = ReflectionHelper.getFields(LIGHTENGINETHREADED_TASKTYPE).get(ReflectionMappingsInfo.ThreadedLevelLightEngine_TaskType_PRE_UPDATE).get(null);
preObj = ReflectionHelper.getFields(LIGHTENGINETHREADED_TASKTYPE).get(ReflectionMappingsInfo.ThreadedLevelLightEngineTaskType_PRE_UPDATE).get(null);
}
catch (Throwable ex) {
ex.printStackTrace();
}
LIGHTENGINETHREADED_TASKTYPE_PRE = preObj;
}

public static final MethodHandle LIGHTENGINETHREADED_QUEUERUNNABLE = ReflectionHelper.getMethodHandle(ThreadedLevelLightEngine.class, ReflectionMappingsInfo.ThreadedLevelLightEngine_addTask,
public static final MethodHandle LIGHTENGINETHREADED_QUEUERUNNABLE = ReflectionHelper.getMethodHandle(ThreadedLevelLightEngine.class, ReflectionMappingsInfo.ThreadedLevelLightEngine_addTask_method,
int.class, int.class, LIGHTENGINETHREADED_TASKTYPE, Runnable.class);

public static void enqueueRunnable(LevelChunk chunk, Runnable runnable) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.denizenscript.denizen.nms.v1_19.impl.network.handlers;

import com.denizenscript.denizen.nms.NMSHandler;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import net.minecraft.network.Connection;
import net.minecraft.network.PacketSendListener;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.PlayerChatMessage;
import net.minecraft.network.chat.SignedMessageChain;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.*;
import net.minecraft.server.MinecraftServer;
Expand Down Expand Up @@ -82,11 +83,6 @@ public void teleport(Location dest) {
oldListener.teleport(dest);
}

@Override
public void chat(String s, boolean async) {
oldListener.chat(s, async);
}

@Override
public CraftPlayer getCraftPlayer() {
return oldListener.getCraftPlayer();
Expand Down Expand Up @@ -118,8 +114,8 @@ public void send(Packet<?> packet) {
}

@Override
public void send(Packet<?> packet, GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) {
oldListener.send(packet, genericfuturelistener);
public void send(Packet<?> packet, PacketSendListener listener) {
oldListener.send(packet, listener);
}

public void handlePacketIn(Packet<ServerGamePacketListener> packet) {
Expand All @@ -135,6 +131,11 @@ public void handleChatPreview(ServerboundChatPreviewPacket packet) {
oldListener.handleChatPreview(packet);
}

@Override
public void handleChatAck(ServerboundChatAckPacket serverboundchatackpacket) {
oldListener.handleChatAck(serverboundchatackpacket);
}

@Override
public void handlePlayerInput(ServerboundPlayerInputPacket packet) {
handlePacketIn(packet);
Expand Down Expand Up @@ -315,6 +316,11 @@ public void handleChatCommand(ServerboundChatCommandPacket packet) {
oldListener.handleChatCommand(packet);
}

@Override
public void chat(String s, PlayerChatMessage original, boolean async) {
oldListener.chat(s, original, async);
}

@Override
public void handleAnimate(ServerboundSwingPacket packet) {
handlePacketIn(packet);
Expand All @@ -327,6 +333,16 @@ public void handlePlayerCommand(ServerboundPlayerCommandPacket packet) {
oldListener.handlePlayerCommand(packet);
}

@Override
public SignedMessageChain.Decoder signedMessageDecoder() {
return oldListener.signedMessageDecoder();
}

@Override
public void addPendingMessage(PlayerChatMessage playerchatmessage) {
oldListener.addPendingMessage(playerchatmessage);
}

@Override
public void handleInteract(ServerboundInteractPacket packet) {
handlePacketIn(packet);
Expand Down Expand Up @@ -415,4 +431,9 @@ public void handleLockDifficulty(ServerboundLockDifficultyPacket packet) {
public ServerPlayer getPlayer() {
return oldListener.getPlayer();
}

@Override
public boolean shouldPropagateHandlingExceptions() {
return oldListener.shouldPropagateHandlingExceptions();
}
}
Loading

0 comments on commit f6d0c8f

Please sign in to comment.