-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deduplicate compat code by building patches on top of each other; bun…
…dle into single release JAR
- Loading branch information
1 parent
c935ec3
commit 2d9f024
Showing
43 changed files
with
534 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 14 additions & 6 deletions
20
...ersleeping-1.17/src/main/java/com/github/reviversmc/bettersleeping/BetterSleeping117.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
package com.github.reviversmc.bettersleeping; | ||
|
||
import net.fabricmc.api.ModInitializer; | ||
import java.util.function.Supplier; | ||
|
||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; | ||
|
||
import com.github.reviversmc.bettersleeping.compat.minecraft.McVersionCompatInitializer; | ||
import com.github.reviversmc.bettersleeping.compat.minecraft.McVersionHelper; | ||
import com.github.reviversmc.bettersleeping.events.EventHandler117; | ||
|
||
public class BetterSleeping117 implements ModInitializer { | ||
public static EventHandler117 eventHandler; | ||
public class BetterSleeping117 extends McVersionCompatInitializer { | ||
static final Supplier<Boolean> IS_COMPATIBLE = () -> McVersionHelper.isWithin("1.17", "1.18.2"); | ||
|
||
@Override | ||
public boolean isCompatible() { | ||
return IS_COMPATIBLE.get(); | ||
} | ||
|
||
@Override | ||
public void onInitialize() { | ||
eventHandler = new EventHandler117(); | ||
public void initialize() { | ||
BetterSleeping.eventHandler = new EventHandler117(); | ||
|
||
ServerTickEvents.END_SERVER_TICK.register(eventHandler::onTick); | ||
ServerTickEvents.END_SERVER_TICK.register(BetterSleeping.eventHandler::onTick); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
bettersleeping-1.17/src/main/java/com/github/reviversmc/bettersleeping/MixinProvider117.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.github.reviversmc.bettersleeping; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import com.github.reviversmc.bettersleeping.compat.minecraft.McVersionMixinProvider; | ||
|
||
public class MixinProvider117 extends McVersionMixinProvider { | ||
@Override | ||
public List<String> getMixins() { | ||
if (BetterSleeping117.IS_COMPATIBLE.get()) { | ||
return Collections.singletonList("ServerPlayerEntityMixin117"); | ||
} | ||
|
||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "bettersleeping", | ||
"id": "bettersleeping-compat-1-17", | ||
"version": "${version}", | ||
"name": "BetterSleeping", | ||
"description": "This mod adds sleep notifications, gives sleeping players buffs and debuffs to the ones who haven't slept in a long time!", | ||
"authors": [ | ||
"NebelNidas", | ||
"TacoMonkey", | ||
"ExtraCrafTX" | ||
], | ||
"contact": { | ||
"homepage": "https://github.com/ReviversMC/bettersleeping", | ||
"issues": "https://github.com/ReviversMC/bettersleeping/issues" | ||
}, | ||
"icon": "assets/bettersleeping/icon.png", | ||
"name": "BetterSleeping 1.17 Compat", | ||
"license": "CC-BY-NC-SA-4.0", | ||
"environment": "*", | ||
"mixins": [ | ||
"bettersleeping.mixins.json" | ||
], | ||
"entrypoints": { | ||
"main": [ | ||
"bettersleeping": [ | ||
"com.github.reviversmc.bettersleeping.BetterSleeping117" | ||
], | ||
"modmenu": [ | ||
"com.github.reviversmc.bettersleeping.client.ModMenuIntegration" | ||
"com.github.reviversmc.bettersleeping.compat.mods.ModMenuIntegration" | ||
] | ||
}, | ||
"mixins": [ | ||
"bettersleeping117.mixins.json" | ||
], | ||
"depends": { | ||
"minecraft": ">=1.17- <1.19", | ||
"fabricloader": ">=0.12.9", | ||
"minecraft": ">=1.17", | ||
"bettersleeping-core": "*" | ||
}, | ||
"custom": { | ||
"modmenu": { | ||
"badges": ["library"], | ||
"parent": { | ||
"id": "bettersleeping" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 14 additions & 6 deletions
20
...leeping-1.19.3/src/main/java/com/github/reviversmc/bettersleeping/BetterSleeping1193.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
package com.github.reviversmc.bettersleeping; | ||
|
||
import net.fabricmc.api.ModInitializer; | ||
import java.util.function.Supplier; | ||
|
||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; | ||
|
||
import com.github.reviversmc.bettersleeping.compat.minecraft.McVersionCompatInitializer; | ||
import com.github.reviversmc.bettersleeping.compat.minecraft.McVersionHelper; | ||
import com.github.reviversmc.bettersleeping.events.EventHandler1193; | ||
|
||
public class BetterSleeping1193 implements ModInitializer { | ||
public static EventHandler1193 eventHandler; | ||
public class BetterSleeping1193 extends McVersionCompatInitializer { | ||
static final Supplier<Boolean> IS_COMPATIBLE = () -> McVersionHelper.isWithin("1.19.3", "1.20.4"); | ||
|
||
@Override | ||
public boolean isCompatible() { | ||
return IS_COMPATIBLE.get(); | ||
} | ||
|
||
@Override | ||
public void onInitialize() { | ||
eventHandler = new EventHandler1193(); | ||
public void initialize() { | ||
BetterSleeping.eventHandler = new EventHandler1193(); | ||
|
||
ServerTickEvents.END_SERVER_TICK.register(eventHandler::onTick); | ||
ServerTickEvents.END_SERVER_TICK.register(BetterSleeping.eventHandler::onTick); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...sleeping-1.19.3/src/main/java/com/github/reviversmc/bettersleeping/MixinProvider1193.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.github.reviversmc.bettersleeping; | ||
|
||
import java.util.List; | ||
|
||
import com.github.reviversmc.bettersleeping.compat.minecraft.McVersionMixinProvider; | ||
|
||
public class MixinProvider1193 extends McVersionMixinProvider { | ||
@Override | ||
public List<String> getMixins() { | ||
if (BetterSleeping1193.IS_COMPATIBLE.get()) { | ||
return List.of("ServerPlayerEntityMixin119"); | ||
} | ||
|
||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
...src/main/java/com/github/reviversmc/bettersleeping/mixin/ServerPlayerEntityMixin1193.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "bettersleeping", | ||
"id": "bettersleeping-compat-1-19-3", | ||
"version": "${version}", | ||
"name": "BetterSleeping", | ||
"description": "This mod adds sleep notifications, gives sleeping players buffs and debuffs to the ones who haven't slept in a long time!", | ||
"authors": [ | ||
"NebelNidas", | ||
"TacoMonkey", | ||
"ExtraCrafTX" | ||
], | ||
"contact": { | ||
"homepage": "https://github.com/ReviversMC/bettersleeping", | ||
"issues": "https://github.com/ReviversMC/bettersleeping/issues" | ||
}, | ||
"icon": "assets/bettersleeping/icon.png", | ||
"name": "BetterSleeping 1.19.3 Compat", | ||
"license": "CC-BY-NC-SA-4.0", | ||
"environment": "*", | ||
"mixins": [ | ||
"bettersleeping.mixins.json" | ||
], | ||
"entrypoints": { | ||
"main": [ | ||
"bettersleeping": [ | ||
"com.github.reviversmc.bettersleeping.BetterSleeping1193" | ||
], | ||
"modmenu": [ | ||
"com.github.reviversmc.bettersleeping.client.ModMenuIntegration" | ||
"com.github.reviversmc.bettersleeping.compat.mods.ModMenuIntegration" | ||
] | ||
}, | ||
"mixins": [ | ||
"bettersleeping1193.mixins.json" | ||
], | ||
"depends": { | ||
"minecraft": ">=1.19.3- <1.20.5", | ||
"bettersleeping-core": "*" | ||
"fabricloader": ">=0.12.9", | ||
"minecraft": ">=1.19.3", | ||
"bettersleeping-compat-1-19": "*" | ||
}, | ||
"custom": { | ||
"modmenu": { | ||
"badges": ["library"], | ||
"parent": { | ||
"id": "bettersleeping" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.