Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix mixin apply error when using CC:T 1.112.0
Browse files Browse the repository at this point in the history
xiewuzhiying committed Aug 3, 2024
1 parent bebd605 commit 7d2e241
Showing 12 changed files with 31 additions and 46 deletions.
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ dependencies {
modImplementation files("jars/createbigcannons-5.5.0-dev+mc.1.20.1-fabric-build.50.jar")

//ComputerCraft
modCompileOnly("maven.modrinth:cc-tweaked:1.111.0")
modCompileOnly("maven.modrinth:cc-tweaked:B9b58ZKh")

//Eureka
modCompileOnly("maven.modrinth:eureka:1.20.1-fabric-1.5.0-beta.3")
2 changes: 1 addition & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ dependencies {
modImplementation("maven.modrinth:create-clockwork:8JdnD9wo")

//ComputerCraft
modImplementation("maven.modrinth:cc-tweaked:1.111.0")
modImplementation("maven.modrinth:cc-tweaked:B9b58ZKh")

// CBC
modImplementation files("jars/createbigcannons-5.5.0-dev+mc.1.20.1-fabric-build.50.jar")
Original file line number Diff line number Diff line change
@@ -19,10 +19,7 @@ public abstract class MixinComputerBlockEntity {
)
private void vs_addition$addAPI(int id, CallbackInfoReturnable<ServerComputer> cir) {
ServerComputer computer = cir.getReturnValue();
Level level = computer.getLevel();

VSAdditionCC.applyCCAPIs(computer, (ServerLevel) level);

// cir.setReturnValue(computer);
ServerLevel level = computer.getLevel();
VSAdditionCC.applyCCAPIs(computer, level);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package io.github.xiewuzhiying.vs_addition.fabric.mixin.computercraft;

import com.llamalad7.mixinextras.sugar.Local;
import dan200.computercraft.shared.pocket.core.PocketBrain;
import dan200.computercraft.shared.pocket.core.PocketHolder;
import dan200.computercraft.shared.pocket.core.PocketServerComputer;
import dan200.computercraft.shared.pocket.items.PocketComputerItem;
import io.github.xiewuzhiying.vs_addition.compats.computercraft.VSAdditionCC;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.Container;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -15,15 +16,11 @@
@Mixin(PocketComputerItem.class)
public abstract class MixinPocketComputerItem {
@Inject(
method = "createServerComputer",
method = "getOrCreateBrain",
at = @At("RETURN"),
remap = false
)
private void vs_addition$addAPI(ServerLevel level, Entity entity, Container inventory, ItemStack stack, CallbackInfoReturnable<PocketServerComputer> cir) {
PocketServerComputer computer = cir.getReturnValue();

private void vs_addition$addAPI(ServerLevel level, PocketHolder holder, ItemStack stack, CallbackInfoReturnable<PocketBrain> cir, @Local PocketServerComputer computer) {
VSAdditionCC.applyCCAPIs(computer, level);

// cir.setReturnValue(computer);
}
}
Original file line number Diff line number Diff line change
@@ -15,15 +15,11 @@
public class MixinTurtleBlockEntity {
@Inject(
method = "createComputer",
at = @At(
value = "INVOKE",
target = "Ldan200/computercraft/shared/computer/core/ServerComputer;addAPI(Ldan200/computercraft/api/lua/ILuaAPI;)V",
shift = At.Shift.AFTER
),
at = @At("RETURN"),
remap = false
)
private void vs_addition$addAPI(int id, CallbackInfoReturnable<ServerComputer> cir, @Local ServerComputer computer) {
Level level = computer.getLevel();
VSAdditionCC.applyCCAPIs(computer, (ServerLevel) level);
ServerLevel level = computer.getLevel();
VSAdditionCC.applyCCAPIs(computer, level);
}
}
Original file line number Diff line number Diff line change
@@ -37,10 +37,11 @@ public abstract class MixinTurtleBrain {
public abstract Level getLevel();

@ModifyVariable(
method = "Ldan200/computercraft/shared/turtle/core/TurtleBrain;teleportTo(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Z",
at = @At(value = "HEAD"),
index = 2,
remap = false
method = "teleportTo(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Z",
at = @At(value = "HEAD"),
index = 2,
argsOnly = true,
remap = false
)
private BlockPos ValkyrienSkies2$teleportToBlockPos(final BlockPos pos) {
final TurtleBlockEntity currentOwner = getOwner();
2 changes: 1 addition & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ dependencies {
modImplementation("com.tterrag.registrate:Registrate:${registrate_version}")

// ComputerCraft
modImplementation("maven.modrinth:cc-tweaked:eMzJxUoQ")
modImplementation("maven.modrinth:cc-tweaked:1.112.0")

//Eureka
modImplementation("maven.modrinth:eureka:1.20.1-forge-1.5.1-beta.3")
Original file line number Diff line number Diff line change
@@ -19,10 +19,7 @@ public abstract class MixinComputerBlockEntity {
)
private void vs_addition$addAPI(int id, CallbackInfoReturnable<ServerComputer> cir) {
ServerComputer computer = cir.getReturnValue();
Level level = computer.getLevel();

VSAdditionCC.applyCCAPIs(computer, (ServerLevel) level);

// cir.setReturnValue(computer);
ServerLevel level = computer.getLevel();
VSAdditionCC.applyCCAPIs(computer, level);
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.github.xiewuzhiying.vs_addition.forge.mixin.computercraft;

import com.llamalad7.mixinextras.sugar.Local;
import dan200.computercraft.shared.pocket.core.PocketBrain;
import dan200.computercraft.shared.pocket.core.PocketHolder;
import dan200.computercraft.shared.pocket.core.PocketServerComputer;
import dan200.computercraft.shared.pocket.items.PocketComputerItem;
import io.github.xiewuzhiying.vs_addition.compats.computercraft.VSAdditionCC;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.Container;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -16,16 +16,11 @@
@Mixin(PocketComputerItem.class)
public abstract class MixinPocketComputerItem {
@Inject(
method = "createServerComputer",
method = "getOrCreateBrain",
at = @At("RETURN"),
remap = false
)
private void vs_addition$addAPI(ServerLevel world, Entity entity, Container inventory, ItemStack stack, CallbackInfoReturnable<PocketServerComputer> cir) {
PocketServerComputer computer = cir.getReturnValue();
Level level = computer.getLevel();

VSAdditionCC.applyCCAPIs(computer, (ServerLevel) level);

// cir.setReturnValue(computer);
private void vs_addition$addAPI(ServerLevel level, PocketHolder holder, ItemStack stack, CallbackInfoReturnable<PocketBrain> cir, @Local PocketServerComputer computer) {
VSAdditionCC.applyCCAPIs(computer, level);
}
}
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ public abstract class MixinTurtleBlockEntity {
remap = false
)
private void vs_addition$addAPI(int id, CallbackInfoReturnable<ServerComputer> cir, @Local ServerComputer computer) {
Level level = computer.getLevel();
VSAdditionCC.applyCCAPIs(computer, (ServerLevel) level);
ServerLevel level = computer.getLevel();
VSAdditionCC.applyCCAPIs(computer, level);
}
}
Original file line number Diff line number Diff line change
@@ -37,9 +37,10 @@ public abstract class MixinTurtleBrain {
public abstract Level getLevel();

@ModifyVariable(
method = "Ldan200/computercraft/shared/turtle/core/TurtleBrain;teleportTo(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Z",
method = "teleportTo(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Z",
at = @At(value = "HEAD"),
index = 2,
argsOnly = true,
remap = false
)
private BlockPos ValkyrienSkies2$teleportToBlockPos(final BlockPos pos) {
1 change: 1 addition & 0 deletions forge/src/main/resources/vs_addition.mixins.json
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
"computercraft.MixinComputerBlockEntity",
"computercraft.MixinPocketComputerItem",
"computercraft.MixinTurtleBlockEntity",
"computercraft.MixinTurtleBrain",
"computercraft.MixinTurtleMoveCommand",
"computercraft.MixinWirelessModemPeripheral",
"computercraft.MixinWirelessNetwork",

0 comments on commit 7d2e241

Please sign in to comment.