Skip to content

Commit

Permalink
Fix Duplicate Ticks in World
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Aug 13, 2024
1 parent 5e614ad commit 8bceea3
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 76 deletions.
7 changes: 0 additions & 7 deletions src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,6 @@ public static class Advanced {
@Config.LangKey("config.nomilabs.advanced.disable_xp_scaling")
public boolean disableXpScaling = false;

@Config.Comment({ "Whether to enable Syncing between Dimensions.",
"This means that changing difficulty, time, spawn point or other properties in one dimension will sync to all dimensions.",
"[default: false]" })
@Config.LangKey("config.nomilabs.advanced.sync_dim_properties")
@Config.RequiresWorldRestart
public boolean syncDimProperties = false;

@Config.Comment({ "Amount of XP Per Level, for Linear XP Scaling.",
"Used for Linear XP Scaling in Actually Additions, EIO and Thermal Items/Machines.",
"Note that for Thermal, XP fixes are only applied for the Tome of Knowledge, not for any machines associated with Essence of Knowledge.",
Expand Down

This file was deleted.

33 changes: 0 additions & 33 deletions src/main/java/com/nomiceu/nomilabs/mixin/WorldMixin.java

This file was deleted.

34 changes: 34 additions & 0 deletions src/main/java/com/nomiceu/nomilabs/mixin/WorldServerMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.nomiceu.nomilabs.mixin;

import net.minecraft.server.MinecraftServer;
import net.minecraft.world.WorldServer;

import org.spongepowered.asm.mixin.Final;
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.Redirect;
import org.spongepowered.asm.mixin.injection.Slice;

/**
* Makes Beds Change Time in All Dimensions. (Required for actually changing the time)
*/
@Mixin(WorldServer.class)
public class WorldServerMixin {

@Shadow
@Final
private MinecraftServer server;

@Redirect(method = "tick",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/WorldServer;setWorldTime(J)V"),
slice = @Slice(from = @At(value = "INVOKE",
target = "Lnet/minecraft/world/WorldServer;areAllPlayersAsleep()Z"),
to = @At(value = "INVOKE", target = "Lnet/minecraft/world/WorldServer;wakeAllPlayers()V")),
require = 1)
private void changeTimeInAllDimensions(WorldServer instance, long time) {
for (var world : server.worlds) {
world.setWorldTime(time);
}
}
}

This file was deleted.

3 changes: 1 addition & 2 deletions src/main/resources/mixins.nomilabs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
"mixins": [
"AccessibleFluidRegistry",
"CommandDifficultyMixin",
"DerivedWorldInfoMixin",
"FluidRegistryMixin",
"ForgeRegistryMixin",
"GameDataMixin",
"ItemStackMixin",
"NarratorMixin",
"SnapshotMixin",
"WorldLoadHandler",
"WorldMixin"
"WorldServerMixin"
],
"client": [
"EntityPlayerSPMixin",
Expand Down

0 comments on commit 8bceea3

Please sign in to comment.