This commit is contained in:
Srendi 2022-08-30 13:37:15 +02:00
parent f6acd38cba
commit 0a5688ebf7
6 changed files with 13 additions and 10 deletions

View file

@ -9,6 +9,7 @@ We create a peripheral with two functions:
* sendMessage - a function which will send a message to every player
## Supported Versions
- [1.19](https://github.com/Seniorendi/CCTutorial/tree/1.19)
- [1.18](https://github.com/Seniorendi/CCTutorial/tree/1.18)
- [1.16](https://github.com/Seniorendi/CCTutorial/tree/1.16)

View file

@ -17,7 +17,7 @@ archivesBaseName = 'cctutorial'
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
minecraft {
mappings channel: 'official', version: '1.18.2'
mappings channel: 'official', version: "${mc_version}"
runs {
client {
@ -88,9 +88,9 @@ dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.18.2-40.0.40'
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
implementation fg.deobf("org.squiddev:cc-tweaked-1.18.2:${cc_version}")
implementation fg.deobf("org.squiddev:cc-tweaked-1.19.1:${cc_version}")
}

View file

@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
cc_version=1.100.4
cc_version=1.100.9
mc_version=1.19.2
forge_version=43.1.3

View file

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

View file

@ -3,8 +3,7 @@ package de.srendi.cctutorial.cctutorial;
import dan200.computercraft.api.lua.LuaFunction;
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
import net.minecraft.Util;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.Component;
import net.minecraftforge.server.ServerLifecycleHooks;
import javax.annotation.Nonnull;
@ -82,8 +81,8 @@ public class CCPeripheral implements IPeripheral {
// Used to get the current server and all online players.
ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers().forEach(player -> {
// Now, send the message
// To send a message, we need a Component(We use a TextComponent) and a sender UUID. We just pass an empty uuid in here
player.sendMessage(new TextComponent(message), Util.NIL_UUID);
// To send a message, we need a Component(In this case a literal text component).
player.sendSystemMessage(Component.literal(message));
});
}

View file

@ -18,7 +18,7 @@ public class Registration {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, CCtutorial.MODID);
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, CCtutorial.MODID);
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, CCtutorial.MODID);
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, CCtutorial.MODID);
// Blocks
public static final RegistryObject<Block> CC_BLOCK = register("tutorial_block", CCBlock::new);