Add radio method

This commit is contained in:
Kellen Hurrey 2025-09-07 19:16:42 -06:00
parent 966206dbf5
commit f6c74ce98e
No known key found for this signature in database
GPG Key ID: CF1E5CF3DB06C0D3

View File

@ -17,6 +17,8 @@ import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import java.util.Map;
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityRadioTorchBase extends TileEntityLoadedBase implements IControlReceiver, SimpleComponent, CompatHandler.OCComponent {
@ -137,4 +139,18 @@ public class TileEntityRadioTorchBase extends TileEntityLoadedBase implements IC
customMap = args.checkBoolean(0);
return new Object[] {};
}
@Callback(direct = true, limit = 4, doc = "setCustomMapValues(value: table) -- Sets the custom signal mapping values with a table with indices corresponding to the redstone value (1-16)")
@Optional.Method(modid = "OpenComputers")
public Object[] setCustomMapValues(Context context, Arguments args){
Map values = args.checkTable(0);
for (int i = 1; i <= 16; i++){
if (values.containsKey(i) && values.get(i) instanceof String){
this.mapping[i - 1] = (String) values.get(i);
}
}
return new Object[] {};
}
}