Merge branch 'basic_systems'
# Conflicts: # src/main/java/carpet/commands/SpawnCommand.java # src/main/java/carpet/helpers/CtrlQCrafting.javax # src/main/java/carpet/utils/HUDController.java # src/main/java/carpet/utils/SpawnReporter.java # src/main/resources/carpet.mixins.json
This commit is contained in:
commit
5109263fd8
48 files changed
+6071
-54
No files matched your search
@@ -0,0 +1,47 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import carpet.fakes.ExperienceOrbInterface;
|
||||
import carpet.helpers.XPcombine;
|
||||
import net.minecraft.entity.ExperienceOrbEntity;
|
||||
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;
|
||||
|
||||
@Mixin(ExperienceOrbEntity.class)
|
||||
public abstract class ExperienceOrbEntityMixin implements ExperienceOrbInterface
|
||||
{
|
||||
@Shadow private int amount;
|
||||
|
||||
public void setAmount(int amount) { this.amount = amount; }
|
||||
|
||||
public int combineDelay = 50;
|
||||
|
||||
public int getCombineDelay() { return combineDelay; }
|
||||
public void setCombineDelay(int what) { combineDelay = what; }
|
||||
|
||||
@Inject(method = "tick",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/entity/ExperienceOrbEntity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V",
|
||||
shift = At.Shift.AFTER
|
||||
))
|
||||
void checkCombineAtTick(CallbackInfo ci)
|
||||
{
|
||||
if (CarpetSettings.getBool("combineXPOrbs"))
|
||||
{
|
||||
if (getCombineDelay() > 0)
|
||||
{
|
||||
setCombineDelay(getCombineDelay()-1);
|
||||
}
|
||||
|
||||
if (getCombineDelay() == 0)
|
||||
{
|
||||
XPcombine.searchForOtherXPNearbyCarpet((ExperienceOrbEntity) (Object) this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetServer;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(IntegratedServer.class)
|
||||
public class IntegratedServerMixin
|
||||
{
|
||||
@Inject(method = "setupServer",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
shift = At.Shift.AFTER,
|
||||
target = "Lnet/minecraft/server/integrated/IntegratedServer;setKeyPair(Ljava/security/KeyPair;)V"
|
||||
)
|
||||
)
|
||||
private void onSetupServerIntegrated(CallbackInfoReturnable<Boolean> cir) {
|
||||
CarpetServer.onServerLoaded((IntegratedServer) (Object) this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetServer;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
public class MinecraftClientMixin
|
||||
{
|
||||
//to inject right before
|
||||
// this.tickWorlds(booleanSupplier_1);
|
||||
@Inject(method = "init", at = @At(value = "RETURN")
|
||||
)
|
||||
private void onInit(CallbackInfo ci) {
|
||||
//CM start game hook
|
||||
CarpetServer.onGameStarted();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetServer;
|
||||
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(MinecraftDedicatedServer.class)
|
||||
public class MinecraftDedicatedServerMixin
|
||||
{
|
||||
//to inject right before
|
||||
// this.tickWorlds(booleanSupplier_1);
|
||||
@Inject(
|
||||
method = "setupServer",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/util/UserCache;setUseRemote(Z)V",
|
||||
shift = At.Shift.AFTER,
|
||||
ordinal = 0
|
||||
)
|
||||
)
|
||||
private void onSetupServer(CallbackInfoReturnable<Boolean> cir) {
|
||||
//CM init - all stuff loaded from the server, just before worlds loading
|
||||
CarpetServer.onServerLoaded((MinecraftDedicatedServer) (Object) this);
|
||||
//CM start game hook
|
||||
CarpetServer.onGameStarted();
|
||||
}
|
||||
}
|
||||
@@ -21,22 +21,27 @@ import java.util.function.BooleanSupplier;
|
||||
@Mixin(MinecraftServer.class)
|
||||
public abstract class MinecraftServerMixin
|
||||
{
|
||||
// Called during game start
|
||||
@Inject(method = "<init>", at = @At(value = "HEAD"))
|
||||
@Inject(method = "<init>", at = @At(value = "RETURN"))
|
||||
private void onMinecraftServerCTOR(File file_1, Proxy proxy_1, DataFixer dataFixer_1,
|
||||
CommandManager serverCommandManager_1, YggdrasilAuthenticationService yggdrasilAuthenticationService_1,
|
||||
MinecraftSessionService minecraftSessionService_1, GameProfileRepository gameProfileRepository_1,
|
||||
UserCache userCache_1, WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory_1,
|
||||
String string_1, CallbackInfo ci)
|
||||
{
|
||||
// Called during game start
|
||||
CarpetServer.init((MinecraftServer) (Object) this);
|
||||
}
|
||||
|
||||
//to inject right before
|
||||
// this.tickWorlds(booleanSupplier_1);
|
||||
@Inject(
|
||||
method = "Lnet/minecraft/server/MinecraftServer;tick(Ljava/util/function/BooleanSupplier;)V",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;tickWorlds(Ljava/util/function/BooleanSupplier;)V", shift = At.Shift.BEFORE, ordinal = 0)
|
||||
method = "tick",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/MinecraftServer;tickWorlds(Ljava/util/function/BooleanSupplier;)V",
|
||||
shift = At.Shift.BEFORE,
|
||||
ordinal = 0
|
||||
)
|
||||
)
|
||||
private void onTick(BooleanSupplier booleanSupplier_1, CallbackInfo ci) {
|
||||
CarpetServer.tick((MinecraftServer) (Object) this);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import net.minecraft.server.network.packet.PlayerActionC2SPacket;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(PlayerActionC2SPacket.class)
|
||||
public interface PlayerActionC2SPacketMixin
|
||||
{
|
||||
@Accessor("pos")
|
||||
void setPos(BlockPos pos);
|
||||
|
||||
@Accessor("direction")
|
||||
void setDirection(Direction direction);
|
||||
|
||||
@Accessor("action")
|
||||
void setAction(PlayerActionC2SPacket.Action action);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import net.minecraft.client.network.packet.PlayerListHeaderS2CPacket;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(PlayerListHeaderS2CPacket.class)
|
||||
public interface PlayerListHeaderS2CPacketMixin
|
||||
{
|
||||
@Accessor("header")
|
||||
void setHeader(Component header);
|
||||
|
||||
@Accessor("footer")
|
||||
void setFooter(Component footer);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.ServerPlayerEntityInterface;
|
||||
import carpet.helpers.EntityPlayerActionPack;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.network.ServerPlayerInteractionManager;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ServerPlayerEntity.class)
|
||||
public abstract class ServerPlayerEntityMixin implements ServerPlayerEntityInterface
|
||||
{
|
||||
public EntityPlayerActionPack actionPack;
|
||||
public EntityPlayerActionPack getActionPack()
|
||||
{
|
||||
return actionPack;
|
||||
}
|
||||
|
||||
@Inject(method = "<init>", at = @At(value = "RETURN"))
|
||||
private void onServerPlayerEntityContructor(
|
||||
MinecraftServer minecraftServer_1,
|
||||
ServerWorld serverWorld_1,
|
||||
GameProfile gameProfile_1,
|
||||
ServerPlayerInteractionManager serverPlayerInteractionManager_1,
|
||||
CallbackInfo ci)
|
||||
{
|
||||
this.actionPack = new EntityPlayerActionPack((ServerPlayerEntity) (Object) this);
|
||||
}
|
||||
|
||||
@Inject(method = "tick", at = @At(value = "HEAD"))
|
||||
private void onTick(CallbackInfo ci)
|
||||
{
|
||||
actionPack.onUpdate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import net.minecraft.util.WeightedPicker;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(WeightedPicker.Entry.class)
|
||||
public interface WeightedPickerEntryMixin
|
||||
{
|
||||
@Accessor("weight")
|
||||
int getWeight();
|
||||
}
|
||||
Reference in new issue
Block a user