Merge pull request #2185 from Kirby7871/master

New OC functions for radar, launch pad and turrets.
This commit is contained in:
HbmMods 2025-05-29 18:10:31 +02:00 committed by GitHub
commit 0c0c9d02d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 3 deletions

View File

@ -528,6 +528,12 @@ public abstract class TileEntityLaunchPadBase extends TileEntityMachineBase impl
return new Object[] {false}; return new Object[] {false};
} }
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getPos(Context context, Arguments args) {
return new Object[] {xCoord, yCoord, zCoord};
}
@Override @Override
@Optional.Method(modid = "OpenComputers") @Optional.Method(modid = "OpenComputers")
public String[] methods() { public String[] methods() {
@ -536,7 +542,8 @@ public abstract class TileEntityLaunchPadBase extends TileEntityMachineBase impl
"getFluid", "getFluid",
"canLaunch", "canLaunch",
"getTier", "getTier",
"launch" "launch",
"getPos"
}; };
} }
@ -554,6 +561,8 @@ public abstract class TileEntityLaunchPadBase extends TileEntityMachineBase impl
return getTier(context, args); return getTier(context, args);
case ("launch"): case ("launch"):
return launch(context, args); return launch(context, args);
case ("getPos"):
return getPos(context, args);
} }
throw new NoSuchMethodException(); throw new NoSuchMethodException();
} }

View File

@ -694,6 +694,12 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I
return new Object[]{false, e.posX, e.posY, e.posZ, type}; return new Object[]{false, e.posX, e.posY, e.posZ, type};
} }
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getPos(Context context, Arguments args) {
return new Object[] {xCoord, yCoord, zCoord};
}
@Override @Override
@Optional.Method(modid = "OpenComputers") @Optional.Method(modid = "OpenComputers")
public String[] methods() { public String[] methods() {
@ -706,7 +712,8 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I
"getAmount", "getAmount",
"isIndexPlayer", "isIndexPlayer",
"getIndexType", "getIndexType",
"getEntityAtIndex" "getEntityAtIndex",
"getPos"
}; };
} }
@ -732,6 +739,8 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I
return getIndexType(context, args); return getIndexType(context, args);
case ("getEntityAtIndex"): case ("getEntityAtIndex"):
return getEntityAtIndex(context, args); return getEntityAtIndex(context, args);
case("getPos"):
return getPos(context, args);
} }
throw new NoSuchMethodException(); throw new NoSuchMethodException();
} }

View File

@ -995,6 +995,12 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
return new Object[] {this.aligned}; return new Object[] {this.aligned};
} }
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getPos(Context context, Arguments args) {
return new Object[] {xCoord, yCoord, zCoord};
}
@Override @Override
@Optional.Method(modid = "OpenComputers") @Optional.Method(modid = "OpenComputers")
public boolean canConnectNode(ForgeDirection side) { public boolean canConnectNode(ForgeDirection side) {
@ -1015,7 +1021,8 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
"getTargeting", "getTargeting",
"hasTarget", "hasTarget",
"getAngle", "getAngle",
"isAligned" "isAligned",
"getPos"
}; };
} }
@ -1045,6 +1052,8 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
return getAngle(context, args); return getAngle(context, args);
case "isAligned": case "isAligned":
return isAligned(context, args); return isAligned(context, args);
case "getPos":
return getPos(context, args);
} }
throw new NoSuchMethodException(); throw new NoSuchMethodException();
} }