mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-11-14 05:44:52 +00:00
Small cleanup after testing
- Use TinyRemapper to remap mixins on Fabric. Mixins in the common project weren't being remapped correctly. - Update to latest NeoForge - Switch to the new tick events. - Call refreshDimensions() in the fake player constructor.
This commit is contained in:
parent
959bdaeb61
commit
2226df7224
@ -9,7 +9,7 @@
|
||||
# Remember to update corresponding versions in fabric.mod.json/neoforge.mods.toml
|
||||
fabric-api = "0.97.6+1.20.5"
|
||||
fabric-loader = "0.15.10"
|
||||
neoForge = "20.5.0-beta"
|
||||
neoForge = "20.5.20-beta"
|
||||
neoForgeSpi = "8.0.1"
|
||||
mixin = "0.8.5"
|
||||
parchment = "2024.04.14"
|
||||
@ -67,7 +67,7 @@ ideaExt = "1.1.7"
|
||||
illuaminate = "0.1.0-71-g378d86e"
|
||||
lwjgl = "3.3.3"
|
||||
minotaur = "2.8.7"
|
||||
neoGradle = "7.0.107"
|
||||
neoGradle = "7.0.116"
|
||||
nullAway = "0.10.25"
|
||||
spotless = "6.23.3"
|
||||
taskTree = "2.1.1"
|
||||
|
@ -109,7 +109,7 @@ sourceSets.main { resources.srcDir("src/generated/resources") }
|
||||
|
||||
loom {
|
||||
accessWidenerPath.set(project(":common").file("src/main/resources/computercraft.accesswidener"))
|
||||
mixin.defaultRefmapName.set("computercraft.refmap.json")
|
||||
mixin.useLegacyMixinAp = false
|
||||
|
||||
mods {
|
||||
register("computercraft") {
|
||||
|
@ -12,18 +12,14 @@ import net.minecraft.world.entity.EntityDimensions;
|
||||
import net.minecraft.world.entity.Pose;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
||||
public final class FakePlayer extends net.fabricmc.fabric.api.entity.FakePlayer {
|
||||
final class FakePlayer extends net.fabricmc.fabric.api.entity.FakePlayer {
|
||||
private static final EntityDimensions DIMENSIONS = EntityDimensions.fixed(0, 0);
|
||||
|
||||
private FakePlayer(ServerLevel serverLevel, GameProfile gameProfile) {
|
||||
FakePlayer(ServerLevel serverLevel, GameProfile gameProfile) {
|
||||
super(serverLevel, gameProfile);
|
||||
refreshDimensions();
|
||||
}
|
||||
|
||||
static FakePlayer create(ServerLevel serverLevel, GameProfile profile) {
|
||||
return new FakePlayer(serverLevel, profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarmPlayer(Player other) {
|
||||
return true;
|
||||
|
@ -236,7 +236,7 @@ public class PlatformHelperImpl implements PlatformHelper {
|
||||
|
||||
@Override
|
||||
public ServerPlayer createFakePlayer(ServerLevel world, GameProfile name) {
|
||||
return FakePlayer.create(world, name);
|
||||
return new FakePlayer(world, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +47,7 @@
|
||||
"depends": {
|
||||
"fabricloader": ">=0.15.10",
|
||||
"fabric-api": ">=0.97.3",
|
||||
"minecraft": "=1.20.5"
|
||||
"minecraft": ">=1.20.5 <1.20.7"
|
||||
},
|
||||
"accessWidener": "computercraft.accesswidener"
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.client.event.*;
|
||||
import net.neoforged.neoforge.client.event.sound.PlayStreamingSourceEvent;
|
||||
import net.neoforged.neoforge.event.TickEvent;
|
||||
import net.neoforged.neoforge.event.level.LevelEvent;
|
||||
|
||||
/**
|
||||
@ -24,13 +23,13 @@ public final class ForgeClientHooks {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onTick(TickEvent.ClientTickEvent event) {
|
||||
if (event.phase == TickEvent.Phase.START) ClientHooks.onTick();
|
||||
public static void onTick(ClientTickEvent.Pre event) {
|
||||
ClientHooks.onTick();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderTick(TickEvent.RenderTickEvent event) {
|
||||
if (event.phase == TickEvent.Phase.START) ClientHooks.onRenderTick();
|
||||
public static void onRenderTick(RenderFrameEvent.Pre event) {
|
||||
ClientHooks.onRenderTick();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -16,7 +16,6 @@ import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.event.AddReloadListenerEvent;
|
||||
import net.neoforged.neoforge.event.LootTableLoadEvent;
|
||||
import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
||||
import net.neoforged.neoforge.event.TickEvent;
|
||||
import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent;
|
||||
import net.neoforged.neoforge.event.entity.living.LivingDropsEvent;
|
||||
import net.neoforged.neoforge.event.level.ChunkEvent;
|
||||
@ -25,6 +24,7 @@ import net.neoforged.neoforge.event.level.ChunkWatchEvent;
|
||||
import net.neoforged.neoforge.event.server.ServerStartedEvent;
|
||||
import net.neoforged.neoforge.event.server.ServerStartingEvent;
|
||||
import net.neoforged.neoforge.event.server.ServerStoppedEvent;
|
||||
import net.neoforged.neoforge.event.tick.ServerTickEvent;
|
||||
|
||||
/**
|
||||
* Forge-specific dispatch for {@link CommonHooks}.
|
||||
@ -32,11 +32,13 @@ import net.neoforged.neoforge.event.server.ServerStoppedEvent;
|
||||
@EventBusSubscriber(modid = ComputerCraftAPI.MOD_ID)
|
||||
public class ForgeCommonHooks {
|
||||
@SubscribeEvent
|
||||
public static void onServerTick(TickEvent.ServerTickEvent event) {
|
||||
switch (event.phase) {
|
||||
case START -> CommonHooks.onServerTickStart(event.getServer());
|
||||
case END -> CommonHooks.onServerTickEnd();
|
||||
}
|
||||
public static void onServerTick(ServerTickEvent.Pre event) {
|
||||
CommonHooks.onServerTickStart(event.getServer());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onServerTick(ServerTickEvent.Post event) {
|
||||
CommonHooks.onServerTickStart(event.getServer());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -22,11 +22,7 @@ class FakePlayerExt extends FakePlayer {
|
||||
|
||||
FakePlayerExt(ServerLevel serverLevel, GameProfile profile) {
|
||||
super(serverLevel, profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doTick() {
|
||||
super.doTick();
|
||||
refreshDimensions();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,8 +15,8 @@ import net.neoforged.neoforge.client.event.ScreenEvent;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
||||
import net.neoforged.neoforge.event.RegisterGameTestsEvent;
|
||||
import net.neoforged.neoforge.event.TickEvent;
|
||||
import net.neoforged.neoforge.event.server.ServerStartedEvent;
|
||||
import net.neoforged.neoforge.event.tick.ServerTickEvent;
|
||||
|
||||
@Mod("cctest")
|
||||
public class TestMod {
|
||||
@ -34,9 +34,7 @@ public class TestMod {
|
||||
private static void onInitializeClient() {
|
||||
var bus = NeoForge.EVENT_BUS;
|
||||
|
||||
bus.addListener((TickEvent.ServerTickEvent e) -> {
|
||||
if (e.phase == TickEvent.Phase.START) ClientTestHooks.onServerTick(e.getServer());
|
||||
});
|
||||
bus.addListener((ServerTickEvent.Pre e) -> ClientTestHooks.onServerTick(e.getServer()));
|
||||
bus.addListener((ScreenEvent.Opening e) -> {
|
||||
if (ClientTestHooks.onOpenScreen(e.getScreen())) e.setCanceled(true);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user