Remove 1.18.1 support.
This commit is contained in:
modmuss50 2022-02-02 18:34:04 +00:00
parent cbff8a2d52
commit 54e5b2eccb
13 changed files with 41 additions and 52 deletions
fabric-biome-api-v1/src/testmod/java/net/fabricmc/fabric/test/biome
fabric-gametest-api-v1/src/main/java/net/fabricmc/fabric/mixin/gametest/server
fabric-key-binding-api-v1/src/main/java/net/fabricmc/fabric/mixin/client/keybinding
fabric-lifecycle-events-v1/src/main/java/net/fabricmc/fabric/mixin/event/lifecycle/client
fabric-rendering-fluids-v1/src
main/java/net/fabricmc/fabric
api/client/render/fluid/v1
impl/client/rendering/fluid
mixin/client/rendering/fluid
testmod/java/net/fabricmc/fabric/test/client/rendering/fluid
fabric-rendering-v1/src/main/java/net/fabricmc/fabric/mixin/client/rendering
fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader
gradle.properties
src/main/resources

View file

@ -30,8 +30,8 @@ import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.biome.TheNetherBiomeCreator;
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.decorator.BiomePlacementModifier;
import net.minecraft.world.gen.decorator.SquarePlacementModifier;
import net.minecraft.world.gen.placementmodifier.BiomePlacementModifier;
import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.DefaultBiomeFeatures;
import net.minecraft.world.gen.feature.EndPlacedFeatures;

View file

@ -64,18 +64,10 @@ public class MainMixin {
// Exit with a non-zero exit code when the server fails to start.
// Otherwise gradlew test will succeed without errors, although no tests have been run.
@Inject(method = "main", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Lorg/slf4j/Marker;Ljava/lang/String;Ljava/lang/Throwable;)V", shift = At.Shift.AFTER, remap = false), remap = false, require = 0)
@Inject(method = "main", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Lorg/slf4j/Marker;Ljava/lang/String;Ljava/lang/Throwable;)V", shift = At.Shift.AFTER, remap = false), remap = false)
private static void exitOnError(CallbackInfo info) {
if (FabricGameTestHelper.ENABLED) {
System.exit(-1);
}
}
@Deprecated(forRemoval = true) // 1.18.1 support
@Inject(method = "main", at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;fatal(Ljava/lang/String;Ljava/lang/Throwable;)V", shift = At.Shift.AFTER, remap = false), remap = false, require = 0)
private static void exitOnErrorLegacy(CallbackInfo info) {
if (FabricGameTestHelper.ENABLED) {
System.exit(-1);
}
}
}

View file

@ -34,10 +34,10 @@ public class MixinGameOptions {
@Mutable
@Final
@Shadow
public KeyBinding[] keysAll;
public KeyBinding[] allKeys;
@Inject(at = @At("HEAD"), method = "load()V")
public void loadHook(CallbackInfo info) {
keysAll = KeyBindingRegistryImpl.process(keysAll);
allKeys = KeyBindingRegistryImpl.process(allKeys);
}
}

View file

@ -41,7 +41,7 @@ public abstract class MinecraftClientMixin {
ClientTickEvents.END_CLIENT_TICK.invoker().onEndTick((MinecraftClient) (Object) this);
}
@Inject(at = @At(value = "INVOKE", target = "{1}(Ljava/lang/String;)V" /* Logger.info */, shift = At.Shift.AFTER, remap = false), method = "stop")
@Inject(at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;info(Ljava/lang/String;)V", shift = At.Shift.AFTER, remap = false), method = "stop")
private void onStopping(CallbackInfo ci) {
ClientLifecycleEvents.CLIENT_STOPPING.invoker().onClientStopping((MinecraftClient) (Object) this);
}

View file

@ -18,6 +18,7 @@ package net.fabricmc.fabric.api.client.render.fluid.v1;
import org.jetbrains.annotations.Nullable;
import net.minecraft.block.BlockState;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.texture.SpriteAtlasTexture;
@ -78,11 +79,12 @@ public interface FluidRenderHandler {
* @param pos The position in the world, of the fluid to render.
* @param world The world the fluid is in
* @param vertexConsumer The vertex consumer to tessellate the fluid in.
* @param state The fluid state being rendered.
* @param blockState The block state being rendered.
* @param fluidState The fluid state being rendered.
* @return Whether anything is tessellated.
*/
default boolean renderFluid(BlockPos pos, BlockRenderView world, VertexConsumer vertexConsumer, FluidState state) {
return ((FluidRenderHandlerRegistryImpl) FluidRenderHandlerRegistry.INSTANCE).renderFluid(pos, world, vertexConsumer, state);
default boolean renderFluid(BlockPos pos, BlockRenderView world, VertexConsumer vertexConsumer, BlockState blockState, FluidState fluidState) {
return ((FluidRenderHandlerRegistryImpl) FluidRenderHandlerRegistry.INSTANCE).renderFluid(pos, world, vertexConsumer, blockState, fluidState);
}
/**

View file

@ -20,6 +20,7 @@ import java.util.IdentityHashMap;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.TransparentBlock;
import net.minecraft.client.MinecraftClient;
@ -119,7 +120,7 @@ public class FluidRenderHandlerRegistryImpl implements FluidRenderHandlerRegistr
}
}
public boolean renderFluid(BlockPos pos, BlockRenderView world, VertexConsumer vertexConsumer, FluidState state) {
return fluidRenderer.render(world, pos, vertexConsumer, state);
public boolean renderFluid(BlockPos pos, BlockRenderView world, VertexConsumer vertexConsumer, BlockState blockState, FluidState fluidState) {
return fluidRenderer.render(world, pos, vertexConsumer, blockState, fluidState);
}
}

View file

@ -16,6 +16,7 @@
package net.fabricmc.fabric.impl.client.rendering.fluid;
import net.minecraft.block.BlockState;
import net.minecraft.client.texture.Sprite;
import net.minecraft.fluid.FluidState;
import net.minecraft.util.math.BlockPos;
@ -26,15 +27,16 @@ import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
public class FluidRendererHookContainer {
public BlockRenderView view;
public BlockPos pos;
public FluidState state;
public BlockState blockState;
public FluidState fluidState;
public FluidRenderHandler handler;
public final Sprite[] sprites = new Sprite[2];
public Sprite overlay;
public boolean hasOverlay;
public void getSprites(BlockRenderView world, BlockPos pos, FluidState fluid) {
public void getSprites(BlockRenderView world, BlockPos pos, FluidState fluidState) {
if (handler != null) {
Sprite[] sprites = handler.getFluidSprites(world, pos, state);
Sprite[] sprites = handler.getFluidSprites(world, pos, fluidState);
this.sprites[0] = sprites[0];
this.sprites[1] = sprites[1];
@ -51,7 +53,8 @@ public class FluidRendererHookContainer {
public void clear() {
view = null;
pos = null;
state = null;
blockState = null;
fluidState = null;
handler = null;
sprites[0] = null;
sprites[1] = null;

View file

@ -61,12 +61,12 @@ public class MixinFluidRenderer {
}
@Inject(at = @At("HEAD"), method = "render", cancellable = true)
public void tesselate(BlockRenderView view, BlockPos pos, VertexConsumer vertexConsumer, FluidState state, CallbackInfoReturnable<Boolean> info) {
public void tesselate(BlockRenderView view, BlockPos pos, VertexConsumer vertexConsumer, BlockState blockState, FluidState fluidState, CallbackInfoReturnable<Boolean> info) {
if (!fabric_customRendering.get()) {
// Prevent recursively looking up custom fluid renderers when default behaviour is being invoked
try {
fabric_customRendering.set(true);
tessellateViaHandler(view, pos, vertexConsumer, state, info);
tessellateViaHandler(view, pos, vertexConsumer, blockState, fluidState, info);
} finally {
fabric_customRendering.set(false);
}
@ -77,30 +77,31 @@ public class MixinFluidRenderer {
}
FluidRendererHookContainer ctr = fabric_renderHandler.get();
ctr.getSprites(view, pos, state);
ctr.getSprites(view, pos, fluidState);
}
@Unique
private void tessellateViaHandler(BlockRenderView view, BlockPos pos, VertexConsumer vertexConsumer, FluidState state, CallbackInfoReturnable<Boolean> info) {
private void tessellateViaHandler(BlockRenderView view, BlockPos pos, VertexConsumer vertexConsumer, BlockState blockState, FluidState fluidState, CallbackInfoReturnable<Boolean> info) {
FluidRendererHookContainer ctr = fabric_renderHandler.get();
FluidRenderHandler handler = ((FluidRenderHandlerRegistryImpl) FluidRenderHandlerRegistry.INSTANCE).getOverride(state.getFluid());
FluidRenderHandler handler = ((FluidRenderHandlerRegistryImpl) FluidRenderHandlerRegistry.INSTANCE).getOverride(fluidState.getFluid());
ctr.view = view;
ctr.pos = pos;
ctr.state = state;
ctr.blockState = blockState;
ctr.fluidState = fluidState;
ctr.handler = handler;
if (handler != null) {
info.setReturnValue(handler.renderFluid(pos, view, vertexConsumer, state));
info.setReturnValue(handler.renderFluid(pos, view, vertexConsumer, blockState, fluidState));
}
}
@Inject(at = @At("RETURN"), method = "render")
public void tesselateReturn(BlockRenderView view, BlockPos pos, VertexConsumer vertexConsumer, FluidState state, CallbackInfoReturnable<Boolean> info) {
public void tesselateReturn(BlockRenderView world, BlockPos pos, VertexConsumer vertexConsumer, BlockState blockState, FluidState fluidState, CallbackInfoReturnable<Boolean> cir) {
fabric_renderHandler.get().clear();
}
@ModifyVariable(at = @At(value = "INVOKE", target = "net/minecraft/client/render/block/FluidRenderer.isSameFluid(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;Lnet/minecraft/fluid/FluidState;)Z"), method = "render", ordinal = 0)
@ModifyVariable(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/block/FluidRenderer;isSameFluid(Lnet/minecraft/fluid/FluidState;Lnet/minecraft/fluid/FluidState;)Z"), method = "render", ordinal = 0)
public boolean modLavaCheck(boolean chk) {
// First boolean local is set by vanilla according to 'matches lava'
// but uses the negation consistent with 'matches water'
@ -114,7 +115,7 @@ public class MixinFluidRenderer {
return !ctr.hasOverlay;
}
@ModifyVariable(at = @At(value = "INVOKE", target = "net/minecraft/client/render/block/FluidRenderer.isSameFluid(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;Lnet/minecraft/fluid/FluidState;)Z"), method = "render", ordinal = 0)
@ModifyVariable(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/block/FluidRenderer;isSameFluid(Lnet/minecraft/fluid/FluidState;Lnet/minecraft/fluid/FluidState;)Z"), method = "render", ordinal = 0)
public Sprite[] modSpriteArray(Sprite[] chk) {
FluidRendererHookContainer ctr = fabric_renderHandler.get();
return ctr.handler != null ? ctr.sprites : chk;
@ -130,7 +131,7 @@ public class MixinFluidRenderer {
@ModifyVariable(at = @At(value = "CONSTANT", args = "intValue=16", ordinal = 0, shift = At.Shift.BEFORE), method = "render", ordinal = 0)
public int modTintColor(int chk) {
FluidRendererHookContainer ctr = fabric_renderHandler.get();
return ctr.handler != null ? ctr.handler.getFluidColor(ctr.view, ctr.pos, ctr.state) : chk;
return ctr.handler != null ? ctr.handler.getFluidColor(ctr.view, ctr.pos, ctr.fluidState) : chk;
}
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getBlock()Lnet/minecraft/block/Block;"), method = "render")

View file

@ -16,6 +16,7 @@
package net.fabricmc.fabric.test.client.rendering.fluid;
import net.minecraft.block.BlockState;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.fluid.FluidState;
@ -31,19 +32,19 @@ public class CustomizedFluidRenderer extends SimpleFluidRenderHandler {
}
@Override
public boolean renderFluid(BlockPos pos, BlockRenderView world, VertexConsumer vertexConsumer, FluidState state) {
public boolean renderFluid(BlockPos pos, BlockRenderView world, VertexConsumer vertexConsumer, BlockState blockState, FluidState fluidState) {
int light = getLight(world, pos);
float u1 = sprites[2].getFrameU(0);
float v1 = sprites[2].getFrameV(0);
float u2 = sprites[2].getFrameU(16);
float v2 = sprites[2].getFrameV(16 * state.getHeight(world, pos));
float v2 = sprites[2].getFrameV(16 * fluidState.getHeight(world, pos));
float x1 = (pos.getX() & 15) + 0.1f;
float y1 = pos.getY() & 15;
float z1 = (pos.getZ() & 15) + 0.1f;
float x2 = (pos.getX() & 15) + 0.9f;
float y2 = (pos.getY() & 15) + state.getHeight(world, pos);
float y2 = (pos.getY() & 15) + fluidState.getHeight(world, pos);
float z2 = (pos.getZ() & 15) + 0.9f;
vertex(vertexConsumer, x1, y1, z1, 1, 1, 1, u1, v1, light);

View file

@ -196,19 +196,8 @@ public abstract class MixinWorldRenderer {
}
}
@Deprecated(forRemoval = true) // 1.18.1 support
@Inject(at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V", shift = At.Shift.AFTER, ordinal = 0), method = "method_3257(Lnet/minecraft/class_4587;Lnet/minecraft/class_1159;FLjava/lang/Runnable;)V", cancellable = true, require = 0, remap = false)
private void renderSky(MatrixStack matrices, Matrix4f matrix4f, float tickDelta, Runnable runnable, CallbackInfo info) {
fabricRenderSky(info);
}
@Inject(at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V", shift = At.Shift.AFTER, ordinal = 0), method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/math/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V", cancellable = true, require = 0)
@Inject(at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V", shift = At.Shift.AFTER, ordinal = 0), method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/math/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V", cancellable = true)
private void renderSky(MatrixStack matrices, Matrix4f matrix4f, float tickDelta, Camera camera, boolean bl, Runnable runnable, CallbackInfo info) {
fabricRenderSky(info);
}
@Unique
private void fabricRenderSky(CallbackInfo info) {
if (this.client.world != null) {
DimensionRenderingRegistry.SkyRenderer renderer = DimensionRenderingRegistry.getSkyRenderer(world.getRegistryKey());

View file

@ -48,7 +48,7 @@ public class ReloadableResourceManagerImplMixin {
@Final
private List<ResourceReloader> reloaders;
@Inject(at = @At(value = "INVOKE", target = "{1}()Z" /* isDebugEnabled()Z */, remap = false), method = "reload")
@Inject(at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;isDebugEnabled()Z", remap = false), method = "reload")
private void reload(Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage, List<ResourcePack> packs, CallbackInfoReturnable<ResourceReload> info) {
ResourceManagerHelperImpl.sort(type, this.reloaders);
}

View file

@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx2560M
version=0.46.3
minecraft_version=22w03a
minecraft_version=22w05a
yarn_version=+build.1
loader_version=0.12.12

View file

@ -18,7 +18,7 @@
"depends": {
"fabricloader": ">=0.12.12",
"java": ">=17",
"minecraft": "~1.18-alpha.21.37.a"
"minecraft": "~1.18.2-alpha.22.5.a"
},
"description": "Core API module providing key hooks and intercompatibility features."
}