refactored nonscarpet references yeet
This commit is contained in:
1 parent
e4c090c355
commit
2ff1f4fb71
22 files changed
+409
-401
No files matched your search
@@ -29,9 +29,9 @@ public class BlockItem_scarpetEventMixin
|
||||
}
|
||||
|
||||
@Inject(method = "placeBlock", at = @At("HEAD"), cancellable = true)
|
||||
private void beforePlacement(BlockPlaceContext blockPlaceContext, BlockState blockState, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (blockPlaceContext.getPlayer() instanceof ServerPlayer && PLAYER_PLACING_BLOCK.isNeeded()) {
|
||||
if (PLAYER_PLACING_BLOCK.onBlockPlaced((ServerPlayer) blockPlaceContext.getPlayer(), blockPlaceContext.getClickedPos(), blockPlaceContext.getHand(), blockPlaceContext.getItemInHand())) {
|
||||
private void beforePlacement(BlockPlaceContext context, BlockState placementState, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (context.getPlayer() instanceof ServerPlayer && PLAYER_PLACING_BLOCK.isNeeded()) {
|
||||
if (PLAYER_PLACING_BLOCK.onBlockPlaced((ServerPlayer) context.getPlayer(), context.getClickedPos(), context.getHand(), context.getItemInHand())) {
|
||||
cir.setReturnValue(false);
|
||||
cir.cancel();
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import static carpet.script.CarpetEventServer.Event.PLAYER_CONNECTS;
|
||||
|
||||
@Mixin(PlayerList.class)
|
||||
public class PlayerList_coreMixin
|
||||
{
|
||||
@@ -19,6 +17,5 @@ public class PlayerList_coreMixin
|
||||
private void onPlayerConnected(Connection connection, ServerPlayer player, CallbackInfo ci)
|
||||
{
|
||||
CarpetServer.onPlayerLoggedIn(player);
|
||||
PLAYER_CONNECTS.onPlayerEvent(player);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetServer;
|
||||
import carpet.fakes.ServerPlayerInterface;
|
||||
import carpet.script.external.Vanilla;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.players.PlayerList;
|
||||
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.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@@ -15,6 +18,8 @@ import static carpet.script.CarpetEventServer.Event.PLAYER_RESPAWNS;
|
||||
@Mixin(PlayerList.class)
|
||||
public class PlayerList_scarpetEventsMixin
|
||||
{
|
||||
@Shadow @Final private MinecraftServer server;
|
||||
|
||||
@Inject(method = "respawn", at = @At("HEAD"))
|
||||
private void onRespawn(ServerPlayer player, boolean olive, CallbackInfoReturnable<ServerPlayer> cir)
|
||||
{
|
||||
@@ -33,6 +38,6 @@ public class PlayerList_scarpetEventsMixin
|
||||
@Inject(method = "reloadResources", at = @At("HEAD"))
|
||||
private void reloadCommands(CallbackInfo ci)
|
||||
{
|
||||
CarpetServer.scriptServer.reAddCommands();
|
||||
Vanilla.MinecraftServer_getScriptServer(server).reAddCommands();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.ServerChunkManagerInterface;
|
||||
import carpet.utils.SpawnReporter;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@@ -22,18 +21,12 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.storage.LevelData;
|
||||
|
||||
@Mixin(ServerChunkCache.class)
|
||||
public abstract class ServerChunkCacheMixin implements ServerChunkManagerInterface
|
||||
public abstract class ServerChunkCacheMixin
|
||||
{
|
||||
@Shadow @Final private ServerLevel level;
|
||||
|
||||
@Shadow @Final private DistanceManager distanceManager;
|
||||
|
||||
@Override // shared between scarpet and spawnChunks setting
|
||||
public DistanceManager getCMTicketManager()
|
||||
{
|
||||
return distanceManager;
|
||||
}
|
||||
|
||||
@Redirect(method = "tickChunks", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/level/DistanceManager;getNaturalSpawnChunkCount()I"
|
||||
|
||||
@@ -13,8 +13,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import static carpet.script.CarpetEventServer.Event.PLAYER_DISCONNECTS;
|
||||
|
||||
@Mixin(ServerGamePacketListenerImpl.class)
|
||||
public class ServerGamePacketListenerImpl_coreMixin implements ServerGamePacketListenerImplInterface {
|
||||
@Shadow
|
||||
@@ -24,8 +22,7 @@ public class ServerGamePacketListenerImpl_coreMixin implements ServerGamePacketL
|
||||
|
||||
@Inject(method = "onDisconnect", at = @At("HEAD"))
|
||||
private void onPlayerDisconnect(Component reason, CallbackInfo ci) {
|
||||
CarpetServer.onPlayerLoggedOut(this.player);
|
||||
if (PLAYER_DISCONNECTS.isNeeded()) PLAYER_DISCONNECTS.onPlayerMessage(player, reason.getContents().toString());
|
||||
CarpetServer.onPlayerLoggedOut(this.player, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -237,25 +237,6 @@ public class ServerGamePacketListenerImpl_scarpetEventsMixin
|
||||
PLAYER_DEPLOYS_ELYTRA.onPlayerEvent(player);
|
||||
}
|
||||
|
||||
/*@Inject(method = "onPlayerInteractEntity", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/network/ServerPlayerEntity;interact(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;"
|
||||
))
|
||||
private void onEntityInteract(PlayerInteractEntityC2SPacket playerInteractEntityC2SPacket_1, CallbackInfo ci)
|
||||
{
|
||||
PLAYER_INTERACTS_WITH_ENTITY.onEntityHandAction(player, playerInteractEntityC2SPacket_1.getEntity(player.getWorld()), playerInteractEntityC2SPacket_1.getHand());
|
||||
}*/
|
||||
|
||||
/*@Inject(method = "onPlayerInteractEntity", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/network/ServerPlayerEntity;attack(Lnet/minecraft/entity/Entity;)V"
|
||||
))
|
||||
private void onEntityAttack(PlayerInteractEntityC2SPacket playerInteractEntityC2SPacket_1, CallbackInfo ci)
|
||||
{
|
||||
//todo add hit and hand in the future
|
||||
PLAYER_ATTACKS_ENTITY.onEntityHandAction(player, playerInteractEntityC2SPacket_1.getEntity(player.getWorld()), null);
|
||||
}*/
|
||||
|
||||
@Inject(method = "handleContainerButtonClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;resetLastActionTime()V"))
|
||||
private void onItemBeingPickedFromInventory(ServerboundContainerButtonClickPacket packet, CallbackInfo ci)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user