mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Move server-affecting mixins to their own package
This commit is contained in:
parent
80b885514f
commit
7560df438c
7 changed files with 29 additions and 31 deletions
|
@ -37,16 +37,6 @@ abstract class MixinChunkBlockLightProvider extends ChunkLightProvider {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@Inject(method = "getLightSourceLuminance", at = @At("RETURN"), cancellable = true)
|
||||
private void onGetLightSourceLuminance(long blockPos, BlockState blockState, CallbackInfoReturnable<Integer> info) {
|
||||
int x = ChunkSectionPos.getSectionCoord(BlockPos.unpackLongX(blockPos));
|
||||
int z = ChunkSectionPos.getSectionCoord(BlockPos.unpackLongZ(blockPos));
|
||||
if (chunkProvider.getChunk(x, z) instanceof WorldChunk chunk) {
|
||||
info.setReturnValue(Math.max(info.getReturnValue(), LightSources.get(chunk.getWorld()).getLuminance(blockPos)));
|
||||
}
|
||||
}*/
|
||||
|
||||
@Inject(method = "method_51529", at = @At("TAIL"))
|
||||
private void onMethod_51529(long blockPos, CallbackInfo info) {
|
||||
long sectionPos = ChunkSectionPos.fromBlockPos(blockPos);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.unicopia.mixin;
|
||||
package com.minelittlepony.unicopia.mixin.server;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.unicopia.mixin;
|
||||
package com.minelittlepony.unicopia.mixin.server;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.unicopia.mixin;
|
||||
package com.minelittlepony.unicopia.mixin.server;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
@ -1,6 +1,5 @@
|
|||
package com.minelittlepony.unicopia.mixin;
|
||||
package com.minelittlepony.unicopia.mixin.server;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -8,16 +7,13 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import com.minelittlepony.unicopia.server.world.BlockDestructionManager;
|
||||
import com.minelittlepony.unicopia.server.world.NocturnalSleepManager;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.server.world.SleepManager;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -57,11 +53,3 @@ abstract class MixinServerWorld extends World implements StructureWorldAccess, N
|
|||
getNocturnalSleepManager().skipTime();
|
||||
}
|
||||
}
|
||||
|
||||
@Mixin(SleepManager.class)
|
||||
abstract class MixinSleepManager {
|
||||
@ModifyVariable(method = "update(Ljava/util/List;)Z", at = @At("HEAD"))
|
||||
public List<ServerPlayerEntity> modifyPlayers(List<ServerPlayerEntity> players) {
|
||||
return players.size() <= 0 ? players : ((NocturnalSleepManager.Source)players.get(0).getWorld()).getNocturnalSleepManager().filterPlayers(players);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.minelittlepony.unicopia.mixin.server;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
|
||||
import com.minelittlepony.unicopia.server.world.NocturnalSleepManager;
|
||||
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.SleepManager;
|
||||
|
||||
@Mixin(SleepManager.class)
|
||||
abstract class MixinSleepManager {
|
||||
@ModifyVariable(method = "update(Ljava/util/List;)Z", at = @At("HEAD"))
|
||||
public List<ServerPlayerEntity> modifyPlayers(List<ServerPlayerEntity> players) {
|
||||
return players.size() <= 0 ? players : ((NocturnalSleepManager.Source)players.get(0).getWorld()).getNocturnalSleepManager().filterPlayers(players);
|
||||
}
|
||||
}
|
|
@ -37,15 +37,10 @@
|
|||
"MixinPersistentProjectileEntity",
|
||||
"MixinPlayerEntity",
|
||||
"MixinPlayerInventory",
|
||||
"MixinPlayerManager",
|
||||
"MixinPointOfInterestType",
|
||||
"MixinPowderSnowBlock",
|
||||
"MixinProjectileEntity",
|
||||
"MixinPufferfishEntity",
|
||||
"MixinServerPlayerEntity",
|
||||
"MixinServerPlayNetworkHandler",
|
||||
"MixinServerWorld",
|
||||
"MixinSleepManager",
|
||||
"MixinSheepEntity",
|
||||
"MixinShulkerEntity",
|
||||
"MixinStateManager",
|
||||
|
@ -56,6 +51,11 @@
|
|||
"MixinWardenEntity",
|
||||
"MixinWorld",
|
||||
"PointOfInterestTypesAccessor",
|
||||
"server.MixinPlayerManager",
|
||||
"server.MixinServerPlayerEntity",
|
||||
"server.MixinServerPlayNetworkHandler",
|
||||
"server.MixinServerWorld",
|
||||
"server.MixinSleepManager",
|
||||
"gravity.MixinBrain",
|
||||
"gravity.MixinEntity",
|
||||
"gravity.MixinLivingEntity",
|
||||
|
|
Loading…
Reference in a new issue