diff --git a/gradle.properties b/gradle.properties index 5052889..c7bce3b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ yarn_mappings=1.20.4+build.1 loader_version=0.15.1 # Mod Properties -mod_version=0.4.3 +mod_version=0.4.4 maven_group=net.modfest archives_base_name=fireblanket diff --git a/src/main/java/net/modfest/fireblanket/mixin/ChangeHowSleepTimeWorks.java b/src/main/java/net/modfest/fireblanket/mixin/ChangeHowSleepTimeWorks.java new file mode 100644 index 0000000..05f062b --- /dev/null +++ b/src/main/java/net/modfest/fireblanket/mixin/ChangeHowSleepTimeWorks.java @@ -0,0 +1,31 @@ +package net.modfest.fireblanket.mixin; + +import net.minecraft.registry.DynamicRegistryManager; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.profiler.Profiler; +import net.minecraft.world.MutableWorldProperties; +import net.minecraft.world.World; +import net.minecraft.world.dimension.DimensionType; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +import java.util.function.Supplier; + +@Mixin(ServerWorld.class) +public abstract class ChangeHowSleepTimeWorks extends World { + protected ChangeHowSleepTimeWorks(MutableWorldProperties properties, RegistryKey registryRef, DynamicRegistryManager registryManager, RegistryEntry dimensionEntry, Supplier profiler, boolean isClient, boolean debugWorld, long biomeAccess, int maxChainedNeighborUpdates) { + super(properties, registryRef, registryManager, dimensionEntry, profiler, isClient, debugWorld, biomeAccess, maxChainedNeighborUpdates); + } + + // Hacked in fix for cerulean/moonrise compat + @ModifyArg(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;setTimeOfDay(J)V")) + long changeSleep(long input) { + if (this.isDay()) { + return input - 24000L; + } + return input; + } +} diff --git a/src/main/resources/fireblanket.mixins.json b/src/main/resources/fireblanket.mixins.json index 37e4405..0762eb4 100644 --- a/src/main/resources/fireblanket.mixins.json +++ b/src/main/resources/fireblanket.mixins.json @@ -4,78 +4,79 @@ "compatibilityLevel": "JAVA_17", "plugin": "net.modfest.fireblanket.FireblanketMixin", "mixins": [ - "accessor.BlockEntityTypeAccessor", - "accessor.ClientConnectionAccessor", - "accessor.EntityTypeAccessor", - "accessor.ServerChunkManagerAccessor", - "accessor.ServerLoginNetworkHandlerAccessor", - "adventure_fix.MixinEggItem", - "adventure_fix.MixinFlowerPotBlock", - "ai.MixinTemptGoal", - "be_sync.MixinBlockEntity", - "be_sync.MixinChunkHolder", - "block.MixinCommandBlock", - "block_format.MixinChunkSection", - "entity_ticking.MixinDebugStickItem", - "entity_ticking.MixinEntity", - "entity_ticking.MixinItemGroups", - "entity_ticking.MixinLivingEntity", - "entity_ticking.MixinMinecraftServer", - "entity_ticking.MixinThreadedAnvilChunkStorage", - "entity_ticking.create.MixinSuperGlueEntity", - "footgun.MixinEntitySelectorOptions", - "footgun.MixinEntitySelectorReader", - "fsc.MixinClientConnection", - "fsc.MixinSizePrepender", - "fsc.MixinSplitterHandler", - "io_uring.MixinServerNetworkIo", - "mods.create.AccessorSmartBlockEntity", - "mods.create.MixinMechanicalBearingBlockEntity", - "mods.mythicmetals.MixinCarmotShield", - "mods.pehkui.MixinScaleUtils", - "mods.pswg.MixinComplexCollisionManager", - "mods.terracotta_knights.MixinItemPickupGoal", - "opto.MixinEntitySelector", - "opto.MixinRecipeManager", - "packet_chunk_cache.MixinChunkDataS2CPacket", - "packet_chunk_cache.MixinWorldChunk", - "region_chunk_cache.MixinServerChunkManager", - "serde.MixinNbtCompound", - "serde.MixinServerPlayerEntity", - "sounds.MixinSpyglassItem", - "zstd.MixinChunkStreamVersion", - "zstd.MixinLevelStorageSession", - "zstd.MixinPersistentState", - "zstd.MixinPersistentStateManager", - "zstd.MixinRegionFile" + "ChangeHowSleepTimeWorks", + "accessor.BlockEntityTypeAccessor", + "accessor.ClientConnectionAccessor", + "accessor.EntityTypeAccessor", + "accessor.ServerChunkManagerAccessor", + "accessor.ServerLoginNetworkHandlerAccessor", + "adventure_fix.MixinEggItem", + "adventure_fix.MixinFlowerPotBlock", + "ai.MixinTemptGoal", + "be_sync.MixinBlockEntity", + "be_sync.MixinChunkHolder", + "block.MixinCommandBlock", + "block_format.MixinChunkSection", + "entity_ticking.MixinDebugStickItem", + "entity_ticking.MixinEntity", + "entity_ticking.MixinItemGroups", + "entity_ticking.MixinLivingEntity", + "entity_ticking.MixinMinecraftServer", + "entity_ticking.MixinThreadedAnvilChunkStorage", + "entity_ticking.create.MixinSuperGlueEntity", + "footgun.MixinEntitySelectorOptions", + "footgun.MixinEntitySelectorReader", + "fsc.MixinClientConnection", + "fsc.MixinSizePrepender", + "fsc.MixinSplitterHandler", + "io_uring.MixinServerNetworkIo", + "mods.create.AccessorSmartBlockEntity", + "mods.create.MixinMechanicalBearingBlockEntity", + "mods.mythicmetals.MixinCarmotShield", + "mods.pehkui.MixinScaleUtils", + "mods.pswg.MixinComplexCollisionManager", + "mods.terracotta_knights.MixinItemPickupGoal", + "opto.MixinEntitySelector", + "opto.MixinRecipeManager", + "packet_chunk_cache.MixinChunkDataS2CPacket", + "packet_chunk_cache.MixinWorldChunk", + "region_chunk_cache.MixinServerChunkManager", + "serde.MixinNbtCompound", + "serde.MixinServerPlayerEntity", + "sounds.MixinSpyglassItem", + "zstd.MixinChunkStreamVersion", + "zstd.MixinLevelStorageSession", + "zstd.MixinPersistentState", + "zstd.MixinPersistentStateManager", + "zstd.MixinRegionFile" ], "injectors": { - "defaultRequire": 1 + "defaultRequire": 1 }, "client": [ - "accessor.ClientLoginNetworkHandlerAccessor", - "client.MixinClientPlayNetworkHandler", - "client.MixinRenderSystem", - "client.MixinSignBlockEntityRenderer", - "client.be_masking.MixinBlockEntityRenderDispatcher", - "client.be_masking.MixinRebuildTask", - "client.be_masking.sodium.MixinChunkRenderRebuildTask", - "client.bufferbuilder_opto.MixinBufferBuilder", - "client.bufferbuilder_opto.MixinVertexFormat", - "client.entity_masking.MixinEntityRenderer", - "client.entity_ticking.MixinArmorStandEntity", - "client.entity_ticking.MixinLivingEntity", - "client.hooks.MixinWorldRenderer", - "client.lambdamap.MixinMapRegionFile", - "client.render_regions.MixinBlockEntityRenderDispatcher", - "client.render_regions.MixinEntityRenderDispatcher", - "client.render_regions.MixinRegionSubjects", - "client.timing.MixinBlockEntityRenderDispatcher", - "client.timing.MixinClientWorld", - "client.timing.MixinEntityRenderer", - "client.timing.MixinObservables", - "client.timing.MixinWorld", - "client.vbo_opto.MixinShaderProgram", - "client.vbo_opto.MixinVertexBuffer" + "accessor.ClientLoginNetworkHandlerAccessor", + "client.MixinClientPlayNetworkHandler", + "client.MixinRenderSystem", + "client.MixinSignBlockEntityRenderer", + "client.be_masking.MixinBlockEntityRenderDispatcher", + "client.be_masking.MixinRebuildTask", + "client.be_masking.sodium.MixinChunkRenderRebuildTask", + "client.bufferbuilder_opto.MixinBufferBuilder", + "client.bufferbuilder_opto.MixinVertexFormat", + "client.entity_masking.MixinEntityRenderer", + "client.entity_ticking.MixinArmorStandEntity", + "client.entity_ticking.MixinLivingEntity", + "client.hooks.MixinWorldRenderer", + "client.lambdamap.MixinMapRegionFile", + "client.render_regions.MixinBlockEntityRenderDispatcher", + "client.render_regions.MixinEntityRenderDispatcher", + "client.render_regions.MixinRegionSubjects", + "client.timing.MixinBlockEntityRenderDispatcher", + "client.timing.MixinClientWorld", + "client.timing.MixinEntityRenderer", + "client.timing.MixinObservables", + "client.timing.MixinWorld", + "client.vbo_opto.MixinShaderProgram", + "client.vbo_opto.MixinVertexBuffer" ] }