Skip to content

Commit

Permalink
Merge pull request #99 from asiekierka/gtnh-oc-1.8.0
Browse files Browse the repository at this point in the history
Update mainline to 1.8.0 stable
  • Loading branch information
boubou19 authored May 7, 2023
2 parents 564a8b8 + bee0788 commit 5096a31
Show file tree
Hide file tree
Showing 19 changed files with 218 additions and 115 deletions.
18 changes: 16 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,29 @@
* Lua 5.2 has been updated with gamax92's backported bugfixes.
* Lua 5.3 has been updated from 5.3.2 to 5.3.6.
* 64-bit integers in calls should now be handled properly.
* Added: New robot names.
* Added: Official support for AArch64 on Linux and macOS.
* Added: Source tank parameter for Transposer transferFluid(). (repo-alt)
* Added: Subtle indentations to Redstone I/O texture.
* The amount of darkened dots on each side marks the ordinal number of the side it responds to.
* Added: Support for non-BMP Unicode codepoints!
* To clarify, Unicode characters >= 0x10000 should now be fully supported - as long as they're provided in the font.
* Added: Support for partial font overrides in resource packs.
* If a resource pack's font.hex file only contains some glyphs, missing glyphs present in parent resource packs won't disappear.
* Added: Support for the "PATCH" HTTP method. (hohserg1)
* Added: New config option: "transposerFluidTransferRate". (repo-alt)
* Changed: New limitFlightHeight configuration definition.
* This allows values above 256 to be used, which may be useful for Cubic Chunks users.
* Changed: Replaced the forceNativeLibWithName config option with two new ones: forceNativeLibPlatform and forceNativeLibPathFirst. (TheCodex6824)
* forceNativeLibPlatform allows overriding the normally auto-detected platform string to a custom value, in case the user is on an unsupported platform.
* forceNativeLibPathFirst allows choosing a directory to check for natives in, instead of always searching in the jar for one. This allows custom natives to be used without packing them into the mod jar first, which should be much easier for end users.
* Changed: The game now crashes instead of reloading defaults if a config file is present but invalid.
* Removed: Native Lua library support for FreeBSD and x86 macOS.
* Fixed: [#3588] Renaming over other files does not properly free space.
* Fixed: [#3591] Memory leak with wrapped worlds from other mods.
* Fixed: [#3596] Freeze when connecting a ComputerCraft peripheral via an Adapter (Kosmos-Prime)
* Fixed: [#3603] computer.getDeviceInfo doesn't pause the computer immediately (AR2000AR)
* Fixed: [#3609] Swapped arguments in a graphics card "bitblt()" edge case. (Kosmos-Prime)
* Removed: Native Lua library support for x86 (32-bit) macOS.
* (1.7.10) Fixed: [#3239] Inconsistencies in Robot block clicking.

## OpenOS fixes/improvements
Expand All @@ -26,4 +40,4 @@

## List of contributors

asie, payonel, Smok1e
AR2000AR, asie, hohserg1, Kosmos-Prime, payonel, repo-alt, Smok1e, TheCodex6824
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

dependencies {
shadowImplementation name: 'OC-LuaJ', version: '20220907.1', ext: 'jar'
shadowImplementation name: 'OC-JNLua', version: '20220928.0', ext: 'jar'
shadowImplementation name: 'OC-JNLua-Natives', version: '20220928.0', ext: 'jar'
shadowImplementation name: 'OC-JNLua', version: '20220928.1', ext: 'jar'
shadowImplementation name: 'OC-JNLua-Natives', version: '20220928.1', ext: 'jar'

compile("com.google.code.findbugs:jsr305:3.0.2")

Expand Down
26 changes: 17 additions & 9 deletions src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -959,11 +959,19 @@ opencomputers {
# Whether to allow adding custom headers to HTTP requests.
enableHttpHeaders: true

# This is a list of allowed HTTP methods. If empty, any HTTP method
# can be used.
enableHttpMethods: []

# This is a number describing how many HTTP redirects are allowed
# while processing an HTTP request call. If 0, no redirects are allowed.
enableHttpRedirects: 50

# Whether to allow TCP connections via internet cards. When enabled,
# the `connect` method on internet card components becomes available.
enableTcp: true

# This is a list of blacklisted domain names. If an HTTP request is made
# This is a list of forbidden domain names. If an HTTP request is made
# or a socket connection is opened the target address will be compared
# to the addresses / address ranges in this list. It it is present in this
# list, the request will be denied.
Expand All @@ -985,9 +993,9 @@ opencomputers {
"172.16.0.0/12"
]

# This is a list of whitelisted domain names. Requests may only be made
# This is a list of allowed domain names. Requests may only be made
# to addresses that are present in this list. If this list is empty,
# requests may be made to all addresses not blacklisted. Note that the
# requests may be made to all addresses not forbidden. Note that the
# blacklist is always applied, so if an entry is present in both the
# whitelist and the blacklist, the blacklist will win.
# Entries are of the same format as in the blacklist. Examples:
Expand Down Expand Up @@ -1100,7 +1108,7 @@ opencomputers {
# Radius in blocks of the disintegration behavior for each active input.
disintegrationRange: 1

# Whitelisted potions, i.e. potions that will be used for the potion
# Allowed potions, i.e. potions that will be used for the potion
# behaviors nanomachines may trigger. This can contain strings or numbers.
# In the case of strings, it has to be the internal name of the potion,
# in case of a number it has to be the potion ID. Add any potion effects
Expand Down Expand Up @@ -1312,7 +1320,7 @@ opencomputers {
geolyzerNoise: 2

# By default the disassembler can only be used to disassemble items from
# OpenComputers itself (or objects whitelisted via the API). If you'd
# OpenComputers itself (or objects allowed via the API). If you'd
# like to allow the disassembler to work on all kinds of items, even from
# other mods, set this to true.
disassembleAllTheThings: false
Expand All @@ -1323,7 +1331,7 @@ opencomputers {
# this chance of breaking in the process.
disassemblerBreakChance: 0.05

# Names of items / blocks that are blacklisted. Recipes containing these
# Names of items / blocks that are forbidden. Recipes containing these
# as inputs will be ignored by the disassembler.
disassemblerInputBlacklist: [
"minecraft:fire"
Expand Down Expand Up @@ -1596,15 +1604,15 @@ opencomputers {

# Chunkloader Upgrade settings.
chunkloader {
# This is a list of blacklisted dimensions in the form of numeric IDs.
# This is a list of forbidden dimensions in the form of numeric IDs.
# Chunkloaders may only be activated in dimensions that aren't present in
# this list.
dimBlacklist: []

# This is a list of whitelisted dimensions in the form of numeric IDs.
# This is a list of allowed dimensions in the form of numeric IDs.
# Chunkloaders may only be activated in dimensions that are present in
# this list. If this list is empty, chunkloaders may be activated to all
# dimensions not blacklisted. Note that the blacklist is always applied,
# dimensions not forbidden. Note that the blacklist is always applied,
# so if an entry is present in both the whitelist and the blacklist, the
# blacklist will win.
dimWhitelist: []
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/assets/opencomputers/lang/ru_RU.lang
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,15 @@ oc:gui.Manual.Warning.OreDictMissing=Запись Ore Dictionary недосту
oc:gui.Raid.Warning=§4Добавление диска очистит его.[nl] Удаление диска очистит RAID.
oc:gui.Robot.Power=Энергия
oc:gui.Robot.TurnOff=Выключить
oc:gui.Robot.TurnOn=Включить
oc:gui.Robot.TurnOn=Включить[nl]§7Используйте анализатор для устранения ошибок.§r
oc:gui.Rack.Back=Сзади
oc:gui.Rack.Bottom=Снизу
oc:gui.Rack.Left=Слева
oc:gui.Rack.None=Нет
oc:gui.Rack.Right=Справа
oc:gui.Rack.Enabled=Включено
oc:gui.Rack.Disabled=Выключено
oc:gui.Rack.RelayModeTooltip=Режим ретрансляции
oc:gui.Rack.Top=Сверху
oc:gui.Switch.TransferRate=Цикличность
oc:gui.Switch.PacketsPerCycle=Пакеты / цикл
Expand Down Expand Up @@ -389,6 +390,7 @@ oc:tooltip.UpgradeSolarGenerator=Позволяет роботам генери
oc:tooltip.UpgradeTank=Позволяет роботам и дронам взаимодействовать с жидкостями. Без него они не смогут хранить жидкость.
oc:tooltip.UpgradeTankController=Позволяет роботам и дронам взамодействовать в внешними хранилищами жидкости, а также заливать и выливать жидкости в них.
oc:tooltip.UpgradeTractorBeam=Даёт роботу самую невероятно продвинутую технологию под кодовым названием "Магнит для предметов". Позволяет роботу подбирать предметы в радиусе 3 блоков от своего расположения.
oc:tooltip.UpgradeTrading=Позволяет роботам и дронам торговать с жителями.
oc:tooltip.Waypoint=Добавляет путевую точку для устройств с навигационным улучшением.
oc:tooltip.WirelessNetworkCard=Позволяет передавать сетевые сообщения по беспроводному каналу в дополнение к проводному. Вы можете настроить §fсилу сигнала§7, чтобы контролировать, насколько далеко должны отправляться сообщения. Более высокая сила сигнала приводит к повышенному потреблению энергии.
oc:tooltip.WorldSensorCard=Позволяет получать информацию об атмосфере и гравитации на планетах, добавляемых модом GalactiCraft. Используйте на свой страх и риск. Производитель не несет ответственности за материальный ущерб и увечья. У нас есть адвокаты. И деньги. Даже не пытайтесь.
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/assets/opencomputers/robot.names
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Mawhrin-skel # The Player of Games (Iain M Banks)
Michiyo # Contributor
*Mute # Analogue: A Hate Story / Hate Plus
Mycroft Holmes # The Moon Is a Harsh Mistress
Nano # Nichijou
Pac-Man # Pac-Man
Optimus # Transformers. Seperated "Optimus Prime" into two names, as both are quite fitting robot names.
Ordis # Warframe
Expand All @@ -103,6 +104,7 @@ R. Giskard Reventlov # Isaac Asimov's
R2-D2 # Star Wars
Replicator # Stargate
Robby # Forbidden Planet
Roboheart # OMORI
Roomba # Under your couch... wait.
Rosie # The Jetsons
Skaffen-Amtiskaw # Use of weapons (Iain M Banks)
Expand All @@ -121,7 +123,7 @@ TARA UH # Perry Rhodan
Terminator # Terminator
Tom Servo # Mystery Science Theater 3000
Rinzler # Tron
Twiki # Buck Rodgers
Twiki # Buck Rogers
Uniblab # The Jetsons
Unimate # First programmable robot.
VEGA # Doom 2016
Expand All @@ -134,5 +136,6 @@ Weebo # Flubber
Wheatley # Portal
Wintermute # Neuromancer
Wobbo # Contributor
WX-78 # Don't Starve
Yui-MHCP001 # AKA Yui (Mental Health Counseling Program 001) - Sword Art Online
Zone of Endless # Ace Combat series
5 changes: 4 additions & 1 deletion src/main/scala/li/cil/oc/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class Settings(val config: Config) {
(-1.0, -1.0)
}
val enableNanomachinePfx = config.getBoolean("client.enableNanomachinePfx")
val transposerFluidTransferRate = try { config.getInt("misc.transposerFluidTransferRate") } catch { case _ : Throwable => 16000 }
val transposerFluidTransferRate = config.getInt("misc.transposerFluidTransferRate")

// ----------------------------------------------------------------------- //
// computer
val threads = config.getInt("computer.threads") max 1
Expand Down Expand Up @@ -298,6 +299,8 @@ class Settings(val config: Config) {
// internet
val httpEnabled = config.getBoolean("internet.enableHttp")
val httpHeadersEnabled = config.getBoolean("internet.enableHttpHeaders")
val httpMethodsEnabled = config.getStringList("internet.enableHttpMethods")
val httpRedirectsEnabled = config.getInt("internet.enableHttpRedirects") max -1
val tcpEnabled = config.getBoolean("internet.enableTcp")
val httpHostBlacklist = Array(config.getStringList("internet.blacklist").map(new Settings.AddressValidator(_)): _*)
val httpHostWhitelist = Array(config.getStringList("internet.whitelist").map(new Settings.AddressValidator(_)): _*)
Expand Down
97 changes: 57 additions & 40 deletions src/main/scala/li/cil/oc/client/renderer/font/FontParserHex.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import li.cil.oc.Settings;
import li.cil.oc.util.FontUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.IResource;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.BufferUtils;

Expand All @@ -14,60 +15,76 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.ByteBuffer;
import java.util.List;

public class FontParserHex implements IGlyphProvider {
private static final byte[] OPAQUE = {(byte) 255, (byte) 255, (byte) 255, (byte) 255};
private static final byte[] TRANSPARENT = {0, 0, 0, 0};

private final TIntObjectMap<byte[]> glyphs = new TIntObjectHashMap<>();

private static int hex2int(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
} else if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
} else if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
} else {
throw new RuntimeException("invalid char: " + c);
}
}

@Override
public void initialize() {
try {
final InputStream font = Minecraft.getMinecraft()
.getResourceManager()
.getResource(new ResourceLocation(Settings.resourceDomain(), "font.hex"))
.getInputStream();
try {
OpenComputers.log().info("Initializing unicode glyph provider.");
final BufferedReader input = new BufferedReader(new InputStreamReader(font));
String line;
int glyphCount = 0;
while ((line = input.readLine()) != null) {
final String[] info = line.split(":");
final int charCode = Integer.parseInt(info[0], 16);
if (charCode < 0 || charCode >= FontUtils.codepoint_limit()) {
OpenComputers.log().warn(String.format("Unicode font contained unexpected glyph: U+%04X, ignoring", charCode));
continue; // Out of bounds.
}
final int expectedWidth = FontUtils.wcwidth(charCode);
if (expectedWidth < 1) continue; // Skip control characters.
// Two chars representing one byte represent one row of eight pixels.
final byte[] glyph = new byte[info[1].length() >> 1];
final int glyphWidth = glyph.length / getGlyphHeight();
if (expectedWidth == glyphWidth) {
for (int i = 0; i < glyph.length; i++) {
glyph[i] = (byte) Integer.parseInt(info[1].substring(i * 2, i * 2 + 2), 16);
glyphs.clear();

OpenComputers.log().info("Loading Unicode glyphs...");
long time = System.currentTimeMillis();
int glyphCount = 0;

ResourceLocation loc = new ResourceLocation(Settings.resourceDomain(), "font.hex");
for (IResource resource : (List<IResource>) Minecraft.getMinecraft().getResourceManager().getAllResources(loc)) {
final InputStream font = resource.getInputStream();
try {
final BufferedReader input = new BufferedReader(new InputStreamReader(font));
String line;
while ((line = input.readLine()) != null) {
final String info = line.substring(0, line.indexOf(':'));
final int charCode = Integer.parseInt(info, 16);
if (charCode < 0 || charCode >= FontUtils.codepoint_limit()) {
OpenComputers.log().warn(String.format("Unicode font contained unexpected glyph: U+%04X, ignoring", charCode));
continue; // Out of bounds.
}
if (!glyphs.containsKey(charCode)) {
glyphCount++;
final int expectedWidth = FontUtils.wcwidth(charCode);
if (expectedWidth < 1) continue; // Skip control characters.
// Two chars representing one byte represent one row of eight pixels.
int glyphStrOfs = info.length() + 1;
final byte[] glyph = new byte[(line.length() - glyphStrOfs) >> 1];
final int glyphWidth = glyph.length / getGlyphHeight();
if (expectedWidth == glyphWidth) {
for (int i = 0; i < glyph.length; i++, glyphStrOfs += 2) {
glyph[i] = (byte) ((hex2int(line.charAt(glyphStrOfs)) << 4) | (hex2int(line.charAt(glyphStrOfs + 1))));
}
if (!glyphs.containsKey(charCode)) {
glyphCount++;
}
glyphs.put(charCode, glyph);
} else if (Settings.get().logHexFontErrors()) {
OpenComputers.log().warn(String.format("Size of glyph for code point U+%04X (%s) in font (%d) does not match expected width (%d), ignoring.", charCode, String.valueOf((char) charCode), glyphWidth, expectedWidth));
}
glyphs.put(charCode, glyph);
} else if (Settings.get().logHexFontErrors()) {
OpenComputers.log()
.warn(String.format(
"Size of glyph for code point U+%04X (%s) in font (%d) does not match expected width (%d), ignoring.",
charCode, String.valueOf((char) charCode), glyphWidth, expectedWidth));
}
}
OpenComputers.log().info("Loaded " + glyphCount + " glyphs.");
} finally {
try {
font.close();
} catch (IOException ex) {
OpenComputers.log().warn("Error parsing font.", ex);
} finally {
try {
font.close();
} catch (IOException ex) {
OpenComputers.log().warn("Error parsing font.", ex);
}
}
}

OpenComputers.log().info("Loaded " + glyphCount + " glyphs in " + (System.currentTimeMillis() - time) + " milliseconds.");
} catch (IOException ex) {
OpenComputers.log().warn("Failed loading glyphs.", ex);
}
Expand All @@ -78,7 +95,7 @@ public ByteBuffer getGlyph(int charCode) {
if (!glyphs.containsKey(charCode))
return null;
final byte[] glyph = glyphs.get(charCode);
if (glyph == null || glyph.length <= 0)
if (glyph == null || glyph.length == 0)
return null;
final ByteBuffer buffer = BufferUtils.createByteBuffer(glyph.length * getGlyphWidth() * 4);
for (byte aGlyph : glyph) {
Expand Down
Loading

0 comments on commit 5096a31

Please sign in to comment.