mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-11 22:45:38 -04:00
23w03a (#2854)
* First look at 223w03a * Fix login * Support onboarding screen in client tests * Fix AFTER_ENTITY_CHANGE_WORLD event * Bump version
This commit is contained in:
parent
2facd44698
commit
b69ba7fabe
41 changed files with 185 additions and 147 deletions
build.gradle
deprecated/fabric-networking-v0/src/client/java/net/fabricmc/fabric/impl/client/networking/v0
fabric-api-base/src/testmod/java/net/fabricmc/fabric/test/base
fabric-biome-api-v1
build.gradle
src
main
java/net/fabricmc/fabric
resources
testmod
generated/data/fabric-biome-api-v1-testmod/worldgen/biome
custom_plains.jsontest_crimson_forest.jsontest_end_barrens.jsontest_end_highlands.jsontest_end_midlands.json
java/net/fabricmc/fabric/test/biome
resources/data/fabric-biome-api-v1-testmod/worldgen/biome
fabric-entity-events-v1/src/main
java/net/fabricmc/fabric/mixin/entity/event
resources
fabric-game-rule-api-v1/src/client/java/net/fabricmc/fabric/impl/gamerule/widget
fabric-networking-api-v1/src
client
java/net/fabricmc/fabric
impl/networking/client
mixin/networking/client/accessor
resources
main
java/net/fabricmc/fabric
impl/networking
mixin/networking/accessor
resources
testmod/java/net/fabricmc/fabric/test/networking
fabric-recipe-api-v1/src/main/resources
fabric-registry-sync-v0/src/client/java/net/fabricmc/fabric/impl/client/registry/sync
fabric-rendering-v1/src
client/java/net/fabricmc/fabric/mixin/client/rendering
testmod/java/net/fabricmc/fabric/test/rendering/client
fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/impl/resource/loader
gradle.propertiessrc/main/resources
|
@ -635,7 +635,7 @@ curseforge {
|
|||
id = "306612"
|
||||
changelog = ENV.CHANGELOG ?: "No changelog provided"
|
||||
releaseType = project.prerelease == "true" ? "beta" : "release"
|
||||
addGameVersion "1.19.3"
|
||||
addGameVersion "1.19-Snapshot"
|
||||
addGameVersion "Fabric"
|
||||
|
||||
mainArtifact(signingEnabled ? signRemapJar.output : remapJar) {
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ClientSidePacketRegistryImpl implements ClientSidePacketRegistry, P
|
|||
@Override
|
||||
public void sendToServer(Packet<?> packet, GenericFutureListener<? extends Future<? super Void>> completionListener) {
|
||||
if (MinecraftClient.getInstance().getNetworkHandler() != null) {
|
||||
MinecraftClient.getInstance().getNetworkHandler().getConnection().send(packet, GenericFutureListenerHolder.create(completionListener));
|
||||
MinecraftClient.getInstance().getNetworkHandler().method_48296().send(packet, GenericFutureListenerHolder.create(completionListener));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import static net.fabricmc.fabric.test.base.FabricClientTestHelper.enableDebugHu
|
|||
import static net.fabricmc.fabric.test.base.FabricClientTestHelper.openGameMenu;
|
||||
import static net.fabricmc.fabric.test.base.FabricClientTestHelper.openInventory;
|
||||
import static net.fabricmc.fabric.test.base.FabricClientTestHelper.setPerspective;
|
||||
import static net.fabricmc.fabric.test.base.FabricClientTestHelper.submitAndWait;
|
||||
import static net.fabricmc.fabric.test.base.FabricClientTestHelper.takeScreenshot;
|
||||
import static net.fabricmc.fabric.test.base.FabricClientTestHelper.waitForLoadingComplete;
|
||||
import static net.fabricmc.fabric.test.base.FabricClientTestHelper.waitForScreen;
|
||||
|
@ -35,6 +36,7 @@ import java.nio.file.Path;
|
|||
|
||||
import org.spongepowered.asm.mixin.MixinEnvironment;
|
||||
|
||||
import net.minecraft.class_8032;
|
||||
import net.minecraft.client.gui.screen.ConfirmScreen;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.client.gui.screen.world.CreateWorldScreen;
|
||||
|
@ -66,6 +68,14 @@ public class FabricApiAutoTestClient implements ClientModInitializer {
|
|||
private void runTest() {
|
||||
waitForLoadingComplete();
|
||||
|
||||
final boolean onboardAccessibility = submitAndWait(client -> client.options.field_41785);
|
||||
|
||||
if (!onboardAccessibility) {
|
||||
waitForScreen(class_8032.class);
|
||||
takeScreenshot("onboarding_screen");
|
||||
clickScreenButton("gui.continue");
|
||||
}
|
||||
|
||||
{
|
||||
waitForScreen(TitleScreen.class);
|
||||
takeScreenshot("title_screen");
|
||||
|
|
|
@ -25,13 +25,13 @@ import java.util.function.Predicate;
|
|||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.Drawable;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.screen.GameMenuScreen;
|
||||
import net.minecraft.client.gui.screen.LevelLoadingScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.CyclingButtonWidget;
|
||||
import net.minecraft.client.gui.widget.GridWidget;
|
||||
import net.minecraft.client.gui.widget.PressableWidget;
|
||||
|
@ -105,11 +105,7 @@ public final class FabricClientTestHelper {
|
|||
}
|
||||
|
||||
if (drawable instanceof GridWidget gridWidget) {
|
||||
for (Element child : gridWidget.children()) {
|
||||
if (child instanceof PressableWidget pressableWidget && pressMatchingButton(pressableWidget, buttonText)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
gridWidget.method_48206(clickableWidget -> pressMatchingButton(clickableWidget, buttonText));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,7 +114,7 @@ public final class FabricClientTestHelper {
|
|||
});
|
||||
}
|
||||
|
||||
private static boolean pressMatchingButton(PressableWidget widget, String text) {
|
||||
private static boolean pressMatchingButton(ClickableWidget widget, String text) {
|
||||
if (widget instanceof ButtonWidget buttonWidget) {
|
||||
if (text.equals(buttonWidget.getMessage().getString())) {
|
||||
buttonWidget.onPress();
|
||||
|
@ -193,7 +189,7 @@ public final class FabricClientTestHelper {
|
|||
return MinecraftClient.getInstance().submit(() -> function.apply(MinecraftClient.getInstance()));
|
||||
}
|
||||
|
||||
private static <T> T submitAndWait(Function<MinecraftClient, T> function) {
|
||||
public static <T> T submitAndWait(Function<MinecraftClient, T> function) {
|
||||
return submit(function).join();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,3 +40,4 @@ loom {
|
|||
// Ensure the worldgen JSONs are re-created to ensure the data-gen still works
|
||||
test.dependsOn runDatagen
|
||||
runTestmodClient.dependsOn runDatagen
|
||||
generateResources.dependsOn runDatagen
|
||||
|
|
|
@ -69,7 +69,7 @@ public interface BiomeModificationContext {
|
|||
* @see Biome#getPrecipitation()
|
||||
* @see Biome.Builder#precipitation(Biome.Precipitation)
|
||||
*/
|
||||
void setPrecipitation(Biome.Precipitation precipitation);
|
||||
void setPrecipitation(boolean hasPrecipitation);
|
||||
|
||||
/**
|
||||
* @see Biome#getTemperature()
|
||||
|
|
|
@ -104,26 +104,24 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
|
|||
}
|
||||
|
||||
private class WeatherContextImpl implements WeatherContext {
|
||||
private final Biome.Weather weather = biome.weather;
|
||||
|
||||
@Override
|
||||
public void setPrecipitation(Biome.Precipitation precipitation) {
|
||||
weather.precipitation = Objects.requireNonNull(precipitation);
|
||||
public void setPrecipitation(boolean hasPrecipitation) {
|
||||
biome.weather = new Biome.Weather(hasPrecipitation, biome.weather.temperature(), biome.weather.temperatureModifier(), biome.weather.downfall());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTemperature(float temperature) {
|
||||
weather.temperature = temperature;
|
||||
biome.weather = new Biome.Weather(biome.weather.hasPrecipitation(), temperature, biome.weather.temperatureModifier(), biome.weather.downfall());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTemperatureModifier(Biome.TemperatureModifier temperatureModifier) {
|
||||
weather.temperatureModifier = Objects.requireNonNull(temperatureModifier);
|
||||
biome.weather = new Biome.Weather(biome.weather.hasPrecipitation(), biome.weather.temperature(), Objects.requireNonNull(temperatureModifier), biome.weather.downfall());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDownfall(float downfall) {
|
||||
weather.downfall = downfall;
|
||||
biome.weather = new Biome.Weather(biome.weather.hasPrecipitation(), biome.weather.temperature(), biome.weather.temperatureModifier(), downfall);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,18 +14,12 @@ mutable field net/minecraft/world/biome/source/BiomeSource biomes Ljava/util/
|
|||
|
||||
# Top-Level Biome Fields Access
|
||||
accessible field net/minecraft/world/biome/Biome weather Lnet/minecraft/world/biome/Biome$Weather;
|
||||
mutable field net/minecraft/world/biome/Biome weather Lnet/minecraft/world/biome/Biome$Weather;
|
||||
accessible field net/minecraft/world/biome/Biome generationSettings Lnet/minecraft/world/biome/GenerationSettings;
|
||||
accessible field net/minecraft/world/biome/Biome spawnSettings Lnet/minecraft/world/biome/SpawnSettings;
|
||||
|
||||
# Biome Weather
|
||||
accessible field net/minecraft/world/biome/Biome$Weather precipitation Lnet/minecraft/world/biome/Biome$Precipitation;
|
||||
mutable field net/minecraft/world/biome/Biome$Weather precipitation Lnet/minecraft/world/biome/Biome$Precipitation;
|
||||
accessible field net/minecraft/world/biome/Biome$Weather temperature F
|
||||
mutable field net/minecraft/world/biome/Biome$Weather temperature F
|
||||
accessible field net/minecraft/world/biome/Biome$Weather temperatureModifier Lnet/minecraft/world/biome/Biome$TemperatureModifier;
|
||||
mutable field net/minecraft/world/biome/Biome$Weather temperatureModifier Lnet/minecraft/world/biome/Biome$TemperatureModifier;
|
||||
accessible field net/minecraft/world/biome/Biome$Weather downfall F
|
||||
mutable field net/minecraft/world/biome/Biome$Weather downfall F
|
||||
accessible method net/minecraft/world/biome/Biome$Weather <init> (ZFLnet/minecraft/world/biome/Biome$TemperatureModifier;F)V
|
||||
|
||||
# Biome Effects
|
||||
accessible field net/minecraft/world/biome/BiomeEffects fogColor I
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
"minecraft:freeze_top_layer"
|
||||
]
|
||||
],
|
||||
"precipitation": "rain",
|
||||
"has_precipitation": true,
|
||||
"spawn_costs": {},
|
||||
"spawners": {
|
||||
"ambient": [
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
"minecraft:crimson_forest_vegetation"
|
||||
]
|
||||
],
|
||||
"precipitation": "none",
|
||||
"has_precipitation": false,
|
||||
"spawn_costs": {},
|
||||
"spawners": {
|
||||
"ambient": [],
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"water_fog_color": 329011
|
||||
},
|
||||
"features": [],
|
||||
"precipitation": "none",
|
||||
"has_precipitation": false,
|
||||
"spawn_costs": {},
|
||||
"spawners": {
|
||||
"ambient": [
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
"minecraft:end_gateway_return"
|
||||
]
|
||||
],
|
||||
"precipitation": "none",
|
||||
"has_precipitation": false,
|
||||
"spawn_costs": {},
|
||||
"spawners": {
|
||||
"ambient": [
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"water_fog_color": 329011
|
||||
},
|
||||
"features": [],
|
||||
"precipitation": "none",
|
||||
"has_precipitation": false,
|
||||
"spawn_costs": {},
|
||||
"spawners": {
|
||||
"ambient": [
|
||||
|
|
|
@ -74,7 +74,7 @@ public final class TestBiomes {
|
|||
private static Biome composeEndSpawnSettings(GenerationSettings.Builder builder) {
|
||||
SpawnSettings.Builder builder2 = new SpawnSettings.Builder();
|
||||
DefaultBiomeFeatures.addPlainsMobs(builder2);
|
||||
return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).temperature(0.5F).downfall(0.5F).effects((new BiomeEffects.Builder()).waterColor(4159204).waterFogColor(329011).fogColor(10518688).skyColor(0).moodSound(
|
||||
return (new Biome.Builder()).method_48164(false).temperature(0.5F).downfall(0.5F).effects((new BiomeEffects.Builder()).waterColor(4159204).waterFogColor(329011).fogColor(10518688).skyColor(0).moodSound(
|
||||
BiomeMoodSound.CAVE).build()).spawnSettings(builder2.build()).generationSettings(builder.build()).build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"temperature": 0.8,
|
||||
"downfall": 0.4,
|
||||
"precipitation": "rain",
|
||||
"has_precipitation": true,
|
||||
"effects": {
|
||||
"sky_color": 7907327,
|
||||
"fog_color": 12638463,
|
||||
|
@ -12,4 +12,4 @@
|
|||
"spawn_costs": {},
|
||||
"carvers": {},
|
||||
"features": []
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,17 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.entity.event;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.network.packet.s2c.play.Flag;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -42,4 +46,13 @@ abstract class EntityMixin {
|
|||
ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.invoker().afterChangeWorld((Entity) (Object) this, ret, (ServerWorld) this.world, (ServerWorld) ret.world);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We need to fire the change world event for entities that are teleported using the `/teleport` command.
|
||||
*/
|
||||
@Inject(method = "method_48105", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setRemoved(Lnet/minecraft/entity/Entity$RemovalReason;)V"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void afterEntityTeleportedToWorld(ServerWorld destination, double x, double y, double z, Set<Flag> flags, float yaw, float pitch, CallbackInfoReturnable<Boolean> cir, float i, Entity newEntity) {
|
||||
Entity originalEntity = (Entity) (Object) this;
|
||||
ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.invoker().afterChangeWorld(originalEntity, newEntity, ((ServerWorld) originalEntity.world), destination);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.mixin.entity.event;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Coerce;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.command.TeleportCommand;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
|
||||
import net.fabricmc.fabric.api.entity.event.v1.ServerEntityWorldChangeEvents;
|
||||
|
||||
@Mixin(TeleportCommand.class)
|
||||
abstract class TeleportCommandMixin {
|
||||
/**
|
||||
* We need to fire the change world event for entities that are teleported using the `/teleport` command.
|
||||
*/
|
||||
@Inject(method = "teleport", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setRemoved(Lnet/minecraft/entity/Entity$RemovalReason;)V"), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
|
||||
private static void afterEntityTeleportedToWorld(ServerCommandSource source, Entity originalEntity, ServerWorld destination, double x, double y, double z, Set<PlayerPositionLookS2CPacket.Flag> movementFlags, float yaw, float pitch, @Coerce Object facingLocation, CallbackInfo ci, float clampedYaw, float clampedPitch, float h, Entity newEntity) {
|
||||
ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.invoker().afterChangeWorld(originalEntity, newEntity, ((ServerWorld) originalEntity.world), destination);
|
||||
}
|
||||
}
|
|
@ -9,8 +9,7 @@
|
|||
"LivingEntityMixin",
|
||||
"PlayerEntityMixin",
|
||||
"PlayerManagerMixin",
|
||||
"ServerPlayerEntityMixin",
|
||||
"TeleportCommandMixin"
|
||||
"ServerPlayerEntityMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1,
|
||||
|
|
|
@ -61,7 +61,7 @@ public final class DoubleRuleWidget extends EditGameRulesScreen.NamedRuleWidget
|
|||
// FIXME: Param names nightmare
|
||||
this.drawName(matrices, y, x);
|
||||
|
||||
this.textFieldWidget.setPos(x + entryWidth - 44, y);
|
||||
this.textFieldWidget.method_48229(x + entryWidth - 44, y);
|
||||
this.textFieldWidget.render(matrices, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public final class EnumRuleWidget<E extends Enum<E>> extends EditGameRulesScreen
|
|||
// FIXME: Param names nightmare
|
||||
this.drawName(matrices, y, x);
|
||||
|
||||
this.buttonWidget.setPos(x + entryWidth - 89, y);
|
||||
this.buttonWidget.method_48229(x + entryWidth - 89, y);
|
||||
this.buttonWidget.render(matrices, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import net.fabricmc.fabric.api.networking.v1.FutureListeners;
|
|||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
|
||||
import net.fabricmc.fabric.impl.networking.AbstractNetworkAddon;
|
||||
import net.fabricmc.fabric.impl.networking.GenericFutureListenerHolder;
|
||||
import net.fabricmc.fabric.mixin.networking.client.accessor.ClientLoginNetworkHandlerAccessor;
|
||||
|
||||
public final class ClientLoginNetworkAddon extends AbstractNetworkAddon<ClientLoginNetworking.LoginQueryRequestHandler> {
|
||||
private final ClientLoginNetworkHandler handler;
|
||||
|
@ -89,7 +90,7 @@ public final class ClientLoginNetworkAddon extends AbstractNetworkAddon<ClientLo
|
|||
listener = FutureListeners.union(listener, each);
|
||||
}
|
||||
|
||||
this.handler.getConnection().send(packet, GenericFutureListenerHolder.create(listener));
|
||||
((ClientLoginNetworkHandlerAccessor) this.handler).getConnection().send(packet, GenericFutureListenerHolder.create(listener));
|
||||
});
|
||||
} catch (Throwable ex) {
|
||||
this.logger.error("Encountered exception while handling in channel with name \"{}\"", channelName, ex);
|
||||
|
|
|
@ -42,6 +42,7 @@ import net.fabricmc.fabric.impl.networking.ChannelInfoHolder;
|
|||
import net.fabricmc.fabric.impl.networking.GlobalReceiverRegistry;
|
||||
import net.fabricmc.fabric.impl.networking.NetworkHandlerExtensions;
|
||||
import net.fabricmc.fabric.impl.networking.NetworkingImpl;
|
||||
import net.fabricmc.fabric.mixin.networking.client.accessor.ClientLoginNetworkHandlerAccessor;
|
||||
import net.fabricmc.fabric.mixin.networking.client.accessor.ConnectScreenAccessor;
|
||||
import net.fabricmc.fabric.mixin.networking.client.accessor.MinecraftClientAccessor;
|
||||
|
||||
|
@ -121,7 +122,8 @@ public final class ClientNetworkingImpl {
|
|||
ids.add(buf.readIdentifier());
|
||||
}
|
||||
|
||||
((ChannelInfoHolder) handler.getConnection()).getPendingChannelsNames().addAll(ids);
|
||||
ClientConnection connection = ((ClientLoginNetworkHandlerAccessor) handler).getConnection();
|
||||
((ChannelInfoHolder) connection).getPendingChannelsNames().addAll(ids);
|
||||
NetworkingImpl.LOGGER.debug("Received accepted channels from the server");
|
||||
|
||||
PacketByteBuf response = PacketByteBufs.create();
|
||||
|
|
|
@ -45,7 +45,7 @@ public final class ClientPlayNetworkAddon extends AbstractChanneledNetworkAddon<
|
|||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
public ClientPlayNetworkAddon(ClientPlayNetworkHandler handler, MinecraftClient client) {
|
||||
super(ClientNetworkingImpl.PLAY, handler.getConnection(), "ClientPlayNetworkAddon for " + handler.getProfile().getName());
|
||||
super(ClientNetworkingImpl.PLAY, handler.method_48296(), "ClientPlayNetworkAddon for " + handler.getProfile().getName());
|
||||
this.handler = handler;
|
||||
this.client = client;
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.mixin.networking.client.accessor;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.client.network.ClientLoginNetworkHandler;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
|
||||
@Mixin(ClientLoginNetworkHandler.class)
|
||||
public interface ClientLoginNetworkHandlerAccessor {
|
||||
@Accessor
|
||||
ClientConnection getConnection();
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
"package": "net.fabricmc.fabric.mixin.networking.client",
|
||||
"compatibilityLevel": "JAVA_16",
|
||||
"client": [
|
||||
"accessor.ClientLoginNetworkHandlerAccessor",
|
||||
"accessor.ConnectScreenAccessor",
|
||||
"accessor.MinecraftClientAccessor",
|
||||
"ClientLoginNetworkHandlerMixin",
|
||||
|
|
|
@ -20,9 +20,10 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
|
@ -30,6 +31,7 @@ import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
|
|||
import net.fabricmc.fabric.api.networking.v1.ServerLoginConnectionEvents;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerLoginNetworking;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
import net.fabricmc.fabric.mixin.networking.accessor.ServerLoginNetworkHandlerAccessor;
|
||||
|
||||
public final class NetworkingImpl {
|
||||
public static final String MOD_ID = "fabric-networking-api-v1";
|
||||
|
@ -77,7 +79,8 @@ public final class NetworkingImpl {
|
|||
ids.add(buf.readIdentifier());
|
||||
}
|
||||
|
||||
((ChannelInfoHolder) handler.getConnection()).getPendingChannelsNames().addAll(ids);
|
||||
ClientConnection connection = ((ServerLoginNetworkHandlerAccessor) handler).getConnection();
|
||||
((ChannelInfoHolder) connection).getPendingChannelsNames().addAll(ids);
|
||||
NetworkingImpl.LOGGER.debug("Received accepted channels from the client for \"{}\"", handler.getConnectionInfo());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public final class ServerLoginNetworkAddon extends AbstractNetworkAddon<ServerLo
|
|||
|
||||
public ServerLoginNetworkAddon(ServerLoginNetworkHandler handler) {
|
||||
super(ServerNetworkingImpl.LOGIN, "ServerLoginNetworkAddon for " + handler.getConnectionInfo());
|
||||
this.connection = handler.connection;
|
||||
this.connection = ((ServerLoginNetworkHandlerAccessor) handler).getConnection();
|
||||
this.handler = handler;
|
||||
this.server = ((ServerLoginNetworkHandlerAccessor) handler).getServer();
|
||||
this.queryIdFactory = QueryIdFactory.create();
|
||||
|
|
|
@ -34,6 +34,7 @@ import net.fabricmc.fabric.impl.networking.AbstractChanneledNetworkAddon;
|
|||
import net.fabricmc.fabric.impl.networking.ChannelInfoHolder;
|
||||
import net.fabricmc.fabric.impl.networking.NetworkingImpl;
|
||||
import net.fabricmc.fabric.mixin.networking.accessor.CustomPayloadC2SPacketAccessor;
|
||||
import net.fabricmc.fabric.mixin.networking.accessor.ServerPlayNetworkHandlerAccessor;
|
||||
|
||||
public final class ServerPlayNetworkAddon extends AbstractChanneledNetworkAddon<ServerPlayNetworking.PlayChannelHandler> {
|
||||
private final ServerPlayNetworkHandler handler;
|
||||
|
@ -41,7 +42,7 @@ public final class ServerPlayNetworkAddon extends AbstractChanneledNetworkAddon<
|
|||
private boolean sentInitialRegisterPacket;
|
||||
|
||||
public ServerPlayNetworkAddon(ServerPlayNetworkHandler handler, MinecraftServer server) {
|
||||
super(ServerNetworkingImpl.PLAY, handler.getConnection(), "ServerPlayNetworkAddon for " + handler.player.getEntityName());
|
||||
super(ServerNetworkingImpl.PLAY, ((ServerPlayNetworkHandlerAccessor) handler).getConnection(), "ServerPlayNetworkAddon for " + handler.player.getEntityName());
|
||||
this.handler = handler;
|
||||
this.server = server;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ package net.fabricmc.fabric.mixin.networking.accessor;
|
|||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerLoginNetworkHandler;
|
||||
|
||||
|
@ -26,4 +27,7 @@ import net.minecraft.server.network.ServerLoginNetworkHandler;
|
|||
public interface ServerLoginNetworkHandlerAccessor {
|
||||
@Accessor
|
||||
MinecraftServer getServer();
|
||||
|
||||
@Accessor
|
||||
ClientConnection getConnection();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.mixin.networking.accessor;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
||||
|
||||
@Mixin(ServerPlayNetworkHandler.class)
|
||||
public interface ServerPlayNetworkHandlerAccessor {
|
||||
@Accessor
|
||||
ClientConnection getConnection();
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
"accessor.CustomPayloadC2SPacketAccessor",
|
||||
"accessor.EntityTrackerAccessor",
|
||||
"accessor.LoginQueryResponseC2SPacketAccessor",
|
||||
"accessor.ServerPlayNetworkHandlerAccessor",
|
||||
"accessor.ServerLoginNetworkHandlerAccessor",
|
||||
"accessor.ThreadedAnvilChunkStorageAccessor"
|
||||
],
|
||||
|
|
|
@ -59,7 +59,7 @@ final class ChannelScreen extends Screen {
|
|||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackgroundTexture(0);
|
||||
this.renderBackgroundTexture(matrices);
|
||||
this.channelList.render(matrices, mouseX, mouseY, delta);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class DisconnectScreenTest implements ClientModInitializer {
|
|||
builder.append("\nLine ").append(i + 1);
|
||||
}
|
||||
|
||||
context.getSource().getPlayer().networkHandler.getConnection().disconnect(Text.of(builder.toString()));
|
||||
context.getSource().getPlayer().networkHandler.method_48296().disconnect(Text.of(builder.toString()));
|
||||
return 1;
|
||||
})));
|
||||
}
|
||||
|
|
|
@ -5,3 +5,5 @@ accessible method net/minecraft/recipe/Ingredient <init> (Ljava/util
|
|||
accessible field net/minecraft/recipe/Ingredient matchingStacks [Lnet/minecraft/item/ItemStack;
|
||||
|
||||
accessible field net/minecraft/network/ClientConnection channel Lio/netty/channel/Channel;
|
||||
|
||||
accessible field net/minecraft/server/network/ServerLoginNetworkHandler connection Lnet/minecraft/network/ClientConnection;
|
||||
|
|
|
@ -40,7 +40,7 @@ public class FabricRegistryClientInit implements ClientModInitializer {
|
|||
RegistrySyncManager.receivePacket(client, packetHandler, buf, RegistrySyncManager.DEBUG || !client.isInSingleplayer(), (e) -> {
|
||||
LOGGER.error("Registry remapping failed!", e);
|
||||
|
||||
client.execute(() -> handler.getConnection().disconnect(Text.literal("Registry remapping failed: " + e.getMessage())));
|
||||
client.execute(() -> handler.method_48296().disconnect(Text.literal("Registry remapping failed: " + e.getMessage())));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
|||
|
||||
@Mixin(InGameHud.class)
|
||||
public class InGameHudMixin {
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderColor(FFFF)V"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;render(Lnet/minecraft/client/util/math/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreboardObjective;)V")))
|
||||
@Inject(method = "render", at = @At(value = "TAIL"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;render(Lnet/minecraft/client/util/math/MatrixStack;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreboardObjective;)V")))
|
||||
public void render(MatrixStack matrixStack, float tickDelta, CallbackInfo callbackInfo) {
|
||||
HudRenderCallback.EVENT.invoker().onHudRender(matrixStack, tickDelta);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,6 @@ public class DimensionalRenderingTest implements ClientModInitializer {
|
|||
tessellator.draw();
|
||||
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class FabricModResourcePack extends GroupResourcePack {
|
|||
|
||||
if ("pack.mcmeta".equals(fileName)) {
|
||||
String description = "Mod resources.";
|
||||
String pack = String.format("{\"pack\":{\"pack_format\":" + type.getPackVersion(SharedConstants.getGameVersion()) + ",\"description\":\"%s\"}}", description);
|
||||
String pack = String.format("{\"pack\":{\"pack_format\":" + SharedConstants.getGameVersion().method_48017(type) + ",\"description\":\"%s\"}}", description);
|
||||
return () -> IOUtils.toInputStream(pack, Charsets.UTF_8);
|
||||
} else if ("pack.png".equals(fileName)) {
|
||||
return FabricLoader.getInstance().getModContainer("fabric-resource-loader-v0")
|
||||
|
|
|
@ -84,7 +84,7 @@ public final class ModResourcePackUtil {
|
|||
switch (filename) {
|
||||
case "pack.mcmeta":
|
||||
String description = Objects.requireNonNullElse(info.getName(), "");
|
||||
String metadata = serializeMetadata(type.getPackVersion(SharedConstants.getGameVersion()), description);
|
||||
String metadata = serializeMetadata(SharedConstants.getGameVersion().method_48017(type), description);
|
||||
return IOUtils.toInputStream(metadata, Charsets.UTF_8);
|
||||
default:
|
||||
return null;
|
||||
|
|
|
@ -1,62 +1,62 @@
|
|||
org.gradle.jvmargs=-Xmx2560M
|
||||
org.gradle.parallel=true
|
||||
|
||||
version=0.72.0
|
||||
minecraft_version=1.19.3
|
||||
yarn_version=+build.3
|
||||
loader_version=0.14.10
|
||||
version=0.72.1
|
||||
minecraft_version=23w03a
|
||||
yarn_version=+build.1
|
||||
loader_version=0.14.13
|
||||
installer_version=0.11.1
|
||||
|
||||
prerelease=false
|
||||
prerelease=true
|
||||
|
||||
# Do not manually update, use the bumpversions task:
|
||||
fabric-api-base-version=0.4.20
|
||||
fabric-api-lookup-api-v1-version=1.6.19
|
||||
fabric-biome-api-v1-version=12.1.0
|
||||
fabric-api-base-version=0.4.21
|
||||
fabric-api-lookup-api-v1-version=1.6.20
|
||||
fabric-biome-api-v1-version=13.0.0
|
||||
fabric-block-api-v1-version=1.0.4
|
||||
fabric-blockrenderlayer-v1-version=1.1.29
|
||||
fabric-command-api-v1-version=1.2.21
|
||||
fabric-command-api-v2-version=2.2.0
|
||||
fabric-commands-v0-version=0.2.38
|
||||
fabric-containers-v0-version=0.1.46
|
||||
fabric-content-registries-v0-version=3.5.0
|
||||
fabric-blockrenderlayer-v1-version=1.1.30
|
||||
fabric-command-api-v1-version=1.2.22
|
||||
fabric-command-api-v2-version=2.2.1
|
||||
fabric-commands-v0-version=0.2.39
|
||||
fabric-containers-v0-version=0.1.47
|
||||
fabric-content-registries-v0-version=3.5.1
|
||||
fabric-crash-report-info-v1-version=0.2.13
|
||||
fabric-data-generation-api-v1-version=11.1.4
|
||||
fabric-dimensions-v1-version=2.1.40
|
||||
fabric-entity-events-v1-version=1.5.6
|
||||
fabric-events-interaction-v0-version=0.4.39
|
||||
fabric-events-lifecycle-v0-version=0.2.42
|
||||
fabric-game-rule-api-v1-version=1.0.29
|
||||
fabric-gametest-api-v1-version=1.1.16
|
||||
fabric-item-api-v1-version=2.1.8
|
||||
fabric-item-group-api-v1-version=2.1.11
|
||||
fabric-data-generation-api-v1-version=11.1.5
|
||||
fabric-dimensions-v1-version=2.1.41
|
||||
fabric-entity-events-v1-version=1.5.7
|
||||
fabric-events-interaction-v0-version=0.4.40
|
||||
fabric-events-lifecycle-v0-version=0.2.43
|
||||
fabric-game-rule-api-v1-version=1.0.30
|
||||
fabric-gametest-api-v1-version=1.1.17
|
||||
fabric-item-api-v1-version=2.1.9
|
||||
fabric-item-group-api-v1-version=2.1.12
|
||||
fabric-key-binding-api-v1-version=1.0.30
|
||||
fabric-keybindings-v0-version=0.2.28
|
||||
fabric-lifecycle-events-v1-version=2.2.9
|
||||
fabric-loot-api-v2-version=1.1.19
|
||||
fabric-loot-tables-v1-version=1.1.23
|
||||
fabric-message-api-v1-version=5.0.13
|
||||
fabric-mining-level-api-v1-version=2.1.30
|
||||
fabric-models-v0-version=0.3.26
|
||||
fabric-networking-api-v1-version=1.2.16
|
||||
fabric-networking-v0-version=0.3.33
|
||||
fabric-object-builder-api-v1-version=5.3.0
|
||||
fabric-particles-v1-version=1.0.19
|
||||
fabric-recipe-api-v1-version=1.0.0
|
||||
fabric-registry-sync-v0-version=2.0.4
|
||||
fabric-renderer-api-v1-version=2.2.0
|
||||
fabric-renderer-indigo-version=0.7.0
|
||||
fabric-renderer-registries-v1-version=3.2.29
|
||||
fabric-rendering-data-attachment-v1-version=0.3.24
|
||||
fabric-rendering-fluids-v1-version=3.0.17
|
||||
fabric-rendering-v0-version=1.1.32
|
||||
fabric-rendering-v1-version=1.12.0
|
||||
fabric-lifecycle-events-v1-version=2.2.10
|
||||
fabric-loot-api-v2-version=1.1.20
|
||||
fabric-loot-tables-v1-version=1.1.24
|
||||
fabric-message-api-v1-version=5.0.14
|
||||
fabric-mining-level-api-v1-version=2.1.31
|
||||
fabric-models-v0-version=0.3.27
|
||||
fabric-networking-api-v1-version=1.2.17
|
||||
fabric-networking-v0-version=0.3.34
|
||||
fabric-object-builder-api-v1-version=5.3.1
|
||||
fabric-particles-v1-version=1.0.20
|
||||
fabric-recipe-api-v1-version=1.0.1
|
||||
fabric-registry-sync-v0-version=2.0.5
|
||||
fabric-renderer-api-v1-version=2.2.1
|
||||
fabric-renderer-indigo-version=0.7.1
|
||||
fabric-renderer-registries-v1-version=3.2.30
|
||||
fabric-rendering-data-attachment-v1-version=0.3.25
|
||||
fabric-rendering-fluids-v1-version=3.0.18
|
||||
fabric-rendering-v0-version=1.1.33
|
||||
fabric-rendering-v1-version=1.12.1
|
||||
fabric-resource-conditions-api-v1-version=2.2.2
|
||||
fabric-resource-loader-v0-version=0.10.4
|
||||
fabric-screen-api-v1-version=1.0.40
|
||||
fabric-screen-handler-api-v1-version=1.3.12
|
||||
fabric-resource-loader-v0-version=0.10.5
|
||||
fabric-screen-api-v1-version=1.0.41
|
||||
fabric-screen-handler-api-v1-version=1.3.13
|
||||
fabric-sound-api-v1-version=1.0.7
|
||||
fabric-transfer-api-v1-version=2.1.14
|
||||
fabric-transfer-api-v1-version=2.1.15
|
||||
fabric-transitive-access-wideners-v1-version=2.3.0
|
||||
fabric-convention-tags-v1-version=1.2.1
|
||||
fabric-client-tags-api-v1-version=1.0.11
|
||||
fabric-convention-tags-v1-version=1.2.2
|
||||
fabric-client-tags-api-v1-version=1.0.12
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
"FabricMC"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.10",
|
||||
"fabricloader": ">=0.14.13",
|
||||
"java": ">=17",
|
||||
"minecraft": ">=1.19.3- <1.19.4-"
|
||||
"minecraft": ">=1.19.4- <1.19.5-"
|
||||
},
|
||||
"description": "Core API module providing key hooks and intercompatibility features."
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue