cleanup of scarpet dependencies

This commit is contained in:
gnembon committed 2023-02-08 21:13:14 +01:00
1 parent fd93785fec
commit 75d94b0570
71 files changed
+1623 -1014

No files matched your search

@@ -1,6 +1,6 @@
package carpet.mixins;
import carpet.fakes.ScreenHandlerInterface;
import carpet.fakes.AbstractContainerMenuInterface;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.EnchantmentMenu;
@@ -23,7 +23,7 @@ public abstract class AbstractContainerMenuSubclasses_scarpetMixin extends Abstr
@Inject(method = "clickMenuButton", at = @At("HEAD"), cancellable = true)
private void buttonClickCallback(Player player, int id, CallbackInfoReturnable<Boolean> cir) {
if(((ScreenHandlerInterface) this).callButtonClickListener(id,player))
if(((AbstractContainerMenuInterface) this).callButtonClickListener(id,player))
cir.cancel();
}
}
@@ -1,7 +1,6 @@
package carpet.mixins;
import carpet.fakes.ScreenHandlerInterface;
import carpet.fakes.AbstractContainerMenuInterface;
import carpet.script.value.ScreenValue;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@@ -20,7 +19,7 @@ import net.minecraft.world.inventory.DataSlot;
import net.minecraft.world.item.crafting.Recipe;
@Mixin(AbstractContainerMenu.class)
public abstract class AbstractContainerMenu_scarpetMixin implements ScreenHandlerInterface
public abstract class AbstractContainerMenu_scarpetMixin implements AbstractContainerMenuInterface
{
@Shadow @Final private List<ContainerListener> containerListeners;
@Shadow public abstract void sendAllDataToRemote();
@@ -73,7 +72,7 @@ public abstract class AbstractContainerMenu_scarpetMixin implements ScreenHandle
}
@Override
public DataSlot getProperty(int index) {
public DataSlot getDataSlot(int index) {
return this.dataSlots.get(index);
}
}
@@ -1,26 +0,0 @@
package carpet.mixins;
import carpet.fakes.ChunkGeneratorInterface;
import net.minecraft.core.Holder;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.structure.Structure;
import net.minecraft.world.level.levelgen.structure.placement.StructurePlacement;
import org.spongepowered.asm.mixin.Mixin;
import java.util.List;
@Mixin(ChunkGenerator.class)
public abstract class ChunkGenerator_scarpetMixin implements ChunkGeneratorInterface
{
@Override
public void initStrongholds(final ServerLevel level)
{
level.getChunkSource().getGeneratorState().ensureStructuresGenerated();
}
@Override
public List<StructurePlacement> getPlacementsForFeatureCM(final ServerLevel level, Structure structure) {
return level.getChunkSource().getGeneratorState().getPlacementsForStructure(Holder.direct(structure));
}
}
@@ -25,6 +25,7 @@ public abstract class EntityMixin implements EntityInterface
@Shadow public Level level;
@Override
public float getMainYaw(float partialTicks)
{
return partialTicks == 1.0F ? this.yRot : Mth.lerp(partialTicks, this.yRotO, this.yRot);
@@ -8,7 +8,6 @@ import org.spongepowered.asm.mixin.Shadow;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
@@ -20,7 +19,6 @@ public class Ingredient_scarpetMixin implements IngredientInterface
@Override
public List<Collection<ItemStack>> getRecipeStacks()
{
List<Collection<ItemStack>> res = Arrays.stream(values).map(Ingredient.Value::getItems).collect(Collectors.toList());
return res;
return Arrays.stream(values).map(Ingredient.Value::getItems).toList();
}
}
@@ -2,6 +2,7 @@ package carpet.mixins;
import carpet.fakes.MinecraftServerInterface;
import carpet.helpers.TickSpeed;
import carpet.script.CarpetScriptServer;
import net.minecraft.Util;
import net.minecraft.core.RegistryAccess;
import net.minecraft.resources.ResourceKey;
@@ -31,6 +32,8 @@ import static carpet.script.CarpetEventServer.Event.TICK;
@Mixin(MinecraftServer.class)
public abstract class MinecraftServer_scarpetMixin extends ReentrantBlockableEventLoop<TickTask> implements MinecraftServerInterface
{
private CarpetScriptServer scriptServer;
public MinecraftServer_scarpetMixin(String string_1)
{
super(string_1);
@@ -74,11 +77,6 @@ public abstract class MinecraftServer_scarpetMixin extends ReentrantBlockableEve
return storageSource;
}
//@Override
//public ServerResources getResourceManager() {
// return resources;
//}
@Override
public Map<ResourceKey<Level>, ServerLevel> getCMWorlds()
{
@@ -93,9 +91,9 @@ public abstract class MinecraftServer_scarpetMixin extends ReentrantBlockableEve
{
if (!TickSpeed.process_entities)
return;
TICK.onTick();
NETHER_TICK.onTick();
ENDER_TICK.onTick();
TICK.onTick((MinecraftServer) (Object) this);
NETHER_TICK.onTick((MinecraftServer) (Object) this);
ENDER_TICK.onTick((MinecraftServer) (Object) this);
}
@Override
@@ -113,4 +111,16 @@ public abstract class MinecraftServer_scarpetMixin extends ReentrantBlockableEve
{
return resources;
}
@Override
public void addScriptServer(final CarpetScriptServer scriptServer)
{
this.scriptServer = scriptServer;
}
@Override
public CarpetScriptServer getScriptServer()
{
return scriptServer;
}
}
@@ -1,7 +1,7 @@
package carpet.mixins;
import carpet.CarpetServer;
import carpet.fakes.ServerPlayerEntityInterface;
import carpet.fakes.ServerPlayerInterface;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.players.PlayerList;
import org.spongepowered.asm.mixin.Mixin;
@@ -27,7 +27,7 @@ public class PlayerList_scarpetEventsMixin
))
private void invalidatePreviousInstance(ServerPlayer player, boolean alive, CallbackInfoReturnable<ServerPlayer> cir)
{
((ServerPlayerEntityInterface)player).invalidateEntityObjectReference();
((ServerPlayerInterface)player).invalidateEntityObjectReference();
}
@Inject(method = "reloadResources", at = @At("HEAD"))
@@ -1,6 +1,6 @@
package carpet.mixins;
import carpet.fakes.ScreenHandlerInterface;
import carpet.fakes.AbstractContainerMenuInterface;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.inventory.RecipeBookMenu;
import net.minecraft.world.item.crafting.Recipe;
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class RecipeBookMenu_scarpetMixin {
@Inject(method = "handlePlacement",at = @At("HEAD"), cancellable = true)
private void selectRecipeCallback(boolean craftAll, Recipe<?> recipe, ServerPlayer player, CallbackInfo ci) {
if(((ScreenHandlerInterface) this).callSelectRecipeListener(player,recipe,craftAll))
if(((AbstractContainerMenuInterface) this).callSelectRecipeListener(player,recipe,craftAll))
ci.cancel();
}
}
@@ -92,6 +92,7 @@ public abstract class ServerLevel_scarpetMixin extends Level implements ServerWo
private ServerLevelData serverLevelData;
@Shadow @Final private PersistentEntitySectionManager<Entity> entityManager;
@Override
public ServerLevelData getWorldPropertiesCM(){
return serverLevelData;
}
@@ -1,9 +1,8 @@
package carpet.mixins;
import carpet.fakes.ServerPlayerEntityInterface;
import carpet.fakes.ServerPlayerInterface;
import carpet.helpers.EntityPlayerActionPack;
import com.mojang.authlib.GameProfile;
import net.minecraft.network.chat.RemoteChatSession;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
@@ -14,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ServerPlayer.class)
public abstract class ServerPlayer_actionPackMixin implements ServerPlayerEntityInterface
public abstract class ServerPlayer_actionPackMixin implements ServerPlayerInterface
{
@Unique
public EntityPlayerActionPack actionPack;
@@ -1,7 +1,7 @@
package carpet.mixins;
import carpet.fakes.EntityInterface;
import carpet.fakes.ServerPlayerEntityInterface;
import carpet.fakes.ServerPlayerInterface;
import carpet.script.EntityEventsGroup;
import com.mojang.authlib.GameProfile;
import net.minecraft.core.BlockPos;
@@ -31,7 +31,7 @@ import static carpet.script.CarpetEventServer.Event.PLAYER_FINISHED_USING_ITEM;
import static carpet.script.CarpetEventServer.Event.STATISTICS;
@Mixin(ServerPlayer.class)
public abstract class ServerPlayer_scarpetEventMixin extends Player implements ServerPlayerEntityInterface
public abstract class ServerPlayer_scarpetEventMixin extends Player implements ServerPlayerInterface
{
// to denote if the player reference is valid