All of time and space
This commit is contained in:
parent
f92a65bdb5
commit
f90500fdd4
10 changed files with 52 additions and 16 deletions
|
@ -90,6 +90,9 @@ dependencies {
|
||||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||||
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
|
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
|
||||||
|
|
||||||
|
|
||||||
|
implementation files("/home/andrew71/.local/share/multimc/instances/TardimInControl/.minecraft/mods/tardim-1.1.5.jar")
|
||||||
|
|
||||||
implementation fg.deobf("org.squiddev:cc-tweaked-1.19.1:${cc_version}")
|
implementation fg.deobf("org.squiddev:cc-tweaked-1.19.1:${cc_version}")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,9 @@ import dan200.computercraft.api.peripheral.IPeripheral;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||||
|
|
||||||
|
import com.swdteam.tardim.TardimData;
|
||||||
|
import com.swdteam.tardim.TardimManager;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -72,26 +75,28 @@ public class CCPeripheral implements IPeripheral {
|
||||||
return tileEntity;
|
return tileEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TardimData getTardimData() {
|
||||||
|
return TardimManager.getFromPos(getTileEntity().getPos());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To register functions for our block, wee need to create final methods with the {@link LuaFunction} annotation
|
* To register functions for our block, wee need to create final methods with the {@link LuaFunction} annotation
|
||||||
* This function will send a message to every player on the Server
|
* This function will send a message to every player on the Server
|
||||||
*/
|
*/
|
||||||
@LuaFunction
|
|
||||||
public final void sendMessage(String message) {
|
|
||||||
// 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(In this case a literal text component).
|
|
||||||
player.sendSystemMessage(Component.literal(message));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Because we want to access the world, we need to run this function on the main thread.
|
|
||||||
*/
|
|
||||||
@LuaFunction(mainThread = true)
|
@LuaFunction(mainThread = true)
|
||||||
public final boolean isRaining() {
|
public final double get_fuel() {
|
||||||
return getTileEntity().getLevel().getRainLevel(0) > 0;
|
return getTardimData().getFuel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@LuaFunction(mainThread = true)
|
||||||
|
public final boolean is_locked() {
|
||||||
|
return getTardimData().isLocked();
|
||||||
|
}
|
||||||
|
|
||||||
|
@LuaFunction(mainThread = true)
|
||||||
|
public final void set_locked(boolean locked) {
|
||||||
|
getTardimData().setLocked(locked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,9 @@ public class CCTileEntity extends BlockEntity {
|
||||||
*/
|
*/
|
||||||
protected CCPeripheral peripheral = new CCPeripheral(this);
|
protected CCPeripheral peripheral = new CCPeripheral(this);
|
||||||
private LazyOptional<IPeripheral> peripheralCap;
|
private LazyOptional<IPeripheral> peripheralCap;
|
||||||
|
public BlockPos getPos() {
|
||||||
|
return this.worldPosition;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When a computer modem tries to wrap our block, the modem will call getCapability to receive our peripheral.
|
* When a computer modem tries to wrap our block, the modem will call getCapability to receive our peripheral.
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class Registration {
|
||||||
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, CCtutorial.MODID);
|
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, CCtutorial.MODID);
|
||||||
|
|
||||||
// Blocks
|
// Blocks
|
||||||
public static final RegistryObject<Block> CC_BLOCK = register("tutorial_block", CCBlock::new);
|
public static final RegistryObject<Block> CC_BLOCK = register("digital_tardim_interface", CCBlock::new);
|
||||||
|
|
||||||
private static <T extends Block> RegistryObject<T> register(String name, Supplier<T> block) {
|
private static <T extends Block> RegistryObject<T> register(String name, Supplier<T> block) {
|
||||||
RegistryObject<T> registryObject = BLOCKS.register(name, block);
|
RegistryObject<T> registryObject = BLOCKS.register(name, block);
|
||||||
|
@ -30,7 +30,7 @@ public class Registration {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tile Entities
|
// Tile Entities
|
||||||
public static final RegistryObject<BlockEntityType<CCTileEntity>> CC_TILEENTITY = Registration.BLOCK_ENTITIES.register("tutorial_block", () -> new BlockEntityType<>(CCTileEntity::new, Sets.newHashSet(CC_BLOCK.get()), null));
|
public static final RegistryObject<BlockEntityType<CCTileEntity>> CC_TILEENTITY = Registration.BLOCK_ENTITIES.register("digital_tardim_interface", () -> new BlockEntityType<>(CCTileEntity::new, Sets.newHashSet(CC_BLOCK.get()), null));
|
||||||
|
|
||||||
// Register our stuff
|
// Register our stuff
|
||||||
public static void register() {
|
public static void register() {
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "cctutorial:block/digital_tardim_interface"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
src/main/resources/assets/cctutorial/lang/en_uk.json
Normal file
3
src/main/resources/assets/cctutorial/lang/en_uk.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"block.cctutorial.digital_tardim_interface": "Digital TARDIM Interface"
|
||||||
|
}
|
3
src/main/resources/assets/cctutorial/lang/en_us.json
Normal file
3
src/main/resources/assets/cctutorial/lang/en_us.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"block.cctutorial.digital_tardim_interface": "Digital TARDIM Interface"
|
||||||
|
}
|
3
src/main/resources/assets/cctutorial/lang/rpr.json
Normal file
3
src/main/resources/assets/cctutorial/lang/rpr.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"block.cctutorial.digital_tardim_interface": "Циферный Интерфейсъ Хрономашины"
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "cctutorial:blocks/digital_tardim_interface"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "cctutorial:block/digital_tardim_interface"
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue