This commit is contained in:
modmuss50
2023-04-26 18:18:06 +01:00
parent 07640e5410
commit b3f2574b16
43 changed files with 200 additions and 235 deletions

View File

@@ -25,6 +25,7 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.EntityTrackingListener;
import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.server.world.ThreadedAnvilChunkStorage;
@@ -33,7 +34,6 @@ import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.chunk.ChunkManager;
import net.minecraft.server.world.EntityTrackingListener;
import net.fabricmc.fabric.mixin.networking.accessor.EntityTrackerAccessor;
import net.fabricmc.fabric.mixin.networking.accessor.ThreadedAnvilChunkStorageAccessor;
@@ -109,7 +109,7 @@ public final class PlayerLookup {
*/
public static Collection<ServerPlayerEntity> tracking(Entity entity) {
Objects.requireNonNull(entity, "Entity cannot be null");
ChunkManager manager = entity.world.getChunkManager();
ChunkManager manager = entity.getWorld().getChunkManager();
if (manager instanceof ServerChunkManager) {
ThreadedAnvilChunkStorage storage = ((ServerChunkManager) manager).threadedAnvilChunkStorage;

View File

@@ -17,7 +17,7 @@
package net.fabricmc.fabric.test.networking.channeltest;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.widget.EntryListWidget;
import net.minecraft.text.Text;
@@ -51,8 +51,8 @@ final class ChannelList extends EntryListWidget<ChannelList.Entry> {
}
@Override
public void render(DrawableHelper drawableHelper, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
drawableHelper.method_51438(ChannelList.this.client.textRenderer, Text.literal(this.channel.toString()).formatted(Formatting.WHITE), x, y);
public void render(DrawContext drawContext, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
drawContext.drawTooltip(ChannelList.this.client.textRenderer, Text.literal(this.channel.toString()).formatted(Formatting.WHITE), x, y);
}
}
}

View File

@@ -16,7 +16,7 @@
package net.fabricmc.fabric.test.networking.channeltest;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.tooltip.Tooltip;
import net.minecraft.client.gui.widget.ButtonWidget;
@@ -58,16 +58,16 @@ final class ChannelScreen extends Screen {
}
@Override
public void render(DrawableHelper drawableHelper, int mouseX, int mouseY, float delta) {
this.renderBackgroundTexture(drawableHelper);
this.channelList.render(drawableHelper, mouseX, mouseY, delta);
super.render(drawableHelper, mouseX, mouseY, delta);
public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) {
this.renderBackgroundTexture(drawContext);
this.channelList.render(drawContext, mouseX, mouseY, delta);
super.render(drawContext, mouseX, mouseY, delta);
if (this.s2cButton.active && this.c2sButton.active) {
final Text clickMe = Text.literal("Click S2C or C2S to view supported channels").formatted(Formatting.YELLOW);
final int textWidth = this.textRenderer.getWidth(clickMe);
drawableHelper.method_51438(
drawContext.drawTooltip(
this.textRenderer,
clickMe,
(int) (this.width / 2.0F - (textWidth / 2.0F)),