diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e76ef7433..76e73fc5f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer diff --git a/gradle.properties b/gradle.properties index 221f5c735..064d72458 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ neogradle.subsystems.conventions.runs.enabled=false # Mod properties isUnstable=true -modVersion=1.115.0 +modVersion=1.115.1 # Minecraft properties: We want to configure this here so we can read it in settings.gradle mcVersion=1.21.1 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e54627e35..d98d45d05 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -47,7 +47,7 @@ rei = "16.0.729" sodium-fabric = "mc1.21-0.6.0-beta.1-fabric" sodium-forge = "mc1.21-0.6.0-beta.1-neoforge" mixinExtra = "0.3.5" -create-forge = "0.5.1.f-33" +create-forge = "6.0.0-6" create-fabric = "0.5.1-f-build.1467+mc1.20.1" # Testing @@ -105,7 +105,7 @@ slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } # Minecraft mods create-fabric = { module = "com.simibubi.create:create-fabric-1.20.1", version.ref = "create-fabric" } -create-forge = { module = "com.simibubi.create:create-1.20.1", version.ref = "create-forge" } +create-forge = { module = "com.simibubi.create:create-1.21.1", version.ref = "create-forge" } emi = { module = "dev.emi:emi-xplat-mojmap", version.ref = "emi" } fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric-api" } fabric-junit = { module = "net.fabricmc:fabric-loader-junit", version.ref = "fabric-loader" } diff --git a/projects/common-api/src/main/java/dan200/computercraft/api/detail/DetailProvider.java b/projects/common-api/src/main/java/dan200/computercraft/api/detail/DetailProvider.java index 879ed77eb..5923271ad 100644 --- a/projects/common-api/src/main/java/dan200/computercraft/api/detail/DetailProvider.java +++ b/projects/common-api/src/main/java/dan200/computercraft/api/detail/DetailProvider.java @@ -14,6 +14,7 @@ import java.util.Map; * * @param The type of object that this provider can provide details for. * @see DetailRegistry + * @see dan200.computercraft.api.detail An overview of the detail system. */ @FunctionalInterface public interface DetailProvider { diff --git a/projects/common-api/src/main/java/dan200/computercraft/api/detail/DetailRegistry.java b/projects/common-api/src/main/java/dan200/computercraft/api/detail/DetailRegistry.java index 4f21ff81f..342150515 100644 --- a/projects/common-api/src/main/java/dan200/computercraft/api/detail/DetailRegistry.java +++ b/projects/common-api/src/main/java/dan200/computercraft/api/detail/DetailRegistry.java @@ -17,6 +17,7 @@ import java.util.Map; * also in this package. * * @param The type of object that this registry provides details for. + * @see dan200.computercraft.api.detail An overview of the detail system. */ @ApiStatus.NonExtendable public interface DetailRegistry { diff --git a/projects/common-api/src/main/java/dan200/computercraft/api/detail/VanillaDetailRegistries.java b/projects/common-api/src/main/java/dan200/computercraft/api/detail/VanillaDetailRegistries.java index 409bca0f0..a7b462e1a 100644 --- a/projects/common-api/src/main/java/dan200/computercraft/api/detail/VanillaDetailRegistries.java +++ b/projects/common-api/src/main/java/dan200/computercraft/api/detail/VanillaDetailRegistries.java @@ -17,6 +17,9 @@ public class VanillaDetailRegistries { *

* This instance's {@link DetailRegistry#getBasicDetails(Object)} is thread safe (assuming the stack is immutable) * and may be called from the computer thread. + *

+ * This does not have special handling for {@linkplain ItemStack#isEmpty() empty item stacks}, and so the returned + * details will be an empty stack of air. Callers should generally check for empty stacks before calling this. */ public static final DetailRegistry ITEM_STACK = ComputerCraftAPIService.get().getItemStackDetailRegistry(); diff --git a/projects/common-api/src/main/java/dan200/computercraft/api/detail/package-info.java b/projects/common-api/src/main/java/dan200/computercraft/api/detail/package-info.java new file mode 100644 index 000000000..a562797dc --- /dev/null +++ b/projects/common-api/src/main/java/dan200/computercraft/api/detail/package-info.java @@ -0,0 +1,48 @@ +// SPDX-FileCopyrightText: 2025 The CC: Tweaked Developers +// +// SPDX-License-Identifier: MPL-2.0 + +/** + * The detail system provides a standard way for mods to return descriptions of common game objects, such as blocks or + * items, as well as registering additional detail to be included in those descriptions. + *

+ * For instance, the built-in {@code turtle.getItemDetail()} method uses + * {@linkplain dan200.computercraft.api.detail.VanillaDetailRegistries#ITEM_STACK in order to provide information about} + * the selected item: + * + *

{@code
+ * local item = turtle.getItemDetail(nil, true)
+ * --[[
+ * item = {
+ *   name = "minecraft:wheat",
+ *   displayName = "Wheat",
+ *   count = 1,
+ *   maxCount = 64,
+ *   tags = {},
+ * }
+ * ]]
+ * }
+ * + *

Built-in detail providers

+ * While you can define your own detail providers (perhaps for types from your own mod), CC comes with several built-in + * detail registries for vanilla and mod-loader objects: + * + *
    + *
  • {@link dan200.computercraft.api.detail.VanillaDetailRegistries}, for vanilla objects
  • + *
  • {@code dan200.computercraft.api.detail.ForgeDetailRegistries} for Forge-specific objects
  • + *
  • {@code dan200.computercraft.api.detail.FabricDetailRegistries} for Fabric-specific objects
  • + *
+ * + *

Example: Returning details from methods

+ * Here we define a {@code getHeldItem()} method for pocket computers which finds the currently held item of the player + * and returns it to the user using {@link dan200.computercraft.api.detail.VanillaDetailRegistries#ITEM_STACK} and + * {@link dan200.computercraft.api.detail.DetailRegistry#getDetails(java.lang.Object)}. + * + * {@snippet class=com.example.examplemod.ExamplePocketPeripheral region=details} + * + *

Example: Registering custom detail registries

+ * Here we define a new detail provider for items that includes the nutrition and saturation values in the returned object. + * + * {@snippet class=com.example.examplemod.ExampleMod region=details} + */ +package dan200.computercraft.api.detail; diff --git a/projects/common/build.gradle.kts b/projects/common/build.gradle.kts index cddd9afee..8af38ba44 100644 --- a/projects/common/build.gradle.kts +++ b/projects/common/build.gradle.kts @@ -39,7 +39,6 @@ dependencies { compileOnly(libs.mixin) compileOnly(libs.mixinExtra) compileOnly(libs.bundles.externalMods.common) - compileOnly(variantOf(libs.create.forge) { classifier("slim") }) { isTransitive = false } clientCompileOnly(variantOf(libs.emi) { classifier("api") }) annotationProcessorEverywhere(libs.autoService) diff --git a/projects/common/src/client/java/dan200/computercraft/client/model/LecternPocketModel.java b/projects/common/src/client/java/dan200/computercraft/client/model/LecternPocketModel.java index 0636e3c43..5e15d0312 100644 --- a/projects/common/src/client/java/dan200/computercraft/client/model/LecternPocketModel.java +++ b/projects/common/src/client/java/dan200/computercraft/client/model/LecternPocketModel.java @@ -45,8 +45,8 @@ public class LecternPocketModel { public static final float TERM_HEIGHT = 14.0f / 32.0f; // The size of the texture. The texture is 36x36, but is at 2x resolution. - private static final int TEXTURE_WIDTH = 36 / 2; - private static final int TEXTURE_HEIGHT = 36 / 2; + private static final int TEXTURE_WIDTH = 48 / 2; + private static final int TEXTURE_HEIGHT = 48 / 2; private final ModelPart root; diff --git a/projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerInstance.java b/projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerInstance.java index 8d3a94674..59a89127e 100644 --- a/projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerInstance.java +++ b/projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerInstance.java @@ -24,7 +24,7 @@ public class SpeakerInstance { SpeakerInstance() { } - private void pushAudio(EncodedAudio buffer) { + private void pushAudio(EncodedAudio buffer, float volume) { var sound = this.sound; var stream = currentStream; @@ -32,18 +32,30 @@ public class SpeakerInstance { var exhausted = stream.isEmpty(); stream.push(buffer); - // If we've got nothing left in the buffer, enqueue an additional one just in case. - if (exhausted && sound != null && sound.stream == stream && stream.channel != null && stream.executor != null) { + if (sound == null) return; + + var volumeChanged = sound.setVolume(volume); + + if ((exhausted || volumeChanged) && sound.stream == stream && stream.channel != null && stream.executor != null) { var actualStream = sound.stream; stream.executor.execute(() -> { var channel = Nullability.assertNonNull(actualStream.channel); - if (!channel.stopped()) channel.pumpBuffers(1); + if (channel.stopped()) return; + + // If we've got nothing left in the buffer, enqueue an additional one just in case. + if (exhausted) channel.pumpBuffers(1); + + // Update the attenuation if the volume has changed: SoundEngine.tickNonPaused updates the volume + // itself, but leaves the attenuation unchanged. We mirror the logic of SoundEngine.play here. + if (volumeChanged) { + channel.linearAttenuation(Math.max(volume, 1) * sound.getSound().getAttenuationDistance()); + } }); } } public void playAudio(SpeakerPosition position, float volume, EncodedAudio buffer) { - pushAudio(buffer); + pushAudio(buffer, volume); var soundManager = Minecraft.getInstance().getSoundManager(); diff --git a/projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerSound.java b/projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerSound.java index 44ab385f2..e55e8d542 100644 --- a/projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerSound.java +++ b/projects/common/src/client/java/dan200/computercraft/client/sound/SpeakerSound.java @@ -83,4 +83,10 @@ public class SpeakerSound extends AbstractSoundInstance implements TickableSound public @Nullable AudioStream getStream() { return stream; } + + boolean setVolume(float volume) { + if (volume == this.volume) return false; + this.volume = volume; + return true; + } } diff --git a/projects/common/src/examples/java/com/example/examplemod/ExampleMod.java b/projects/common/src/examples/java/com/example/examplemod/ExampleMod.java index 8a54e743a..7dc1d2728 100644 --- a/projects/common/src/examples/java/com/example/examplemod/ExampleMod.java +++ b/projects/common/src/examples/java/com/example/examplemod/ExampleMod.java @@ -3,7 +3,9 @@ package com.example.examplemod; import com.example.examplemod.data.TurtleUpgradeProvider; import com.example.examplemod.peripheral.FurnacePeripheral; import dan200.computercraft.api.ComputerCraftAPI; +import dan200.computercraft.api.detail.VanillaDetailRegistries; import dan200.computercraft.api.upgrades.UpgradeType; +import net.minecraft.core.component.DataComponents; /** * Our example mod, containing the various things we register. @@ -34,6 +36,16 @@ public final class ExampleMod { ComputerCraftAPI.registerGenericSource(new FurnacePeripheral()); // @end region=generic_source + // @start region=details + VanillaDetailRegistries.ITEM_STACK.addProvider((out, stack) -> { + var food = stack.get(DataComponents.FOOD); + if (food == null) return; + + out.put("saturation", food.saturation()); + out.put("nutrition", food.nutrition()); + }); + // @end region=details + ExampleAPI.register(); } } diff --git a/projects/common/src/examples/java/com/example/examplemod/ExamplePocketPeripheral.java b/projects/common/src/examples/java/com/example/examplemod/ExamplePocketPeripheral.java new file mode 100644 index 000000000..bf9a19aa4 --- /dev/null +++ b/projects/common/src/examples/java/com/example/examplemod/ExamplePocketPeripheral.java @@ -0,0 +1,49 @@ +package com.example.examplemod; + +import dan200.computercraft.api.detail.DetailRegistry; +import dan200.computercraft.api.detail.VanillaDetailRegistries; +import dan200.computercraft.api.lua.LuaFunction; +import dan200.computercraft.api.peripheral.IPeripheral; +import dan200.computercraft.api.pocket.IPocketAccess; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.LivingEntity; +import org.jspecify.annotations.Nullable; + +import java.util.Map; + +/** + * An example peripheral for pocket computers. This currently doesn't have an associated upgrade — it mostly exists to + * demonstrate other functionality. + */ +public class ExamplePocketPeripheral implements IPeripheral { + private final IPocketAccess pocket; + + public ExamplePocketPeripheral(IPocketAccess pocket) { + this.pocket = pocket; + } + + @Override + public String getType() { + return "example"; + } + + /** + * An example of using {@linkplain DetailRegistry detail registries} to get the current player's held item. + * + * @return The item details, or {@code null} if the player is not holding an item. + */ + // @start region=details + @LuaFunction(mainThread = true) + public final @Nullable Map getHeldItem() { + if (!(pocket.getEntity() instanceof LivingEntity entity)) return null; + + var heldItem = entity.getItemInHand(InteractionHand.MAIN_HAND); + return heldItem.isEmpty() ? null : VanillaDetailRegistries.ITEM_STACK.getDetails(heldItem); + } + // @end region=details + + @Override + public boolean equals(@Nullable IPeripheral other) { + return other instanceof ExamplePocketPeripheral o && pocket == o.pocket; + } +} diff --git a/projects/common/src/main/java/dan200/computercraft/shared/integration/ExternalModTags.java b/projects/common/src/main/java/dan200/computercraft/shared/integration/ExternalModTags.java index c52fc98f0..d4338540d 100644 --- a/projects/common/src/main/java/dan200/computercraft/shared/integration/ExternalModTags.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/integration/ExternalModTags.java @@ -27,9 +27,9 @@ public final class ExternalModTags { /** * Create's "brittle" tag, used to determine if this block needs to be moved before its neighbours. * - * @see com.simibubi.create.content.contraptions.BlockMovementChecks#isBrittle(BlockState) + * @see com.simibubi.create.api.contraption.BlockMovementChecks#isBrittle(BlockState) */ - public static final TagKey CREATE_BRITTLE = make(CreateIntegration.ID, "brittle"); + public static final TagKey CREATE_BRITTLE = make("create", "brittle"); private static TagKey make(String mod, String name) { return TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(mod, name)); diff --git a/projects/common/src/main/resources/assets/computercraft/lang/de_de.json b/projects/common/src/main/resources/assets/computercraft/lang/de_de.json index c4a6dbe43..3c4aa9d55 100644 --- a/projects/common/src/main/resources/assets/computercraft/lang/de_de.json +++ b/projects/common/src/main/resources/assets/computercraft/lang/de_de.json @@ -1,5 +1,6 @@ { "argument.computercraft.argument_expected": "Parameter erwartet", + "argument.computercraft.computer.distance": "Entfernung zur Entität", "argument.computercraft.computer.family": "Computer familie", "argument.computercraft.computer.id": "Computer ID", "argument.computercraft.computer.instance": "einzigartige Instanz ID", @@ -98,6 +99,7 @@ "gui.computercraft.config.http.bandwidth.tooltip": "Limitiert die Bandbreite der Computer.", "gui.computercraft.config.http.enabled": "HTTP-API aktivieren", "gui.computercraft.config.http.max_requests": "Maximale Anzahl gleichzeitiger Anfragen", + "gui.computercraft.config.http.max_requests.tooltip": "Die Anzahl der http Anfragen, die ein Computer gleichzeitig machen kann. Zusätzliche Anfragen werden der Warteschlange hinzugefügt und nach den laufenden Anfragen gesendet. Für unendlich auf 0 setzen.", "gui.computercraft.config.http.max_websockets": "Maximale Anzahl gleichzeitiger Websockets", "gui.computercraft.config.http.max_websockets.tooltip": "Die Anzahl der Websockets die ein Computer gleichzeitig öffnen kann.", "gui.computercraft.config.http.proxy": "Proxy", @@ -114,6 +116,7 @@ "gui.computercraft.config.log_computer_errors": "Computerfehler loggen", "gui.computercraft.config.maximum_open_files": "Maximalanzahl an gleichzeitig offenen Dateien je Computer", "gui.computercraft.config.maximum_open_files.tooltip": "Legen Sie fest, wie viele Dateien gleichzeitig geöffnet werden können. Setzen Sie auf 0 für unbegrenzt.", + "gui.computercraft.config.monitor_distance": "Monitordistanz", "gui.computercraft.config.peripheral": "Peripheriegeräte", "gui.computercraft.config.peripheral.command_block_enabled": "Befehlsblöcke als Peripheriegerät erlauben", "gui.computercraft.config.peripheral.command_block_enabled.tooltip": "Befehlsblock Peripherie Unterstützung aktivieren", diff --git a/projects/common/src/main/resources/assets/computercraft/lang/fr_fr.json b/projects/common/src/main/resources/assets/computercraft/lang/fr_fr.json index f4481d5ec..414d410ee 100644 --- a/projects/common/src/main/resources/assets/computercraft/lang/fr_fr.json +++ b/projects/common/src/main/resources/assets/computercraft/lang/fr_fr.json @@ -1,8 +1,14 @@ { "argument.computercraft.argument_expected": "Argument attendu", + "argument.computercraft.computer.distance": "Distance jusqu'à l'entité", + "argument.computercraft.computer.family": "Famille d'ordinateurs", + "argument.computercraft.computer.id": "ID de l'ordinateur", + "argument.computercraft.computer.instance": "ID unique de l'instance", + "argument.computercraft.computer.label": "Étiquette de l'ordinateur", "argument.computercraft.computer.many_matching": "Plusieurs ordinateurs correspondent à '%s' (instances %s)", "argument.computercraft.computer.no_matching": "Pas d'ordinateurs correspondant à '%s'", "argument.computercraft.tracking_field.no_field": "Champ '%s' inconnu", + "argument.computercraft.unknown_computer_family": "Famille d'ordinateur '%s ' inconnue", "block.computercraft.cable": "Câble réseau", "block.computercraft.computer_advanced": "Ordinateur Avancé", "block.computercraft.computer_command": "Ordinateur de commande", @@ -11,6 +17,7 @@ "block.computercraft.monitor_advanced": "Moniteur Avancé", "block.computercraft.monitor_normal": "Moniteur", "block.computercraft.printer": "Imprimante", + "block.computercraft.redstone_relay": "Relais de Redstone", "block.computercraft.speaker": "Haut-parleur", "block.computercraft.turtle_advanced": "Tortue Avancée", "block.computercraft.turtle_advanced.upgraded": "Tortue %s Avancée", @@ -137,16 +144,22 @@ "gui.computercraft.config.term_sizes": "Tailles de terminal", "gui.computercraft.config.term_sizes.computer": "Ordinateur", "gui.computercraft.config.term_sizes.computer.height": "Hauteur du terminal", + "gui.computercraft.config.term_sizes.computer.height.tooltip": "Hauteur du terminal de l'ordinateur", "gui.computercraft.config.term_sizes.computer.tooltip": "Taille du terminal des ordinateurs.", "gui.computercraft.config.term_sizes.computer.width": "Largeur du terminal", + "gui.computercraft.config.term_sizes.computer.width.tooltip": "Largeur du terminal de l'ordinateur", "gui.computercraft.config.term_sizes.monitor": "Moniteur", "gui.computercraft.config.term_sizes.monitor.height": "Hauteur maximale du moniteur", + "gui.computercraft.config.term_sizes.monitor.height.tooltip": "Hauteur maximale des moniteurs", "gui.computercraft.config.term_sizes.monitor.tooltip": "Taille maximale des moniteurs (en blocs).", "gui.computercraft.config.term_sizes.monitor.width": "Largeur maximale du moniteur", + "gui.computercraft.config.term_sizes.monitor.width.tooltip": "Largeur maximale des moniteurs", "gui.computercraft.config.term_sizes.pocket_computer": "Ordinateur de poche", "gui.computercraft.config.term_sizes.pocket_computer.height": "Hauteur du terminal", + "gui.computercraft.config.term_sizes.pocket_computer.height.tooltip": "Hauteur du terminal de l'ordinateur de poche", "gui.computercraft.config.term_sizes.pocket_computer.tooltip": "Taille du terminal des ordinateurs de poche.", "gui.computercraft.config.term_sizes.pocket_computer.width": "Largeur du terminal", + "gui.computercraft.config.term_sizes.pocket_computer.width.tooltip": "Largeur du terminal de l'ordinateur de poche", "gui.computercraft.config.term_sizes.tooltip": "Configure la taille des différents terminaux de l'ordinateur.\nLes terminaux plus grands nécessitent plus de bande passante, réglez donc avec précaution.", "gui.computercraft.config.turtle": "Tortues", "gui.computercraft.config.turtle.advanced_fuel_limit": "Limite de carburant par Tortue Avancée", @@ -192,6 +205,8 @@ "item.computercraft.treasure_disk": "Disquette", "itemGroup.computercraft": "ComputerCraft", "tag.item.computercraft.computer": "Ordinateurs", + "tag.item.computercraft.monitor": "Moniteurs", + "tag.item.computercraft.turtle": "Tortues", "tag.item.computercraft.wired_modem": "Modems câblés", "tracking_field.computercraft.avg": "%s (moyenne)", "tracking_field.computercraft.computer_tasks.name": "Tâches", @@ -200,6 +215,7 @@ "tracking_field.computercraft.http_download.name": "Téléchargement HTTP", "tracking_field.computercraft.http_requests.name": "Requêtes HTTP", "tracking_field.computercraft.http_upload.name": "Publication HTTP", + "tracking_field.computercraft.java_allocation.name": "Allocations Java", "tracking_field.computercraft.max": "%s (max)", "tracking_field.computercraft.peripheral.name": "Appels aux périphériques", "tracking_field.computercraft.server_tasks.name": "Tâches du serveur", diff --git a/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_advanced.png b/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_advanced.png index b8b6b40d0..9096b8401 100644 Binary files a/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_advanced.png and b/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_advanced.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_colour.png b/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_colour.png index 23e57787b..2d236d3f3 100644 Binary files a/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_colour.png and b/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_colour.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_frame.png b/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_frame.png index 8362bf8bb..4f52772d8 100644 Binary files a/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_frame.png and b/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_frame.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_light.png b/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_light.png index 49b2a99ff..9e92b04c8 100644 Binary files a/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_light.png and b/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_light.png differ diff --git a/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_normal.png b/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_normal.png index 5102383aa..20dff3ff3 100644 Binary files a/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_normal.png and b/projects/common/src/main/resources/assets/computercraft/textures/entity/pocket_computer_normal.png differ diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/help/changelog.md b/projects/core/src/main/resources/data/computercraft/lua/rom/help/changelog.md index 1fc239a72..fdddc9328 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/help/changelog.md +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/help/changelog.md @@ -1,3 +1,13 @@ +# New features in CC: Tweaked 1.115.1 + +* Update various translations (cyb3r, kevk2156, teamer337, yakku). +* Support Fabric's item lookup API for registering media providers. + +Several bug fixes: +* Fix crashes on Create 6.0 (ellellie). +* Fix `speaker.playAudio` not updating speaker volume. +* Resize pocket lectern textures to fix issues with generating mipmaps. + # New features in CC: Tweaked 1.115.0 * Support placing pocket computers on lecterns. diff --git a/projects/core/src/main/resources/data/computercraft/lua/rom/help/whatsnew.md b/projects/core/src/main/resources/data/computercraft/lua/rom/help/whatsnew.md index e7c63fd7d..ba927c761 100644 --- a/projects/core/src/main/resources/data/computercraft/lua/rom/help/whatsnew.md +++ b/projects/core/src/main/resources/data/computercraft/lua/rom/help/whatsnew.md @@ -1,12 +1,11 @@ -New features in CC: Tweaked 1.115.0 +New features in CC: Tweaked 1.115.1 -* Support placing pocket computers on lecterns. -* Suggest alternative table keys on `nil` errors. -* Errors from inside `parallel` functions now have source information attached. -* Expose printout contents to the Java API. -* Add support for MoreRed bundled cables. +* Update various translations (cyb3r, kevk2156, teamer337, yakku). +* Support Fabric's item lookup API for registering media providers. Several bug fixes: -* Ignore unrepresentable characters in `char`/`paste` events. +* Fix crashes on Create 6.0 (ellellie). +* Fix `speaker.playAudio` not updating speaker volume. +* Resize pocket lectern textures to fix issues with generating mipmaps. Type "help changelog" to see the full version history. diff --git a/projects/common/src/main/java/dan200/computercraft/shared/integration/CreateIntegration.java b/projects/fabric/src/main/java/dan200/computercraft/shared/integration/CreateIntegration.java similarity index 100% rename from projects/common/src/main/java/dan200/computercraft/shared/integration/CreateIntegration.java rename to projects/fabric/src/main/java/dan200/computercraft/shared/integration/CreateIntegration.java diff --git a/projects/forge/build.gradle.kts b/projects/forge/build.gradle.kts index f72aece47..d0f35bdc9 100644 --- a/projects/forge/build.gradle.kts +++ b/projects/forge/build.gradle.kts @@ -160,7 +160,7 @@ dependencies { clientCompileOnly(variantOf(libs.emi) { classifier("api") }) compileOnly(libs.bundles.externalMods.forge.compile) clientRuntimeOnly(libs.bundles.externalMods.forge.runtime) - compileOnly(variantOf(libs.create.forge) { classifier("slim") }) { isTransitive = false } + compileOnly(libs.create.forge) { isTransitive = false } // Depend on our other projects. "localImplementation"(project(":core")) diff --git a/projects/forge/src/main/java/dan200/computercraft/shared/integration/CreateIntegration.java b/projects/forge/src/main/java/dan200/computercraft/shared/integration/CreateIntegration.java new file mode 100644 index 000000000..a606f9376 --- /dev/null +++ b/projects/forge/src/main/java/dan200/computercraft/shared/integration/CreateIntegration.java @@ -0,0 +1,34 @@ +// SPDX-FileCopyrightText: 2024 The CC: Tweaked Developers +// +// SPDX-License-Identifier: MPL-2.0 + +package dan200.computercraft.shared.integration; + +import com.simibubi.create.api.contraption.BlockMovementChecks; +import com.simibubi.create.api.contraption.BlockMovementChecks.CheckResult; +import dan200.computercraft.shared.peripheral.modem.wired.CableBlock; +import dan200.computercraft.shared.peripheral.modem.wireless.WirelessModemBlock; + +/** + * Integration with Create. + */ +public final class CreateIntegration { + public static final String ID = "create"; + + private CreateIntegration() { + } + + public static void setup() { + // Allow modems to be treated as "attached" to their adjacent block. + BlockMovementChecks.registerAttachedCheck((state, world, pos, direction) -> { + var block = state.getBlock(); + if (block instanceof WirelessModemBlock) { + return CheckResult.of(state.getValue(WirelessModemBlock.FACING) == direction); + } else if (block instanceof CableBlock) { + return CheckResult.of(state.getValue(CableBlock.MODEM).getFacing() == direction); + } else { + return CheckResult.PASS; + } + }); + } +}