Skip to content

Commit

Permalink
More mixin lambda target fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Su5eD committed Jul 5, 2023
1 parent 434c7d9 commit e7be46e
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@Mixin(HoneycombItem.class)
public class HoneycombItemMixin {
@Dynamic("method_34723: Synthetic lambda body for Suppliers.memoize in initialization of UNWAXED_TO_WAXED_BLOCKS")
@Inject(method = { "method_34723", "m_150881_" }, at = @At("RETURN"), require = 1, remap = false, cancellable = true)
@Inject(method = "method_34723()Lcom/google/common/collect/BiMap;", at = @At("RETURN"), cancellable = true)
private static void createUnwaxedToWaxedMap(CallbackInfoReturnable<BiMap> cir) {
cir.setReturnValue(HashBiMap.create(cir.getReturnValue()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private void runTail(DataWriter writer, CallbackInfoReturnable<CompletableFuture
blockStateMapThreadLocal.remove();
}

@Inject(method = { "method_25738", "m_125115_" }, at = @At("HEAD"), require = 1, cancellable = true)
@Inject(method = "method_25738(Ljava/util/Map;Lnet/minecraft/block/Block;)Z", at = @At("HEAD"), cancellable = true)
private static void filterBlocksForProcessingMod(Map<Block, BlockStateSupplier> map, Block block, CallbackInfoReturnable<Boolean> cir) {
FabricDataOutput dataOutput = fabricDataOutputThreadLocal.get();

Expand All @@ -112,7 +112,7 @@ private static void filterBlocksForProcessingMod(Map<Block, BlockStateSupplier>
}
}

@Inject(method = { "method_25741", "m_125125_" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/data/client/ModelIds;getItemModelId(Lnet/minecraft/item/Item;)Lnet/minecraft/util/Identifier;"), require = 1, cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
@Inject(method = "method_25741(Ljava/util/Set;Ljava/util/Map;Lnet/minecraft/block/Block;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/data/client/ModelIds;getItemModelId(Lnet/minecraft/item/Item;)Lnet/minecraft/util/Identifier;"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
private static void filterItemsForProcessingMod(Set<Item> set, Map<Identifier, Supplier<JsonElement>> map, Block block, CallbackInfo ci, Item item) {
FabricDataOutput dataOutput = fabricDataOutputThreadLocal.get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private void initializeFabricGameruleCategories(EditGameRulesScreen screen, Game
}

// Synthetic method
@Inject(method = { "method_27638(Ljava/util/Map$Entry;)V", "m_170228_(Ljava/util/Map$Entry;)V" }, at = @At("HEAD"), require = 1, remap = false, cancellable = true)
@Inject(method = "method_27638(Ljava/util/Map$Entry;)V", at = @At("HEAD"), cancellable = true)
private void ignoreKeysWithCustomCategories(Map.Entry<GameRules.Key<?>, EditGameRulesScreen.AbstractRuleWidget> entry, CallbackInfo ci) {
final GameRules.Key<?> ruleKey = entry.getKey();
CustomGameRuleCategory.getCategory(ruleKey).ifPresent(key -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public abstract class ThreadedAnvilChunkStorageMixin {
* Injection is inside of tryUnloadChunk.
* We inject just after "setLoadedToWorld" is made false, since here the WorldChunk is guaranteed to be unloaded.
*/
@Inject(method = { "method_18843", "m_202998_" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/WorldChunk;setLoadedToWorld(Z)V", shift = At.Shift.AFTER), require = 1)
@Inject(method = "method_18843(Lnet/minecraft/server/world/ChunkHolder;Ljava/util/concurrent/CompletableFuture;JLnet/minecraft/world/chunk/Chunk;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/WorldChunk;setLoadedToWorld(Z)V", shift = At.Shift.AFTER))
private void onChunkUnload(ChunkHolder chunkHolder, CompletableFuture<Chunk> chunkFuture, long pos, Chunk chunk, CallbackInfo ci) {
ServerChunkEvents.CHUNK_UNLOAD.invoker().onChunkUnload(this.world, (WorldChunk) chunk);
}
Expand All @@ -60,7 +60,7 @@ private void onChunkUnload(ChunkHolder chunkHolder, CompletableFuture<Chunk> chu
* <ul><li>the chunk being loaded MUST be a WorldChunk.
* <li>everything within the chunk has been loaded into the world. Entities, BlockEntities, etc.</ul>
*/
@Inject(method = { "method_17227", "m_214854_" }, at = @At("TAIL"), require = 1, remap = false)
@Inject(method = "method_17227(Lnet/minecraft/server/world/ChunkHolder;Lnet/minecraft/world/chunk/Chunk;)Lnet/minecraft/world/chunk/Chunk;", at = @At("TAIL"))
private void onChunkLoad(ChunkHolder chunkHolder, Chunk protoChunk, CallbackInfoReturnable<Chunk> callbackInfoReturnable) {
// We fire the event at TAIL since the chunk is guaranteed to be a WorldChunk then.
ServerChunkEvents.CHUNK_LOAD.invoker().onChunkLoad(this.world, (WorldChunk) callbackInfoReturnable.getReturnValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private void fabric_onFilteredSignedChatMessage(MessageType.Parameters params, S
}
}

@Inject(method = { "method_45745", "m_244709_" }, at = @At("HEAD"), require = 1, remap = false, cancellable = true)
@Inject(method = "method_45745(Lnet/minecraft/network/message/MessageType$Parameters;Lnet/minecraft/text/Text;Ljava/time/Instant;)Z", at = @At("HEAD"), cancellable = true)
private void fabric_onProfilelessChatMessage(MessageType.Parameters params, Text content, Instant receptionTimestamp, CallbackInfoReturnable<Boolean> cir) {
fabric_onChatMessage(params.applyChatDecoration(content), null, null, params, receptionTimestamp, cir);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public abstract class EntityRenderersMixin {

// synthetic lambda in reloadEntityRenderers
@SuppressWarnings({"unchecked", "rawtypes"})
@Redirect(method = { "method_32174", "m_257087_" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/EntityRendererFactory;create(Lnet/minecraft/client/render/entity/EntityRendererFactory$Context;)Lnet/minecraft/client/render/entity/EntityRenderer;"), require = 1)
@Redirect(method = { "method_32174(Lcom/google/common/collect/ImmutableMap$Builder;Lnet/minecraft/client/render/entity/EntityRendererFactory$Context;Lnet/minecraft/entity/EntityType;Lnet/minecraft/client/render/entity/EntityRendererFactory;)V", "lambda$createEntityRenderers$2" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/EntityRendererFactory;create(Lnet/minecraft/client/render/entity/EntityRendererFactory$Context;)Lnet/minecraft/client/render/entity/EntityRenderer;"), require = 1)
private static EntityRenderer<?> createEntityRenderer(EntityRendererFactory<?> entityRendererFactory, EntityRendererFactory.Context context, ImmutableMap.Builder builder, EntityRendererFactory.Context context2, EntityType<?> entityType) {
EntityRenderer<?> entityRenderer = entityRendererFactory.create(context);

Expand All @@ -51,7 +51,7 @@ private static EntityRenderer<?> createEntityRenderer(EntityRendererFactory<?> e

// private static synthetic method_32175(Lcom/google/common/collect/ImmutableMap$Builder;Lnet/minecraft/class_5617$class_5618;Ljava/lang/String;Lnet/minecraft/class_5617;)V
@SuppressWarnings("rawtypes")
@Redirect(method = { "method_32175", "m_234604_" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/EntityRendererFactory;create(Lnet/minecraft/client/render/entity/EntityRendererFactory$Context;)Lnet/minecraft/client/render/entity/EntityRenderer;"), require = 1)
@Redirect(method = { "method_32175(Lcom/google/common/collect/ImmutableMap$Builder;Lnet/minecraft/client/render/entity/EntityRendererFactory$Context;Ljava/lang/String;Lnet/minecraft/client/render/entity/EntityRendererFactory;)V", "lambda$createPlayerRenderers$3" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/EntityRendererFactory;create(Lnet/minecraft/client/render/entity/EntityRendererFactory$Context;)Lnet/minecraft/client/render/entity/EntityRenderer;"), require = 1)
private static EntityRenderer<? extends PlayerEntity> createPlayerEntityRenderer(EntityRendererFactory<AbstractClientPlayerEntity> playerEntityRendererFactory, EntityRendererFactory.Context context, ImmutableMap.Builder builder, EntityRendererFactory.Context context2, String str, EntityRendererFactory<AbstractClientPlayerEntity> playerEntityRendererFactory2) {
EntityRenderer<? extends PlayerEntity> entityRenderer = playerEntityRendererFactory.create(context);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@Mixin(SinglePreparationResourceReloader.class)
public class SinglePreparationResourceReloaderMixin {
// thenAcceptAsync in reload
@Inject(at = @At("HEAD"), method = { "method_18790", "m_10789_" }, require = 1, remap = false)
@Inject(at = @At("HEAD"), method = "method_18790(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;Ljava/lang/Object;)V")
private void applyResourceConditions(ResourceManager resourceManager, Profiler profiler, Object object, CallbackInfo ci) {
fabric_applyResourceConditions(resourceManager, profiler, object);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ public class TagManagerLoaderMixin {

// lambda body inside thenAcceptAsync, in the reload method
@Dynamic
@Inject(
method = { "method_40098(Ljava/util/List;Ljava/lang/Void;)V", "m_203915_(Ljava/util/List;Ljava/lang/Void;)V" },
at = @At("RETURN"),
require = 1, remap = false
)
@Inject(method = "method_40098(Ljava/util/List;Ljava/lang/Void;)V", at = @At("RETURN"))
private void hookApply(List<?> list, Void void_, CallbackInfo ci) {
ResourceConditionsImpl.setTags(registryTags);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public class ReloadableResourceManagerImplMixin {
// private static synthetic method_29491(Ljava/util/List;)Ljava/lang/Object;
// Supplier lambda in beginMonitoredReload method.
@Inject(method = { "method_29491", "m_203825_" }, at = @At("HEAD"), require = 1, remap = false, cancellable = true)
@Inject(method = "method_29491(Ljava/util/List;)Ljava/lang/Object;", at = @At("HEAD"), cancellable = true)
private static void getResourcePackNames(List<ResourcePack> packs, CallbackInfoReturnable<String> cir) {
cir.setReturnValue(packs.stream().map(pack -> {
if (pack instanceof GroupResourcePack) {
Expand Down
4 changes: 4 additions & 0 deletions gradle/ffapi-setup.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ allprojects {
spotlessGroovyGradle {
enabled = false
}

loom.mixin {
defaultRefmapName = project.base.archivesName.map { it + "-refmap.json" }
}
}

configurations {
Expand Down

0 comments on commit e7be46e

Please sign in to comment.