1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-14 20:20:30 +00:00

Merge branch 'mc-1.16.x' into mc-1.17.x

This commit is contained in:
Jonathan Coates 2021-11-03 09:34:21 +00:00
commit bca964629a
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
73 changed files with 422 additions and 236 deletions

View File

@ -4,5 +4,5 @@ contact_links:
url: https://discord.computercraft.cc
about: Get help on the ComputerCraft Discord.
- name: GitHub Discussions
url: https://github.com/SquidDev-CC/CC-Tweaked/discussions
url: https://github.com/cc-tweaked/CC-Tweaked/discussions
about: Or ask questions on GitHub Discussions.

View File

@ -13,7 +13,7 @@ chmod 600 "$HOME/.ssh/key"
# And upload
rsync -avc -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" \
"$GITHUB_WORKSPACE/build/docs/lua/" \
"$SSH_USER@$SSH_HOST:/var/www/tweaked.cc/$DEST"
"$SSH_USER@$SSH_HOST:/$DEST"
rsync -avc -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no -p $SSH_PORT" \
"$GITHUB_WORKSPACE/build/docs/javadoc/" \
"$SSH_USER@$SSH_HOST:/var/www/tweaked.cc/$DEST/javadoc"
"$SSH_USER@$SSH_HOST:/$DEST/javadoc"

View File

@ -16,11 +16,11 @@ automatically with GitHub, so please don't submit PRs adding/changing translatio
In order to develop CC: Tweaked, you'll need to download the source code and then run it. This is a pretty simple
process. When building on Windows, Use `gradlew.bat` instead of `./gradlew`.
- **Clone the repository:** `git clone https://github.com/SquidDev-CC/CC-Tweaked.git && cd CC-Tweaked`
- **Clone the repository:** `git clone https://github.com/cc-tweaked/CC-Tweaked.git && cd CC-Tweaked`
- **Setup Forge:** `./gradlew build`
- **Run Minecraft:** `./gradlew runClient` (or run the `GradleStart` class from your IDE).
- **Optionally:** For small PRs (especially those only touching Lua code), it may be easier to use GitPod, which
provides a pre-configured environment: [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-2b2b2b?logo=gitpod)](https://gitpod.io/#https://github.com/SquidDev-CC/CC-Tweaked/)
provides a pre-configured environment: [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-2b2b2b?logo=gitpod)](https://gitpod.io/#https://github.com/cc-tweaked/CC-Tweaked/)
Do note you will need to download the mod after compiling to test.
@ -103,7 +103,7 @@ tests go inside `describe` blocks, and a single test goes inside `it`.
Assertions are generally written using `expect` (inspired by Hamcrest and the like). For instance, `expect(foo):eq("bar")`
asserts that your variable `foo` is equal to the expected value `"bar"`.
[new-issue]: https://github.com/SquidDev-CC/CC-Tweaked/issues/new/choose "Create a new issue"
[new-issue]: https://github.com/cc-tweaked/CC-Tweaked/issues/new/choose "Create a new issue"
[community]: README.md#Community "Get in touch with the community."
[checkstyle]: https://checkstyle.org/
[illuaminate]: https://github.com/SquidDev/illuaminate/ "Illuaminate on GitHub"

View File

@ -1,5 +1,5 @@
# ![CC: Tweaked](doc/logo.png)
[![Current build status](https://github.com/SquidDev-CC/CC-Tweaked/workflows/Build/badge.svg)](https://github.com/SquidDev-CC/CC-Tweaked/actions "Current build status") [![Download CC: Tweaked on CurseForge](http://cf.way2muchnoise.eu/title/cc-tweaked.svg)][CurseForge]
[![Current build status](https://github.com/cc-tweaked/CC-Tweaked/workflows/Build/badge.svg)](https://github.com/cc-tweaked/CC-Tweaked/actions "Current build status") [![Download CC: Tweaked on CurseForge](http://cf.way2muchnoise.eu/title/cc-tweaked.svg)][CurseForge]
CC: Tweaked is a mod for Minecraft which adds programmable computers, turtles and more to the game. A fork of the
much-beloved [ComputerCraft], it continues its legacy with better performance, stability, and a wealth of new features.

View File

@ -493,7 +493,7 @@ curseforge {
project {
id = '282001'
releaseType = isStable ? 'release' : 'alpha'
changelog = "Release notes can be found on the GitHub repository (https://github.com/SquidDev-CC/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
changelog = "Release notes can be found on the GitHub repository (https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
addGameVersion "${mc_version}"
}
@ -511,7 +511,7 @@ tasks.register('publishModrinth', TaskModrinthUpload.class).configure {
uploadFile = jar
versionType = isStable ? 'RELEASE' : 'ALPHA'
addGameVersion(project.mc_version)
changelog = "Release notes can be found on the [GitHub repository](https://github.com/SquidDev-CC/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
changelog = "Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v${mc_version}-${mod_version})."
addLoader('forge')
}
@ -528,21 +528,21 @@ publishing {
pom {
name = 'CC: Tweaked'
description = 'CC: Tweaked is a fork of ComputerCraft, adding programmable computers, turtles and more to Minecraft.'
url = 'https://github.com/SquidDev-CC/CC-Tweaked'
url = 'https://github.com/cc-tweaked/CC-Tweaked'
scm {
url = 'https://github.com/SquidDev-CC/CC-Tweaked.git'
url = 'https://github.com/cc-tweaked/CC-Tweaked.git'
}
issueManagement {
system = 'github'
url = 'https://github.com/SquidDev-CC/CC-Tweaked/issues'
url = 'https://github.com/cc-tweaked/CC-Tweaked/issues'
}
licenses {
license {
name = 'ComputerCraft Public License, Version 1.0'
url = 'https://github.com/SquidDev-CC/CC-Tweaked/blob/mc-1.15.x/LICENSE'
url = 'https://github.com/cc-tweaked/CC-Tweaked/blob/mc-1.15.x/LICENSE'
}
}
@ -567,7 +567,7 @@ publishing {
githubRelease {
token project.hasProperty('githubApiKey') ? project.githubApiKey : ''
owner 'SquidDev-CC'
owner 'cc-tweaked'
repo 'CC-Tweaked'
targetCommitish.set(project.provider({
def cmd = ["git", "rev-parse", "--abbrev-ref", "HEAD"]

View File

@ -43,8 +43,8 @@ If you get stuck, do pop in to the [Minecraft Computer Mod Discord guild][discor
## Get Involved
CC: Tweaked lives on [GitHub]. If you've got any ideas, feedback or bugs please do [create an issue][bug].
[github]: https://github.com/SquidDev-CC/CC-Tweaked/ "CC: Tweaked on GitHub"
[bug]: https://github.com/SquidDev-CC/CC-Tweaked/issues/new/choose
[github]: https://github.com/cc-tweaked/CC-Tweaked/ "CC: Tweaked on GitHub"
[bug]: https://github.com/cc-tweaked/CC-Tweaked/issues/new/choose
[computercraft]: https://github.com/dan200/ComputerCraft "ComputerCraft on GitHub"
[curseforge]: https://minecraft.curseforge.com/projects/cc-tweaked "Download CC: Tweaked from CurseForge"
[modrinth]: https://modrinth.com/mod/gu7yAYhd "Download CC: Tweaked from Modrinth"

Binary file not shown.

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

2
gradlew vendored
View File

@ -72,7 +72,7 @@ case "`uname`" in
Darwin* )
darwin=true
;;
MINGW* )
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )

View File

@ -18,7 +18,7 @@
(title "CC: Tweaked")
(logo src/main/resources/pack.png)
(url https://tweaked.cc/)
(source-link https://github.com/SquidDev-CC/CC-Tweaked/blob/${commit}/${path}#L${line})
(source-link https://github.com/cc-tweaked/CC-Tweaked/blob/${commit}/${path}#L${line})
(styles src/web/styles.css)
(scripts build/rollup/index.js)
@ -71,6 +71,7 @@
:max
_CC_DEFAULT_SETTINGS
_CC_DISABLE_LUA51_FEATURES
_HOST
;; Ideally we'd pick these up from bios.lua, but illuaminate currently
;; isn't smart enough.
sleep write printError read rs)))

View File

@ -21,7 +21,7 @@
"conditions": {
"items": [
{
"tag": "computercraft:computer"
"tag": "computercraft:wired_modem"
}
]
}

View File

@ -6,14 +6,15 @@
"P"
],
"key": {
"#": {
"P": {
"item": "computercraft:pocket_computer_advanced"
},
"P": {
"#": {
"item": "computercraft:speaker"
}
},
"result": {
"item": "computercraft:pocket_computer_advanced"
"item": "computercraft:pocket_computer_advanced",
"nbt": "{Upgrade:\"computercraft:speaker\"}"
}
}

View File

@ -6,14 +6,15 @@
"P"
],
"key": {
"#": {
"P": {
"item": "computercraft:pocket_computer_advanced"
},
"P": {
"#": {
"item": "computercraft:wireless_modem_advanced"
}
},
"result": {
"item": "computercraft:pocket_computer_advanced"
"item": "computercraft:pocket_computer_advanced",
"nbt": "{Upgrade:\"computercraft:wireless_modem_advanced\"}"
}
}

View File

@ -6,14 +6,15 @@
"P"
],
"key": {
"#": {
"P": {
"item": "computercraft:pocket_computer_advanced"
},
"P": {
"#": {
"item": "computercraft:wireless_modem_normal"
}
},
"result": {
"item": "computercraft:pocket_computer_advanced"
"item": "computercraft:pocket_computer_advanced",
"nbt": "{Upgrade:\"computercraft:wireless_modem_normal\"}"
}
}

View File

@ -6,14 +6,15 @@
"P"
],
"key": {
"#": {
"P": {
"item": "computercraft:pocket_computer_normal"
},
"P": {
"#": {
"item": "computercraft:speaker"
}
},
"result": {
"item": "computercraft:pocket_computer_normal"
"item": "computercraft:pocket_computer_normal",
"nbt": "{Upgrade:\"computercraft:speaker\"}"
}
}

View File

@ -6,14 +6,15 @@
"P"
],
"key": {
"#": {
"P": {
"item": "computercraft:pocket_computer_normal"
},
"P": {
"#": {
"item": "computercraft:wireless_modem_advanced"
}
},
"result": {
"item": "computercraft:pocket_computer_normal"
"item": "computercraft:pocket_computer_normal",
"nbt": "{Upgrade:\"computercraft:wireless_modem_advanced\"}"
}
}

View File

@ -6,14 +6,15 @@
"P"
],
"key": {
"#": {
"P": {
"item": "computercraft:pocket_computer_normal"
},
"P": {
"#": {
"item": "computercraft:wireless_modem_normal"
}
},
"result": {
"item": "computercraft:pocket_computer_normal"
"item": "computercraft:pocket_computer_normal",
"nbt": "{Upgrade:\"computercraft:wireless_modem_normal\"}"
}
}

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_advanced"
},
"T": {
"#": {
"item": "computercraft:speaker"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_advanced"
},
"T": {
"#": {
"item": "computercraft:wireless_modem_advanced"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_advanced"
},
"T": {
"#": {
"item": "computercraft:wireless_modem_normal"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_advanced"
},
"T": {
"#": {
"item": "minecraft:crafting_table"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_advanced"
},
"T": {
"#": {
"item": "minecraft:diamond_axe"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_advanced"
},
"T": {
"#": {
"item": "minecraft:diamond_hoe"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_advanced"
},
"T": {
"#": {
"item": "minecraft:diamond_pickaxe"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_advanced"
},
"T": {
"#": {
"item": "minecraft:diamond_shovel"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_advanced"
},
"T": {
"#": {
"item": "minecraft:diamond_sword"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_normal"
},
"T": {
"#": {
"item": "computercraft:speaker"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_normal"
},
"T": {
"#": {
"item": "computercraft:wireless_modem_advanced"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_normal"
},
"T": {
"#": {
"item": "computercraft:wireless_modem_normal"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_normal"
},
"T": {
"#": {
"item": "minecraft:crafting_table"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_normal"
},
"T": {
"#": {
"item": "minecraft:diamond_axe"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_normal"
},
"T": {
"#": {
"item": "minecraft:diamond_hoe"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_normal"
},
"T": {
"#": {
"item": "minecraft:diamond_pickaxe"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_normal"
},
"T": {
"#": {
"item": "minecraft:diamond_shovel"
}
},

View File

@ -5,10 +5,10 @@
"#T"
],
"key": {
"#": {
"T": {
"item": "computercraft:turtle_normal"
},
"T": {
"#": {
"item": "minecraft:diamond_sword"
}
},

View File

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"computercraft:computer_normal",
"computercraft:computer_advanced",
"computercraft:computer_command"
]
}

View File

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"computercraft:monitor_normal",
"computercraft:monitor_advanced"
]
}

View File

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"computercraft:turtle_normal",
"computercraft:turtle_advanced"
]
}

View File

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"#minecraft:leaves",
"minecraft:bamboo",
"minecraft:bamboo_sapling"
]
}

View File

@ -0,0 +1,11 @@
{
"replace": false,
"values": [
"#minecraft:crops",
"minecraft:cactus",
"minecraft:melon",
"minecraft:pumpkin",
"minecraft:carved_pumpkin",
"minecraft:jack_o_lantern"
]
}

View File

@ -0,0 +1,9 @@
{
"replace": false,
"values": [
"minecraft:melon",
"minecraft:pumpkin",
"minecraft:carved_pumpkin",
"minecraft:jack_o_lantern"
]
}

View File

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"#minecraft:wool",
"minecraft:cobweb"
]
}

View File

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"computercraft:cable",
"computercraft:wired_modem_full"
]
}

View File

@ -9,7 +9,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.sounds.AbstractSoundInstance;
import net.minecraft.client.resources.sounds.SoundInstance;
import net.minecraft.client.resources.sounds.TickableSoundInstance;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.phys.Vec3;
@ -21,7 +21,7 @@ public class SoundManager
{
private static final Map<UUID, MoveableSound> sounds = new HashMap<>();
public static void playSound( UUID source, Vec3 position, SoundEvent event, float volume, float pitch )
public static void playSound( UUID source, Vec3 position, ResourceLocation event, float volume, float pitch )
{
var soundManager = Minecraft.getInstance().getSoundManager();
@ -54,7 +54,7 @@ public class SoundManager
private static class MoveableSound extends AbstractSoundInstance implements TickableSoundInstance
{
protected MoveableSound( SoundEvent sound, Vec3 position, float volume, float pitch )
protected MoveableSound( ResourceLocation sound, Vec3 position, float volume, float pitch )
{
super( sound, SoundSource.RECORDS );
setPosition( position );

View File

@ -0,0 +1,63 @@
/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.data;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.shared.Registry;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.tags.BlockTagsProvider;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.common.data.ExistingFileHelper;
import static dan200.computercraft.shared.ComputerCraftTags.Blocks.*;
public class BlockTagsGenerator extends BlockTagsProvider
{
public BlockTagsGenerator( DataGenerator generator, ExistingFileHelper helper )
{
super( generator, ComputerCraft.MOD_ID, helper );
}
@Override
@SuppressWarnings( "unchecked" )
protected void addTags()
{
// Items
tag( COMPUTER ).add(
Registry.ModBlocks.COMPUTER_NORMAL.get(),
Registry.ModBlocks.COMPUTER_ADVANCED.get(),
Registry.ModBlocks.COMPUTER_COMMAND.get()
);
tag( TURTLE ).add( Registry.ModBlocks.TURTLE_NORMAL.get(), Registry.ModBlocks.TURTLE_ADVANCED.get() );
tag( WIRED_MODEM ).add( Registry.ModBlocks.CABLE.get(), Registry.ModBlocks.WIRED_MODEM_FULL.get() );
tag( MONITOR ).add( Registry.ModBlocks.MONITOR_NORMAL.get(), Registry.ModBlocks.MONITOR_ADVANCED.get() );
tag( TURTLE_ALWAYS_BREAKABLE ).addTags( BlockTags.LEAVES ).add(
Blocks.BAMBOO, Blocks.BAMBOO_SAPLING // Bamboo isn't instabreak for some odd reason.
);
tag( TURTLE_SHOVEL_BREAKABLE ).addTag( BlockTags.MINEABLE_WITH_SHOVEL ).add(
Blocks.MELON,
Blocks.PUMPKIN,
Blocks.CARVED_PUMPKIN,
Blocks.JACK_O_LANTERN
);
tag( TURTLE_HOE_BREAKABLE ).addTags(
BlockTags.CROPS,
BlockTags.MINEABLE_WITH_HOE
).add(
Blocks.CACTUS,
Blocks.MELON,
Blocks.PUMPKIN,
Blocks.CARVED_PUMPKIN,
Blocks.JACK_O_LANTERN
);
tag( TURTLE_SWORD_BREAKABLE ).addTags( BlockTags.WOOL ).add( Blocks.COBWEB );
}
}

View File

@ -7,6 +7,7 @@ package dan200.computercraft.data;
import dan200.computercraft.shared.Registry;
import net.minecraft.data.DataGenerator;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
@ -20,9 +21,14 @@ public class Generators
Registry.registerLoot();
DataGenerator generator = event.getGenerator();
generator.addProvider( new Recipes( generator ) );
generator.addProvider( new LootTables( generator ) );
generator.addProvider( new Tags( generator, event.getExistingFileHelper() ) );
generator.addProvider( new BlockModelProvider( generator, event.getExistingFileHelper() ) );
ExistingFileHelper existingFiles = event.getExistingFileHelper();
generator.addProvider( new RecipeGenerator( generator ) );
generator.addProvider( new LootTableGenerator( generator ) );
generator.addProvider( new BlockModelProvider( generator, existingFiles ) );
BlockTagsGenerator blockTags = new BlockTagsGenerator( generator, existingFiles );
generator.addProvider( blockTags );
generator.addProvider( new ItemTagsGenerator( generator, blockTags, existingFiles ) );
}
}

View File

@ -0,0 +1,39 @@
/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.data;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.shared.ComputerCraftTags.Blocks;
import dan200.computercraft.shared.Registry;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraft.tags.ItemTags;
import net.minecraftforge.common.data.ExistingFileHelper;
import static dan200.computercraft.shared.ComputerCraftTags.Items.*;
public class ItemTagsGenerator extends ItemTagsProvider
{
public ItemTagsGenerator( DataGenerator generator, BlockTagsGenerator blockTags, ExistingFileHelper helper )
{
super( generator, blockTags, ComputerCraft.MOD_ID, helper );
}
@Override
protected void addTags()
{
copy( Blocks.COMPUTER, COMPUTER );
copy( Blocks.TURTLE, TURTLE );
tag( WIRED_MODEM ).add( Registry.ModItems.WIRED_MODEM.get(), Registry.ModItems.WIRED_MODEM_FULL.get() );
copy( Blocks.MONITOR, MONITOR );
tag( ItemTags.PIGLIN_LOVED ).add(
Registry.ModItems.COMPUTER_ADVANCED.get(), Registry.ModItems.TURTLE_ADVANCED.get(),
Registry.ModItems.WIRELESS_MODEM_ADVANCED.get(), Registry.ModItems.POCKET_COMPUTER_ADVANCED.get(),
Registry.ModItems.MONITOR_ADVANCED.get()
);
}
}

View File

@ -30,9 +30,9 @@ import net.minecraftforge.fmllegacy.RegistryObject;
import java.util.function.BiConsumer;
public class LootTables extends LootTableProvider
public class LootTableGenerator extends LootTableProvider
{
public LootTables( DataGenerator generator )
public LootTableGenerator( DataGenerator generator )
{
super( generator );
}

View File

@ -6,7 +6,6 @@
package dan200.computercraft.data;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.data.Tags.CCTags;
import dan200.computercraft.shared.PocketUpgrades;
import dan200.computercraft.shared.Registry;
import dan200.computercraft.shared.TurtleUpgrades;
@ -40,9 +39,12 @@ import javax.annotation.Nonnull;
import java.util.Locale;
import java.util.function.Consumer;
public class Recipes extends RecipeProvider
import static dan200.computercraft.shared.ComputerCraftTags.Items.COMPUTER;
import static dan200.computercraft.shared.ComputerCraftTags.Items.WIRED_MODEM;
public class RecipeGenerator extends RecipeProvider
{
public Recipes( DataGenerator generator )
public RecipeGenerator( DataGenerator generator )
{
super( generator );
}
@ -105,8 +107,8 @@ public class Recipes extends RecipeProvider
.shaped( result.getItem() )
.group( String.format( "%s:turtle_%s", ComputerCraft.MOD_ID, nameId ) )
.pattern( "#T" )
.define( '#', base.getItem() )
.define( 'T', upgrade.getCraftingItem().getItem() )
.define( 'T', base.getItem() )
.define( '#', upgrade.getCraftingItem().getItem() )
.unlockedBy( "has_items",
inventoryChange( base.getItem(), upgrade.getCraftingItem().getItem() ) )
.save(
@ -134,14 +136,14 @@ public class Recipes extends RecipeProvider
String nameId = family.name().toLowerCase( Locale.ROOT );
PocketUpgrades.getVanillaUpgrades().forEach( upgrade -> {
ItemStack result = PocketComputerItemFactory.create( -1, null, -1, family, null );
ItemStack result = PocketComputerItemFactory.create( -1, null, -1, family, upgrade );
ShapedRecipeBuilder
.shaped( result.getItem() )
.group( String.format( "%s:pocket_%s", ComputerCraft.MOD_ID, nameId ) )
.pattern( "#" )
.pattern( "P" )
.define( '#', base.getItem() )
.define( 'P', upgrade.getCraftingItem().getItem() )
.define( 'P', base.getItem() )
.define( '#', upgrade.getCraftingItem().getItem() )
.unlockedBy( "has_items",
inventoryChange( base.getItem(), upgrade.getCraftingItem().getItem() ) )
.save(
@ -163,8 +165,8 @@ public class Recipes extends RecipeProvider
.pattern( " # " )
.define( '#', Tags.Items.STONE )
.define( 'R', Tags.Items.DUSTS_REDSTONE )
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.unlockedBy( "has_modem", inventoryChange( CCTags.COMPUTER ) )
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
.unlockedBy( "has_modem", inventoryChange( WIRED_MODEM ) )
.save( add );
ShapedRecipeBuilder
@ -207,7 +209,7 @@ public class Recipes extends RecipeProvider
.pattern( "#R#" )
.define( '#', Tags.Items.STONE )
.define( 'R', Tags.Items.DUSTS_REDSTONE )
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
.save( add );
ShapedRecipeBuilder
@ -217,7 +219,7 @@ public class Recipes extends RecipeProvider
.pattern( "###" )
.define( '#', Tags.Items.STONE )
.define( 'G', Tags.Items.GLASS_PANES )
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
.save( add );
ShapedRecipeBuilder
@ -227,7 +229,7 @@ public class Recipes extends RecipeProvider
.pattern( "###" )
.define( '#', Tags.Items.INGOTS_GOLD )
.define( 'G', Tags.Items.GLASS_PANES )
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
.save( add );
ShapedRecipeBuilder
@ -238,7 +240,7 @@ public class Recipes extends RecipeProvider
.define( '#', Tags.Items.STONE )
.define( 'A', Items.GOLDEN_APPLE )
.define( 'G', Tags.Items.GLASS_PANES )
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
.unlockedBy( "has_apple", inventoryChange( Items.GOLDEN_APPLE ) )
.save( add );
@ -250,7 +252,7 @@ public class Recipes extends RecipeProvider
.define( '#', Tags.Items.INGOTS_GOLD )
.define( 'A', Items.GOLDEN_APPLE )
.define( 'G', Tags.Items.GLASS_PANES )
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
.unlockedBy( "has_apple", inventoryChange( Items.GOLDEN_APPLE ) )
.save( add );
@ -262,7 +264,7 @@ public class Recipes extends RecipeProvider
.define( '#', Tags.Items.STONE )
.define( 'R', Tags.Items.DUSTS_REDSTONE )
.define( 'D', Tags.Items.DYES )
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
.save( add );
ShapedRecipeBuilder
@ -273,7 +275,7 @@ public class Recipes extends RecipeProvider
.define( '#', Tags.Items.STONE )
.define( 'N', Blocks.NOTE_BLOCK )
.define( 'R', Tags.Items.DUSTS_REDSTONE )
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
.save( add );
ShapedRecipeBuilder
@ -283,19 +285,19 @@ public class Recipes extends RecipeProvider
.pattern( "###" )
.define( '#', Tags.Items.STONE )
.define( 'R', Tags.Items.DUSTS_REDSTONE )
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
.unlockedBy( "has_cable", inventoryChange( Registry.ModItems.CABLE.get() ) )
.save( add );
ShapelessRecipeBuilder
.shapeless( Registry.ModBlocks.WIRED_MODEM_FULL.get() )
.requires( Registry.ModItems.WIRED_MODEM.get() )
.unlockedBy( "has_modem", inventoryChange( CCTags.WIRED_MODEM ) )
.unlockedBy( "has_modem", inventoryChange( WIRED_MODEM ) )
.save( add, new ResourceLocation( ComputerCraft.MOD_ID, "wired_modem_full_from" ) );
ShapelessRecipeBuilder
.shapeless( Registry.ModItems.WIRED_MODEM.get() )
.requires( Registry.ModBlocks.WIRED_MODEM_FULL.get() )
.unlockedBy( "has_modem", inventoryChange( CCTags.WIRED_MODEM ) )
.unlockedBy( "has_modem", inventoryChange( WIRED_MODEM ) )
.save( add, new ResourceLocation( ComputerCraft.MOD_ID, "wired_modem_full_to" ) );
ShapedRecipeBuilder
@ -305,7 +307,7 @@ public class Recipes extends RecipeProvider
.pattern( "###" )
.define( '#', Tags.Items.STONE )
.define( 'E', Tags.Items.ENDER_PEARLS )
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
.save( add );
ShapedRecipeBuilder
@ -315,7 +317,7 @@ public class Recipes extends RecipeProvider
.pattern( "###" )
.define( '#', Tags.Items.INGOTS_GOLD )
.define( 'E', Items.ENDER_EYE )
.unlockedBy( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.unlockedBy( "has_computer", inventoryChange( COMPUTER ) )
.unlockedBy( "has_wireless", inventoryChange( Registry.ModBlocks.WIRELESS_MODEM_NORMAL.get() ) )
.save( add );

View File

@ -1,61 +0,0 @@
/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.data;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.shared.Registry;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.tags.BlockTagsProvider;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.world.item.Item;
import net.minecraftforge.common.data.ExistingFileHelper;
import static dan200.computercraft.data.Tags.CCTags.*;
public class Tags extends ItemTagsProvider
{
private static final Tag.Named<Item> PIGLIN_LOVED = ItemTags.PIGLIN_LOVED;
public static class CCTags
{
public static final Tag.Named<Item> COMPUTER = item( "computer" );
public static final Tag.Named<Item> TURTLE = item( "turtle" );
public static final Tag.Named<Item> WIRED_MODEM = item( "wired_modem" );
public static final Tag.Named<Item> MONITOR = item( "monitor" );
}
public Tags( DataGenerator generator, ExistingFileHelper helper )
{
super( generator, new BlockTagsProvider( generator, ComputerCraft.MOD_ID, helper ), ComputerCraft.MOD_ID, helper );
}
@Override
protected void addTags()
{
tag( COMPUTER ).add(
Registry.ModItems.COMPUTER_NORMAL.get(),
Registry.ModItems.COMPUTER_ADVANCED.get(),
Registry.ModItems.COMPUTER_COMMAND.get()
);
tag( TURTLE ).add( Registry.ModItems.TURTLE_NORMAL.get(), Registry.ModItems.TURTLE_ADVANCED.get() );
tag( WIRED_MODEM ).add( Registry.ModItems.WIRED_MODEM.get(), Registry.ModItems.WIRED_MODEM_FULL.get() );
tag( MONITOR ).add( Registry.ModItems.MONITOR_NORMAL.get(), Registry.ModItems.MONITOR_ADVANCED.get() );
tag( PIGLIN_LOVED ).add(
Registry.ModItems.COMPUTER_ADVANCED.get(), Registry.ModItems.TURTLE_ADVANCED.get(),
Registry.ModItems.WIRELESS_MODEM_ADVANCED.get(), Registry.ModItems.POCKET_COMPUTER_ADVANCED.get(),
Registry.ModItems.MONITOR_ADVANCED.get()
);
}
private static Tag.Named<Item> item( String name )
{
return ItemTags.bind( new ResourceLocation( ComputerCraft.MOD_ID, name ).toString() );
}
}

View File

@ -0,0 +1,48 @@
/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.shared;
import dan200.computercraft.ComputerCraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
public class ComputerCraftTags
{
public static class Items
{
public static final Tag.Named<Item> COMPUTER = make( "computer" );
public static final Tag.Named<Item> TURTLE = make( "turtle" );
public static final Tag.Named<Item> WIRED_MODEM = make( "wired_modem" );
public static final Tag.Named<Item> MONITOR = make( "monitor" );
private static Tag.Named<Item> make( String name )
{
return ItemTags.bind( new ResourceLocation( ComputerCraft.MOD_ID, name ).toString() );
}
}
public static class Blocks
{
public static final Tag.Named<Block> COMPUTER = make( "computer" );
public static final Tag.Named<Block> TURTLE = make( "turtle" );
public static final Tag.Named<Block> WIRED_MODEM = make( "wired_modem" );
public static final Tag.Named<Block> MONITOR = make( "monitor" );
public static final Tag.Named<Block> TURTLE_ALWAYS_BREAKABLE = make( "turtle_always_breakable" );
public static final Tag.Named<Block> TURTLE_SHOVEL_BREAKABLE = make( "turtle_shovel_harvestable" );
public static final Tag.Named<Block> TURTLE_SWORD_BREAKABLE = make( "turtle_sword_harvestable" );
public static final Tag.Named<Block> TURTLE_HOE_BREAKABLE = make( "turtle_hoe_harvestable" );
private static Tag.Named<Block> make( String name )
{
return BlockTags.bind( new ResourceLocation( ComputerCraft.MOD_ID, name ).toString() );
}
}
}

View File

@ -341,6 +341,7 @@ public final class Config
ComputerCraft.httpMaxRequests = httpMaxRequests.get();
ComputerCraft.httpMaxWebsockets = httpMaxWebsockets.get();
ComputerCraft.httpDownloadBandwidth = httpDownloadBandwidth.get();
ComputerCraft.httpUploadBandwidth = httpUploadBandwidth.get();
NetworkUtils.reloadConfig();
// Peripheral

View File

@ -9,12 +9,10 @@ import dan200.computercraft.client.SoundManager;
import dan200.computercraft.shared.network.NetworkMessage;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fmllegacy.network.NetworkEvent;
import net.minecraftforge.registries.ForgeRegistries;
import javax.annotation.Nonnull;
import java.util.UUID;
@ -68,7 +66,6 @@ public class SpeakerPlayClientMessage implements NetworkMessage
@OnlyIn( Dist.CLIENT )
public void handle( NetworkEvent.Context context )
{
SoundEvent sound = ForgeRegistries.SOUND_EVENTS.getValue( this.sound );
if( sound != null ) SoundManager.playSound( source, pos, sound, volume, pitch );
SoundManager.playSound( source, pos, sound, volume, pitch );
}
}

View File

@ -35,7 +35,8 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.EnumMap;
import static dan200.computercraft.shared.util.WaterloggableHelpers.*;
import static dan200.computercraft.shared.util.WaterloggableHelpers.WATERLOGGED;
import static dan200.computercraft.shared.util.WaterloggableHelpers.getFluidStateForPlacement;
public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock
{

View File

@ -30,7 +30,8 @@ import net.minecraftforge.fmllegacy.RegistryObject;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static dan200.computercraft.shared.util.WaterloggableHelpers.*;
import static dan200.computercraft.shared.util.WaterloggableHelpers.WATERLOGGED;
import static dan200.computercraft.shared.util.WaterloggableHelpers.getFluidStateForPlacement;
public class BlockWirelessModem extends BlockGeneric implements SimpleWaterloggedBlock
{

View File

@ -47,7 +47,8 @@ import net.minecraftforge.fmllegacy.RegistryObject;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static dan200.computercraft.shared.util.WaterloggableHelpers.*;
import static dan200.computercraft.shared.util.WaterloggableHelpers.WATERLOGGED;
import static dan200.computercraft.shared.util.WaterloggableHelpers.getFluidStateForPlacement;
public class BlockTurtle extends BlockComputerBase<TileTurtle> implements SimpleWaterloggedBlock
{

View File

@ -9,6 +9,7 @@ import dan200.computercraft.api.turtle.ITurtleAccess;
import dan200.computercraft.api.turtle.TurtleCommandResult;
import dan200.computercraft.api.turtle.TurtleSide;
import dan200.computercraft.api.turtle.TurtleVerb;
import dan200.computercraft.shared.ComputerCraftTags;
import dan200.computercraft.shared.turtle.core.TurtlePlaceCommand;
import dan200.computercraft.shared.turtle.core.TurtlePlayer;
import net.minecraft.core.BlockPos;
@ -18,7 +19,6 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import javax.annotation.Nonnull;
@ -40,17 +40,14 @@ public class TurtleHoe extends TurtleTool
}
@Override
protected boolean canBreakBlock( BlockState state, Level world, BlockPos pos, TurtlePlayer player )
protected TurtleCommandResult checkBlockBreakable( BlockState state, Level world, BlockPos pos, TurtlePlayer player )
{
if( !super.canBreakBlock( state, world, pos, player ) ) return false;
TurtleCommandResult result = super.checkBlockBreakable( state, world, pos, player );
if( !result.isSuccess() ) return result;
Material material = state.getMaterial();
return material == Material.PLANT ||
material == Material.CACTUS ||
material == Material.VEGETABLE ||
material == Material.LEAVES ||
material == Material.WATER_PLANT ||
material == Material.REPLACEABLE_PLANT;
return state.is( ComputerCraftTags.Blocks.TURTLE_HOE_BREAKABLE )
|| isTriviallyBreakable( world, pos, state )
? result : INEFFECTIVE;
}
@Nonnull

View File

@ -9,6 +9,7 @@ import dan200.computercraft.api.turtle.ITurtleAccess;
import dan200.computercraft.api.turtle.TurtleCommandResult;
import dan200.computercraft.api.turtle.TurtleSide;
import dan200.computercraft.api.turtle.TurtleVerb;
import dan200.computercraft.shared.ComputerCraftTags;
import dan200.computercraft.shared.turtle.core.TurtlePlaceCommand;
import dan200.computercraft.shared.turtle.core.TurtlePlayer;
import net.minecraft.core.BlockPos;
@ -18,7 +19,6 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import javax.annotation.Nonnull;
@ -40,21 +40,14 @@ public class TurtleShovel extends TurtleTool
}
@Override
protected boolean canBreakBlock( BlockState state, Level world, BlockPos pos, TurtlePlayer player )
protected TurtleCommandResult checkBlockBreakable( BlockState state, Level world, BlockPos pos, TurtlePlayer player )
{
if( !super.canBreakBlock( state, world, pos, player ) ) return false;
TurtleCommandResult result = super.checkBlockBreakable( state, world, pos, player );
if( !result.isSuccess() ) return result;
Material material = state.getMaterial();
return material == Material.DIRT ||
material == Material.SAND ||
material == Material.TOP_SNOW ||
material == Material.CLAY ||
material == Material.SNOW ||
material == Material.PLANT ||
material == Material.CACTUS ||
material == Material.VEGETABLE ||
material == Material.LEAVES ||
material == Material.REPLACEABLE_PLANT;
return state.is( ComputerCraftTags.Blocks.TURTLE_SHOVEL_BREAKABLE )
|| isTriviallyBreakable( world, pos, state )
? result : INEFFECTIVE;
}
@Nonnull

View File

@ -5,6 +5,8 @@
*/
package dan200.computercraft.shared.turtle.upgrades;
import dan200.computercraft.api.turtle.TurtleCommandResult;
import dan200.computercraft.shared.ComputerCraftTags;
import dan200.computercraft.shared.turtle.core.TurtlePlayer;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
@ -12,7 +14,6 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
public class TurtleSword extends TurtleTool
{
@ -32,16 +33,14 @@ public class TurtleSword extends TurtleTool
}
@Override
protected boolean canBreakBlock( BlockState state, Level world, BlockPos pos, TurtlePlayer player )
protected TurtleCommandResult checkBlockBreakable( BlockState state, Level world, BlockPos pos, TurtlePlayer player )
{
if( !super.canBreakBlock( state, world, pos, player ) ) return false;
TurtleCommandResult result = super.checkBlockBreakable( state, world, pos, player );
if( !result.isSuccess() ) return result;
Material material = state.getMaterial();
return material == Material.PLANT ||
material == Material.LEAVES ||
material == Material.REPLACEABLE_PLANT ||
material == Material.WOOL ||
material == Material.WEB;
return state.is( ComputerCraftTags.Blocks.TURTLE_SWORD_BREAKABLE )
|| isTriviallyBreakable( world, pos, state )
? result : INEFFECTIVE;
}
@Override

View File

@ -10,6 +10,7 @@ import com.mojang.math.Transformation;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.api.client.TransformedModel;
import dan200.computercraft.api.turtle.*;
import dan200.computercraft.shared.ComputerCraftTags;
import dan200.computercraft.shared.TurtlePermissions;
import dan200.computercraft.shared.turtle.core.TurtleBrain;
import dan200.computercraft.shared.turtle.core.TurtlePlayer;
@ -27,6 +28,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.decoration.ArmorStand;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
@ -46,6 +48,9 @@ import java.util.function.Function;
public class TurtleTool extends AbstractTurtleUpgrade
{
protected static final TurtleCommandResult UNBREAKABLE = TurtleCommandResult.failure( "Unbreakable block detected" );
protected static final TurtleCommandResult INEFFECTIVE = TurtleCommandResult.failure( "Cannot break block with this tool" );
protected final ItemStack item;
public TurtleTool( ResourceLocation id, String adjective, Item item )
@ -107,13 +112,14 @@ public class TurtleTool extends AbstractTurtleUpgrade
}
}
protected boolean canBreakBlock( BlockState state, Level world, BlockPos pos, TurtlePlayer player )
protected TurtleCommandResult checkBlockBreakable( BlockState state, Level world, BlockPos pos, TurtlePlayer player )
{
Block block = state.getBlock();
return !state.isAir()
&& block != Blocks.BEDROCK
&& state.getDestroyProgress( player, world, pos ) > 0
&& block.canEntityDestroy( state, world, pos, player );
&& block.canEntityDestroy( state, world, pos, player )
? TurtleCommandResult.success() : UNBREAKABLE;
}
protected float getDamageMultiplier()
@ -158,6 +164,7 @@ public class TurtleTool extends AbstractTurtleUpgrade
{
float damage = (float) turtlePlayer.getAttributeValue( Attributes.ATTACK_DAMAGE );
damage *= getDamageMultiplier();
ComputerCraft.log.info( "Dealing {} damage", damage );
if( damage > 0.0f )
{
DamageSource source = DamageSource.playerAttack( turtlePlayer );
@ -224,10 +231,8 @@ public class TurtleTool extends AbstractTurtleUpgrade
}
// Check if we can break the block
if( !canBreakBlock( state, world, blockPosition, turtlePlayer ) )
{
return TurtleCommandResult.failure( "Unbreakable block detected" );
}
TurtleCommandResult breakable = checkBlockBreakable( state, world, blockPosition, turtlePlayer );
if( !breakable.isSuccess() ) return breakable;
// Consume the items the block drops
DropConsumer.set( world, blockPosition, turtleDropConsumer( turtleTile, turtle ) );
@ -281,4 +286,11 @@ public class TurtleTool extends AbstractTurtleUpgrade
} ) );
}
}
protected boolean isTriviallyBreakable( BlockGetter reader, BlockPos pos, BlockState state )
{
return state.is( ComputerCraftTags.Blocks.TURTLE_ALWAYS_BREAKABLE )
// Allow breaking any "instabreak" block.
|| state.getDestroySpeed( reader, pos ) == 0;
}
}

View File

@ -97,6 +97,7 @@ public final class DropConsumer
if( dropEntity == null || drops.getEntity() != dropEntity ) return;
for( ItemEntity drop : drops.getDrops() ) handleDrops( drop.getItem() );
drops.getDrops().clear();
drops.setCanceled( true );
}
}

View File

@ -1,8 +1,8 @@
modLoader="javafml"
loaderVersion="[37,38)"
issueTrackerURL="https://github.com/SquidDev-CC/CC-Tweaked/issues"
displayURL="https://github.com/SquidDev-CC/CC-Tweaked"
issueTrackerURL="https://github.com/cc-tweaked/CC-Tweaked/issues"
displayURL="https://github.com/cc-tweaked/CC-Tweaked"
logoFile="pack.png"
credits="Created by Daniel Ratcliffe (@DanTwoHundred)"

View File

@ -40,7 +40,7 @@
"chat.computercraft.wired_modem.peripheral_connected": "Peripheral \"%s\" connected to network",
"chat.computercraft.wired_modem.peripheral_disconnected": "Peripheral \"%s\" disconnected from network",
"commands.computercraft.synopsis": "Various commands for controlling computers.",
"commands.computercraft.desc": "The /computercraft command provides various debugging and administrator tools for controlling and interacting with computers.",
"commands.computercraft.desc": "The /computercraft command provides various debugging and administrator tools for controlling and interacting with computers.",
"commands.computercraft.help.synopsis": "Provide help for a specific command",
"commands.computercraft.help.desc": "Displays this help message",
"commands.computercraft.help.no_children": "%s has no sub-commands",

View File

@ -116,7 +116,7 @@
"gui.computercraft.tooltip.terminate": "Arrêter le programme en cours d'éxecution",
"gui.computercraft.tooltip.terminate.key": "Tenir Ctrl+T",
"gui.computercraft.upload.overwrite": "Les fichiers seraient écrasés",
"gui.computercraft.upload.overwrite.detail": "Les fichiers suivants seront écrasés lors de l'envoie. Continuer ?%s",
"gui.computercraft.upload.overwrite.detail": "Les fichiers suivants seront écrasés lors de l'envoie. Continuer?%s",
"gui.computercraft.upload.overwrite_button": "Écraser",
"gui.computercraft.upload.success": "Envoie avec succès",
"gui.computercraft.upload.success.msg": "Le fichier %d est envoyé.",
@ -125,7 +125,7 @@
"gui.computercraft.upload.failed.computer_off": "Vous devez allumer cet ordinateur avant d'envoyer ce fichier.",
"gui.computercraft.upload.failed.too_much": "Votre fichier est trop lourd pour être envoyé.",
"gui.computercraft.upload.failed.overwrite_dir": "%s ne peut pas être envoyé, il y a déjà un dossier avec le même nom.",
"gui.computercraft.upload.failed.generic": "Echec de l'envoie des fichiers(%s)",
"gui.computercraft.upload.failed.generic": "Echec de l'envoie des fichiers (%s)",
"commands.computercraft.dump.open_path": "Voir les fichiers de cet ordinateur",
"gui.computercraft.tooltip.turn_on": "Allumer cet ordinateur"
}

View File

@ -127,5 +127,8 @@
"gui.computercraft.upload.failed.generic": "Загрузка файлов не удалась (%s)",
"gui.computercraft.upload.overwrite": "Файлы будут перезаписаны",
"gui.computercraft.upload.overwrite.detail": "При загрузке следующие файлы будут перезаписаны. Продолжить?%s",
"gui.computercraft.upload.overwrite_button": "Перезаписать"
"gui.computercraft.upload.overwrite_button": "Перезаписать",
"gui.computercraft.upload.failed.name_too_long": "Названия файлов слишком длинны для загрузки.",
"gui.computercraft.upload.failed.too_many_files": "Нельзя загрузить столько файлов.",
"gui.computercraft.upload.failed.corrupted": "Файлы повреждены при загрузки. Попробуй снова."
}

View File

@ -1,4 +1,4 @@
Please report bugs at https://github.com/SquidDev-CC/CC-Tweaked. Thanks!
Please report bugs at https://github.com/cc-tweaked/CC-Tweaked. Thanks!
View the documentation at https://tweaked.cc
Show off your programs or ask for help at our forum: https://forums.computercraft.cc
You can disable these messages by running "set motd.enable false".

View File

@ -0,0 +1,4 @@
-- Prints information about CraftOS
term.setTextColor(colors.yellow)
print(os.version() .. " on " .. _HOST)
term.setTextColor(colors.white)

View File

@ -5,6 +5,8 @@ elseif date.month == 12 and date.day == 24 then
print("Merry X-mas!")
elseif date.month == 10 and date.day == 31 then
print("OOoooOOOoooo! Spooky!")
elseif date.month == 4 and date.day == 28 then
print("Ed Balls")
else
local tMotd = {}

View File

@ -1,8 +1,8 @@
local capture = require "test_helpers".capture_program
describe("The motd program", function()
local function setup_date(month, day)
stub(os, "date", function() return { month = month, day = day } end)
local function setup_date(day, month)
stub(os, "date", function() return { day = day, month = month } end)
end
it("displays MOTD", function()
@ -16,20 +16,26 @@ describe("The motd program", function()
:matches { ok = true, output = "Hello World!\n", error = "" }
end)
it("displays date-specific MOTD (1/1)", function()
it("displays date-specific MOTD (1 Jan)", function()
setup_date(1, 1)
expect(capture(stub, "motd"))
:matches { ok = true, output = "Happy new year!\n", error = "" }
end)
it("displays date-specific MOTD (10/31)", function()
setup_date(10, 31)
it("displays date-specific MOTD (28 Apr)", function()
setup_date(28, 4)
expect(capture(stub, "motd"))
:matches { ok = true, output = "Ed Balls\n", error = "" }
end)
it("displays date-specific MOTD (31 Oct)", function()
setup_date(31, 10)
expect(capture(stub, "motd"))
:matches { ok = true, output = "OOoooOOOoooo! Spooky!\n", error = "" }
end)
it("displays date-specific MOTD (12/24)", function()
setup_date(12, 24)
it("displays date-specific MOTD (24 Dec)", function()
setup_date(24, 12)
expect(capture(stub, "motd"))
:matches { ok = true, output = "Merry X-mas!\n", error = "" }
end)

View File

@ -11,7 +11,7 @@ class Computer_Test {
/**
* Ensures redstone signals do not travel through computers.
*
* @see [#548](https://github.com/SquidDev-CC/CC-Tweaked/issues/548)
* @see [#548](https://github.com/cc-tweaked/CC-Tweaked/issues/548)
*/
@GameTest
fun No_through_signal(context: GameTestHelper) = context.sequence {

View File

@ -11,7 +11,7 @@ class Disk_Drive_Test {
/**
* Ensure audio disks exist and we can play them.
*
* @see [#688](https://github.com/SquidDev-CC/CC-Tweaked/issues/688)
* @see [#688](https://github.com/cc-tweaked/CC-Tweaked/issues/688)
*/
@GameTest
fun Audio_disk(helper: GameTestHelper) = helper.sequence { thenComputerOk() }

View File

@ -13,7 +13,7 @@ class Turtle_Test {
/**
* Checks turtles can sheer sheep (and drop items)
*
* @see [#537](https://github.com/SquidDev-CC/CC-Tweaked/issues/537)
* @see [#537](https://github.com/cc-tweaked/CC-Tweaked/issues/537)
*/
@GameTest(timeoutTicks = COMPUTER_TIMEOUT)
fun Shears_sheep(helper: GameTestHelper) = helper.sequence { thenComputerOk() }
@ -21,7 +21,7 @@ class Turtle_Test {
/**
* Checks turtles can place lava.
*
* @see [#518](https://github.com/SquidDev-CC/CC-Tweaked/issues/518)
* @see [#518](https://github.com/cc-tweaked/CC-Tweaked/issues/518)
*/
@GameTest(timeoutTicks = COMPUTER_TIMEOUT)
fun Place_lava(helper: GameTestHelper) = helper.sequence { thenComputerOk() }
@ -29,7 +29,7 @@ class Turtle_Test {
/**
* Checks turtles can place when waterlogged.
*
* @see [#385](https://github.com/SquidDev-CC/CC-Tweaked/issues/385)
* @see [#385](https://github.com/cc-tweaked/CC-Tweaked/issues/385)
*/
@GameTest(timeoutTicks = COMPUTER_TIMEOUT)
fun Place_waterlogged(helper: GameTestHelper) = helper.sequence { thenComputerOk() }
@ -37,7 +37,7 @@ class Turtle_Test {
/**
* Checks turtles can pick up lava
*
* @see [#297](https://github.com/SquidDev-CC/CC-Tweaked/issues/297)
* @see [#297](https://github.com/cc-tweaked/CC-Tweaked/issues/297)
*/
@GameTest(timeoutTicks = COMPUTER_TIMEOUT)
fun Gather_lava(helper: GameTestHelper) = helper.sequence { thenComputerOk() }
@ -45,7 +45,7 @@ class Turtle_Test {
/**
* Checks turtles can hoe dirt.
*
* @see [#258](https://github.com/SquidDev-CC/CC-Tweaked/issues/258)
* @see [#258](https://github.com/cc-tweaked/CC-Tweaked/issues/258)
*/
@GameTest(timeoutTicks = COMPUTER_TIMEOUT)
fun Hoe_dirt(helper: GameTestHelper) = helper.sequence { thenComputerOk() }
@ -53,7 +53,7 @@ class Turtle_Test {
/**
* Checks turtles can place monitors
*
* @see [#691](https://github.com/SquidDev-CC/CC-Tweaked/issues/691)
* @see [#691](https://github.com/cc-tweaked/CC-Tweaked/issues/691)
*/
@GameTest(timeoutTicks = COMPUTER_TIMEOUT)
fun Place_monitor(helper: GameTestHelper) = helper.sequence { thenComputerOk() }

View File

@ -1,8 +1,8 @@
modLoader="javafml"
loaderVersion="[30,)"
issueTrackerURL="https://github.com/SquidDev-CC/CC-Tweaked/issues"
displayURL="https://github.com/SquidDev-CC/CC-Tweaked"
issueTrackerURL="https://github.com/cc-tweaked/CC-Tweaked/issues"
displayURL="https://github.com/cc-tweaked/CC-Tweaked"
logoFile="pack.png"
credits="Created by Daniel Ratcliffe (@DanTwoHundred)"