Remove no longer needed Mixins (#1030)
This commit is contained in:
1 parent
19ad8cfbf3
commit
2a391962ff
14 files changed
+8
-175
No files matched your search
@@ -18,9 +18,7 @@ import net.minecraft.server.dedicated.DedicatedServer;
|
|||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Box;
|
|
||||||
import net.minecraft.util.math.ChunkPos;
|
import net.minecraft.util.math.ChunkPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
@@ -607,9 +605,6 @@ public class CarpetSettings
|
|||||||
public static boolean waterFlow = true;
|
public static boolean waterFlow = true;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@Rule(desc = "One player is required on the server to cause night to pass", category = SURVIVAL)
|
|
||||||
//public static boolean onePlayerSleeping = false;
|
|
||||||
|
|
||||||
@Rule(
|
@Rule(
|
||||||
desc = "Sets a different motd message on client trying to connect to the server",
|
desc = "Sets a different motd message on client trying to connect to the server",
|
||||||
extra = "use '_' to use the startup setting from server.properties",
|
extra = "use '_' to use the startup setting from server.properties",
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
package carpet.fakes;
|
|
||||||
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.network.PacketByteBuf;
|
|
||||||
|
|
||||||
public interface CustomPayloadC2SPacketInterface
|
|
||||||
{
|
|
||||||
Identifier getPacketChannel();
|
|
||||||
PacketByteBuf getPacketData();
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package carpet.fakes;
|
|
||||||
|
|
||||||
public interface HungerManagerInterface {
|
|
||||||
float getExhaustionCM();
|
|
||||||
void setExhaustionCM(float exhaust);
|
|
||||||
void setSaturationCM(float saturn);
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package carpet.fakes;
|
|
||||||
|
|
||||||
public interface StatTypeInterface<T>
|
|
||||||
{
|
|
||||||
boolean hasStatCreated(T key);
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import carpet.fakes.CustomPayloadC2SPacketInterface;
|
|
||||||
import net.minecraft.network.PacketByteBuf;
|
|
||||||
import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
@Mixin(CustomPayloadC2SPacket.class)
|
|
||||||
public class CustomPayloadC2SPacketMixin implements CustomPayloadC2SPacketInterface
|
|
||||||
{
|
|
||||||
@Shadow
|
|
||||||
private Identifier channel;
|
|
||||||
@Shadow
|
|
||||||
private PacketByteBuf data;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Identifier getPacketChannel() {
|
|
||||||
return channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PacketByteBuf getPacketData() {
|
|
||||||
return new PacketByteBuf(this.data.copy());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import carpet.fakes.HungerManagerInterface;
|
|
||||||
import net.minecraft.entity.player.HungerManager;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
@Mixin(HungerManager.class)
|
|
||||||
public class HungerManagerMixin_scarpetEventsMixin implements HungerManagerInterface {
|
|
||||||
@Shadow private float exhaustion;
|
|
||||||
@Shadow private float foodSaturationLevel;
|
|
||||||
@Override
|
|
||||||
public float getExhaustionCM(){ return exhaustion; }
|
|
||||||
@Override
|
|
||||||
public void setExhaustionCM(float exhaust) { exhaustion = exhaust; }
|
|
||||||
@Override
|
|
||||||
public void setSaturationCM(float saturn) { foodSaturationLevel = saturn; }
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins;
|
||||||
|
|
||||||
import carpet.fakes.CustomPayloadC2SPacketInterface;
|
|
||||||
import carpet.network.CarpetClient;
|
import carpet.network.CarpetClient;
|
||||||
import carpet.network.ServerNetworkHandler;
|
import carpet.network.ServerNetworkHandler;
|
||||||
|
import net.minecraft.network.PacketByteBuf;
|
||||||
import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
|
import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
|
||||||
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
@@ -21,10 +21,10 @@ public class ServerPlayNetworkHandlerMixin
|
|||||||
@Inject(method = "onCustomPayload", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onCustomPayload", at = @At("HEAD"), cancellable = true)
|
||||||
private void onCustomCarpetPayload(CustomPayloadC2SPacket packet, CallbackInfo ci)
|
private void onCustomCarpetPayload(CustomPayloadC2SPacket packet, CallbackInfo ci)
|
||||||
{
|
{
|
||||||
Identifier channel = ((CustomPayloadC2SPacketInterface) packet).getPacketChannel();
|
Identifier channel = packet.getChannel();
|
||||||
if (CarpetClient.CARPET_CHANNEL.equals(channel))
|
if (CarpetClient.CARPET_CHANNEL.equals(channel))
|
||||||
{
|
{
|
||||||
ServerNetworkHandler.handleData(((CustomPayloadC2SPacketInterface) packet).getPacketData(), player);
|
ServerNetworkHandler.handleData(new PacketByteBuf(packet.getData().copy()), player);
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import carpet.CarpetSettings;
|
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
|
||||||
import net.minecraft.server.world.ServerWorld;
|
|
||||||
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.Redirect;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@Mixin(ServerWorld.class)
|
|
||||||
public class ServerWorld_onePlayerSleepingMixin
|
|
||||||
{/* removed due to 1.17 changes
|
|
||||||
@Shadow @Final private List<ServerPlayerEntity> players;
|
|
||||||
|
|
||||||
@Shadow private boolean allPlayersSleeping;
|
|
||||||
|
|
||||||
@Inject(method = "updateSleepingPlayers", cancellable = true, at = @At("HEAD"))
|
|
||||||
private void updateOnePlayerSleeping(CallbackInfo ci)
|
|
||||||
{
|
|
||||||
if(CarpetSettings.onePlayerSleeping)
|
|
||||||
{
|
|
||||||
allPlayersSleeping = false;
|
|
||||||
for (ServerPlayerEntity p : players)
|
|
||||||
if (!p.isSpectator() && p.isSleeping())
|
|
||||||
{
|
|
||||||
allPlayersSleeping = true;
|
|
||||||
ci.cancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ci.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Redirect(method = "tick", at = @At(
|
|
||||||
value = "INVOKE",
|
|
||||||
target = "Ljava/util/stream/Stream;noneMatch(Ljava/util/function/Predicate;)Z"
|
|
||||||
))
|
|
||||||
private boolean noneMatchSleep(Stream<ServerPlayerEntity> stream, Predicate<ServerPlayerEntity> predicate)
|
|
||||||
{
|
|
||||||
if (CarpetSettings.onePlayerSleeping)
|
|
||||||
return stream.anyMatch((p) -> !p.isSpectator() && p.isSleepingLongEnough());
|
|
||||||
return stream.noneMatch(predicate);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import carpet.fakes.StatTypeInterface;
|
|
||||||
import net.minecraft.stat.Stat;
|
|
||||||
import net.minecraft.stat.StatType;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Mixin(StatType.class)
|
|
||||||
public class StatType_scarpetMixin<T> implements StatTypeInterface<T>
|
|
||||||
{
|
|
||||||
@Shadow @Final private Map<T, Stat<T>> stats;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasStatCreated(T key)
|
|
||||||
{
|
|
||||||
return this.stats.containsKey(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import net.minecraft.util.collection.WeightedPicker;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
|
|
||||||
@Mixin(WeightedPicker.Entry.class)
|
|
||||||
public interface WeightedPickerEntryMixin
|
|
||||||
{/* /// not needed in 1.17
|
|
||||||
@Accessor("weight")
|
|
||||||
int getWeight();*/
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ package carpet.script.api;
|
|||||||
import carpet.CarpetServer;
|
import carpet.CarpetServer;
|
||||||
import carpet.fakes.MinecraftServerInterface;
|
import carpet.fakes.MinecraftServerInterface;
|
||||||
import carpet.fakes.ServerWorldInterface;
|
import carpet.fakes.ServerWorldInterface;
|
||||||
import carpet.fakes.StatTypeInterface;
|
|
||||||
import carpet.fakes.ThreadedAnvilChunkStorageInterface;
|
import carpet.fakes.ThreadedAnvilChunkStorageInterface;
|
||||||
import carpet.helpers.FeatureGenerator;
|
import carpet.helpers.FeatureGenerator;
|
||||||
import carpet.logging.HUDController;
|
import carpet.logging.HUDController;
|
||||||
@@ -1209,7 +1208,7 @@ public class Auxiliary {
|
|||||||
private static <T> Stat<T> getStat(StatType<T> type, Identifier id)
|
private static <T> Stat<T> getStat(StatType<T> type, Identifier id)
|
||||||
{
|
{
|
||||||
T key = type.getRegistry().get(id);
|
T key = type.getRegistry().get(id);
|
||||||
if (key == null || !((StatTypeInterface)type).hasStatCreated(key))
|
if (key == null || !type.hasStat(key))
|
||||||
return null;
|
return null;
|
||||||
return type.getOrCreateStat(key);
|
return type.getOrCreateStat(key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import carpet.fakes.ItemEntityInterface;
|
|||||||
import carpet.fakes.LivingEntityInterface;
|
import carpet.fakes.LivingEntityInterface;
|
||||||
import carpet.fakes.MemoryInterface;
|
import carpet.fakes.MemoryInterface;
|
||||||
import carpet.fakes.MobEntityInterface;
|
import carpet.fakes.MobEntityInterface;
|
||||||
import carpet.fakes.HungerManagerInterface;
|
|
||||||
import carpet.fakes.ServerPlayerEntityInterface;
|
import carpet.fakes.ServerPlayerEntityInterface;
|
||||||
import carpet.fakes.ServerPlayerInteractionManagerInterface;
|
import carpet.fakes.ServerPlayerInteractionManagerInterface;
|
||||||
import carpet.helpers.Tracer;
|
import carpet.helpers.Tracer;
|
||||||
@@ -572,7 +571,7 @@ public class EntityValue extends Value
|
|||||||
});
|
});
|
||||||
|
|
||||||
put("exhaustion",(e, a)->{
|
put("exhaustion",(e, a)->{
|
||||||
if(e instanceof PlayerEntity) return new NumericValue(((HungerManagerInterface)((PlayerEntity) e).getHungerManager()).getExhaustionCM());
|
if(e instanceof PlayerEntity) return new NumericValue(((PlayerEntity) e).getHungerManager().getExhaustion());
|
||||||
return Value.NULL;
|
return Value.NULL;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1464,7 +1463,7 @@ public class EntityValue extends Value
|
|||||||
});
|
});
|
||||||
|
|
||||||
put("exhaustion", (e, v)-> {
|
put("exhaustion", (e, v)-> {
|
||||||
if(e instanceof PlayerEntity) ((HungerManagerInterface) ((PlayerEntity) e).getHungerManager()).setExhaustionCM(NumericValue.asNumber(v).getFloat());
|
if(e instanceof PlayerEntity) ((PlayerEntity) e).getHungerManager().setExhaustion(NumericValue.asNumber(v).getFloat());
|
||||||
});
|
});
|
||||||
|
|
||||||
put("add_exhaustion", (e, v)-> {
|
put("add_exhaustion", (e, v)-> {
|
||||||
@@ -1497,7 +1496,7 @@ public class EntityValue extends Value
|
|||||||
});
|
});
|
||||||
|
|
||||||
put("saturation", (e, v)-> {
|
put("saturation", (e, v)-> {
|
||||||
if(e instanceof PlayerEntity) ((HungerManagerInterface) ((PlayerEntity) e).getHungerManager()).setSaturationCM(NumericValue.asNumber(v, "saturation").getFloat());
|
if(e instanceof PlayerEntity) ((PlayerEntity) e).getHungerManager().setSaturationLevel(NumericValue.asNumber(v, "saturation").getFloat());
|
||||||
});
|
});
|
||||||
|
|
||||||
put("air", (e, v) -> e.setAir(NumericValue.asNumber(v, "air").getInt()));
|
put("air", (e, v) -> e.setAir(NumericValue.asNumber(v, "air").getInt()));
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ public class SpawnReporter
|
|||||||
|
|
||||||
String creature_name = mob.getType().getName().getString();
|
String creature_name = mob.getType().getName().getString();
|
||||||
String pack_size = String.format("%d", mob.getLimitPerChunk());//String.format("%d-%d", animal.minGroupCount, animal.maxGroupCount);
|
String pack_size = String.format("%d", mob.getLimitPerChunk());//String.format("%d-%d", animal.minGroupCount, animal.maxGroupCount);
|
||||||
int weight = spawnEntry.getWeight().getValue();// ((WeightedPickerEntryMixin) spawnEntry).getWeight();
|
int weight = spawnEntry.getWeight().getValue();
|
||||||
if (canspawn)
|
if (canspawn)
|
||||||
{
|
{
|
||||||
String c = (fits_true && will_spawn>0)?"e":"gi";
|
String c = (fits_true && will_spawn>0)?"e":"gi";
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
"CommandManagerMixin",
|
"CommandManagerMixin",
|
||||||
|
|
||||||
"ServerPlayNetworkHandlerMixin",
|
"ServerPlayNetworkHandlerMixin",
|
||||||
"CustomPayloadC2SPacketMixin",
|
|
||||||
|
|
||||||
"PerfCommand_permissionMixin",
|
"PerfCommand_permissionMixin",
|
||||||
"FillCommandMixin",
|
"FillCommandMixin",
|
||||||
@@ -75,7 +74,6 @@
|
|||||||
"ServerPlayNetworkHandler_tickMixin",
|
"ServerPlayNetworkHandler_tickMixin",
|
||||||
"MinecraftServer_scarpetMixin",
|
"MinecraftServer_scarpetMixin",
|
||||||
"PlayerListHeaderS2CPacketMixin",
|
"PlayerListHeaderS2CPacketMixin",
|
||||||
"WeightedPickerEntryMixin",
|
|
||||||
"ExperienceOrbEntityMixin",
|
"ExperienceOrbEntityMixin",
|
||||||
"PlayerActionC2SPacketMixin",
|
"PlayerActionC2SPacketMixin",
|
||||||
"ServerPlayerEntityMixin",
|
"ServerPlayerEntityMixin",
|
||||||
@@ -88,7 +86,6 @@
|
|||||||
"PistonHandler_pushLimitMixin",
|
"PistonHandler_pushLimitMixin",
|
||||||
"PoweredRailBlock_powerLimitMixin",
|
"PoweredRailBlock_powerLimitMixin",
|
||||||
"LivingEntity_maxCollisionsMixin",
|
"LivingEntity_maxCollisionsMixin",
|
||||||
"ServerWorld_onePlayerSleepingMixin",
|
|
||||||
"CoralBlockMixin",
|
"CoralBlockMixin",
|
||||||
"CoralFeatureMixin",
|
"CoralFeatureMixin",
|
||||||
"BuddingAmethystBlock_movableAmethystMixin",
|
"BuddingAmethystBlock_movableAmethystMixin",
|
||||||
@@ -188,11 +185,9 @@
|
|||||||
|
|
||||||
"BiomeEffects_scarpetMixin",
|
"BiomeEffects_scarpetMixin",
|
||||||
"ChunkTicketManager_scarpetMixin",
|
"ChunkTicketManager_scarpetMixin",
|
||||||
"StatType_scarpetMixin",
|
|
||||||
"PointOfInterest_scarpetMixin",
|
"PointOfInterest_scarpetMixin",
|
||||||
"ServerWorld_scarpetMixin",
|
"ServerWorld_scarpetMixin",
|
||||||
"ServerEntityManager_scarpetMixin",
|
"ServerEntityManager_scarpetMixin",
|
||||||
"HungerManagerMixin_scarpetEventsMixin",
|
|
||||||
"ReloadCommand_reloadAppsMixin",
|
"ReloadCommand_reloadAppsMixin",
|
||||||
"CrashReport_addScarpetAppsMixin",
|
"CrashReport_addScarpetAppsMixin",
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user