mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-23 15:36:54 +00:00
Merge branch 'mc-1.19.x' into mc-1.20.x
This commit is contained in:
commit
1ece2aa23b
1
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
1
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
@ -11,6 +11,7 @@ body:
|
||||
- 1.16.x
|
||||
- 1.18.x
|
||||
- 1.19.x
|
||||
- 1.20.x
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
|
@ -33,7 +33,6 @@ val publishCurseForge by tasks.registering(TaskPublishCurseForge::class) {
|
||||
enabled = apiToken != ""
|
||||
|
||||
val mainFile = upload("282001", modPublishing.output.get().archiveFile)
|
||||
dependsOn(modPublishing.output) // See https://github.com/Darkhax/CurseForgeGradle/pull/7.
|
||||
mainFile.changelog =
|
||||
"Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v$mcVersion-$modVersion)."
|
||||
mainFile.changelogType = "markdown"
|
||||
|
@ -2,8 +2,6 @@
|
||||
//
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
import org.gradle.kotlin.dsl.`maven-publish`
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
|
@ -10,7 +10,7 @@ kotlin.jvm.target.validation.mode=error
|
||||
|
||||
# Mod properties
|
||||
isUnstable=false
|
||||
modVersion=1.104.0
|
||||
modVersion=1.105.0
|
||||
|
||||
# Minecraft properties: We want to configure this here so we can read it in settings.gradle
|
||||
mcVersion=1.20
|
||||
|
@ -50,7 +50,7 @@ junit = "5.9.2"
|
||||
# Build tools
|
||||
cctJavadoc = "1.7.0"
|
||||
checkstyle = "10.3.4"
|
||||
curseForgeGradle = "1.0.11"
|
||||
curseForgeGradle = "1.0.14"
|
||||
errorProne-core = "2.18.0"
|
||||
errorProne-plugin = "3.0.1"
|
||||
fabric-loom = "1.1.10"
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
package dan200.computercraft.api.pocket;
|
||||
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import dan200.computercraft.api.upgrades.UpgradeBase;
|
||||
import dan200.computercraft.api.upgrades.UpgradeSerialiser;
|
||||
import dan200.computercraft.impl.ComputerCraftAPIService;
|
||||
@ -30,14 +29,6 @@ import java.util.function.Function;
|
||||
* @see PocketUpgradeDataProvider
|
||||
*/
|
||||
public interface PocketUpgradeSerialiser<T extends IPocketUpgrade> extends UpgradeSerialiser<T> {
|
||||
/**
|
||||
* The ID for the associated registry.
|
||||
*
|
||||
* @deprecated Use {@link #registryId()} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
ResourceKey<Registry<PocketUpgradeSerialiser<?>>> REGISTRY_ID = ResourceKey.createRegistryKey(new ResourceLocation(ComputerCraftAPI.MOD_ID, "pocket_upgrade_serialiser"));
|
||||
|
||||
/**
|
||||
* The ID for the associated registry.
|
||||
*
|
||||
|
@ -13,7 +13,6 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -68,25 +67,6 @@ public interface ITurtleAccess {
|
||||
*/
|
||||
boolean teleportTo(Level world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* Returns a vector containing the floating point co-ordinates at which the turtle is rendered.
|
||||
* This will shift when the turtle is moving.
|
||||
*
|
||||
* @param f The subframe fraction.
|
||||
* @return A vector containing the floating point co-ordinates at which the turtle resides.
|
||||
* @see #getVisualYaw(float)
|
||||
*/
|
||||
Vec3 getVisualPosition(float f);
|
||||
|
||||
/**
|
||||
* Returns the yaw the turtle is facing when it is rendered.
|
||||
*
|
||||
* @param f The subframe fraction.
|
||||
* @return The yaw the turtle is facing.
|
||||
* @see #getVisualPosition(float)
|
||||
*/
|
||||
float getVisualYaw(float f);
|
||||
|
||||
/**
|
||||
* Returns the world direction the turtle is currently facing.
|
||||
*
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
package dan200.computercraft.api.turtle;
|
||||
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import dan200.computercraft.api.upgrades.UpgradeBase;
|
||||
import dan200.computercraft.api.upgrades.UpgradeSerialiser;
|
||||
import dan200.computercraft.impl.ComputerCraftAPIService;
|
||||
@ -65,14 +64,6 @@ import java.util.function.Function;
|
||||
* @see dan200.computercraft.api.client.turtle.TurtleUpgradeModeller
|
||||
*/
|
||||
public interface TurtleUpgradeSerialiser<T extends ITurtleUpgrade> extends UpgradeSerialiser<T> {
|
||||
/**
|
||||
* The ID for the associated registry.
|
||||
*
|
||||
* @deprecated Use {@link #registryId()} instead.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
ResourceKey<Registry<TurtleUpgradeSerialiser<?>>> REGISTRY_ID = ResourceKey.createRegistryKey(new ResourceLocation(ComputerCraftAPI.MOD_ID, "turtle_upgrade_serialiser"));
|
||||
|
||||
/**
|
||||
* The ID for the associated registry.
|
||||
*
|
||||
|
@ -23,7 +23,7 @@ import java.util.Objects;
|
||||
* A {@link TableFormatter} subclass which writes directly to {@linkplain ChatComponent the chat GUI}.
|
||||
* <p>
|
||||
* Each message written gets a special {@link GuiMessageTag}, so we can remove the previous table of the same
|
||||
* {@link TableBuilder#getId() id}.
|
||||
* {@linkplain TableBuilder#getId() id}.
|
||||
*/
|
||||
public class ClientTableFormatter implements TableFormatter {
|
||||
public static final ClientTableFormatter INSTANCE = new ClientTableFormatter();
|
||||
|
@ -15,6 +15,7 @@ import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.narration.NarratedElementType;
|
||||
import net.minecraft.client.gui.narration.NarrationElementOutput;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
@ -81,6 +82,11 @@ public class TerminalWidget extends AbstractWidget {
|
||||
@Override
|
||||
public boolean keyPressed(int key, int scancode, int modifiers) {
|
||||
if (key == GLFW.GLFW_KEY_ESCAPE) return false;
|
||||
if (Screen.isPaste(key)) {
|
||||
paste();
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((modifiers & GLFW.GLFW_MOD_CONTROL) != 0) {
|
||||
switch (key) {
|
||||
case GLFW.GLFW_KEY_T -> {
|
||||
@ -92,13 +98,25 @@ public class TerminalWidget extends AbstractWidget {
|
||||
case GLFW.GLFW_KEY_R -> {
|
||||
if (rebootTimer < 0) rebootTimer = 0;
|
||||
}
|
||||
case GLFW.GLFW_KEY_V -> {
|
||||
// Ctrl+V for paste
|
||||
}
|
||||
}
|
||||
|
||||
if (key >= 0 && terminateTimer < KEY_SUPPRESS_DELAY && rebootTimer < KEY_SUPPRESS_DELAY && shutdownTimer < KEY_SUPPRESS_DELAY) {
|
||||
// Queue the "key" event and add to the down set
|
||||
var repeat = keysDown.get(key);
|
||||
keysDown.set(key);
|
||||
computer.keyDown(key, repeat);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void paste() {
|
||||
var clipboard = Minecraft.getInstance().keyboardHandler.getClipboard();
|
||||
if (clipboard != null) {
|
||||
|
||||
// Clip to the first occurrence of \r or \n
|
||||
var newLineIndex1 = clipboard.indexOf("\r");
|
||||
var newLineIndex2 = clipboard.indexOf("\n");
|
||||
var newLineIndex1 = clipboard.indexOf('\r');
|
||||
var newLineIndex2 = clipboard.indexOf('\n');
|
||||
if (newLineIndex1 >= 0 && newLineIndex2 >= 0) {
|
||||
clipboard = clipboard.substring(0, Math.min(newLineIndex1, newLineIndex2));
|
||||
} else if (newLineIndex1 >= 0) {
|
||||
@ -114,21 +132,6 @@ public class TerminalWidget extends AbstractWidget {
|
||||
if (clipboard.length() > 512) clipboard = clipboard.substring(0, 512);
|
||||
computer.queueEvent("paste", new Object[]{ clipboard });
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (key >= 0 && terminateTimer < KEY_SUPPRESS_DELAY && rebootTimer < KEY_SUPPRESS_DELAY && shutdownTimer < KEY_SUPPRESS_DELAY) {
|
||||
// Queue the "key" event and add to the down set
|
||||
var repeat = keysDown.get(key);
|
||||
keysDown.set(key);
|
||||
computer.keyDown(key, repeat);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,15 +5,11 @@
|
||||
package dan200.computercraft.shared.details;
|
||||
|
||||
import com.google.gson.JsonParseException;
|
||||
import dan200.computercraft.shared.platform.PlatformHelper;
|
||||
import dan200.computercraft.shared.platform.RegistryWrappers;
|
||||
import dan200.computercraft.shared.util.NBTUtil;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.CreativeModeTabs;
|
||||
import net.minecraft.world.item.EnchantedBookItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
@ -46,7 +42,9 @@ public class ItemDetails {
|
||||
}
|
||||
|
||||
data.put("tags", DetailHelpers.getTags(stack.getTags()));
|
||||
data.put("itemGroups", getItemGroups(stack));
|
||||
|
||||
// Include deprecated itemGroups field
|
||||
data.put("itemGroups", List.of());
|
||||
|
||||
var tag = stack.getTag();
|
||||
if (tag != null && tag.contains("display", Tag.TAG_COMPOUND)) {
|
||||
@ -85,25 +83,6 @@ public class ItemDetails {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all item groups an item stack pertains to.
|
||||
*
|
||||
* @param stack Stack to analyse
|
||||
* @return A filled list that contains pairs of item group IDs and their display names.
|
||||
*/
|
||||
private static List<Map<String, Object>> getItemGroups(ItemStack stack) {
|
||||
return CreativeModeTabs.allTabs().stream()
|
||||
.filter(x -> x.shouldDisplay() && x.getType() == CreativeModeTab.Type.CATEGORY && x.contains(stack))
|
||||
.map(group -> {
|
||||
Map<String, Object> groupData = new HashMap<>(2);
|
||||
|
||||
groupData.put("id", PlatformHelper.get().getRegistryKey(Registries.CREATIVE_MODE_TAB, group).toString());
|
||||
groupData.put("displayName", group.getDisplayName().getString());
|
||||
return groupData;
|
||||
})
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all visible enchantments from given stack. Try to follow all tooltip rules : order and visibility.
|
||||
*
|
||||
|
@ -319,7 +319,6 @@ public class TurtleBrain implements TurtleAccessInternal {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getVisualPosition(float f) {
|
||||
var offset = getRenderOffset(f);
|
||||
var pos = owner.getBlockPos();
|
||||
@ -330,7 +329,6 @@ public class TurtleBrain implements TurtleAccessInternal {
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getVisualYaw(float f) {
|
||||
var yaw = getDirection().toYRot();
|
||||
switch (animation) {
|
||||
|
@ -169,7 +169,7 @@ public class TurtlePlaceCommand implements TurtleCommand {
|
||||
if (Math.abs(hitY - 0.5f) < 0.01f) hitY = 0.45f;
|
||||
|
||||
// Check if there's something suitable to place onto
|
||||
var hit = new BlockHitResult(new Vec3(hitX, hitY, hitZ), side, position, false);
|
||||
var hit = new BlockHitResult(new Vec3(position.getX() + hitX, position.getY() + hitY, position.getZ() + hitZ), side, position, false);
|
||||
var context = new UseOnContext(turtlePlayer.player(), InteractionHand.MAIN_HAND, hit);
|
||||
if (!canDeployOnBlock(new BlockPlaceContext(context), turtle, turtlePlayer, position, side, adjacent, outErrorMessage)) {
|
||||
return false;
|
||||
|
@ -1,3 +1,27 @@
|
||||
# New features in CC: Tweaked 1.105.0
|
||||
|
||||
* Optimise JSON string parsing.
|
||||
* Add `colors.fromBlit` (Erb3).
|
||||
* Upload file size limit is now configurable (khankul).
|
||||
* Wired cables no longer have a distance limit.
|
||||
* Java methods now coerce values to strings consistently with Lua.
|
||||
* Add custom timeout support to the HTTP API.
|
||||
* Support custom proxies for HTTP requests (Lemmmy).
|
||||
* The `speaker` program now errors when playing HTTP files.
|
||||
* `edit` now shows an error message when editing read-only files.
|
||||
* Update Ukranian translation (SirEdvin).
|
||||
|
||||
Several bug fixes:
|
||||
* Allow GPS hosts to only be 1 block apart.
|
||||
* Fix "Turn On"/"Turn Off" buttons being inverted in the computer GUI (Erb3).
|
||||
* Fix arrow keys not working in the printout UI.
|
||||
* Several documentation fixes (zyxkad, Lupus590, Commandcracker).
|
||||
* Fix monitor renderer debug text always being visible on Forge.
|
||||
* Fix crash when another mod changes the LoggerContext.
|
||||
* Fix the `monitor_renderer` option not being present in Fabric config files.
|
||||
* Pasting on MacOS/OSX now uses Cmd+V rather than Ctrl+V.
|
||||
* Fix turtles placing blocks upside down when at y<0.
|
||||
|
||||
# New features in CC: Tweaked 1.104.0
|
||||
|
||||
* Update to Minecraft 1.19.4.
|
||||
|
@ -1,31 +1,25 @@
|
||||
New features in CC: Tweaked 1.104.0
|
||||
New features in CC: Tweaked 1.105.0
|
||||
|
||||
* Update to Minecraft 1.19.4.
|
||||
* Turtles can now right click items "into" certain blocks (cauldrons and hives by default, configurable with the `computercraft:turtle_can_use` block tag).
|
||||
* Update Cobalt to 0.7:
|
||||
* `table` methods and `ipairs` now use metamethods.
|
||||
* Type errors now use the `__name` metatag.
|
||||
* Coroutines no longer run on multiple threads.
|
||||
* Timeout errors should be thrown more reliably.
|
||||
* `speaker` program now reports an error on common unsupported audio formats.
|
||||
* `multishell` now hides the implementation details of its terminal redirect from programs.
|
||||
* Use VBO monitor renderer by default.
|
||||
* Improve syntax errors when missing commas in tables, and on trailing commas in parameter lists.
|
||||
* Turtles can now hold flags.
|
||||
* Update several translations (Alessandro, chesiren, Erlend, RomanPlayer22).
|
||||
* Optimise JSON string parsing.
|
||||
* Add `colors.fromBlit` (Erb3).
|
||||
* Upload file size limit is now configurable (khankul).
|
||||
* Wired cables no longer have a distance limit.
|
||||
* Java methods now coerce values to strings consistently with Lua.
|
||||
* Add custom timeout support to the HTTP API.
|
||||
* Support custom proxies for HTTP requests (Lemmmy).
|
||||
* The `speaker` program now errors when playing HTTP files.
|
||||
* `edit` now shows an error message when editing read-only files.
|
||||
* Update Ukranian translation (SirEdvin).
|
||||
|
||||
Several bug fixes:
|
||||
* `settings.load` now ignores malformed values created by editing the `.settings` file by hand.
|
||||
* Fix introduction dates on `os.cancelAlarm` and `os.cancelTimer` (MCJack123).
|
||||
* Fix the REPL syntax reporting crashing on valid parses.
|
||||
* Make writes to the ID file atomic.
|
||||
* Obey stack limits when transferring items with Fabric's APIs.
|
||||
* Ignore metatables in `textutils.serialize`.
|
||||
* Correctly recurse into NBT lists when computing the NBT hash (Lemmmy).
|
||||
* Fix advanced pocket computers rendering as greyscale.
|
||||
* Fix stack overflow when using `shell` as a hashbang program.
|
||||
* Fix websocket messages being empty when using a non-default compression settings.
|
||||
* Fix `gps.locate` returning `nan` when receiving a duplicate location (Wojbie).
|
||||
* Remove several thread safety issues inside Java-side argument parsing code.
|
||||
* Allow GPS hosts to only be 1 block apart.
|
||||
* Fix "Turn On"/"Turn Off" buttons being inverted in the computer GUI (Erb3).
|
||||
* Fix arrow keys not working in the printout UI.
|
||||
* Several documentation fixes (zyxkad, Lupus590, Commandcracker).
|
||||
* Fix monitor renderer debug text always being visible on Forge.
|
||||
* Fix crash when another mod changes the LoggerContext.
|
||||
* Fix the `monitor_renderer` option not being present in Fabric config files.
|
||||
* Pasting on MacOS/OSX now uses Cmd+V rather than Ctrl+V.
|
||||
* Fix turtles placing blocks upside down when at y<0.
|
||||
|
||||
Type "help changelog" to see the full version history.
|
||||
|
@ -254,3 +254,7 @@ publishing {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
modrinth {
|
||||
required.project("fabric-api")
|
||||
}
|
||||
|
@ -96,13 +96,18 @@ public class InventoryMethods implements GenericPeripheral {
|
||||
* <p>
|
||||
* The returned information contains the same information as each item in
|
||||
* {@link #list}, as well as additional details like the display name
|
||||
* (`displayName`), item groups (`itemGroups`), which are the creative tabs
|
||||
* an item will appear under, and item and item durability (`damage`,
|
||||
* `maxDamage`, `durability`).
|
||||
* (`displayName`), and item and item durability (`damage`, `maxDamage`, `durability`).
|
||||
* <p>
|
||||
* Some items include more information (such as enchantments) - it is
|
||||
* recommended to print it out using @{textutils.serialize} or in the Lua
|
||||
* REPL, to explore what is available.
|
||||
* <p>
|
||||
* :::info Deprecated fields
|
||||
* Older versions of CC: Tweaked exposed an {@code itemGroups} field, listing the
|
||||
* creative tabs an item was available under. This information is no longer available on
|
||||
* more recent versions of the game, and so this field will always be empty. Do not use this
|
||||
* field in new code!
|
||||
* :::
|
||||
*
|
||||
* @param inventory The current inventory.
|
||||
* @param slot The slot to get information about.
|
||||
@ -119,10 +124,6 @@ public class InventoryMethods implements GenericPeripheral {
|
||||
* print(("%s (%s)"):format(item.displayName, item.name))
|
||||
* print(("Count: %d/%d"):format(item.count, item.maxCount))
|
||||
*
|
||||
* for _, group in pairs(item.itemGroups) do
|
||||
* print(("Group: %s"):format(group.displayName))
|
||||
* end
|
||||
*
|
||||
* if item.damage then
|
||||
* print(("Damage: %d/%d"):format(item.damage, item.maxDamage))
|
||||
* end
|
||||
|
@ -257,7 +257,6 @@ public class PlatformHelperImpl implements PlatformHelper {
|
||||
return ForgeHooks.getBurnTime(stack, null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CreativeModeTab.Builder newCreativeModeTab() {
|
||||
return CreativeModeTab.builder();
|
||||
|
Loading…
Reference in New Issue
Block a user