Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.18.3",
"fabricloader": ">=0.18.4",
"fabric-resource-loader-v1": "*"
},
"description": "Asset and data resource loading.",
Expand Down
2 changes: 1 addition & 1 deletion fabric-api-base/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.18.3"
"fabricloader": ">=0.18.4"
},
"description": "Contains the essentials for Fabric API modules.",
"custom": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.18.3",
"fabricloader": ">=0.18.4",
"fabric-api-base": "*",
"fabric-lifecycle-events-v1": "*"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public class NoiseChunkMixin {
private long seed;

@Inject(method = "<init>", at = @At("TAIL"))
private void init(int horizontalSize, RandomState randomState, int i, int j, NoiseSettings generationShapeConfig, DensityFunctions.BeardifierOrMarker arg, NoiseGeneratorSettings chunkGeneratorSettings, Aquifer.FluidPicker fluidLevelSampler, Blender blender, CallbackInfo ci) {
private void init(int cellCountXZ, RandomState randomState, int chunkMinBlockX, int chunkMinBlockZ, NoiseSettings noiseSettings, DensityFunctions.BeardifierOrMarker beardifier, NoiseGeneratorSettings settings, Aquifer.FluidPicker globalFluidPicker, Blender blender, CallbackInfo ci) {
seed = ((MultiNoiseSamplerHooks) (Object) randomState.sampler()).fabric_getSeed();
}

@Inject(method = "cachedClimateSampler", at = @At("RETURN"))
private void createMultiNoiseSampler(NoiseRouter noiseRouter, List<Climate.ParameterPoint> list, CallbackInfoReturnable<Climate.Sampler> cir) {
private void createMultiNoiseSampler(NoiseRouter noises, List<Climate.ParameterPoint> spawnTarget, CallbackInfoReturnable<Climate.Sampler> cir) {
((MultiNoiseSamplerHooks) (Object) cir.getReturnValue()).fabric_setSeed(seed);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class RandomStateMixin {
private Climate.Sampler sampler;

@Inject(method = "<init>", at = @At("TAIL"))
private void init(NoiseGeneratorSettings chunkGeneratorSettings, HolderGetter<NormalNoise.NoiseParameters> arg, long seed, CallbackInfo ci) {
private void init(NoiseGeneratorSettings settings, HolderGetter<NormalNoise.NoiseParameters> noises, long seed, CallbackInfo ci) {
((MultiNoiseSamplerHooks) (Object) sampler).fabric_setSeed(seed);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class TheEndBiomeSourceMixin extends BiomeSourceMixin {
@Shadow
@Mutable
@Final
static MapCodec<TheEndBiomeSource> CODEC;
public static MapCodec<TheEndBiomeSource> CODEC;

@Unique
private Supplier<TheEndBiomeData.Overrides> overrides;
Expand Down Expand Up @@ -92,7 +92,7 @@ private static void clearLookup(HolderGetter<Biome> biomes, CallbackInfoReturnab
* Uses the captured biome registry to set up the modded end biomes.
*/
@Inject(method = "<init>", at = @At("RETURN"))
private void init(Holder<Biome> centerBiome, Holder<Biome> highlandsBiome, Holder<Biome> midlandsBiome, Holder<Biome> smallIslandsBiome, Holder<Biome> barrensBiome, CallbackInfo ci) {
private void init(Holder<Biome> end, Holder<Biome> highlands, Holder<Biome> midlands, Holder<Biome> islands, Holder<Biome> barrens, CallbackInfo ci) {
HolderGetter<Biome> biomes = TheEndBiomeData.biomeRegistry.get();

if (biomes == null) {
Expand All @@ -105,8 +105,8 @@ private void init(Holder<Biome> centerBiome, Holder<Biome> highlandsBiome, Holde
}

@Inject(method = "getNoiseBiome", at = @At("RETURN"), cancellable = true)
private void getWeightedEndBiome(int biomeX, int biomeY, int biomeZ, Climate.Sampler noise, CallbackInfoReturnable<Holder<Biome>> cir) {
cir.setReturnValue(overrides.get().pick(biomeX, biomeY, biomeZ, noise, cir.getReturnValue()));
private void getWeightedEndBiome(int quartX, int quartY, int quartZ, Climate.Sampler sampler, CallbackInfoReturnable<Holder<Biome>> cir) {
cir.setReturnValue(overrides.get().pick(quartX, quartY, quartZ, sampler, cir.getReturnValue()));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion fabric-biome-api-v1/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.18.3",
"fabricloader": ">=0.18.4",
"minecraft": ">=1.16.2"
},
"description": "Hooks for adding biomes to the default world generator.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package net.fabricmc.fabric.mixin.block;

import com.llamalad7.mixinextras.expression.Definition;
import com.llamalad7.mixinextras.expression.Expression;
import com.llamalad7.mixinextras.sugar.Local;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -32,13 +34,15 @@

@Mixin(LivingEntity.class)
abstract class LivingEntityMixin {
@Definition(id = "getBlockState", method = "Lnet/minecraft/world/level/Level;getBlockState(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either define the local or switch to MEV

@Expression("? = ?.getBlockState(?)")
@Inject(
method = "trapdoorUsableAsLadder",
at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/level/Level;getBlockState(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;"),
at = @At(value = "MIXINEXTRAS:EXPRESSION", shift = At.Shift.AFTER),
allow = 1,
cancellable = true
)
private void allowTaggedBlocksForTrapdoorClimbing(BlockPos pos, BlockState state, CallbackInfoReturnable<Boolean> info, @Local(ordinal = 1) BlockState belowState) {
private void allowTaggedBlocksForTrapdoorClimbing(BlockPos pos, BlockState state, CallbackInfoReturnable<Boolean> info, @Local(name = "belowState") BlockState belowState) {
if (belowState.is(BlockFunctionalityTags.CAN_CLIMB_TRAPDOOR_ABOVE)) {
if (belowState.getBlock() instanceof LadderBlock) {
// Check that the ladder and trapdoor are placed in the same direction.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
},
"overwrites": {
"requireAnnotations": true
},
"mixinextras": {
"minVersion": "0.5.0"
}
}
2 changes: 1 addition & 1 deletion fabric-block-api-v1/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.18.3"
"fabricloader": ">=0.18.4"
},
"entrypoints": {
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public abstract class RenderRegionCacheMixin {
private static final Logger LOGGER = LoggerFactory.getLogger(RenderRegionCacheMixin.class);

@Inject(method = "createRegion", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/chunk/RenderRegionCache;getSectionDataCopy(Lnet/minecraft/world/level/Level;III)Lnet/minecraft/client/renderer/chunk/SectionCopy;"))
private void copyDataForChunk(Level level, long packedChunkPos, CallbackInfoReturnable<RenderSectionRegion> cir, @Share("dataMap") LocalRef<Long2ObjectOpenHashMap<Object>> mapRef, @Local(ordinal = 11) int x, @Local(ordinal = 10) int y, @Local(ordinal = 9) int z) {
private void copyDataForChunk(Level level, long sectionNode, CallbackInfoReturnable<RenderSectionRegion> cir, @Share("dataMap") LocalRef<Long2ObjectOpenHashMap<Object>> mapRef, @Local(name = "regionSectionX") int regionSectionX, @Local(name = "regionSectionY") int regionSectionY, @Local(name = "regionSectionZ") int regionSectionZ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can any of these locals be avoided by switching injectors, if they're involved in the call?

// Hash maps in chunks should generally not be modified outside of client thread
// but does happen in practice, due to mods or inconsistent vanilla behaviors, causing
// CMEs when we iterate the map. (Vanilla does not iterate these maps when it builds
Expand All @@ -59,7 +59,7 @@ private void copyDataForChunk(Level level, long packedChunkPos, CallbackInfoRetu
// We handle this simply by retrying until it works. Ugly but effective.
while (true) {
try {
mapRef.set(mapChunk(level.getChunk(x, z), SectionPos.of(packedChunkPos), mapRef.get()));
mapRef.set(mapChunk(level.getChunk(regionSectionX, regionSectionZ), SectionPos.of(sectionNode), mapRef.get()));
break;
} catch (ConcurrentModificationException e) {
final int count = ERROR_COUNTER.incrementAndGet();
Expand All @@ -76,7 +76,7 @@ private void copyDataForChunk(Level level, long packedChunkPos, CallbackInfoRetu
}

@Inject(method = "createRegion", at = @At(value = "RETURN"))
private void createDataMap(Level level, long l, CallbackInfoReturnable<RenderSectionRegion> cir, @Share("dataMap") LocalRef<Long2ObjectOpenHashMap<Object>> mapRef) {
private void createDataMap(Level level, long sectionNode, CallbackInfoReturnable<RenderSectionRegion> cir, @Share("dataMap") LocalRef<Long2ObjectOpenHashMap<Object>> mapRef) {
RenderSectionRegion rendererRegion = cir.getReturnValue();
Long2ObjectOpenHashMap<Object> map = mapRef.get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.18.3"
"fabricloader": ">=0.18.4"
},
"description": "Hooks for block views",
"mixins": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
@Mixin(GlCommandEncoder.class)
public class GlCommandEncoderMixin {
@WrapOperation(method = "presentTexture", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/opengl/DirectStateAccess;blitFrameBuffers(IIIIIIIIIIII)V"))
private void blitFrameBuffer(DirectStateAccess manager, int readFramebuffer, int drawFramebuffer, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter, Operation<Void> original, @Local(argsOnly = true) GpuTextureView gpuTextureView) {
if (gpuTextureView.texture() == Minecraft.getInstance().getMainRenderTarget().getColorTexture()) {
private void blitFrameBuffer(DirectStateAccess manager, int readFramebuffer, int drawFramebuffer, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter, Operation<Void> original, @Local(argsOnly = true, name = "textureView") GpuTextureView textureView) {
if (textureView.texture() == Minecraft.getInstance().getMainRenderTarget().getColorTexture()) {
WindowHooks window = ((WindowHooks) (Object) Minecraft.getInstance().getWindow());
dstX1 = window.fabric_getRealFramebufferWidth();
dstY1 = window.fabric_getRealFramebufferHeight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
@Mixin(InputConstants.class)
public class InputConstantsMixin {
@Inject(method = "isKeyDown", at = @At("HEAD"), cancellable = true)
private static void useGameTestInputForKeyDown(Window window, int keyCode, CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(TestInputImpl.isKeyDown(keyCode));
private static void useGameTestInputForKeyDown(Window window, int key, CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(TestInputImpl.isKeyDown(key));
}

@Inject(method = {"setupKeyboardCallbacks", "setupMouseCallbacks"}, at = @At("HEAD"), cancellable = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ public abstract class WindowMixin implements WindowHooks {
private int realFramebufferHeight;

@Inject(method = "<init>", at = @At("RETURN"))
private void onInit(WindowEventHandler eventHandler, DisplayData settings, String fullscreenVideoModeString, String title, GpuBackend[] backends, ShaderSource defaultShaderSource, GpuDebugOptions debugOptions, CallbackInfo ci) {
this.defaultWidth = settings.width();
this.defaultHeight = settings.height();
private void onInit(WindowEventHandler eventHandler, DisplayData displayData, String fullscreenVideoModeString, String title, GpuBackend[] backends, ShaderSource defaultShaderSource, GpuDebugOptions debugOptions, CallbackInfo ci) {
this.defaultWidth = displayData.width();
this.defaultHeight = displayData.height();
this.realWidth = this.width;
this.realHeight = this.height;
this.realFramebufferWidth = this.framebufferWidth;
Expand All @@ -107,16 +107,16 @@ private void cancelEvents(CallbackInfo ci) {
}

@Inject(method = "onResize", at = @At("HEAD"), cancellable = true)
private void cancelResize(long window, int width, int height, CallbackInfo ci) {
realWidth = width;
realHeight = height;
private void cancelResize(long handle, int newWidth, int newHeight, CallbackInfo ci) {
realWidth = newWidth;
realHeight = newHeight;
ci.cancel();
}

@Inject(method = "onFramebufferResize", at = @At("HEAD"), cancellable = true)
private void cancelFramebufferResize(long window, int width, int height, CallbackInfo ci) {
realFramebufferWidth = width;
realFramebufferHeight = height;
private void cancelFramebufferResize(long handle, int newWidth, int newHeight, CallbackInfo ci) {
realFramebufferWidth = newWidth;
realFramebufferHeight = newHeight;
ci.cancel();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
@Mixin(BlockableEventLoop.class)
public class BlockableEventLoopMixin {
@Inject(method = "schedule", at = @At("HEAD"))
private void onPacketHandlerSchedule(Runnable task, CallbackInfo ci) {
private void onPacketHandlerSchedule(Runnable r, CallbackInfo ci) {
switch ((Object) this) {
case Minecraft $ -> NetworkSynchronizer.CLIENTBOUND.preTaskAdded(task);
case MinecraftServer $ -> NetworkSynchronizer.SERVERBOUND.preTaskAdded(task);
case Minecraft $ -> NetworkSynchronizer.CLIENTBOUND.preTaskAdded(r);
case MinecraftServer $ -> NetworkSynchronizer.SERVERBOUND.preTaskAdded(r);
default -> {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public class ConnectionMixin {
private PacketFlow receiving;

@WrapMethod(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/protocol/Packet;)V")
private void onNettyReceivePacket(ChannelHandlerContext context, Packet<?> packet, Operation<Void> original) {
private void onNettyReceivePacket(ChannelHandlerContext ctx, Packet<?> packet, Operation<Void> original) {
NetworkSynchronizer synchronizer = receiving == PacketFlow.CLIENTBOUND ? NetworkSynchronizer.CLIENTBOUND : NetworkSynchronizer.SERVERBOUND;
synchronizer.preNettyHandlePacket();

try {
original.call(context, packet);
original.call(ctx, packet);
} finally {
synchronizer.postNettyHandlePacket();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ private void postRunTasksHook(CallbackInfo ci, @Share("ticksPerFrame") LocalIntR
}

@Inject(method = "doWorldLoad", at = @At("HEAD"), cancellable = true)
private void deferStartIntegratedServer(LevelStorageSource.LevelStorageAccess storageAccess, PackRepository dataPackManager, WorldStem worldStem, boolean newWorld, CallbackInfo ci) {
private void deferStartIntegratedServer(LevelStorageSource.LevelStorageAccess levelSourceAccess, PackRepository packRepository, WorldStem worldStem, boolean newWorld, CallbackInfo ci) {
if (ThreadingImpl.taskToRun != null) {
// don't start the integrated server (which busywaits) inside a task
deferredTask = () -> Minecraft.getInstance().doWorldLoad(storageAccess, dataPackManager, worldStem, newWorld);
deferredTask = () -> Minecraft.getInstance().doWorldLoad(levelSourceAccess, packRepository, worldStem, newWorld);
ci.cancel();
}
}
Expand All @@ -124,10 +124,10 @@ private void onStartIntegratedServerBusyWait(CallbackInfo ci) {
}

@Inject(method = "disconnect(Lnet/minecraft/client/gui/screens/Screen;Z)V", at = @At("HEAD"), cancellable = true)
private void deferDisconnect(Screen disconnectionScreen, boolean transferring, CallbackInfo ci) {
private void deferDisconnect(Screen screen, boolean keepResourcePacks, CallbackInfo ci) {
if (Minecraft.getInstance().getSingleplayerServer() != null && ThreadingImpl.taskToRun != null) {
// don't disconnect (which busywaits) inside a task
deferredTask = () -> Minecraft.getInstance().disconnect(disconnectionScreen, transferring);
deferredTask = () -> Minecraft.getInstance().disconnect(screen, keepResourcePacks);
ci.cancel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
@Mixin(CreateWorldScreen.class)
public class CreateWorldScreenMixin {
@Inject(method = "onCreate", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/worldselection/WorldOpenFlows;confirmWorldCreation(Lnet/minecraft/client/Minecraft;Lnet/minecraft/client/gui/screens/worldselection/CreateWorldScreen;Lcom/mojang/serialization/Lifecycle;Ljava/lang/Runnable;Z)V"), cancellable = true)
private void createLevelDataForServers(CallbackInfo ci, @Local LayeredRegistryAccess<RegistryLayer> registries, @Local PrimaryLevelData levelData) {
private void createLevelDataForServers(CallbackInfo ci, @Local(name = "finalLayers") LayeredRegistryAccess<RegistryLayer> finalLayers, @Local(name = "worldData") PrimaryLevelData worldData) {
if (DedicatedServerImplUtil.saveLevelDataTo != null) {
CompoundTag levelDatInner = levelData.createTag(registries.compositeAccess(), null);
CompoundTag levelDatInner = worldData.createTag(finalLayers.compositeAccess(), null);
CompoundTag levelDat = new CompoundTag();
levelDat.put("Data", levelDatInner);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.18.3",
"fabricloader": ">=0.18.4",
"fabric-resource-loader-v1": "*"
},
"description": "Allows registration of client game tests.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void setLastReceivedCommandsPacket(ClientboundCommandsPacket packet, Cal
}

@Inject(method = "sendUnattendedCommand", at = @At("HEAD"), cancellable = true)
private void onSendCommand(String command, Screen screen, CallbackInfo info) {
private void onSendCommand(String command, Screen screenAfterCommand, CallbackInfo info) {
if (ClientCommandInternals.executeCommand(command)) {
info.cancel();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public abstract class CommandsMixin {
* @reason Add commands before ambiguities are calculated.
*/
@Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/CommandDispatcher;setConsumer(Lcom/mojang/brigadier/ResultConsumer;)V"), method = "<init>")
private void fabric_addCommands(Commands.CommandSelection selection, CommandBuildContext buildContext, CallbackInfo ci) {
CommandRegistrationCallback.EVENT.invoker().register(this.dispatcher, buildContext, selection);
private void fabric_addCommands(Commands.CommandSelection commandSelection, CommandBuildContext context, CallbackInfo ci) {
CommandRegistrationCallback.EVENT.invoker().register(this.dispatcher, context, commandSelection);
}
}
2 changes: 1 addition & 1 deletion fabric-command-api-v2/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.18.3",
"fabricloader": ">=0.18.4",
"fabric-api-base": "*",
"minecraft": ">1.19-alpha.22.11.a"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@Mixin(AxeItem.class)
public class AxeItemMixin {
@ModifyArg(method = "getStripped", at = @At(value = "INVOKE", target = "Ljava/util/Optional;map(Ljava/util/function/Function;)Ljava/util/Optional;"))
private Function<Block, BlockState> handleCustomStrippingBehavior(Function<Block, BlockState> mapper, @Local(argsOnly = true) BlockState state) {
private Function<Block, BlockState> handleCustomStrippingBehavior(Function<Block, BlockState> mapper, @Local(argsOnly = true, name = "state") BlockState state) {
StrippableBlockRegistry.StrippingTransformer transformer = StrippableBlockRegistryImpl.getTransformer(state.getBlock());

if (transformer != null) {
Expand Down
Loading
Loading