diff --git a/.gitignore b/.gitignore index 778a722..e498e7d 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ build # other eclipse run +/.idea/ diff --git a/CHANGELOG.txt b/CHANGELOG.txt deleted file mode 100644 index 3afeadc..0000000 --- a/CHANGELOG.txt +++ /dev/null @@ -1,15 +0,0 @@ -Added list-biomes and list-dimensions TARDIM commands + Corresponding ComputerCraft methods - This is a community-requested QOL feature that lets users scroll through available biomes and, - with lua methods, make advanced navigation dashboards even easier. - -Computercraft compatibility improvements - Made ComputerCraft optional - Added peripherals for fuel storage, time rotor and scanner blocks - Added digital interface methods that list biomes and dimensions - -Added Create compatibility - Added various display sources for fuel storage - -Improved TARDIM's fuel system - Any item that can be used as fuel in furnace should now be able to power up a TARDIM - Buckets no longer get destroyed, and only get their fluids taken \ No newline at end of file diff --git a/Common/build.gradle b/Common/build.gradle deleted file mode 100644 index 16f36a0..0000000 --- a/Common/build.gradle +++ /dev/null @@ -1,69 +0,0 @@ -plugins { - id 'java' - id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' - id 'maven-publish' -} - -archivesBaseName = "${mod_name}-common-${minecraft_version}" - -minecraft { - version(minecraft_version) - runs { - if (project.hasProperty('common_runs_enabled') ? project.findProperty('common_runs_enabled').toBoolean() : true) { - - server(project.hasProperty('common_server_run_name') ? project.findProperty('common_server_run_name') : 'vanilla_server') { - workingDirectory(this.file("run")) - } - client(project.hasProperty('common_client_run_name') ? project.findProperty('common_client_run_name') : 'vanilla_client') { - workingDirectory(this.file("run")) - } - } - } -} - -repositories { - maven { - url "https://cursemaven.com" - content { - includeGroup "curse.maven" - } - } -} - -dependencies { - compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5' - implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1' - - // CC: R and TARDIM - //implementation("curse.maven:cc-restitched-462672:3908334") - //compileOnly("org.squiddev:cc-tweaked-1.19.1:${cc_version}") - //compileOnly("curse.maven:tardim-531315:4453925") - //implementation ("org.squiddev:cc-tweaked-1.19.1:${cc_version}") -} - -processResources { - - def buildProps = project.properties.clone() - - filesMatching(['pack.mcmeta']) { - - expand buildProps - } -} - -publishing { - publications { - mavenJava(MavenPublication) { - groupId project.group - artifactId project.archivesBaseName - version project.version - from components.java - } - } - - repositories { - maven { - url "file://" + System.getenv("local_maven") - } - } -} \ No newline at end of file diff --git a/Common/src/main/resources/assets/tardim_ic/blockstates/tardim_dock.json b/Common/src/main/resources/assets/tardim_ic/blockstates/tardim_dock.json deleted file mode 100644 index 8cda046..0000000 --- a/Common/src/main/resources/assets/tardim_ic/blockstates/tardim_dock.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "tardim_ic:block/tardim_dock" - } - } -} \ No newline at end of file diff --git a/Common/src/main/resources/iconCurseForge.png b/Common/src/main/resources/iconCurseForge.png deleted file mode 100644 index dac272e..0000000 Binary files a/Common/src/main/resources/iconCurseForge.png and /dev/null differ diff --git a/Common/src/main/resources/pack.mcmeta b/Common/src/main/resources/pack.mcmeta deleted file mode 100644 index 760e561..0000000 --- a/Common/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "description": "TARDIM: In Control resources", - "pack_format": 6 - } -} diff --git a/Fabric/build.gradle b/Fabric/build.gradle deleted file mode 100644 index 15c4d4b..0000000 --- a/Fabric/build.gradle +++ /dev/null @@ -1,79 +0,0 @@ -plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' - id 'maven-publish' - id 'idea' -} - -archivesBaseName = "${mod_name}-fabric-${minecraft_version}" - -dependencies { - minecraft "com.mojang:minecraft:${minecraft_version}" - mappings loom.officialMojangMappings() - modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" - modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}" - implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1' - implementation project(":Common") - - // Blame CC: Restitched for this... - modApi 'com.electronwill.night-config:core:3.6.3' - modApi 'com.electronwill.night-config:toml:3.6.3' - modApi 'org.squiddev:Cobalt:0.5.5' - modImplementation "io.netty:netty-codec-http:4.1.77.Final" - - modImplementation "curse.maven:tardim-531315:4453924" - //modImplementation "curse.maven:cc-restitched-462672:3908334" - //.. maybe? - modApi "curse.maven:cc-restitched-462672:3908334" - modCompileOnly "curse.maven:cc-restitched-462672:3908334" - - // Create! - modCompileOnly "curse.maven:create-fabric-624165:4537370" -} - -loom { - runs { - client { - client() - setConfigName("Fabric Client") - ideConfigGenerated(true) - runDir("run") - } - server { - server() - setConfigName("Fabric Server") - ideConfigGenerated(true) - runDir("run") - } - } -} - - -processResources { - from project(":Common").sourceSets.main.resources - inputs.property "version", project.version - - filesMatching("fabric.mod.json") { - expand "version": project.version - } -} - -tasks.withType(JavaCompile) { - source(project(":Common").sourceSets.main.allSource) -} - -publishing { - publications { - mavenJava(MavenPublication) { - groupId project.group - artifactId project.archivesBaseName - version project.version - from components.java - } - } - - repositories { - maven { - url "file://" + System.getenv("local_maven") - } - } -} diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/Registration.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/Registration.java deleted file mode 100644 index a4d86bc..0000000 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/Registration.java +++ /dev/null @@ -1,79 +0,0 @@ -package su.a71.tardim_ic.tardim_ic; - -import net.fabricmc.loader.api.FabricLoader; - -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.item.*; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraft.core.Registry; - -import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; -import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; -import net.fabricmc.fabric.api.item.v1.FabricItemSettings; - -import su.a71.tardim_ic.tardim_ic.blocks.food_machine.FoodMachineBlock; -import su.a71.tardim_ic.tardim_ic.blocks.food_machine.FoodMachineTileEntity; -import su.a71.tardim_ic.tardim_ic.jammer.LocationJammerMaterial; -import su.a71.tardim_ic.tardim_ic.blocks.redstone_input.RedstoneInputBlock; -import su.a71.tardim_ic.tardim_ic.blocks.redstone_input.RedstoneInputTileEntity; -import su.a71.tardim_ic.tardim_ic.registration.CommandInit; -import su.a71.tardim_ic.tardim_ic.registration.ComputerCraftCompat; -import su.a71.tardim_ic.tardim_ic.registration.CreateCompat; -import su.a71.tardim_ic.tardim_ic.registration.Exteriors; - -public class Registration { - // Blocks - public static final Block REDSTONE_TARDIM_INPUT = new RedstoneInputBlock(); - public static final Block FOOD_MACHINE = new FoodMachineBlock(); - - // Tile Entities - public static final BlockEntityType REDSTONE_TARDIM_INPUT_TILEENTITY = Registry.register( - Registry.BLOCK_ENTITY_TYPE, - new ResourceLocation("tardim_ic", "redstone_tardim_input"), - FabricBlockEntityTypeBuilder.create(RedstoneInputTileEntity::new, REDSTONE_TARDIM_INPUT).build() - ); - - public static final BlockEntityType FOOD_MACHINE_TILEENTITY = Registry.register( - Registry.BLOCK_ENTITY_TYPE, - new ResourceLocation("tardim_ic", "food_machine"), - FabricBlockEntityTypeBuilder.create(FoodMachineTileEntity::new, FOOD_MACHINE).build() - ); - - public static final CreativeModeTab TARDIM_IC_TAB = FabricItemGroupBuilder - .create(new ResourceLocation("tardim_ic")) - .icon(() -> new ItemStack(REDSTONE_TARDIM_INPUT)) - .build(); - - // Cloister bell - public static final ResourceLocation CLOISTER_SOUND = new ResourceLocation("tardim_ic:cloister"); - public static SoundEvent CLOISTER_SOUND_EVENT = new SoundEvent(CLOISTER_SOUND); - - public static final ArmorMaterial LOCATION_JAMMER_MATERIAL = new LocationJammerMaterial(); - public static final Item LOCATION_JAMMER = new ArmorItem(LOCATION_JAMMER_MATERIAL, EquipmentSlot.CHEST, new Item.Properties().tab(TARDIM_IC_TAB)); - - // Register our stuff - public static void register() { - Registry.register(Registry.ITEM, new ResourceLocation(Constants.MOD_ID, "location_jammer"), LOCATION_JAMMER); - - if (FabricLoader.getInstance().isModLoaded("computercraft")) { - ComputerCraftCompat.register(); // Register ComputerCraft-related features - } - if (FabricLoader.getInstance().isModLoaded("create")) { - CreateCompat.register(); // Register Create-related features - } - Exteriors.register(); // Register custom TARDIM exteriors - - Registry.register(Registry.BLOCK, new ResourceLocation(Constants.MOD_ID, "redstone_tardim_input"), REDSTONE_TARDIM_INPUT); - Registry.register(Registry.ITEM, new ResourceLocation(Constants.MOD_ID, "redstone_tardim_input"), new BlockItem(REDSTONE_TARDIM_INPUT, new FabricItemSettings().tab(TARDIM_IC_TAB))); - - Registry.register(Registry.BLOCK, new ResourceLocation(Constants.MOD_ID, "food_machine"), FOOD_MACHINE); - Registry.register(Registry.ITEM, new ResourceLocation(Constants.MOD_ID, "food_machine"), new BlockItem(FOOD_MACHINE, new FabricItemSettings().tab(TARDIM_IC_TAB))); - - Registry.register(Registry.SOUND_EVENT, CLOISTER_SOUND, CLOISTER_SOUND_EVENT); - - CommandInit.init(); - } -} \ No newline at end of file diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/food_machine/FoodMachineTileEntity.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/food_machine/FoodMachineTileEntity.java deleted file mode 100644 index 98966b8..0000000 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/food_machine/FoodMachineTileEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.blocks.food_machine; - -import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraft.world.level.block.state.BlockState; -import su.a71.tardim_ic.tardim_ic.Registration; - -import java.util.UUID; - -public class FoodMachineTileEntity extends BlockEntity { - public boolean isPowered = false; - public UUID lastPlayer = null; - - public FoodMachineTileEntity(BlockPos pos, BlockState state) { - super(Registration.REDSTONE_TARDIM_INPUT_TILEENTITY, pos, state); - } - - public BlockPos getPos() { - return this.worldPosition; - } - - - @Override - public void saveAdditional(CompoundTag tag) { - tag.putBoolean("is_powered", isPowered); - if (lastPlayer != null) { - tag.putUUID("last_player", lastPlayer); - } - super.saveAdditional(tag); - } - - @Override - public void load(CompoundTag tag) { - super.load(tag); - isPowered = tag.getBoolean("is_powered"); - lastPlayer = tag.getUUID("last_player"); - } -} diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/roundels/roundels.txt b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/roundels/roundels.txt deleted file mode 100644 index 713482e..0000000 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/roundels/roundels.txt +++ /dev/null @@ -1,4 +0,0 @@ -"Base:" - * Quartz - * Deepslate - * Stone? \ No newline at end of file diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/TardimPeripheralProvider.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/TardimPeripheralProvider.java deleted file mode 100644 index 9561de3..0000000 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/TardimPeripheralProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.computercraft_compat; - -import com.swdteam.tardim.common.block.BlockFuelStorage; -import com.swdteam.tardim.common.block.BlockRotor; -import com.swdteam.tardim.common.block.BlockTardimScanner; -import dan200.computercraft.api.peripheral.IPeripheral; -import dan200.computercraft.api.peripheral.IPeripheralProvider; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import org.jetbrains.annotations.NotNull; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.peripherals.FuelStoragePeripheral; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.peripherals.TardimScannerPeripheral; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.peripherals.TimeRotorPeripheral; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.blocks.digital_interface.DigitalInterfaceBlock; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.peripherals.DigitalInterfacePeripheral; - -public class TardimPeripheralProvider implements IPeripheralProvider { - @Override - public IPeripheral getPeripheral(@NotNull Level level, @NotNull BlockPos blockPos, @NotNull Direction direction) { - if (level.isClientSide()) return null; // Please...? - - Block block = level.getBlockState(blockPos).getBlock(); - if (block instanceof DigitalInterfaceBlock) { - return new DigitalInterfacePeripheral(new FakeTardimPeripheralTileEntity(blockPos, level)); - } else if (block instanceof BlockFuelStorage) { - return new FuelStoragePeripheral(new FakeTardimPeripheralTileEntity(blockPos, level)); - } else if (block instanceof BlockRotor) { - return new TimeRotorPeripheral(new FakeTardimPeripheralTileEntity(blockPos, level)); - } else if (block instanceof BlockTardimScanner) { - return new TardimScannerPeripheral(new FakeTardimPeripheralTileEntity(blockPos, level)); - } - - return null; - } -} \ No newline at end of file diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/blocks/digital_interface/DigitalInterfaceTileEntity.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/blocks/digital_interface/DigitalInterfaceTileEntity.java deleted file mode 100644 index d7f39e4..0000000 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/blocks/digital_interface/DigitalInterfaceTileEntity.java +++ /dev/null @@ -1,14 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.computercraft_compat.blocks.digital_interface; - -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; - -import su.a71.tardim_ic.tardim_ic.registration.ComputerCraftCompat; - - -public class DigitalInterfaceTileEntity extends BlockEntity {//implements IDigitalInterfaceEntity { - public DigitalInterfaceTileEntity(BlockPos pos, BlockState state) { - super(ComputerCraftCompat.DIGITAL_TARDIM_INTERFACE_TILEENTITY, pos, state); - } -} diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/create_compat/display_source/fuel_storage/FuelLevelDisplaySource.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/create_compat/display_source/fuel_storage/FuelLevelDisplaySource.java deleted file mode 100644 index 43bc8fc..0000000 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/create_compat/display_source/fuel_storage/FuelLevelDisplaySource.java +++ /dev/null @@ -1,60 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.create_compat.display_source.fuel_storage; - -import com.simibubi.create.content.logistics.block.display.DisplayLinkContext; -import com.simibubi.create.content.logistics.block.display.source.PercentOrProgressBarDisplaySource; -import com.simibubi.create.foundation.gui.ModularGuiLineBuilder; -import com.simibubi.create.foundation.utility.Lang; - -import com.swdteam.tardim.common.init.TRDDimensions; -import com.swdteam.tardim.tardim.TardimData; -import com.swdteam.tardim.tardim.TardimManager; -import com.swdteam.tardim.tileentity.TileEntityFuelStorage; - -import net.minecraft.world.level.block.entity.BlockEntity; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; - -import static su.a71.tardim_ic.tardim_ic.Constants.LOG; - -public class FuelLevelDisplaySource extends PercentOrProgressBarDisplaySource { - @Override - protected Float getProgress(DisplayLinkContext context) { - if (context.level() != context.level().getServer().getLevel(TRDDimensions.TARDIS)) { - return null; - } - BlockEntity te = context.getSourceTE(); - if (!(te instanceof TileEntityFuelStorage fuelStorage)) - return null; - TardimData data = TardimManager.getFromPos(fuelStorage.getBlockPos()); - LOG.info(String.valueOf((float) (data.getFuel()))); - return (float) (data.getFuel() / 100); - } - - @Override - protected boolean progressBarActive(DisplayLinkContext context) { - return context.sourceConfig() - .getInt("Mode") != 0; - } - - @Override - protected String getTranslationKey() { - return "fuel_level"; - } - - @Override - @Environment(EnvType.CLIENT) - public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder, boolean isFirstLine) { - super.initConfigurationWidgets(context, builder, isFirstLine); - if (isFirstLine) - return; - builder.addSelectionScrollInput(0, 120, - (si, l) -> si.forOptions(Lang.translatedOptions("display_source.fuel_level", "percent", "progress_bar")) - .titled(Lang.translateDirect("display_source.fuel_level.display")), - "Mode"); - } - - @Override - protected boolean allowsLabeling(DisplayLinkContext context) { - return true; - } -} diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/create_compat/display_source/fuel_storage/RequiredFuelDisplaySource.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/create_compat/display_source/fuel_storage/RequiredFuelDisplaySource.java deleted file mode 100644 index 056c2a5..0000000 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/create_compat/display_source/fuel_storage/RequiredFuelDisplaySource.java +++ /dev/null @@ -1,54 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.create_compat.display_source.fuel_storage; - -import com.simibubi.create.content.logistics.block.display.DisplayLinkContext; -import com.simibubi.create.content.logistics.block.display.source.NumericSingleLineDisplaySource; -import com.simibubi.create.content.logistics.block.display.target.DisplayTargetStats; -import com.simibubi.create.foundation.utility.Components; - -import com.swdteam.tardim.common.init.TRDDimensions; -import com.swdteam.tardim.tardim.TardimData; -import com.swdteam.tardim.tardim.TardimManager; -import com.swdteam.tardim.tileentity.TileEntityFuelStorage; - -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.phys.Vec3; - -public class RequiredFuelDisplaySource extends NumericSingleLineDisplaySource { - @Override - protected MutableComponent provideLine(DisplayLinkContext displayLinkContext, DisplayTargetStats displayTargetStats) { - if (displayLinkContext.level() != displayLinkContext.level().getServer().getLevel(TRDDimensions.TARDIS)) - return null; - BlockEntity te = displayLinkContext.getSourceTE(); - if (!(te instanceof TileEntityFuelStorage fuelStorage)) - return null; - TardimData data = TardimManager.getFromPos(fuelStorage.getBlockPos()); - - if (data.getTravelLocation() == null) return ZERO.copy(); - - TardimData.Location curr = data.getCurrentLocation(); - TardimData.Location dest = data.getTravelLocation(); - - double fuel = 0.0; - - if (curr.getLevel() != dest.getLevel()) - { - fuel = 10.0; - } - - Vec3 posA = new Vec3(curr.getPos().getX(), curr.getPos().getY(), curr.getPos().getZ()); - Vec3 posB = new Vec3(dest.getPos().getX(), dest.getPos().getY(), dest.getPos().getZ()); - fuel += posA.distanceTo(posB) / 100.0; - if (fuel > 100.0) fuel = 100.0; - - return Components.literal(String.valueOf(fuel)); - } - - protected String getTranslationKey() { - return "required_fuel"; - } - - protected boolean allowsLabeling(DisplayLinkContext context) { - return true; - } -} diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/mixin/JammerMixin.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/mixin/JammerMixin.java deleted file mode 100644 index f32227b..0000000 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/mixin/JammerMixin.java +++ /dev/null @@ -1,35 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.mixin; - -import com.swdteam.tardim.common.command.tardim.CommandLocate; -import com.swdteam.tardim.common.command.tardim.CommandTardimBase; -import com.swdteam.tardim.tardim.TardimData; -import com.swdteam.tardim.tardim.TardimManager; -import dan200.computercraft.api.lua.LuaException; -import net.minecraft.core.BlockPos; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import su.a71.tardim_ic.tardim_ic.registration.CommandInit; - -import static com.swdteam.tardim.common.command.tardim.CommandTardimBase.sendResponse; -import static su.a71.tardim_ic.tardim_ic.Constants.LOG; -import static su.a71.tardim_ic.tardim_ic.Registration.LOCATION_JAMMER; - -@Mixin(value = CommandLocate.class, remap = false) -public class JammerMixin { -// @Inject(method="execute()V", at=@At(value = "INVOKE", target = "Lcom/swdteam/tardim/tardim/TardimData;setTravelLocation(Lcom/swdteam/tardim/tardim/TardimData$Location;)V")) -// public void execute(CallbackInfo ci) { -// LOG.info("test"); -//// for (ItemStack armour : player.getArmorSlots()) { -//// if (armour.is(LOCATION_JAMMER)) { -//// sendResponse(player, "Player's location is jammed", CommandTardimBase.ResponseType.FAIL, source); -//// ci.cancel(); -//// }; -//// } -// } -} diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/ComputerCraftCompat.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/ComputerCraftCompat.java deleted file mode 100644 index 52dc61e..0000000 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/ComputerCraftCompat.java +++ /dev/null @@ -1,36 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.registration; - -import com.swdteam.tardim.common.init.CommandManager; -import dan200.computercraft.api.ComputerCraftAPI; -import net.fabricmc.fabric.api.item.v1.FabricItemSettings; -import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntityType; -import su.a71.tardim_ic.tardim_ic.Constants; -import su.a71.tardim_ic.tardim_ic.Registration; -import su.a71.tardim_ic.tardim_ic.command.CommandModemTransmit; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.TardimPeripheralProvider; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.blocks.digital_interface.DigitalInterfaceBlock; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.blocks.digital_interface.DigitalInterfaceTileEntity; - -public class ComputerCraftCompat { - public static final Block DIGITAL_TARDIM_INTERFACE = new DigitalInterfaceBlock(); - - public static final BlockEntityType DIGITAL_TARDIM_INTERFACE_TILEENTITY = Registry.register( - Registry.BLOCK_ENTITY_TYPE, - new ResourceLocation("tardim_ic", "digital_tardim_interface"), - FabricBlockEntityTypeBuilder.create(DigitalInterfaceTileEntity::new, DIGITAL_TARDIM_INTERFACE).build() - ); - - public static void register() { - Constants.LOG.info("Loaded ComputerCraft compatibility!"); - Registry.register(Registry.BLOCK, new ResourceLocation(Constants.MOD_ID, "digital_tardim_interface"), DIGITAL_TARDIM_INTERFACE); - Registry.register(Registry.ITEM, new ResourceLocation(Constants.MOD_ID, "digital_tardim_interface"), new BlockItem(DIGITAL_TARDIM_INTERFACE, new FabricItemSettings().tab(Registration.TARDIM_IC_TAB))); - - CommandManager.register(new CommandModemTransmit()); - ComputerCraftAPI.registerPeripheralProvider(new TardimPeripheralProvider()); - } -} diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CreateCompat.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CreateCompat.java deleted file mode 100644 index d5d4222..0000000 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CreateCompat.java +++ /dev/null @@ -1,21 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.registration; - -import com.simibubi.create.content.logistics.block.display.AllDisplayBehaviours; -import net.minecraft.resources.ResourceLocation; -import su.a71.tardim_ic.tardim_ic.Constants; -import su.a71.tardim_ic.tardim_ic.create_compat.display_source.fuel_storage.FuelLevelDisplaySource; -import su.a71.tardim_ic.tardim_ic.create_compat.display_source.fuel_storage.RequiredFuelDisplaySource; - -import static com.swdteam.tardim.common.init.TRDTiles.TILE_FUEL_STORAGE; - -public class CreateCompat { - - public static void register() { - Constants.LOG.info("Loaded Create compatibility!"); -// Registry.register(Registry.BLOCK, new ResourceLocation(Constants.MOD_ID, "digital_tardim_interface"), DIGITAL_TARDIM_INTERFACE); -// Registry.register(Registry.ITEM, new ResourceLocation(Constants.MOD_ID, "digital_tardim_interface"), new BlockItem(DIGITAL_TARDIM_INTERFACE, new FabricItemSettings().tab(Registration.TARDIM_IC_TAB))); - - AllDisplayBehaviours.assignTile(AllDisplayBehaviours.register(new ResourceLocation(Constants.MOD_ID, "fuel_storage_display_source"), new FuelLevelDisplaySource()), TILE_FUEL_STORAGE); - AllDisplayBehaviours.assignTile(AllDisplayBehaviours.register(new ResourceLocation(Constants.MOD_ID, "fuel_required_display_source"), new RequiredFuelDisplaySource()), TILE_FUEL_STORAGE); - } -} diff --git a/Fabric/src/main/resources/fabric.mod.json b/Fabric/src/main/resources/fabric.mod.json deleted file mode 100644 index dec8061..0000000 --- a/Fabric/src/main/resources/fabric.mod.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "schemaVersion": 1, - "id": "tardim_ic", - "version": "${version}", - - "name": "Tardim: In Control", - "description": "All of time and space, now automated. Control your TARDIM using ComputerCraft: Tweaked.", - "authors": [ - "Andrew_7_1" - ], - "contact": { - "sources": "https://github.com/Andrew-71/tardim-in-control" - }, - - "license": "MIT", - "icon": "icon.png", - - "environment": "*", - "entrypoints": { - "main": [ - "su.a71.tardim_ic.tardim_ic.TardimInControl" - ] - }, - "mixins": [ - "mixins.tardim_ic.json" - ], - - "depends": { - "fabricloader": ">=0.14.10", - "fabric": "*", - "minecraft": "1.19.x", - "java": ">=17", - "tardim": ">=1.2.2" - }, - - "suggests": { - "computercraft": ">=1.101.0" - } - } - \ No newline at end of file diff --git a/Fabric/src/main/resources/mixins.tardim_ic.json b/Fabric/src/main/resources/mixins.tardim_ic.json deleted file mode 100644 index d945634..0000000 --- a/Fabric/src/main/resources/mixins.tardim_ic.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "required": true, - "package": "su.a71.tardim_ic.tardim_ic.mixin", - "compatibilityLevel": "JAVA_17", - "refmap": "refmap.tardim_ic.json", - "mixins": [ - "BetterFuelMapMixin", - "BetterFuelStorageMixin" - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - }, - "minVersion": "0.8.4" -} \ No newline at end of file diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/Registration.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/Registration.java deleted file mode 100644 index 2f96cd0..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/Registration.java +++ /dev/null @@ -1,65 +0,0 @@ -package su.a71.tardim_ic.tardim_ic; - -import com.google.common.collect.Sets; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; - -import su.a71.tardim_ic.tardim_ic.digital_interface.DigitalInterfaceBlock; -import su.a71.tardim_ic.tardim_ic.digital_interface.DigitalInterfaceTileEntity; -import su.a71.tardim_ic.tardim_ic.redstone_input.RedstoneInputBlock; -import su.a71.tardim_ic.tardim_ic.redstone_input.RedstoneInputTileEntity; -import su.a71.tardim_ic.tardim_ic.registration.CommandInit; - -import java.util.function.Supplier; - -public class Registration { - - public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, TardimInControl.MODID); - public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, TardimInControl.MODID); - public static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, TardimInControl.MODID); - public static final DeferredRegister SOUNDS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, TardimInControl.MODID); - - public static final CreativeModeTab TARDIM_IC_TAB = new CreativeModeTab("tardim_ic") { - @Override - public ItemStack makeIcon() { - return new ItemStack(Registration.DIGITAL_TARDIM_INTERFACE.get()); - } - }; - - // Blocks - private static RegistryObject register(String name, Supplier block) { - RegistryObject registryObject = BLOCKS.register(name, block); - ITEMS.register(name, () -> new BlockItem(registryObject.get(), new Item.Properties().tab(TARDIM_IC_TAB))); - return registryObject; - } - public static final RegistryObject DIGITAL_TARDIM_INTERFACE = register("digital_tardim_interface", DigitalInterfaceBlock::new); - public static final RegistryObject REDSTONE_TARDIM_INPUT = register("redstone_tardim_input", RedstoneInputBlock::new); - - // Tile Entities - public static final RegistryObject> DIGITAL_TARDIM_INTERFACE_TILEENTITY = Registration.BLOCK_ENTITIES.register("digital_tardim_interface", () -> new BlockEntityType<>(DigitalInterfaceTileEntity::new, Sets.newHashSet(DIGITAL_TARDIM_INTERFACE.get()), null)); - public static final RegistryObject> REDSTONE_TARDIM_INPUT_TILEENTITY = Registration.BLOCK_ENTITIES.register("redstone_tardim_input", () -> new BlockEntityType<>(RedstoneInputTileEntity::new, Sets.newHashSet(REDSTONE_TARDIM_INPUT.get()), null)); - - // Cloister bell - public static final RegistryObject CLOISTER_SOUND = SOUNDS.register("cloister", () -> new SoundEvent(new ResourceLocation(TardimInControl.MODID, "cloister"))); - - // Register our stuff - public static void register() { - IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); - BLOCKS.register(modEventBus); - ITEMS.register(modEventBus); - BLOCK_ENTITIES.register(modEventBus); - SOUNDS.register(modEventBus); - } -} \ No newline at end of file diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandCloisterBell.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandCloisterBell.java deleted file mode 100644 index 4bfa48a..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandCloisterBell.java +++ /dev/null @@ -1,59 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.command; - -import com.swdteam.common.command.tardim.CommandTardimBase; -import com.swdteam.common.command.tardim.ICommand; -import com.swdteam.tardim.TardimData; -import com.swdteam.tardim.TardimManager; - -import net.minecraft.core.BlockPos; -import net.minecraft.sounds.SoundSource; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import su.a71.tardim_ic.tardim_ic.Registration; - -public class CommandCloisterBell implements ICommand { - @Override - public void execute(String[] args, Player player, BlockPos pos, CommandTardimBase.CommandSource source) { - if (args.length == 0) { - TardimData data = TardimManager.getFromPos(pos); - if (data != null) { - if (data.hasPermission(player)) { - try { - Level lvl = player.getLevel(); - if (!lvl.isClientSide) { - lvl.playSound( - null, - pos, - Registration.CLOISTER_SOUND.get(), - SoundSource.BLOCKS, - 1.5f, - 1f - ); - } - } catch (Exception var9) { - CommandTardimBase.sendResponse(player, "There was an error", CommandTardimBase.ResponseType.FAIL, source); - } - } else { - CommandTardimBase.sendResponse(player, "You do not have permission", CommandTardimBase.ResponseType.FAIL, source); - } - } - } else { - CommandTardimBase.sendResponse(player, this.getUsage(), CommandTardimBase.ResponseType.FAIL, source); - } - } - - @Override - public String getCommandName() { - return "cloister-bell"; - } - - @Override - public String getUsage() { - return "/cloister-bell"; - } - - @Override - public CommandTardimBase.CommandSource allowedSource() { - return CommandTardimBase.CommandSource.BOTH; - } -} diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListBiomes.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListBiomes.java deleted file mode 100644 index 1455788..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListBiomes.java +++ /dev/null @@ -1,54 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.command; - -import com.swdteam.common.command.tardim.CommandTardimBase; -import com.swdteam.common.command.tardim.ICommand; -import com.swdteam.tardim.TardimData; -import com.swdteam.tardim.TardimManager; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.biome.Biome; - - -public class CommandListBiomes implements ICommand{ - @Override - public void execute(String[] args, Player player, BlockPos pos, CommandTardimBase.CommandSource source) { - ; - if (args.length == 1 || args.length == 0) { - TardimData data = TardimManager.getFromPos(pos); - if (data != null) { - if (data.hasPermission(player)) { - Registry biomeRegistry = player.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); - biomeRegistry.keySet().forEach( - (ResourceLocation res) -> { - String out = res.toString(); - if (args.length == 0 || (args[0].equals(out.split(":")[0]))) { - CommandTardimBase.sendResponse(player, out, CommandTardimBase.ResponseType.INFO, source); - } - } - ); - } else { - CommandTardimBase.sendResponse(player, "You do not have permission", CommandTardimBase.ResponseType.FAIL, source); - } - } - } else { - CommandTardimBase.sendResponse(player, this.getUsage(), CommandTardimBase.ResponseType.FAIL, source); - } - } - - @Override - public String getCommandName() { - return "list-biomes"; - } - - @Override - public String getUsage() { - return "/list-biomes"; - } - - @Override - public CommandTardimBase.CommandSource allowedSource() { - return CommandTardimBase.CommandSource.BOTH; - } -} \ No newline at end of file diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListDimensions.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListDimensions.java deleted file mode 100644 index 2ff16ea..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListDimensions.java +++ /dev/null @@ -1,47 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.command; - -import com.swdteam.common.command.tardim.CommandTardimBase; - -import com.swdteam.common.command.tardim.ICommand; -import com.swdteam.tardim.TardimData; -import com.swdteam.tardim.TardimManager; - -import net.minecraft.core.BlockPos; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.player.Player; - -public class CommandListDimensions implements ICommand{ - @Override - public void execute(String[] args, Player player, BlockPos pos, CommandTardimBase.CommandSource source) { - if (args.length == 0) { - TardimData data = TardimManager.getFromPos(pos); - if (data != null) { - if (data.hasPermission(player)) { - // TODO: Does this really work? - for (ServerLevel serverLevel : player.getLevel().getServer().getAllLevels()) { - CommandTardimBase.sendResponse(player, serverLevel.dimension().location().toString(), CommandTardimBase.ResponseType.INFO, source); - } - } else { - CommandTardimBase.sendResponse(player, "You do not have permission", CommandTardimBase.ResponseType.FAIL, source); - } - } - } else { - CommandTardimBase.sendResponse(player, this.getUsage(), CommandTardimBase.ResponseType.FAIL, source); - } - } - - @Override - public String getCommandName() { - return "list-dimensions"; - } - - @Override - public String getUsage() { - return "/list-dimensions"; - } - - @Override - public CommandTardimBase.CommandSource allowedSource() { - return CommandTardimBase.CommandSource.BOTH; - } -} \ No newline at end of file diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandModemTransmit.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandModemTransmit.java deleted file mode 100644 index 9e95ffc..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandModemTransmit.java +++ /dev/null @@ -1,69 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.command; - -// This will be added whenever I manage to convince TARDIM devs to make CommandManager.register public -// 13.04.23 ITS ALIVE - -import com.swdteam.common.command.tardim.CommandTardimBase; -import com.swdteam.common.command.tardim.ICommand; -import com.swdteam.tardim.TardimData; -import com.swdteam.tardim.TardimManager; - -import net.minecraft.core.BlockPos; -import net.minecraft.world.entity.player.Player; - -import dan200.computercraft.api.network.Packet; -import dan200.computercraft.api.ComputerCraftAPI; - -public class CommandModemTransmit implements ICommand { - @Override - public void execute(String[] args, Player player, BlockPos pos, CommandTardimBase.CommandSource source) { - if (args.length == 3) { // TODO: 3 or 4??? - TardimData data = TardimManager.getFromPos(pos); - if (data != null) { - if (data.hasPermission(player)) { - try { - int sendChannel = Integer.parseInt(args[0]); - int replyChannel = Integer.parseInt(args[1]); - String message = args[2]; - boolean allDimensions = Boolean.parseBoolean(args[3]) || args[3].equals("true"); - - if (data.getTravelLocation() == null) { - data.setTravelLocation(new TardimData.Location(data.getCurrentLocation())); - } - - if (allDimensions) - { - ComputerCraftAPI.getWirelessNetwork().transmitInterdimensional(new Packet(sendChannel, replyChannel, message, new CommandSender(player, data.getTravelLocation().getPos()))); - } - else { - ComputerCraftAPI.getWirelessNetwork().transmitSameDimension(new Packet(sendChannel, replyChannel, message, - new CommandSender(player, data.getTravelLocation().getPos())), 300); - } - CommandTardimBase.sendResponse(player, "Sent modem message", CommandTardimBase.ResponseType.COMPLETE, source); - } catch (Exception var9) { - CommandTardimBase.sendResponse(player, "Invalid coordinates", CommandTardimBase.ResponseType.FAIL, source); - } - } else { - CommandTardimBase.sendResponse(player, "You do not have permission", CommandTardimBase.ResponseType.FAIL, source); - } - } - } else { - CommandTardimBase.sendResponse(player, this.getUsage(), CommandTardimBase.ResponseType.FAIL, source); - } - } - - @Override - public String getCommandName() { - return "cc-modem-transmit"; - } - - @Override - public String getUsage() { - return "/cc-modem-transmit "; - } - - @Override - public CommandTardimBase.CommandSource allowedSource() { - return CommandTardimBase.CommandSource.BOTH; - } -} \ No newline at end of file diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandSender.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandSender.java deleted file mode 100644 index aec340f..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandSender.java +++ /dev/null @@ -1,40 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.command; - -import dan200.computercraft.api.network.IPacketSender; -import net.minecraft.core.BlockPos; -import net.minecraft.resources.ResourceKey; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.Vec3; -import org.jetbrains.annotations.NotNull; - -public class CommandSender implements IPacketSender { - - private final Player player; - private final Level level; - private final BlockPos pos; - - CommandSender(Player player, BlockPos pos) { - this.player = player; - this.level = player.level; - this.pos = pos; - } - - @NotNull - @Override - public Level getLevel() { - return this.level; - } - - @NotNull - @Override - public Vec3 getPosition() { - return new Vec3(this.pos.getX(), this.pos.getY(), this.pos.getZ()); - } - - @NotNull - @Override - public String getSenderID() { - return this.player.getName().getString(); - } -} diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfaceBlock.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfaceBlock.java deleted file mode 100644 index 284345f..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfaceBlock.java +++ /dev/null @@ -1,27 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.digital_interface; - -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.EntityBlock; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; -import org.jetbrains.annotations.NotNull; - -import su.a71.tardim_ic.tardim_ic.Registration; - -import javax.annotation.Nullable; - - -public class DigitalInterfaceBlock extends Block implements EntityBlock { - - public DigitalInterfaceBlock() { - super(Properties.of(Material.METAL).strength(2, 4).noOcclusion()); - } - - @Nullable - @Override - public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) { - return Registration.DIGITAL_TARDIM_INTERFACE_TILEENTITY.get().create(pos, state); - } -} diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfacePeripheral.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfacePeripheral.java deleted file mode 100644 index 7df5118..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfacePeripheral.java +++ /dev/null @@ -1,887 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.digital_interface; - -import com.mojang.datafixers.util.Pair; -import com.swdteam.common.command.tardim.CommandTardimBase; -import com.swdteam.common.command.tardim.CommandTravel; -import com.swdteam.common.data.DimensionMapReloadListener; -import com.swdteam.common.init.TRDSounds; -import com.swdteam.common.init.TardimRegistry; -import com.swdteam.common.item.ItemTardim; -import com.swdteam.main.Tardim; -import com.swdteam.tardim.TardimData; -import com.swdteam.tardim.TardimData.Location; -import com.swdteam.tardim.TardimManager; - -import dan200.computercraft.api.lua.LuaException; -import dan200.computercraft.api.lua.LuaFunction; -import dan200.computercraft.api.lua.ObjectLuaTable; -import dan200.computercraft.api.peripheral.IComputerAccess; -import dan200.computercraft.api.peripheral.IPeripheral; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.players.PlayerList; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundSource; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.levelgen.Heightmap; -import net.minecraft.world.phys.Vec3; -import net.minecraftforge.client.DimensionSpecialEffectsManager; -import su.a71.tardim_ic.tardim_ic.Registration; -import su.a71.tardim_ic.tardim_ic.utils.FakePlayer; - -import net.minecraftforge.registries.ForgeRegistries; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.*; - - -public class DigitalInterfacePeripheral implements IPeripheral { - - private final List connectedComputers = new ArrayList<>(); // List of computers connected to the peripheral - private final IDigitalInterfaceEntity tileEntity; // Peripheral's BlockEntity, used for accessing coordinates - /** - * @param tileEntity the tile entity of this peripheral - * @hidden - */ - public DigitalInterfacePeripheral(IDigitalInterfaceEntity tileEntity) { - this.tileEntity = tileEntity; - } - - /** Setting name for the peripheral. A computer will see it as "digital_tardim_interface_n" - * @hidden - */ - @Nonnull - @Override - public String getType() { return "digital_tardim_interface"; } - - /** Apparently CC uses this to check if the peripheral in front of a modem is this one - * @hidden - * @param iPeripheral The peripheral to compare against. This may be {@code null}. - * @return {@code true} if the peripheral is the same as this one. - */ - @Override - public boolean equals(@Nullable IPeripheral iPeripheral) { return this == iPeripheral; } - - /** Called when a computer disconnects from the peripheral - * @hidden - * @param computer The interface to the computer that is being detached. Remember that multiple computers can be - * attached to a peripheral at once. - */ - @Override - public void detach(@Nonnull IComputerAccess computer) { connectedComputers.remove(computer); } - - /** Called when a computer connects to the peripheral - * @hidden - * @param computer The interface to the computer that is being attached. Remember that multiple computers can be - * attached to a peripheral at once. - */ - @Override - public void attach(@Nonnull IComputerAccess computer) { connectedComputers.add(computer); } - - /** - * I *think* I use this to get peripheral's world position - * @hidden - * @return - */ - public IDigitalInterfaceEntity getTileEntity() { - return tileEntity; - } - - /** - * Get TARDIM's data, which we need for *every* function - *

- * We can't do a simple - * TardimManager.getFromPos(getTileEntity().getPos()) - *

- * because if someone attempts to call a method outside a TARDIM, this would create a new TARDIM/Point to the one with ID of 0 (Due to the way TardimSaveHandler.loadTardisData works). - * Which is obviously not what we want. - *

- * So instead we use this, and get the ability to give user a LuaException if they think that fiddling with time is funny - * This is mostly a copy of getIDForXZ function with some added checks - * - * @return TardimData of the TARDIM that the peripheral is in - * @hidden - */ - public TardimData getTardimDataInitial() { - int X = getTileEntity().getPos().getX(), Z = getTileEntity().getPos().getZ(); - - int index = 0; - int x = 0; - int y = 0; - int dx = 0; - int dy = 1; - int segment_length = 1; - int segment_passed = 0; - boolean found = false; - long timecheck = System.currentTimeMillis(); - - while(true) { - if (System.currentTimeMillis() - timecheck > 10000L) { - System.out.println("Finding ID from XZ Coordinates is taking too long!"); - break; - } - - if (X >= x * TardimManager.INTERIOR_BOUNDS - && X <= TardimManager.INTERIOR_BOUNDS + x * TardimManager.INTERIOR_BOUNDS - && Z >= y * TardimManager.INTERIOR_BOUNDS - && Z <= TardimManager.INTERIOR_BOUNDS + y * TardimManager.INTERIOR_BOUNDS) { - found = true; - break; - } - - x += dx; - y += dy; - if (++segment_passed == segment_length) { - segment_passed = 0; - int buffer = dy; - dy = -dx; - dx = buffer; - if (buffer == 0) { - ++segment_length; - } - } - - ++index; - } - - // We really don't want to access a ghost TARDIM, do we? - // If we fail checks here are not inside a TARDIM - if (!found) { - return null; - } - TardimData T = TardimManager.getTardim(index); - if (T.getCurrentLocation() == null || T.getOwnerName() == null) { - return null; - } - - return T; - } - - public TardimData getTardimData() throws LuaException { - TardimData data = this.getTileEntity().getTardim(); - if (data == null || data.getCurrentLocation() == null || data.getOwnerName() == null) { - throw new LuaException("Peripheral is not inside a TARDIM"); - } - return data; - } - - // Peripheral methods =============================================================== - - /** - * Return how much fuel is left in the TARDIM - * - * @return Fuel left (Out of 100) - */ - @LuaFunction(mainThread = true) - public final double getFuel() throws LuaException { - return getTardimData().getFuel(); - } - - /** - * Get how much fuel it would take to travel to the destination - * @return Amount of fuel needed (Out of 100) - */ - @LuaFunction(mainThread = true) - public final double calculateFuelForJourney() throws LuaException { - TardimData data = getTardimData(); - - if (data.getTravelLocation() == null) return 0; - - Location curr = data.getCurrentLocation(); - Location dest = data.getTravelLocation(); - - double fuel = 0.0; - - if (curr.getLevel() != dest.getLevel()) - { - fuel = 10.0; - } - - Vec3 posA = new Vec3(curr.getPos().getX(), curr.getPos().getY(), curr.getPos().getZ()); - Vec3 posB = new Vec3(dest.getPos().getX(), dest.getPos().getY(), dest.getPos().getZ()); - fuel += posA.distanceTo(posB) / 100.0; - if (fuel > 100.0) fuel = 100.0; - - return fuel; - } - - /** - * Check whether the TARDIM is locked - * @return true if locked, false if not - */ - @LuaFunction(mainThread = true) - public final boolean isLocked() throws LuaException { - return getTardimData().isLocked(); - } - - /** - * Check whether the TARDIM is in flight - * @return true if in flight, false if not - */ - @LuaFunction(mainThread = true) - public final boolean isInFlight() throws LuaException { return getTardimData().isInFlight(); } - - /** - * Supposedly gets UNIX timestamp of when we entered flight - * @return UNIX timestamp if in flight, -1 if not - */ - @LuaFunction(mainThread = true) - public final long getTimeEnteredFlight() throws LuaException { - TardimData data = getTardimData(); - if (!data.isInFlight()) { - return -1; - } - return data.getTimeEnteredFlight(); - } - - /** - * Get username of the TARDIM's owner - * @return String of the owner's username - */ - @LuaFunction(mainThread = true) - public final String getOwnerName() throws LuaException { - TardimData data = getTardimData(); - return data.getOwnerName(); - } - - /** - * Lock/unlock the TARDIM - * @param locked true to lock, false to unlock - */ - @LuaFunction(mainThread = true) - public final void setLocked(boolean locked) throws LuaException { - getTardimData().setLocked(locked); - } - - /** - * Get the current location of the TARDIM - * @return ObjectLuaTable of the current location with the following keys: - *

    - *
  • dimension - String of the dimension
  • - *
  • pos - table with the keys x, y, z that hold numbers
  • - *
  • facing - String of the facing
  • - *
- */ - @LuaFunction(mainThread = true) - public final ObjectLuaTable getCurrentLocation() throws LuaException { - Location loc = getTardimData().getCurrentLocation(); - return new ObjectLuaTable(Map.of( - "dimension", loc.getLevel().location().toString(), - "pos", new ObjectLuaTable(Map.of( - "x", loc.getPos().getX(), - "y", loc.getPos().getY(), - "z", loc.getPos().getZ() - )), - "facing", loc.getFacing().toString() - )); - } - - /** - * Get the current location of the TARDIM - * @return if there is no destination returns null. - *

- * Otherwise, ObjectLuaTable of the current location with the following keys: - *

    - *
  • dimension - String of the dimension
  • - *
  • pos - table with the keys x, y, z that hold numbers
  • - *
  • facing - String of the facing
  • - *
- */ - @LuaFunction(mainThread = true) - public final ObjectLuaTable getTravelLocation() throws LuaException { - TardimData data = getTardimData(); - if (data.getTravelLocation() == null) { - data.setTravelLocation(data.getCurrentLocation()); - } - Location loc = data.getTravelLocation(); - return new ObjectLuaTable(Map.of( - "dimension", loc.getLevel().location().toString(), - "pos", new ObjectLuaTable(Map.of( - "x", loc.getPos().getX(), - "y", loc.getPos().getY(), - "z", loc.getPos().getZ() - )), - "facing", loc.getFacing().toString() - )); - } - - /** - * Get list of the TARDIM owner's companions - * @return ObjectLuaTable containing the usernames of the companions - */ - @LuaFunction(mainThread = true) - public final ObjectLuaTable getCompanions() throws LuaException { - TardimData data = getTardimData(); - Map companions = new HashMap<>(); - for (int i = 0; i < data.getCompanions().size(); i++) { - companions.put(i + 1, data.getCompanions().get(i).getUsername()); - } - return new ObjectLuaTable(companions); - } - - - /** - * Set dimension for the TARDIM to travel to - *

- * This is a serious hazard right now due to the fact that I am unable to check if the dimension is valid. - *

- * TODO: If invalid dimension is given, the TARDIM is unable to land until the dimension is changed. Add proper checks. - * @param dimension String of the dimension e.g. "minecraft:overworld" - */ - @LuaFunction(mainThread = true) - public final void setDimension(String dimension) throws LuaException { - TardimData data = getTardimData(); - - String key = dimension; - dimension = DimensionMapReloadListener.toTitleCase(dimension); - if (TardimManager.DIMENSION_MAP.containsKey(dimension)) { - key = (String)TardimManager.DIMENSION_MAP.get(dimension); - } else { - dimension = dimension.toLowerCase(); - } - - if (!CommandTravel.isValidPath(key)) { - throw new LuaException("Invalid dimension"); - } else { - ResourceKey dim = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(dimension)); - if (data.getTravelLocation() == null) { - data.setTravelLocation(new Location(data.getCurrentLocation())); - } - - data.getTravelLocation().setLocation(dim); - } - } - - /** - * Set the destination's coordinates - * @param x X coordinate - * @param y Y coordinate - * @param z Z coordinate - */ - @LuaFunction(mainThread = true) - public final void setTravelLocation(int x, int y, int z) throws LuaException { - TardimData data = getTardimData(); - if (data.getTravelLocation() == null) { - data.setTravelLocation(new Location(data.getCurrentLocation())); - } - - data.getTravelLocation().setPosition(x, y, z); - } - - - /** - * Set destination to the TARDIM's owner's home (Must be online) - */ - @LuaFunction(mainThread = true) - public final void home() throws LuaException { - if (this.tileEntity.getLevel().isClientSide()) { - return; - } - TardimData data = getTardimData(); - - UUID uuid = data.getOwner(); - String username = data.getOwnerName(); - if (uuid == null || username == null) { - throw new LuaException("TARDIM has no owner"); - } - - PlayerList playerList = this.tileEntity.getLevel().getServer().getPlayerList(); - ServerPlayer player = playerList.getPlayer(uuid); - if (player == null) { - throw new LuaException("TARDIM owner is not online"); - } - - ResourceKey dim = player.getRespawnDimension(); - BlockPos pos = player.getRespawnPosition(); - if (pos == null) { - throw new LuaException("TARDIM owner has no home"); - } - - setDimension(dim.location().toString()); - setTravelLocation(pos.getX(), pos.getY(), pos.getZ()); - } - - /** - * Set destination for a player's location (Player must be online) - * @param username - String of the username of the player - */ - @LuaFunction(mainThread = true) - public final void locatePlayer(String username) throws LuaException { - if (this.tileEntity.getLevel().isClientSide()) { - return; - } - - PlayerList playerList = this.tileEntity.getLevel().getServer().getPlayerList(); - - ServerPlayer player = playerList.getPlayerByName(username); - if (player == null) { - throw new LuaException("Player not found"); - } - - ResourceKey dim = player.getCommandSenderWorld().dimension(); - BlockPos pos = player.blockPosition(); - - setDimension(dim.location().toString()); - setTravelLocation(pos.getX(), pos.getY(), pos.getZ()); - } - - /** - * Get online players. Useful for making a GUI for the locate function or just a nice dashboard. - * - * @return ObjectLuaTable of the online players - */ - @LuaFunction(mainThread = true) - public final ObjectLuaTable getOnlinePlayers() throws LuaException { - if (this.tileEntity.getLevel().isClientSide()) { - return null; - } - - PlayerList playerList = this.tileEntity.getLevel().getServer().getPlayerList(); - Map players = new HashMap<>(); - for (int i = 0; i < playerList.getPlayers().size(); i++) { - players.put(i + 1, playerList.getPlayers().get(i).getGameProfile().getName()); - } - - return new ObjectLuaTable(players); - } - - /** - * Get the rotation of the TARDIM's door - * @return String of the door rotation ("north", "south", "east", "west") - */ - @LuaFunction(mainThread = true) - public final String getDoorRotation() throws LuaException { - TardimData data = getTardimData(); - Direction rotation = data.getTravelLocation().getFacing(); - switch (rotation) { - case NORTH -> { - return "north"; - } - case EAST -> { - return "east"; - } - case SOUTH -> { - return "south"; - } - case WEST -> { - return "west"; - } - default -> { - throw new LuaException("Invalid door rotation"); - } - } - } - - /** - * Set the rotation of the TARDIM's door - * @param rotation String of the door rotation ("north", "south", "east", "west") - */ - @LuaFunction(mainThread = true) - public final void setDoorRotation(String rotation) throws LuaException { - TardimData data = getTardimData(); - switch (rotation) { - case "north" -> data.getTravelLocation().setFacing(Direction.NORTH); - case "east" -> data.getTravelLocation().setFacing(Direction.EAST); - case "south" -> data.getTravelLocation().setFacing(Direction.SOUTH); - case "west" -> data.getTravelLocation().setFacing(Direction.WEST); - default -> throw new LuaException("Invalid door rotation"); - } - - data.save(); - } - - /** - * Toggle the rotation of the TARDIM's door (north -> east -> south -> west -> north) - */ - @LuaFunction(mainThread = true) - public final void toggleDoorRotation() throws LuaException { - TardimData data = getTardimData(); - if (data.getTravelLocation() == null) { - data.setTravelLocation(new Location(data.getCurrentLocation())); - } - - if (data.getTravelLocation().getFacing() == null) { - data.getTravelLocation().setFacing(Direction.NORTH); - } - - switch (data.getTravelLocation().getFacing()) { - case NORTH -> data.getTravelLocation().setFacing(Direction.EAST); - case EAST -> data.getTravelLocation().setFacing(Direction.SOUTH); - case SOUTH -> data.getTravelLocation().setFacing(Direction.WEST); - case WEST -> data.getTravelLocation().setFacing(Direction.NORTH); - default -> data.getTravelLocation().setFacing(Direction.NORTH); - } - - data.save(); - } - - /** - * Add a number to the destination's coordinates - * @param axis String of the axis ("x", "y", "z") - * @param amount Number to add to the axis - */ - @LuaFunction(mainThread = true) - public final void coordAdd(String axis, int amount) throws LuaException { - TardimData data = getTardimData(); - if (data.getTravelLocation() == null) { - data.setTravelLocation(new Location(data.getCurrentLocation())); - } - - Location location = data.getTravelLocation(); - switch (axis) { - case "x" -> location.addPosition(amount, 0, 0); - case "y" -> location.addPosition(0, amount, 0); - case "z" -> location.addPosition(0, 0, amount); - default -> throw new LuaException("Invalid axis"); - } - } - - /** - * Dematerialize the TARDIM - */ - @LuaFunction(mainThread = true) - public final void demat() throws LuaException { - if (this.tileEntity.getLevel().isClientSide()) { - return; - } - - TardimData data = getTardimData(); - - if (data.isInFlight()) { - throw new LuaException("TARDIM is already in flight"); - } - Location loc = data.getCurrentLocation(); - ServerLevel level = this.tileEntity.getLevel().getServer().getLevel(loc.getLevel()); - ItemTardim.destroyTardim(level, loc.getPos(), Direction.NORTH); - data.setInFlight(true); - if (data.getTravelLocation() == null) { - data.setTravelLocation(new Location(data.getCurrentLocation())); - } - - // TODO: This is a horrendous way of doing this. Please fix. - String level_str = "tardim:tardis_dimension"; - this.tileEntity.getLevel().getServer().getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(level_str))).playSound(null, this.tileEntity.getPos(), (SoundEvent) TRDSounds.TARDIM_TAKEOFF.get(), SoundSource.AMBIENT, 1.0F, 1.0F); - - data.save(); - } - - /** - * Materialize the TARDIM at the destination - *

- * Has a LOT of checks to make sure the TARDIM can materialize, so please implement error handling if you use this. - */ - @LuaFunction(mainThread = true) - public final void remat() throws LuaException { - if (this.tileEntity.getLevel().isClientSide()) { - return; - } - - TardimData data = getTardimData(); - - if (data.isInFlight()) { - if (data.getTimeEnteredFlight() < System.currentTimeMillis() / 1000L - 10L) { - Location loc = data.getTravelLocation(); - ServerLevel level = this.tileEntity.getLevel().getServer().getLevel(loc.getLevel()); - double fuel = data.calculateFuelForJourney( - this.tileEntity.getLevel().getServer().getLevel(data.getCurrentLocation().getLevel()), level, data.getCurrentLocation().getPos(), loc.getPos() - ); - if (data.getFuel() >= fuel) { - level.getChunk(loc.getPos()); - BlockPos landingPosButBetter = CommandTravel.getLandingPosition(level, loc.getPos()); - boolean recalc = false; - - for(int jj = 0; jj < 32; ++jj) { - if (!Block.canSupportRigidBlock(level, landingPosButBetter.below())) { - BlockPos pos2 = landingPosButBetter.offset( - level.random.nextInt(10) * (level.random.nextBoolean() ? 1 : -1), - 0, - level.random.nextInt(10) * (level.random.nextBoolean() ? 1 : -1) - ); - landingPosButBetter = CommandTravel.getLandingPosition(level, pos2); - if (Block.canSupportRigidBlock(level, landingPosButBetter.below())) { - recalc = true; - break; - } - } - } - - if (!recalc) { - for(int jj = 0; jj < 32; ++jj) { - if (!Block.canSupportRigidBlock(level, landingPosButBetter.below())) { - BlockPos pos2 = landingPosButBetter.offset( - level.random.nextInt(30) * (level.random.nextBoolean() ? 1 : -1), - 0, - level.random.nextInt(30) * (level.random.nextBoolean() ? 1 : -1) - ); - landingPosButBetter = CommandTravel.getLandingPosition(level, pos2); - if (Block.canSupportRigidBlock(level, landingPosButBetter.below())) { - recalc = true; - break; - } - } - } - } - - if (!recalc) { - for(int jj = 0; jj < 32; ++jj) { - if (!Block.canSupportRigidBlock(level, landingPosButBetter.below())) { - BlockPos pos2 = landingPosButBetter.offset( - level.random.nextInt(50) * (level.random.nextBoolean() ? 1 : -1), - 0, - level.random.nextInt(50) * (level.random.nextBoolean() ? 1 : -1) - ); - landingPosButBetter = CommandTravel.getLandingPosition(level, pos2); - if (Block.canSupportRigidBlock(level, landingPosButBetter.below())) { - recalc = true; - break; - } - } - } - } - - if (Block.canSupportRigidBlock(level, landingPosButBetter.below())) { - loc.setPosition(landingPosButBetter.getX(), landingPosButBetter.getY(), landingPosButBetter.getZ()); - if (Tardim.isPosValid(level, loc.getPos())) { - TardimRegistry.TardimBuilder builder = TardimRegistry.getTardimBuilder(data.getTardimID()); - builder.buildTardim(level, loc.getPos(), data.getTravelLocation().getFacing(), data.getId()); - data.setCurrentLocation(data.getTravelLocation()); - data.setTravelLocation(null); - data.setInFlight(false); - data.addFuel(-fuel); - data.save(); - -// if (!recalc) { -// sendResponse(player, "TARDIM is landing", CommandTardimBase.ResponseType.COMPLETE, source); -// } else { -// sendResponse(player, "Landing recalculated due to obstruction", CommandTardimBase.ResponseType.INFO, source); -// sendResponse(player, "TARDIM is landing", CommandTardimBase.ResponseType.COMPLETE, source); -// } - - String level_str = "tardim:tardis_dimension"; - this.tileEntity.getLevel().getServer().getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(level_str))).playSound(null, this.tileEntity.getPos(), (SoundEvent) TRDSounds.TARDIM_LANDING.get(), SoundSource.AMBIENT, 1.0F, 1.0F); - - } else { - throw new LuaException("TARDIM landing obstructed. Aborting..."); - } - } else { - throw new LuaException("TARDIM landing obstructed. Aborting..."); - } - } else { - throw new LuaException("Not enough fuel for journey"); - } - } else { - throw new LuaException("TARDIM is still taking off"); - } - } else { - throw new LuaException("TARDIM has already landed"); - } - } - - /** - * Locate a biome - * @param biome_str String of the biome e.g. "minecraft:plains" - */ - @LuaFunction(mainThread = true) - public final void locateBiome(String biome_str) throws LuaException { - if (this.tileEntity.getLevel().isClientSide()) { - return; - } - - TardimData data = getTardimData(); - if (data.getTravelLocation() == null) { - data.setTravelLocation(new Location(data.getCurrentLocation())); - } - - Optional biome = this.tileEntity.getLevel().getServer() - .registryAccess() - .registryOrThrow(Registry.BIOME_REGISTRY) - .getOptional(new ResourceLocation(biome_str)); - if (biome != null && biome.isPresent()) { - if (data.getTravelLocation() == null) { - data.setTravelLocation(new Location(data.getCurrentLocation())); - } - - ServerLevel level = this.tileEntity.getLevel().getServer().getLevel(data.getTravelLocation().getLevel()); - BlockPos blockpos = new BlockPos( - data.getTravelLocation().getPos().getX(), - level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, data.getTravelLocation().getPos()).getY(), - data.getTravelLocation().getPos().getZ() - ); - BlockPos blockpos1 = this.findNearestBiome(level, (Biome)biome.get(), blockpos, 6400, 8); - if (blockpos1 != null) { - data.getTravelLocation().setPosition(blockpos1.getX(), blockpos1.getY(), blockpos1.getZ()); - data.save(); - } else { - throw new LuaException("Biome not found"); - } - } else { - throw new LuaException("Unknown biome"); - } - } - - /** - * Helper method to find a biome - * @param level ServerLevel to search - * @param biome Biome to find - * @param pos BlockPos to start from - * @param i Idk what this is, likely a radius - * @param j No idea about this either - * @return BlockPos of the biome - * @hidden - */ - public BlockPos findNearestBiome(ServerLevel level, Biome biome, BlockPos pos, int i, int j) { - Pair> bb = level.getChunkSource() - .getGenerator() - .getBiomeSource() - .findBiomeHorizontal( - pos.getX(), - pos.getY(), - pos.getZ(), - i, - j, - b_val -> b_val.value() == biome, - level.random, - true, - level.getChunkSource().randomState().sampler() - ); - return bb != null && bb.getFirst() != null ? (BlockPos)bb.getFirst() : null; - } - - /** - * Set the skin of the TARDIM - * @param skin Skin name to change to - * @hidden - */ - @LuaFunction(mainThread = true) - public final void setSkin(String skin) throws LuaException { - if (this.tileEntity.getLevel().isClientSide()) { - return; - } - - TardimData data = getTardimData(); - - ResourceLocation skinToApply = null; - Iterator var13 = TardimRegistry.getRegistry().keySet().iterator(); - - label39: { - ResourceLocation builder; - TardimRegistry.TardimBuilder b; - do { - if (!var13.hasNext()) { - break label39; - } - - builder = (ResourceLocation)var13.next(); - b = TardimRegistry.getTardimBuilder(builder); - } while(!b.getDisplayName().equalsIgnoreCase(skin) && !builder.toString().equalsIgnoreCase(skin)); - - skinToApply = builder; - } - - if (skinToApply == null) { - throw new LuaException("Skin '" + skin + "' not found"); - } - - TardimData.Location loc = data.getCurrentLocation(); - ServerLevel level = this.tileEntity.getLevel().getServer().getLevel(loc.getLevel()); - data.setIdentifier(skinToApply); - - // FakePlayer... - TardimRegistry.getTardimBuilder(skinToApply).changeTardimSkin(data, level, loc.getPos(), loc.getFacing(), new FakePlayer(this.tileEntity.getLevel(), this.tileEntity.getPos())); - } - - /** - * Get all available TARDIM skins. Useful for making a GUI skin selection. - * - * @return ObjectLuaTable of the available skins - */ - @LuaFunction(mainThread = true) - public final ObjectLuaTable getSkins() throws LuaException { - if (this.tileEntity.getLevel().isClientSide()) { - return null; - } - - Map skins = new HashMap<>(); - - Iterator var5 = TardimRegistry.getRegistry().keySet().iterator(); - int i = 0; - while(var5.hasNext()) { - ResourceLocation builder = (ResourceLocation)var5.next(); - TardimRegistry.TardimBuilder b = TardimRegistry.getTardimBuilder(builder); - skins.put(i + 1, b.getDisplayName()); - i++; - } - - return new ObjectLuaTable(skins); - } - - /** - * Play cloister bell sound. - */ - @LuaFunction(mainThread = true) - public final void cloisterBell() throws LuaException { - if (this.tileEntity.getLevel().isClientSide()) { - return; - } - try { - Level lvl = this.tileEntity.getLevel(); - if (!lvl.isClientSide) { - lvl.playSound( - null, - this.tileEntity.getPos(), - Registration.CLOISTER_SOUND.get(), - SoundSource.BLOCKS, - 1.5f, - 1f - ); - } - } catch (Exception var9) { - throw new LuaException("There was an error trying to play the sound"); - } - } - - /** - * Get a table with all registered biomes' names. - * Useful for creating advanced navigation systems. - * @return ObjectLuaTable with all biomes' technical names - */ - @LuaFunction(mainThread = true) - public final ObjectLuaTable getBiomes() throws LuaException { - Map biomes = new HashMap<>(); - Registry biomeRegistry = tileEntity.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); - Iterator biome_it = biomeRegistry.keySet().iterator(); - int i = 0; - while (biome_it.hasNext()) { - biomes.put(i + 1, biome_it.next().toString()); - i++; - } - - return new ObjectLuaTable(biomes); - } - - /** - * Get a table with all registered dimensions' names. - * Useful for creating advanced navigation systems. - * @return ObjectLuaTable with all dimensions' technical names - */ - @LuaFunction(mainThread = true) - public final ObjectLuaTable getDimensions() throws LuaException { - Iterator dim_it = this.tileEntity.getLevel().getServer().getAllLevels().iterator(); // TODO: Does this really work? - Map dimensions = new HashMap<>(); - int i = 0; - while (dim_it.hasNext()) { - dimensions.put(i + 1, dim_it.next().dimension().location().toString()); - i++; - } - return new ObjectLuaTable(dimensions); - } -} diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfaceTileEntity.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfaceTileEntity.java deleted file mode 100644 index d03667d..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfaceTileEntity.java +++ /dev/null @@ -1,118 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.digital_interface; - -import com.swdteam.tardim.TardimData; -import com.swdteam.tardim.TardimManager; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; - -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.util.LazyOptional; - -import org.jetbrains.annotations.NotNull; -import su.a71.tardim_ic.tardim_ic.Registration; - -import dan200.computercraft.api.peripheral.IPeripheral; -import static dan200.computercraft.shared.Capabilities.CAPABILITY_PERIPHERAL; - -public class DigitalInterfaceTileEntity extends BlockEntity implements IDigitalInterfaceEntity { - public TardimData data; // Our TARDIM - - public DigitalInterfaceTileEntity(BlockPos pos, BlockState state) { - super(Registration.DIGITAL_TARDIM_INTERFACE_TILEENTITY.get(), pos, state); - this.data = getTardimDataInitial(); - } - - /** - * Our peripheral, we create a new peripheral for each new tile entity - */ - protected DigitalInterfacePeripheral peripheral = new DigitalInterfacePeripheral(this); - private LazyOptional peripheralCap; - public BlockPos getPos() { - return this.worldPosition; - } - - @Override - public TardimData getTardim() { - return this.data; - } - - /** - * When a computer modem tries to wrap our block, the modem will call getCapability to receive our peripheral. - * Then we just simply return a {@link LazyOptional} with our Peripheral - */ - @Override - @NotNull - public LazyOptional getCapability(@NotNull Capability cap, Direction direction) { - if (cap == CAPABILITY_PERIPHERAL) { - if (peripheralCap == null) { - peripheralCap = LazyOptional.of(() -> peripheral); - } - return peripheralCap.cast(); - } - return super.getCapability(cap, direction); - } - - public TardimData getTardimDataInitial() { - int X = this.getPos().getX(), Z = this.getPos().getZ(); - - int index = 0; - int x = 0; - int y = 0; - int dx = 0; - int dy = 1; - int segment_length = 1; - int segment_passed = 0; - boolean found = false; - long timecheck = System.currentTimeMillis(); - - while(true) { - if (System.currentTimeMillis() - timecheck > 10000L) { - System.out.println("Finding ID from XZ Coordinates is taking too long!"); - break; - } - - if (X >= x * TardimManager.INTERIOR_BOUNDS - && X <= TardimManager.INTERIOR_BOUNDS + x * TardimManager.INTERIOR_BOUNDS - && Z >= y * TardimManager.INTERIOR_BOUNDS - && Z <= TardimManager.INTERIOR_BOUNDS + y * TardimManager.INTERIOR_BOUNDS) { - found = true; - break; - } - - x += dx; - y += dy; - if (++segment_passed == segment_length) { - segment_passed = 0; - int buffer = dy; - dy = -dx; - dx = buffer; - if (buffer == 0) { - ++segment_length; - } - } - - ++index; - } - - // We really don't want to access a ghost TARDIM, do we? - // If we fail checks here are not inside a TARDIM - if (!found) { - return null; - } - TardimData T = TardimManager.getTardim(index); - if (T.getCurrentLocation() == null || T.getOwnerName() == null) { - return null; - } - - return T; - } - - @Override - public void load(CompoundTag tag) { - super.load(tag); - this.data = getTardimDataInitial(); - } -} diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/FakeDigitalInterfaceTileEntity.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/FakeDigitalInterfaceTileEntity.java deleted file mode 100644 index df5fe94..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/FakeDigitalInterfaceTileEntity.java +++ /dev/null @@ -1,89 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.digital_interface; - -import com.swdteam.tardim.TardimData; -import com.swdteam.tardim.TardimManager; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.Level; - -public class FakeDigitalInterfaceTileEntity implements IDigitalInterfaceEntity { - public BlockPos blockPos; - public Level level; - public TardimData data; // Our TARDIM - - - FakeDigitalInterfaceTileEntity(BlockPos in_block, Level in_level) { - this.blockPos = in_block; - this.level = in_level; - this.data = getTardimDataInitial(); - } - - @Override - public BlockPos getPos() { - return this.blockPos; - } - - @Override - public Level getLevel() { - return this.level; - } - - @Override - public TardimData getTardim() { - return this.data; - } - - public TardimData getTardimDataInitial() { - int X = this.getPos().getX(), Z = this.getPos().getZ(); - - int index = 0; - int x = 0; - int y = 0; - int dx = 0; - int dy = 1; - int segment_length = 1; - int segment_passed = 0; - boolean found = false; - long timecheck = System.currentTimeMillis(); - - while(true) { - if (System.currentTimeMillis() - timecheck > 10000L) { - System.out.println("Finding ID from XZ Coordinates is taking too long!"); - break; - } - - if (X >= x * TardimManager.INTERIOR_BOUNDS - && X <= TardimManager.INTERIOR_BOUNDS + x * TardimManager.INTERIOR_BOUNDS - && Z >= y * TardimManager.INTERIOR_BOUNDS - && Z <= TardimManager.INTERIOR_BOUNDS + y * TardimManager.INTERIOR_BOUNDS) { - found = true; - break; - } - - x += dx; - y += dy; - if (++segment_passed == segment_length) { - segment_passed = 0; - int buffer = dy; - dy = -dx; - dx = buffer; - if (buffer == 0) { - ++segment_length; - } - } - - ++index; - } - - // We really don't want to access a ghost TARDIM, do we? - // If we fail checks here are not inside a TARDIM - if (!found) { - return null; - } - TardimData T = TardimManager.getTardim(index); - if (T.getCurrentLocation() == null || T.getOwnerName() == null) { - return null; - } - - return T; - } -} diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/IDigitalInterfaceEntity.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/IDigitalInterfaceEntity.java deleted file mode 100644 index ccbb39c..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/IDigitalInterfaceEntity.java +++ /dev/null @@ -1,12 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.digital_interface; - -import com.swdteam.tardim.TardimData; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.Level; - -public interface IDigitalInterfaceEntity { - public BlockPos getPos(); - public Level getLevel(); - - public TardimData getTardim(); -} diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/redstone_input/RedstoneInputTileEntity.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/redstone_input/RedstoneInputTileEntity.java deleted file mode 100644 index 06f4303..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/redstone_input/RedstoneInputTileEntity.java +++ /dev/null @@ -1,41 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.redstone_input; - -import com.swdteam.tileentity.TileEntityBaseTardimPanel; - -import net.minecraft.core.BlockPos; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.level.block.state.BlockState; -import su.a71.tardim_ic.tardim_ic.Registration; - -import java.util.UUID; - - -public class RedstoneInputTileEntity extends TileEntityBaseTardimPanel { - public boolean isPowered = false; - public UUID lastPlayer = null; - - public RedstoneInputTileEntity(BlockPos pos, BlockState state) { - super(Registration.REDSTONE_TARDIM_INPUT_TILEENTITY.get(), pos, state); - } - - public BlockPos getPos() { - return this.worldPosition; - } - - - @Override - public void saveAdditional(CompoundTag tag) { - tag.putBoolean("is_powered", isPowered); - if (lastPlayer != null) { - tag.putUUID("last_player", lastPlayer); - } - super.saveAdditional(tag); - } - - @Override - public void load(CompoundTag tag) { - super.load(tag); - isPowered = tag.getBoolean("is_powered"); - lastPlayer = tag.getUUID("last_player"); - } -} \ No newline at end of file diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CommandInit.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CommandInit.java deleted file mode 100644 index 20be2d0..0000000 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CommandInit.java +++ /dev/null @@ -1,17 +0,0 @@ -package su.a71.tardim_ic.tardim_ic.registration; - - -import su.a71.tardim_ic.tardim_ic.command.CommandListBiomes; -import su.a71.tardim_ic.tardim_ic.command.CommandListDimensions; -import su.a71.tardim_ic.tardim_ic.command.CommandModemTransmit; -import su.a71.tardim_ic.tardim_ic.command.CommandCloisterBell; -import com.swdteam.common.init.CommandManager; - -public class CommandInit { - public static void init() { - CommandManager.register(new CommandModemTransmit()); - CommandManager.register(new CommandCloisterBell()); - CommandManager.register(new CommandListBiomes()); - CommandManager.register(new CommandListDimensions()); - } -} diff --git a/Forge/src/main/resources/META-INF/mods.toml b/Forge/src/main/resources/META-INF/mods.toml deleted file mode 100644 index e94d668..0000000 --- a/Forge/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,48 +0,0 @@ - -modLoader = "javafml" #mandatory -loaderVersion="[43,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. -license = "MIT" -[[mods]] #mandatory -# The modid of the mod -modId = "tardim_ic" #mandatory -version = "1.1" #mandatory -# A display name for the mod -displayName = "TARDIM: In Control" #mandatory -# The description text for the mod (multi line!) (#mandatory) -description = ''' - All of time and space, now automated. Control your TARDIM using ComputerCraft: Tweaked. -''' -logoFile = "icon.png" -authors = "Andrew_7_1" -# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. -[[dependencies.tardim_ic]] #optional -# the modid of the dependency -modId = "forge" #mandatory -# Does this dependency have to exist - if not, ordering below must be specified -mandatory = true #mandatory -# The version range of the dependency -versionRange="[43,)" #mandatory -# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory -ordering = "NONE" -# Side this dependency is applied on - BOTH, CLIENT or SERVER -side = "BOTH" -# Here's another dependency -[[dependencies.tardim_ic]] -modId = "computercraft" -mandatory = true -versionRange = "1.95.3" -ordering = "NONE" -side = "BOTH" -[[dependencies.tardim_ic]] -modId = "tardim" -mandatory = true -versionRange = "1.2.2" -ordering = "AFTER" -side = "BOTH" -[[dependencies.tardim_ic]] -modId = "minecraft" -mandatory = true -# This version range declares a minimum of the current minecraft version up to but not including the next major version -versionRange = "1.19.2" -ordering = "NONE" -side = "BOTH" \ No newline at end of file diff --git a/Forge/src/main/resources/mixins.tardim_ic.json b/Forge/src/main/resources/mixins.tardim_ic.json deleted file mode 100644 index 68e23e1..0000000 --- a/Forge/src/main/resources/mixins.tardim_ic.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "required": true, - "package": "su.a71.tardim_ic.tardim_ic.mixin", - "compatibilityLevel": "JAVA_17", - "refmap": "refmap.tardim_ic.json", - "mixins": [ - "Commands" - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - }, - "minVersion": "0.8.4" -} \ No newline at end of file diff --git a/README.md b/README.md index 9da4025..dd2b6a3 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,49 @@ -# TARDIM: In Control ![Modrinth Downloads](https://img.shields.io/modrinth/dt/tardim-in-control?color=00AF5C&label=modrinth&style=flat&logo=modrinth) -### All of time and space, *now automated*. +![TARDIM: IC Banner](https://cdn.modrinth.com/data/xsv4H3pa/images/561e86895ec0b73d8fcbfb8bb83d4cc92b15734d.png) +### All of time and space, *now automated and improved*. -![Example dashboard](https://cdn.modrinth.com/data/xsv4H3pa/images/a6726a966b6ceb6cbfa81d4886b26375ee500854.png) +This mod is an addon for the [TARDIM mod](https://www.curseforge.com/minecraft/mc-mods/tardim), +and adds a way to control and manage your time (but mostly space) machine with new blocks, redstone, +and even other mods like [ComputerCraft: Tweaked](https://tweaked.cc) or [Create](https://github.com/Creators-of-Create/Create) -This mod is an addon for the [TARDIM mod](https://www.curseforge.com/minecraft/mc-mods/tardim), and adds a way to control your time (but mostly space) machine with [ComputerCraft: Tweaked](https://tweaked.cc) computers and redstone using new blocks and peripherals. - -### Features: -* Digital TARDIM interface: ComputerCraft peripheral that lets you control a TARDIM using computers! Full list of methods is available in the [Javadoc](http://andrey71.me/TARDIM-ic-docs/su/a71/tardim_ic/tardim_ic/DigitalInterfacePeripheral.html) (Sorry for that, this is the best auto-generated docs I could find for now). The peripheral supports almost all commands that the TARDIM computer panel has. +## Features: +* New commands that let you ring cloister bell or list all biomes and dimensions +* Improved fuel system, which will take in any furnace fuel and won't consume buckets * Redstone TARDIM Input: New block that lets you execute a TARDIM command with the power of redstone! After saving a command, this block executes it every time it gets powered by redstone -* *This is just the beginning, there are more features to come!* +* Full ComputerCraft integration + * Digital TARDIM interface: ComputerCraft peripheral that lets you control a TARDIM using computers! The peripheral supports almost all commands that the TARDIM computer panel has. + * Peripherals for some of the TARDIM blocks that provide a few of digital interface's methods at smaller costs +* New exterior - Soviet Chronobox, styled like a USSR phone booth +* [Coming once Create Fabric is on 1.20] Create integration (display sources): some of the blocks will now be able to act as a display source with Create mod +* [WIP] Food machine - exchange fuel for food. *Currently only in creative mode and half finished.* +* You can see planned features [in the docs](https://tardim.a71.su/planned) -### Example use-cases +## Example use-cases * Make a dashboard to monitor fuel levels, current location, and other information on a screen in a nice way. * Get refined control over your TARDIM, such as saving and loading locations, or setting a destination in a GUI. * Add visual effects that activate during flight e.g. note blocks or Create mod contraptions. -The possibilities are endless, the only limit is your imagination! (And coding skills) +The possibilities are endless, the only limit is your imagination! -### Note -Due to nature of the mod **anyone** inside your TARDIM with access to a computer and this mod's peripheral -will be able to run **any** methods. There is no fix that I know of (aside from disabling any commands except "getters" like fuel info), so if you want to use this mod on your server, -please don't let untrustworthy players anywhere near your computer.\ -And another thing: the method that sets destination dimension can't check if the dimension is valid. If you cannot land just change dimension to a valid one like overworld or nether. +## Documentation +Information about the mod's blocks and integration, crafting recipes, and plans for development are available at https://tardim.a71.su -### FAQ +## FAQ **Is this for Fabric or Forge?** : Both! As a Fabric player who recognises Forge's large playerbase, I support both major modloaders. +However, due to nature of development Fabric versions may get released a bit earlier. **Can I use this in my modpack?** : Sure, as long as you don't claim the mod as your own. A link to this mod's page would be appreciated too. -**Will there be a 1.19.3 version and beyond?** -: Right now my focus on 1.19.2, but I will try my best to update to later versions as soon as this mod is fully stable. +**Will there be a 1.20.1 version and beyond?** +: I am in the process of moving to 1.20, with Fabric already out and Forge in progress. +I intend to follow latest versions with TARDIM. **I encountered a bug or have a suggestion. What do I do?** : If you have a problem or suggestion, the best way to get them to me is through the project's Discord server. -**I don't know ComputerCraft, will this always be a CC-only mod?** -: Ok fine, nobody actually asked that. But in case you did, good news: No! The mod already adds things like Redstone TARDIM Input, -which let you integrate your TARDIM into good old redstone. Going forward, -I plan to add even more ways to control the TARDIM without computers for those who don't want to code their own implementation. \ No newline at end of file +**Do I need to install things like ComputerCraft or Create for this mod?** +: Nope! While I highly suggest you do (because digital interface is in my opinion the star of the show), +you can enjoy a lot of TARDIM: In Control's features with only TARDIM installed. +If you ever decide to add other optional dependencies, the relevant blocks will become available and craftable! \ No newline at end of file diff --git a/SWD_MOMENT.txt b/SWD_MOMENT.txt index addca91..8e6d1d4 100644 --- a/SWD_MOMENT.txt +++ b/SWD_MOMENT.txt @@ -7,9 +7,9 @@ public ResourceLocation getFabricId() { return new ResourceLocation("tutorial", "tardim_dimension_lookup"); } +5.1 Forge's MANIFEST.MF too! Andrew71's proposals: - 1. Quick-return command 2. add support for far more fuel sources via AbstractFurnaceBlockEntity.getFuel() on top of built-in TARDIM method 3. Unify package names on Forge and Fabric \ No newline at end of file diff --git a/TODO b/TODO new file mode 100644 index 0000000..fd65f85 --- /dev/null +++ b/TODO @@ -0,0 +1,10 @@ +=== TODO === +Doing every fucking thing over again + +* Basics + * Registrate creative mode tab + * Registrate a single block. Any block will do + +* Digital Interface for TARDIM + * Block + * Peripheral \ No newline at end of file diff --git a/TODO.txt b/TODO.txt deleted file mode 100644 index 82778f1..0000000 --- a/TODO.txt +++ /dev/null @@ -1,51 +0,0 @@ -TODO for 1.2 and beyond - -Blocks: - Food Dispenser - one button iterates over food types, another dispenses it at cost of some fuel - Cartridge Loader - one button to write to the cartridge, another to load information from it (Right now just location, in the future maybe other too) - Dock Station - lets you get into locations you often visit better, good tool for shop keepers as well. On RP servers could prevent liftoff. - Roundels? - Both normal and storage. -Items: - Personal Location Jammer - when worn, prevents others from locating you. Possibly add some kind of power mechanic to make it less OP - Location Cartridge - a cartridge that stores a location to later visit it with a TARDIM. Can be locked like map. Potentially add a way to write in the field. -Commands: - Quick return - set destination to previous materialisation point. -Compat: - CC - add more meaningful peripherals to things like fuel tank, CREATIVE INTERFACE? - Create - Port to 0.5.1, add display sources to more things. Also look into mechanical TARDIM power-up - -Mixins: - Location jammer working - Better fuel tank (More fuel sources, do not eat buckets) - Into demat for quick return mixin - Fuel tank should give off comparator output based on how full it is, and time rotor based on whether we are in flight - Potentially let name change appearance of TARDIM Controls? -Code: - Make better and coherent file structure. Unify Forge and Fabric where possible. Prepare for if SWDTeam ever unify more things. - - -Achievements/Advancements: - "Nobody needs soup more than me" - Get soup from TARDIM's food machine - - "Power of the Redstone" - Activate a redstone input - - "From Russia with love" - Set exterior to Soviet Chronobox (or any other potential USSR-themed exteriors) - - "Cyber-Upgrade" - Craft a digital interface - - "???" - Register a dock - - "I prefer jelly" - Put on a location jammer - - "I will always remember..." - Save (or maybe lock like a map?) a location cartridge - -Crafting recipe for floppy with tardim tutorial installer - -Power indicator for redstone interface \ No newline at end of file diff --git a/build.gradle b/build.gradle index c789a22..c7f1eef 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,13 @@ +plugins { + id 'fabric-loom' version '1.3-SNAPSHOT' apply(false) + id 'net.neoforged.gradle' version '[6.0.18,6.2)' apply(false) + id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' apply(false) + id("org.spongepowered.mixin") version "0.7-SNAPSHOT" apply(false) +} + subprojects { - apply plugin: 'java' - + java.toolchain.languageVersion = JavaLanguageVersion.of(17) java.withSourcesJar() java.withJavadocJar() @@ -19,7 +25,7 @@ subprojects { 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_author, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - 'Timestamp' : System.currentTimeMillis(), + 'Timestamp' : System.currentTimeMillis(), 'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", 'Built-On-Minecraft' : minecraft_version ]) @@ -33,34 +39,63 @@ subprojects { } repositories { - mavenCentral() - maven { name = 'Sponge / Mixin' url = 'https://repo.spongepowered.org/repository/maven-public/' } - maven { - name = 'BlameJared Maven (CrT / Bookshelf)' + name = 'BlameJared Maven (JEI / CraftTweaker / Bookshelf)' url = 'https://maven.blamejared.com' } - maven { url 'https://squiddev.cc/maven/' } - maven { url "https://cursemaven.com"} + // CC: Tweaked + maven { + url "https://squiddev.cc/maven/" + content { + includeGroup("cc.tweaked") + includeModule("org.squiddev", "Cobalt") + } + } + // Curseforge + repositories { + maven { + url "https://cursemaven.com" + } + } + // Create Fabric 1.20 (Jeez that's a lot of mavens) +// maven { +// name "devOSSnapshots" +// url "https://mvn.devos.one/snapshots" +// } +// maven { +// name "tterrag maven" +// url "https://maven.tterrag.com/" +// } +// maven { +// url "https://maven.jamieswhiteshirt.com/libs-release" +// content { +// includeGroup "com.jamieswhiteshirt" +// } +// } } tasks.withType(JavaCompile).configureEach { it.options.encoding = 'UTF-8' - it.options.release = 17 + it.options.getRelease().set(17) + } + + processResources { + filesMatching(['pack.mcmeta', 'fabric.mod.json', 'mods.toml', '*.mixins.json']) { + expand project.properties + } } // Disables Gradle's custom module metadata from being published to maven. The // metadata includes mapped dependencies which are not reasonably consumable by // other mod developers. - tasks.withType(GenerateModuleMetadata) { - + tasks.withType(GenerateModuleMetadata).configureEach { enabled = false } -} +} \ No newline at end of file diff --git a/common/build.gradle b/common/build.gradle new file mode 100644 index 0000000..d4eaea3 --- /dev/null +++ b/common/build.gradle @@ -0,0 +1,39 @@ +plugins { + id 'idea' + id 'java' + id 'maven-publish' + id 'org.spongepowered.gradle.vanilla' +} +base { + archivesName = "${mod_name}-common-${minecraft_version}" +} +minecraft { + version(minecraft_version) + if(file("src/main/resources/${mod_id}.accesswidener").exists()){ + accessWideners(file("src/main/resources/${mod_id}.accesswidener")) + } +} + +dependencies { + compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5' + implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1' + + // ComputerCraft + compileOnly("cc.tweaked:cc-tweaked-$minecraft_version-common-api:$cc_version") + + compileOnly(files("./tardim-1.2.2-dev.jar")) +} + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId base.archivesName.get() + from components.java + } + } + repositories { + maven { + url "file://" + System.getenv("local_maven") + } + } +} \ No newline at end of file diff --git a/Common/src/main/java/su/a71/tardim_ic/tardim_ic/Constants.java b/common/src/main/java/su/a71/tardim_ic/Constants.java similarity index 88% rename from Common/src/main/java/su/a71/tardim_ic/tardim_ic/Constants.java rename to common/src/main/java/su/a71/tardim_ic/Constants.java index f07c887..2866edb 100644 --- a/Common/src/main/java/su/a71/tardim_ic/tardim_ic/Constants.java +++ b/common/src/main/java/su/a71/tardim_ic/Constants.java @@ -1,4 +1,4 @@ -package su.a71.tardim_ic.tardim_ic; +package su.a71.tardim_ic; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListBiomes.java b/common/src/main/java/su/a71/tardim_ic/command/CommandListBiomes.java similarity index 92% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListBiomes.java rename to common/src/main/java/su/a71/tardim_ic/command/CommandListBiomes.java index 146ac06..555b1fd 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListBiomes.java +++ b/common/src/main/java/su/a71/tardim_ic/command/CommandListBiomes.java @@ -1,4 +1,4 @@ -package su.a71.tardim_ic.tardim_ic.command; +package su.a71.tardim_ic.command; import com.swdteam.tardim.common.command.tardim.CommandTardimBase; import com.swdteam.tardim.common.command.tardim.ICommand; @@ -6,6 +6,7 @@ import com.swdteam.tardim.tardim.TardimData; import com.swdteam.tardim.tardim.TardimManager; import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.FurnaceFuelSlot; @@ -26,7 +27,7 @@ public class CommandListBiomes implements ICommand{ TardimData data = TardimManager.getFromPos(pos); if (data != null) { if (data.hasPermission(player)) { - Registry biomeRegistry = player.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); + Registry biomeRegistry = player.level().registryAccess().registryOrThrow(Registries.BIOME); biomeRegistry.keySet().forEach( (ResourceLocation res) -> { String out = res.toString(); diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListDimensions.java b/common/src/main/java/su/a71/tardim_ic/command/CommandListDimensions.java similarity index 91% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListDimensions.java rename to common/src/main/java/su/a71/tardim_ic/command/CommandListDimensions.java index d5cebda..3658b5a 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListDimensions.java +++ b/common/src/main/java/su/a71/tardim_ic/command/CommandListDimensions.java @@ -1,4 +1,4 @@ -package su.a71.tardim_ic.tardim_ic.command; +package su.a71.tardim_ic.command; import com.swdteam.tardim.common.command.tardim.CommandTardimBase; import com.swdteam.tardim.common.command.tardim.ICommand; @@ -18,7 +18,7 @@ public class CommandListDimensions implements ICommand{ TardimData data = TardimManager.getFromPos(pos); if (data != null) { if (data.hasPermission(player)) { - for (ServerLevel serverLevel : player.getLevel().getServer().getAllLevels()) { + for (ServerLevel serverLevel : player.level().getServer().getAllLevels()) { CommandTardimBase.sendResponse(player, serverLevel.dimension().location().toString(), CommandTardimBase.ResponseType.INFO, source); } } else { diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandModemTransmit.java b/common/src/main/java/su/a71/tardim_ic/command/CommandModemTransmit.java similarity index 91% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandModemTransmit.java rename to common/src/main/java/su/a71/tardim_ic/command/CommandModemTransmit.java index f7472bc..eaf208b 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandModemTransmit.java +++ b/common/src/main/java/su/a71/tardim_ic/command/CommandModemTransmit.java @@ -1,4 +1,4 @@ -package su.a71.tardim_ic.tardim_ic.command; +package su.a71.tardim_ic.command; // This will be added whenever I manage to convince TARDIM devs to make CommandManager.register public // 13.04.23 ITS ALIVE @@ -38,10 +38,10 @@ public class CommandModemTransmit implements ICommand { if (allDimensions) { - ComputerCraftAPI.getWirelessNetwork().transmitInterdimensional(new Packet(sendChannel, replyChannel, message, new CommandSender(player, data.getTravelLocation().getPos()))); + ComputerCraftAPI.getWirelessNetwork(player.getServer()).transmitInterdimensional(new Packet(sendChannel, replyChannel, message, new CommandSender(player, data.getTravelLocation().getPos()))); } else { - ComputerCraftAPI.getWirelessNetwork().transmitSameDimension(new Packet(sendChannel, replyChannel, message, + ComputerCraftAPI.getWirelessNetwork(player.getServer()).transmitSameDimension(new Packet(sendChannel, replyChannel, message, new CommandSender(player, data.getTravelLocation().getPos())), 300); } CommandTardimBase.sendResponse(player, "Sent modem message", CommandTardimBase.ResponseType.COMPLETE, source); diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandSender.java b/common/src/main/java/su/a71/tardim_ic/command/CommandSender.java similarity index 80% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandSender.java rename to common/src/main/java/su/a71/tardim_ic/command/CommandSender.java index 89af0db..4515986 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandSender.java +++ b/common/src/main/java/su/a71/tardim_ic/command/CommandSender.java @@ -1,13 +1,13 @@ -package su.a71.tardim_ic.tardim_ic.command; +package su.a71.tardim_ic.command; -import dan200.computercraft.api.network.IPacketSender; +import dan200.computercraft.api.network.PacketSender; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.NotNull; -public class CommandSender implements IPacketSender { +public class CommandSender implements PacketSender { private final Player player; private final Level level; @@ -15,7 +15,7 @@ public class CommandSender implements IPacketSender { CommandSender(Player player, BlockPos pos) { this.player = player; - this.level = player.level; + this.level = player.level(); this.pos = pos; } diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/FakeTardimPeripheralTileEntity.java b/common/src/main/java/su/a71/tardim_ic/computercraft_compat/entity/FakeTardimPeripheralTileEntity.java similarity index 91% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/FakeTardimPeripheralTileEntity.java rename to common/src/main/java/su/a71/tardim_ic/computercraft_compat/entity/FakeTardimPeripheralTileEntity.java index 173e76e..ffe4d4d 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/FakeTardimPeripheralTileEntity.java +++ b/common/src/main/java/su/a71/tardim_ic/computercraft_compat/entity/FakeTardimPeripheralTileEntity.java @@ -1,16 +1,16 @@ -package su.a71.tardim_ic.tardim_ic.computercraft_compat; +package su.a71.tardim_ic.computercraft_compat.entity; import com.swdteam.tardim.tardim.TardimData; import com.swdteam.tardim.tardim.TardimManager; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; public class FakeTardimPeripheralTileEntity implements ITardimPeripheralTileEntity { public BlockPos blockPos; public Level level; public TardimData data; // Our TARDIM - public FakeTardimPeripheralTileEntity(BlockPos in_block, Level in_level) { this.blockPos = in_block; this.level = in_level; @@ -32,6 +32,11 @@ public class FakeTardimPeripheralTileEntity implements ITardimPeripheralTileEnti return this.data; } + @Override + public Block getBlock() { + return this.level.getBlockState(this.blockPos).getBlock(); + } + public TardimData getTardimDataInitial() { int X = this.getPos().getX(), Z = this.getPos().getZ(); diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/ITardimPeripheralTileEntity.java b/common/src/main/java/su/a71/tardim_ic/computercraft_compat/entity/ITardimPeripheralTileEntity.java similarity index 56% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/ITardimPeripheralTileEntity.java rename to common/src/main/java/su/a71/tardim_ic/computercraft_compat/entity/ITardimPeripheralTileEntity.java index 3485898..7e9b82e 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/ITardimPeripheralTileEntity.java +++ b/common/src/main/java/su/a71/tardim_ic/computercraft_compat/entity/ITardimPeripheralTileEntity.java @@ -1,14 +1,18 @@ -package su.a71.tardim_ic.tardim_ic.computercraft_compat; +package su.a71.tardim_ic.computercraft_compat.entity; import com.swdteam.tardim.tardim.TardimData; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; // This is used to getPost(), getLevel() and getTardim() nicely without refactoring code to account for PeripheralProvider -// At least I believe so. Otherwise don't really remember why I don't just pass these methods to the peripherals. +// At least I believe so. Otherwise, don't really remember why I don't just pass these methods to the peripherals. public interface ITardimPeripheralTileEntity { public BlockPos getPos(); public Level getLevel(); public TardimData getTardim(); + + public Block getBlock(); } diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/FuelStoragePeripheral.java b/common/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/FuelStoragePeripheral.java similarity index 78% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/FuelStoragePeripheral.java rename to common/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/FuelStoragePeripheral.java index 9a22a02..05ff46d 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/FuelStoragePeripheral.java +++ b/common/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/FuelStoragePeripheral.java @@ -1,35 +1,27 @@ -package su.a71.tardim_ic.tardim_ic.computercraft_compat.peripherals; +package su.a71.tardim_ic.computercraft_compat.peripherals; +import com.swdteam.tardim.common.block.BlockFuelStorage; import com.swdteam.tardim.tardim.TardimData; import dan200.computercraft.api.lua.LuaException; import dan200.computercraft.api.lua.LuaFunction; import dan200.computercraft.api.peripheral.IPeripheral; import net.minecraft.world.phys.Vec3; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.FakeTardimPeripheralTileEntity; - -import javax.annotation.Nonnull; +import su.a71.tardim_ic.computercraft_compat.entity.FakeTardimPeripheralTileEntity; /* * CC Peripheral for TARDIM's fuel storage block. * Only provides getters for the fuel parts for people who cannot afford or don't need the digital interface. */ -public class FuelStoragePeripheral extends TardimPeripheral implements IPeripheral { +public class FuelStoragePeripheral extends TardimPeripheral implements IPeripheral { /** * @param tileEntity the tile entity of this peripheral * @hidden */ public FuelStoragePeripheral(FakeTardimPeripheralTileEntity tileEntity) { - super(tileEntity); + super(tileEntity, "tardim_fuel_storage", (BlockFuelStorage) tileEntity.getBlock()); } - /** Setting name for the peripheral. A computer will see it as "digital_tardim_interface_n" - * @hidden - */ - @Nonnull - @Override - public String getType() { return "tardim_fuel_storage"; } - // Peripheral methods =============================================================== diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/TardimPeripheral.java b/common/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/TardimPeripheral.java similarity index 76% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/TardimPeripheral.java rename to common/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/TardimPeripheral.java index 4dee2ed..2228b6e 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/TardimPeripheral.java +++ b/common/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/TardimPeripheral.java @@ -1,28 +1,47 @@ -package su.a71.tardim_ic.tardim_ic.computercraft_compat.peripherals; +package su.a71.tardim_ic.computercraft_compat.peripherals; import com.swdteam.tardim.tardim.TardimData; import dan200.computercraft.api.lua.LuaException; import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IPeripheral; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.ITardimPeripheralTileEntity; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import su.a71.tardim_ic.computercraft_compat.entity.ITardimPeripheralTileEntity; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.*; // Base CC peripheral for whn you need something with access to a TARDIM -public abstract class TardimPeripheral implements IPeripheral { +public abstract class TardimPeripheral implements IPeripheral { private final List connectedComputers = new ArrayList<>(); // List of computers connected to the peripheral public final ITardimPeripheralTileEntity tileEntity; // Peripheral's BlockEntity, used for accessing coordinates + public final String name; + private final BL block; + /** * @param tileEntity the tile entity of this peripheral * @hidden */ - public TardimPeripheral(ITardimPeripheralTileEntity tileEntity) { + public TardimPeripheral(ITardimPeripheralTileEntity tileEntity, String name, BL block) { this.tileEntity = tileEntity; + this.name = name; + this.block = block; } + @Override + public BL getTarget() { + return this.block; + } + + /** Setting name for the peripheral. A computer will see it as "digital_tardim_interface_n" + * @hidden + */ + @Nonnull + @Override + public String getType() { return this.name; } + /** Apparently CC uses this to check if the peripheral in front of a modem is this one * @hidden * @param iPeripheral The peripheral to compare against. This may be {@code null}. diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/TardimScannerPeripheral.java b/common/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/TardimScannerPeripheral.java similarity index 89% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/TardimScannerPeripheral.java rename to common/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/TardimScannerPeripheral.java index e4caaee..a562735 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/TardimScannerPeripheral.java +++ b/common/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/TardimScannerPeripheral.java @@ -1,5 +1,6 @@ -package su.a71.tardim_ic.tardim_ic.computercraft_compat.peripherals; +package su.a71.tardim_ic.computercraft_compat.peripherals; +import com.swdteam.tardim.common.block.BlockTardimScanner; import com.swdteam.tardim.common.init.TardimRegistry; import com.swdteam.tardim.tardim.TardimData; import dan200.computercraft.api.lua.LuaException; @@ -7,13 +8,13 @@ import dan200.computercraft.api.lua.LuaFunction; import dan200.computercraft.api.lua.ObjectLuaTable; import dan200.computercraft.api.peripheral.IPeripheral; import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.players.PlayerList; import net.minecraft.world.level.biome.Biome; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.FakeTardimPeripheralTileEntity; +import su.a71.tardim_ic.computercraft_compat.entity.FakeTardimPeripheralTileEntity; -import javax.annotation.Nonnull; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -24,22 +25,15 @@ import java.util.Map; * Only provides getters for data-related (mostly table output) methods e.g. biome or companion list * for people who cannot afford or don't need the digital interface. */ -public class TardimScannerPeripheral extends TardimPeripheral implements IPeripheral { +public class TardimScannerPeripheral extends TardimPeripheral implements IPeripheral { /** * @param tileEntity the tile entity of this peripheral * @hidden */ public TardimScannerPeripheral(FakeTardimPeripheralTileEntity tileEntity) { - super(tileEntity); + super(tileEntity, "tardim_scanner", (BlockTardimScanner) tileEntity.getBlock()); } - /** Setting name for the peripheral. A computer will see it as "digital_tardim_interface_n" - * @hidden - */ - @Nonnull - @Override - public String getType() { return "tardim_scanner"; } - // Peripheral methods =============================================================== @@ -120,7 +114,7 @@ public class TardimScannerPeripheral extends TardimPeripheral implements IPeriph @LuaFunction(mainThread = true) public final ObjectLuaTable getBiomes() throws LuaException { Map biomes = new HashMap<>(); - Registry biomeRegistry = tileEntity.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); + Registry biomeRegistry = tileEntity.getLevel().registryAccess().registryOrThrow(Registries.BIOME); Iterator biome_it = biomeRegistry.keySet().iterator(); int i = 0; while (biome_it.hasNext()) { diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/TimeRotorPeripheral.java b/common/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/TimeRotorPeripheral.java similarity index 87% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/TimeRotorPeripheral.java rename to common/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/TimeRotorPeripheral.java index 7a2d622..9bf959f 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/TimeRotorPeripheral.java +++ b/common/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/TimeRotorPeripheral.java @@ -1,35 +1,28 @@ -package su.a71.tardim_ic.tardim_ic.computercraft_compat.peripherals; +package su.a71.tardim_ic.computercraft_compat.peripherals; +import com.swdteam.tardim.common.block.BlockRotor; import com.swdteam.tardim.tardim.TardimData; import dan200.computercraft.api.lua.LuaException; import dan200.computercraft.api.lua.LuaFunction; import dan200.computercraft.api.lua.ObjectLuaTable; import dan200.computercraft.api.peripheral.IPeripheral; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.FakeTardimPeripheralTileEntity; +import su.a71.tardim_ic.computercraft_compat.entity.FakeTardimPeripheralTileEntity; -import javax.annotation.Nonnull; import java.util.Map; /* * CC Peripheral for TARDIM's time rotor block. * Only provides getters for the flight status for people who cannot afford or don't need the digital interface. */ -public class TimeRotorPeripheral extends TardimPeripheral implements IPeripheral { +public class TimeRotorPeripheral extends TardimPeripheral implements IPeripheral { /** * @param tileEntity the tile entity of this peripheral * @hidden */ public TimeRotorPeripheral(FakeTardimPeripheralTileEntity tileEntity) { - super(tileEntity); + super(tileEntity, "tardim_rotor", (BlockRotor) tileEntity.getBlock()); } - /** Setting name for the peripheral. A computer will see it as "digital_tardim_interface_n" - * @hidden - */ - @Nonnull - @Override - public String getType() { return "tardim_time_rotor"; } - // Peripheral methods =============================================================== diff --git a/common/src/main/java/su/a71/tardim_ic/mixin/JammerMixin.java b/common/src/main/java/su/a71/tardim_ic/mixin/JammerMixin.java new file mode 100644 index 0000000..de20f26 --- /dev/null +++ b/common/src/main/java/su/a71/tardim_ic/mixin/JammerMixin.java @@ -0,0 +1,58 @@ +//package su.a71.tardim_ic.mixin; +// +//import com.swdteam.tardim.common.command.tardim.CommandLocate; +//import com.swdteam.tardim.common.command.tardim.CommandTardimBase; +//import com.swdteam.tardim.tardim.TardimData; +//import com.swdteam.tardim.tardim.TardimManager; +//import net.minecraft.core.BlockPos; +//import net.minecraft.world.entity.player.Player; +//import net.minecraft.world.item.ItemStack; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Overwrite; +// +//import static com.swdteam.tardim.common.command.tardim.CommandTardimBase.sendResponse; +// +//@Mixin(value = CommandLocate.class, remap = false) +//public class JammerMixin { +//// @Inject(method="execute()V", at=@At(value = "INVOKE", +//// target = "Lcom/swdteam/tardim/tardim/TardimData;setTravelLocation(Lcom/swdteam/tardim/tardim/TardimData$Location;)V")) +//// public void execute(CallbackInfo ci) { +//// LOG.info("test"); +////// for (ItemStack armour : player.getArmorSlots()) { +////// if (armour.is(LOCATION_JAMMER)) { +////// sendResponse(player, "Player's location is jammed", CommandTardimBase.ResponseType.FAIL, source); +////// ci.cancel(); +////// }; +////// } +//// } +// +// @Overwrite +// public void execute(String[] args, Player player, BlockPos pos, CommandTardimBase.CommandSource source) { +// if (args.length == 1) { +// TardimData data = TardimManager.getFromPos(pos); +// if (data != null) { +// if (data.hasPermission(player)) { +// Player otherPlayer = player.getServer().getPlayerList().getPlayerByName(args[0]); +// if (otherPlayer != null) { +// for (ItemStack armour : otherPlayer.getArmorSlots()) { +//// if (armour.is(PERSONAL_JAMMER)) { +//// sendResponse(player, otherPlayer.getGameProfile().getName() + "'s location is jammed", CommandTardimBase.ResponseType.FAIL, source); +//// return; +//// } +// // TODO: Re-add +// } +// data.setTravelLocation(new TardimData.Location(otherPlayer.blockPosition(), otherPlayer.level().dimension())); +// sendResponse(player, "Coords locked on to " + otherPlayer.getGameProfile().getName(), CommandTardimBase.ResponseType.COMPLETE, source); +// } else { +// sendResponse(player, "Player does not exist", CommandTardimBase.ResponseType.FAIL, source); +// } +// } else { +// sendResponse(player, "You do not have permission", CommandTardimBase.ResponseType.FAIL, source); +// } +// } +// } else { +// sendResponse(player, ((CommandLocate)(Object)this).getUsage(), CommandTardimBase.ResponseType.FAIL, source); +// } +// +// } +//} diff --git a/common/src/main/java/su/a71/tardim_ic/platform/Services.java b/common/src/main/java/su/a71/tardim_ic/platform/Services.java new file mode 100644 index 0000000..ab300de --- /dev/null +++ b/common/src/main/java/su/a71/tardim_ic/platform/Services.java @@ -0,0 +1,25 @@ +package su.a71.tardim_ic.platform; + +import su.a71.tardim_ic.Constants; +import su.a71.tardim_ic.platform.services.IPlatformHelper; + +import java.util.ServiceLoader; + +public class Services { + + // Platform helper that lets us do stuff for Forge/Fabric while being in Common + public static final IPlatformHelper PLATFORM = load(IPlatformHelper.class); + + // This code is used to load a service for the current environment. Your implementation of the service must be defined + // manually by including a text file in META-INF/services named with the fully qualified class name of the service. + // Inside the file you should write the fully qualified class name of the implementation to load for the platform. For + // example our file on Forge points to ForgePlatformHelper while Fabric points to FabricPlatformHelper. + public static T load(Class clazz) { + + final T loadedService = ServiceLoader.load(clazz) + .findFirst() + .orElseThrow(() -> new NullPointerException("Failed to load service for " + clazz.getName())); +// Constants.LOG.debug("Loaded {} for service {}", loadedService, clazz); + return loadedService; + } +} \ No newline at end of file diff --git a/common/src/main/java/su/a71/tardim_ic/platform/services/IPlatformHelper.java b/common/src/main/java/su/a71/tardim_ic/platform/services/IPlatformHelper.java new file mode 100644 index 0000000..c7f9b35 --- /dev/null +++ b/common/src/main/java/su/a71/tardim_ic/platform/services/IPlatformHelper.java @@ -0,0 +1,47 @@ +package su.a71.tardim_ic.platform.services; + +import net.minecraft.sounds.SoundEvent; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MobCategory; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; + +import java.util.function.Supplier; + +public interface IPlatformHelper { + + /** + * Gets the name of the current platform + * + * @return The name of the current platform. + */ + String getPlatformName(); + + /** + * Checks if a mod with the given id is loaded. + * + * @param modId The mod to check if it is loaded. + * @return True if the mod is loaded, false otherwise. + */ + boolean isModLoaded(String modId); + + /** + * Check if the game is currently in a development environment. + * + * @return True if in a development environment, false otherwise. + */ + boolean isDevelopmentEnvironment(); + + /** + * Gets the name of the environment type as a string. + * + * @return The name of the environment type. + */ + default String getEnvironmentName() { + + return isDevelopmentEnvironment() ? "development" : "production"; + } +} \ No newline at end of file diff --git a/Common/src/main/java/su/a71/tardim_ic/tardim_ic/utils/FakePlayer.java b/common/src/main/java/su/a71/tardim_ic/utils/FakePlayer.java similarity index 73% rename from Common/src/main/java/su/a71/tardim_ic/tardim_ic/utils/FakePlayer.java rename to common/src/main/java/su/a71/tardim_ic/utils/FakePlayer.java index c55aabc..c37a7d9 100644 --- a/Common/src/main/java/su/a71/tardim_ic/tardim_ic/utils/FakePlayer.java +++ b/common/src/main/java/su/a71/tardim_ic/utils/FakePlayer.java @@ -1,4 +1,4 @@ -package su.a71.tardim_ic.tardim_ic.utils; +package su.a71.tardim_ic.utils; import com.mojang.authlib.GameProfile; import net.minecraft.core.BlockPos; @@ -7,14 +7,18 @@ import net.minecraft.world.level.Level; import java.util.UUID; +/** + * This class is used whenever we need a player for a function but cannot get one + * (i.g we are on server side and need to execute TARDIM command) + */ public class FakePlayer extends Player { public FakePlayer(Level lvl, BlockPos blockPos) { - super(lvl, blockPos, 0, new GameProfile(UUID.randomUUID(), "FakePlayer_tardimic"), null); + super(lvl, blockPos, 0, new GameProfile(UUID.randomUUID(), "FakePlayer_tardimic")); } public FakePlayer(Level lvl, BlockPos blockPos, UUID id) { - super(lvl, blockPos, 0, new GameProfile(id, "FakePlayer_tardimic"), null); + super(lvl, blockPos, 0, new GameProfile(id, "FakePlayer_tardimic")); } @@ -28,5 +32,3 @@ public class FakePlayer extends Player { return false; } } - - diff --git a/Common/src/main/resources/assets/minecraft/textures/models/armor/personal_jammer.png b/common/src/main/resources/assets/minecraft/textures/models/armor/personal_jammer.png similarity index 100% rename from Common/src/main/resources/assets/minecraft/textures/models/armor/personal_jammer.png rename to common/src/main/resources/assets/minecraft/textures/models/armor/personal_jammer.png diff --git a/common/src/main/resources/assets/minecraft/textures/models/armor/personal_jammer_layer_1.png b/common/src/main/resources/assets/minecraft/textures/models/armor/personal_jammer_layer_1.png new file mode 100644 index 0000000..c98028b Binary files /dev/null and b/common/src/main/resources/assets/minecraft/textures/models/armor/personal_jammer_layer_1.png differ diff --git a/common/src/main/resources/assets/minecraft/textures/models/armor/personal_jammer_layer_2.png b/common/src/main/resources/assets/minecraft/textures/models/armor/personal_jammer_layer_2.png new file mode 100644 index 0000000..c98028b Binary files /dev/null and b/common/src/main/resources/assets/minecraft/textures/models/armor/personal_jammer_layer_2.png differ diff --git a/Common/src/main/resources/assets/tardim_ic/blockstates/digital_tardim_interface.json b/common/src/main/resources/assets/tardim_ic/blockstates/digital_tardim_interface.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/blockstates/digital_tardim_interface.json rename to common/src/main/resources/assets/tardim_ic/blockstates/digital_tardim_interface.json diff --git a/Common/src/main/resources/assets/tardim_ic/blockstates/food_machine.json b/common/src/main/resources/assets/tardim_ic/blockstates/food_machine.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/blockstates/food_machine.json rename to common/src/main/resources/assets/tardim_ic/blockstates/food_machine.json diff --git a/Common/src/main/resources/assets/tardim_ic/blockstates/redstone_tardim_input.json b/common/src/main/resources/assets/tardim_ic/blockstates/redstone_tardim_input.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/blockstates/redstone_tardim_input.json rename to common/src/main/resources/assets/tardim_ic/blockstates/redstone_tardim_input.json diff --git a/common/src/main/resources/assets/tardim_ic/blockstates/tardim_dock.json b/common/src/main/resources/assets/tardim_ic/blockstates/tardim_dock.json new file mode 100644 index 0000000..39f44ce --- /dev/null +++ b/common/src/main/resources/assets/tardim_ic/blockstates/tardim_dock.json @@ -0,0 +1,8 @@ +{ + "variants": { + "facing=north": { "model": "tardim_ic:block/tardim_dock"}, + "facing=east": { "model": "tardim_ic:block/tardim_dock", "y": 90}, + "facing=south": { "model": "tardim_ic:block/tardim_dock", "y": 180}, + "facing=west": { "model": "tardim_ic:block/tardim_dock", "y": 270} + } +} \ No newline at end of file diff --git a/Common/src/main/resources/assets/tardim_ic/blockstates/tardim_door_soviet.json b/common/src/main/resources/assets/tardim_ic/blockstates/tardim_door_soviet.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/blockstates/tardim_door_soviet.json rename to common/src/main/resources/assets/tardim_ic/blockstates/tardim_door_soviet.json diff --git a/Common/src/main/resources/assets/tardim_ic/blockstates/tardim_floor_soviet.json b/common/src/main/resources/assets/tardim_ic/blockstates/tardim_floor_soviet.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/blockstates/tardim_floor_soviet.json rename to common/src/main/resources/assets/tardim_ic/blockstates/tardim_floor_soviet.json diff --git a/Common/src/main/resources/assets/tardim_ic/blockstates/tardim_roof_soviet.json b/common/src/main/resources/assets/tardim_ic/blockstates/tardim_roof_soviet.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/blockstates/tardim_roof_soviet.json rename to common/src/main/resources/assets/tardim_ic/blockstates/tardim_roof_soviet.json diff --git a/Common/src/main/resources/icon.png b/common/src/main/resources/assets/tardim_ic/icon.png similarity index 100% rename from Common/src/main/resources/icon.png rename to common/src/main/resources/assets/tardim_ic/icon.png diff --git a/Common/src/main/resources/assets/tardim_ic/lang/en_uk.json b/common/src/main/resources/assets/tardim_ic/lang/en_uk.json similarity index 87% rename from Common/src/main/resources/assets/tardim_ic/lang/en_uk.json rename to common/src/main/resources/assets/tardim_ic/lang/en_uk.json index db7410f..252bf62 100644 --- a/Common/src/main/resources/assets/tardim_ic/lang/en_uk.json +++ b/common/src/main/resources/assets/tardim_ic/lang/en_uk.json @@ -2,6 +2,7 @@ "block.tardim_ic.digital_tardim_interface": "Digital TARDIM Interface", "block.tardim_ic.redstone_tardim_input": "Redstone TARDIM Input", "block.tardim_ic.tardim_dock": "TARDIM Dock", + "block.tardim_ic.food_machine": "TARDIM food machine", "itemGroup.tardim_ic": "TARDIM: In Control", "itemGroup.minecraft.tardim_ic": "TARDIM: In Control", "subtitles.tardim_ic.cloister": "Cloister bell rings", diff --git a/Common/src/main/resources/assets/tardim_ic/lang/en_us.json b/common/src/main/resources/assets/tardim_ic/lang/en_us.json similarity index 87% rename from Common/src/main/resources/assets/tardim_ic/lang/en_us.json rename to common/src/main/resources/assets/tardim_ic/lang/en_us.json index 51aef28..8ae4985 100644 --- a/Common/src/main/resources/assets/tardim_ic/lang/en_us.json +++ b/common/src/main/resources/assets/tardim_ic/lang/en_us.json @@ -2,6 +2,7 @@ "block.tardim_ic.digital_tardim_interface": "Digital TARDIM interface", "block.tardim_ic.redstone_tardim_input": "Redstone TARDIM input", "block.tardim_ic.tardim_dock": "TARDIM dock", + "block.tardim_ic.food_machine": "TARDIM food machine", "itemGroup.tardim_ic": "TARDIM: In Control", "itemGroup.minecraft.tardim_ic": "TARDIM: In Control", "subtitles.tardim_ic.cloister": "Cloister bell rings", diff --git a/Common/src/main/resources/assets/tardim_ic/lang/rpr.json b/common/src/main/resources/assets/tardim_ic/lang/rpr.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/lang/rpr.json rename to common/src/main/resources/assets/tardim_ic/lang/rpr.json diff --git a/Common/src/main/resources/assets/tardim_ic/lang/ru_ru.json b/common/src/main/resources/assets/tardim_ic/lang/ru_ru.json similarity index 89% rename from Common/src/main/resources/assets/tardim_ic/lang/ru_ru.json rename to common/src/main/resources/assets/tardim_ic/lang/ru_ru.json index a37d071..c819c1d 100644 --- a/Common/src/main/resources/assets/tardim_ic/lang/ru_ru.json +++ b/common/src/main/resources/assets/tardim_ic/lang/ru_ru.json @@ -2,6 +2,7 @@ "block.tardim_ic.digital_tardim_interface": "Цифровой интерфейс TARDIM", "block.tardim_ic.redstone_tardim_input": "Редстоуновый ввод TARDIM", "block.tardim_ic.tardim_dock": "Стыковочная станция для TARDIM", + "block.tardim_ic.food_machine": "Раздатчик еды", "itemGroup.tardim_ic": "TARDIM: In Control", "itemGroup.minecraft.tardim_ic": "TARDIM: In Control", "subtitles.tardim_ic.cloister": "Звон монастырского колокола", diff --git a/common/src/main/resources/assets/tardim_ic/models/block/digital_tardim_interface.json b/common/src/main/resources/assets/tardim_ic/models/block/digital_tardim_interface.json new file mode 100644 index 0000000..490fd9d --- /dev/null +++ b/common/src/main/resources/assets/tardim_ic/models/block/digital_tardim_interface.json @@ -0,0 +1,213 @@ +{ + "credit": "Made by karoter2 (Feulim)", + "parent": "digital_tardim_interface", + "texture_size": [64, 64], + "textures": { + "1": "tardim_ic:block/digital_tardim_interface", + "particle": "tardim_ic:block/digital_tardim_interface" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 14, 16], + "faces": { + "north": {"uv": [4, 4, 8, 7.5], "texture": "#1"}, + "east": {"uv": [0, 4, 4, 7.5], "texture": "#1"}, + "south": {"uv": [12, 4, 16, 7.5], "texture": "#1"}, + "west": {"uv": [8, 4, 12, 7.5], "texture": "#1"}, + "up": {"uv": [8, 4, 4, 0], "texture": "#1"}, + "down": {"uv": [12, 0, 8, 4], "texture": "#1"} + } + }, + { + "from": [5, 14, 5], + "to": [11, 16, 11], + "faces": { + "north": {"uv": [1.5, 9, 3, 9.5], "texture": "#1"}, + "east": {"uv": [0, 9, 1.5, 9.5], "texture": "#1"}, + "south": {"uv": [4.5, 9, 6, 9.5], "texture": "#1"}, + "west": {"uv": [3, 9, 4.5, 9.5], "texture": "#1"}, + "up": {"uv": [3, 9, 1.5, 7.5], "texture": "#1"}, + "down": {"uv": [4.5, 7.5, 3, 9], "texture": "#1"} + } + }, + { + "from": [11, 14, 7], + "to": [14, 16, 9], + "faces": { + "north": {"uv": [12.5, 0.5, 13.25, 1], "texture": "#1"}, + "east": {"uv": [12, 0.5, 12.5, 1], "texture": "#1"}, + "south": {"uv": [13.75, 0.5, 14.5, 1], "texture": "#1"}, + "west": {"uv": [13.25, 0.5, 13.75, 1], "texture": "#1"}, + "up": {"uv": [13.25, 0.5, 12.5, 0], "texture": "#1"}, + "down": {"uv": [14, 0, 13.25, 0.5], "texture": "#1"} + } + }, + { + "from": [12.5, 14, 3.5], + "to": [12.5, 15, 12.5], + "faces": { + "north": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "east": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "south": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "west": {"uv": [13, 3.75, 15.25, 4], "texture": "#1"}, + "up": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "down": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"} + } + }, + { + "from": [3.5, 14, 12.5], + "to": [12.5, 15, 12.5], + "faces": { + "north": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "east": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "south": {"uv": [12.5, 3.75, 14.75, 4], "texture": "#1"}, + "west": {"uv": [13.5, 3.75, 15.75, 4], "texture": "#1"}, + "up": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "down": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"} + } + }, + { + "from": [3.5, 14, 3.5], + "to": [12.5, 15, 3.5], + "faces": { + "north": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "east": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "south": {"uv": [12.5, 3.75, 14.75, 4], "texture": "#1"}, + "west": {"uv": [13.5, 3.75, 15.75, 4], "texture": "#1"}, + "up": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "down": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"} + } + }, + { + "from": [3.5, 14, 3.5], + "to": [3.5, 15, 12.5], + "faces": { + "north": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "east": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "south": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "west": {"uv": [13, 3.75, 15.25, 4], "texture": "#1"}, + "up": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"}, + "down": {"uv": [12, 3.75, 14.25, 4], "texture": "#1"} + } + }, + { + "from": [2, 14, 7], + "to": [5, 16, 9], + "faces": { + "north": {"uv": [5, 8, 5.75, 8.5], "texture": "#1"}, + "east": {"uv": [4.5, 8, 5, 8.5], "texture": "#1"}, + "south": {"uv": [6.25, 8, 7, 8.5], "texture": "#1"}, + "west": {"uv": [5.75, 8, 6.25, 8.5], "texture": "#1"}, + "up": {"uv": [5.75, 8, 5, 7.5], "texture": "#1"}, + "down": {"uv": [6.5, 7.5, 5.75, 8], "texture": "#1"} + } + }, + { + "from": [7, 14, 2], + "to": [9, 16, 5], + "faces": { + "north": {"uv": [3.25, 12.5, 3.75, 13], "texture": "#1"}, + "east": {"uv": [2.5, 12.5, 3.25, 13], "texture": "#1"}, + "south": {"uv": [4.5, 12.5, 5, 13], "texture": "#1"}, + "west": {"uv": [3.75, 12.5, 4.5, 13], "texture": "#1"}, + "up": {"uv": [3.75, 12.5, 3.25, 11.75], "texture": "#1"}, + "down": {"uv": [4.25, 11.75, 3.75, 12.5], "texture": "#1"} + } + }, + { + "from": [7, 14, 11], + "to": [9, 16, 14], + "faces": { + "north": {"uv": [0.75, 12.5, 1.25, 13], "texture": "#1"}, + "east": {"uv": [0, 12.5, 0.75, 13], "texture": "#1"}, + "south": {"uv": [2, 12.5, 2.5, 13], "texture": "#1"}, + "west": {"uv": [1.25, 12.5, 2, 13], "texture": "#1"}, + "up": {"uv": [1.25, 12.5, 0.75, 11.75], "texture": "#1"}, + "down": {"uv": [1.75, 11.75, 1.25, 12.5], "texture": "#1"} + } + }, + { + "from": [6, 13, -2], + "to": [10, 17, 2], + "faces": { + "north": {"uv": [10, 9.5, 11, 10.5], "texture": "#1"}, + "east": {"uv": [9, 9.5, 10, 10.5], "texture": "#1"}, + "south": {"uv": [12, 9.5, 13, 10.5], "texture": "#1"}, + "west": {"uv": [11, 9.5, 12, 10.5], "texture": "#1"}, + "up": {"uv": [11, 9.5, 10, 8.5], "texture": "#1"}, + "down": {"uv": [12, 8.5, 11, 9.5], "texture": "#1"} + } + }, + { + "from": [6, 13, 14], + "to": [10, 17, 18], + "faces": { + "north": {"uv": [7, 8.5, 8, 9.5], "texture": "#1"}, + "east": {"uv": [6, 8.5, 7, 9.5], "texture": "#1"}, + "south": {"uv": [9, 8.5, 10, 9.5], "texture": "#1"}, + "west": {"uv": [8, 8.5, 9, 9.5], "texture": "#1"}, + "up": {"uv": [8, 8.5, 7, 7.5], "texture": "#1"}, + "down": {"uv": [9, 7.5, 8, 8.5], "texture": "#1"} + } + }, + { + "from": [-2, 13, 6], + "to": [2, 17, 10], + "faces": { + "north": {"uv": [1, 3, 2, 4], "texture": "#1"}, + "east": {"uv": [0, 3, 1, 4], "texture": "#1"}, + "south": {"uv": [3, 3, 4, 4], "texture": "#1"}, + "west": {"uv": [2, 3, 3, 4], "texture": "#1"}, + "up": {"uv": [2, 3, 1, 2], "texture": "#1"}, + "down": {"uv": [3, 2, 2, 3], "texture": "#1"} + } + }, + { + "from": [14, 13, 6], + "to": [18, 17, 10], + "faces": { + "north": {"uv": [1, 1, 2, 2], "texture": "#1"}, + "east": {"uv": [0, 1, 1, 2], "texture": "#1"}, + "south": {"uv": [3, 1, 4, 2], "texture": "#1"}, + "west": {"uv": [2, 1, 3, 2], "texture": "#1"}, + "up": {"uv": [2, 1, 1, 0], "texture": "#1"}, + "down": {"uv": [3, 0, 2, 1], "texture": "#1"} + } + } + ], + "display": { + "thirdperson_righthand": { + "translation": [0, -1.5, 0], + "scale": [0.5, 0.5, 0.5] + }, + "thirdperson_lefthand": { + "translation": [0, -1.5, 0], + "scale": [0.5, 0.5, 0.5] + }, + "firstperson_righthand": { + "translation": [-1.25, 0, 0], + "scale": [0.5, 0.5, 0.5] + }, + "firstperson_lefthand": { + "translation": [3.75, -1.5, 0], + "scale": [0.5, 0.5, 0.5] + }, + "ground": { + "translation": [0, -0.5, 0], + "scale": [0.35, 0.35, 0.35] + }, + "gui": { + "rotation": [33, 45, 0], + "scale": [0.6, 0.6, 0.6] + }, + "head": { + "translation": [0, 0.75, 0], + "scale": [1.1, 1.1, 1.1] + }, + "fixed": { + "rotation": [-90, 0, 0], + "translation": [0, 0, 4.25] + } + } +} \ No newline at end of file diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/food_machine.json b/common/src/main/resources/assets/tardim_ic/models/block/food_machine.json similarity index 97% rename from Common/src/main/resources/assets/tardim_ic/models/block/food_machine.json rename to common/src/main/resources/assets/tardim_ic/models/block/food_machine.json index c4b5c76..7cbaf76 100644 --- a/Common/src/main/resources/assets/tardim_ic/models/block/food_machine.json +++ b/common/src/main/resources/assets/tardim_ic/models/block/food_machine.json @@ -2,8 +2,8 @@ "credit": "Made by karoter2 (Feulim)", "texture_size": [128, 128], "textures": { - "0": "tardim_ic:blocks/food_machine", - "particle": "tardim_ic:blocks/food_machine" + "0": "tardim_ic:block/food_machine", + "particle": "tardim_ic:block/food_machine" }, "elements": [ { diff --git a/common/src/main/resources/assets/tardim_ic/models/block/redstone_tardim_input.json b/common/src/main/resources/assets/tardim_ic/models/block/redstone_tardim_input.json new file mode 100644 index 0000000..2068e27 --- /dev/null +++ b/common/src/main/resources/assets/tardim_ic/models/block/redstone_tardim_input.json @@ -0,0 +1,36 @@ +{ + "credit": "Made by karoter2 (Feulim)", + "parent": "block/cube_all", + "ambientocclusion": false, + "textures": { + "1": "tardim_ic:block/redstone_input", + "2": "tardim_ic:block/redstone_input", + "particle": "tardim_ic:block/redstone_input" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#2"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#2"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#2"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#2"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#2"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#2"} + } + }, + { + "from": [-0.325, -0.35, -0.35], + "to": [16.35, 16.525, 16.275], + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#1"} + } + } + ] +} \ No newline at end of file diff --git a/common/src/main/resources/assets/tardim_ic/models/block/redstone_tardim_input_lit.json b/common/src/main/resources/assets/tardim_ic/models/block/redstone_tardim_input_lit.json new file mode 100644 index 0000000..18bb49a --- /dev/null +++ b/common/src/main/resources/assets/tardim_ic/models/block/redstone_tardim_input_lit.json @@ -0,0 +1,8 @@ +{ + "parent": "tardim_ic:block/redstone_tardim_input", + "textures": { + "1": "tardim_ic:block/redstone_input_lit", + "2": "tardim_ic:block/redstone_input_lit", + "particle": "tardim_ic:block/redstone_input_lit" + } +} \ No newline at end of file diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/tardim_dock.json b/common/src/main/resources/assets/tardim_ic/models/block/tardim_dock.json similarity index 97% rename from Common/src/main/resources/assets/tardim_ic/models/block/tardim_dock.json rename to common/src/main/resources/assets/tardim_ic/models/block/tardim_dock.json index 3ae2da8..33ff950 100644 --- a/Common/src/main/resources/assets/tardim_ic/models/block/tardim_dock.json +++ b/common/src/main/resources/assets/tardim_ic/models/block/tardim_dock.json @@ -1,9 +1,9 @@ { - "credit": "Made by karoter2 with Blockbench", + "credit": "Made by karoter2 (Feulim)", "texture_size": [64, 64], "textures": { - "1": "tardim_ic:blocks/tardim_dock", - "particle": "tardim_ic:blocks/tardim_dock" + "1": "tardim_ic:block/tardim_dock", + "particle": "tardim_ic:block/tardim_dock" }, "elements": [ { diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_bottom_closed.json b/common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_bottom_closed.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_bottom_closed.json rename to common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_bottom_closed.json diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_bottom_open.json b/common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_bottom_open.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_bottom_open.json rename to common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_bottom_open.json diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_sides.json b/common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_sides.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_sides.json rename to common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_sides.json diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_sides_bottom.json b/common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_sides_bottom.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_sides_bottom.json rename to common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_sides_bottom.json diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_sides_top.json b/common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_sides_top.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_sides_top.json rename to common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_sides_top.json diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_top_front_closed.json b/common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_top_front_closed.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_top_front_closed.json rename to common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_top_front_closed.json diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_top_front_open.json b/common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_top_front_open.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_top_front_open.json rename to common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_door_top_front_open.json diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_floor.json b/common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_floor.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_floor.json rename to common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_floor.json diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_roof.json b/common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_roof.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_roof.json rename to common/src/main/resources/assets/tardim_ic/models/block/tardim_soviet_chronobox/tardim_roof.json diff --git a/Common/src/main/resources/assets/tardim_ic/models/item/digital_tardim_interface.json b/common/src/main/resources/assets/tardim_ic/models/item/digital_tardim_interface.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/item/digital_tardim_interface.json rename to common/src/main/resources/assets/tardim_ic/models/item/digital_tardim_interface.json diff --git a/Common/src/main/resources/assets/tardim_ic/models/item/food_machine.json b/common/src/main/resources/assets/tardim_ic/models/item/food_machine.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/item/food_machine.json rename to common/src/main/resources/assets/tardim_ic/models/item/food_machine.json diff --git a/Common/src/main/resources/assets/tardim_ic/models/item/location_jammer.json b/common/src/main/resources/assets/tardim_ic/models/item/personal_jammer.json similarity index 53% rename from Common/src/main/resources/assets/tardim_ic/models/item/location_jammer.json rename to common/src/main/resources/assets/tardim_ic/models/item/personal_jammer.json index 1a1fcc4..d8930c2 100644 --- a/Common/src/main/resources/assets/tardim_ic/models/item/location_jammer.json +++ b/common/src/main/resources/assets/tardim_ic/models/item/personal_jammer.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures": { - "layer0": "tardim_ic:item/location_jammer" + "layer0": "tardim_ic:item/personal_jammer" } } \ No newline at end of file diff --git a/Common/src/main/resources/assets/tardim_ic/models/item/redstone_tardim_input.json b/common/src/main/resources/assets/tardim_ic/models/item/redstone_tardim_input.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/item/redstone_tardim_input.json rename to common/src/main/resources/assets/tardim_ic/models/item/redstone_tardim_input.json diff --git a/Common/src/main/resources/assets/tardim_ic/models/item/tardim_dock.json b/common/src/main/resources/assets/tardim_ic/models/item/tardim_dock.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/models/item/tardim_dock.json rename to common/src/main/resources/assets/tardim_ic/models/item/tardim_dock.json diff --git a/Common/src/main/resources/assets/tardim_ic/sounds.json b/common/src/main/resources/assets/tardim_ic/sounds.json similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/sounds.json rename to common/src/main/resources/assets/tardim_ic/sounds.json diff --git a/Common/src/main/resources/assets/tardim_ic/sounds/cloister.ogg b/common/src/main/resources/assets/tardim_ic/sounds/cloister.ogg similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/sounds/cloister.ogg rename to common/src/main/resources/assets/tardim_ic/sounds/cloister.ogg diff --git a/Common/src/main/resources/assets/tardim_ic/textures/blocks/digital_tardim_interface.png b/common/src/main/resources/assets/tardim_ic/textures/block/digital_tardim_interface.png similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/textures/blocks/digital_tardim_interface.png rename to common/src/main/resources/assets/tardim_ic/textures/block/digital_tardim_interface.png diff --git a/Common/src/main/resources/assets/tardim_ic/textures/blocks/food_machine.png b/common/src/main/resources/assets/tardim_ic/textures/block/food_machine.png similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/textures/blocks/food_machine.png rename to common/src/main/resources/assets/tardim_ic/textures/block/food_machine.png diff --git a/Common/src/main/resources/assets/tardim_ic/textures/blocks/red_contr.png b/common/src/main/resources/assets/tardim_ic/textures/block/redstone_input.png similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/textures/blocks/red_contr.png rename to common/src/main/resources/assets/tardim_ic/textures/block/redstone_input.png diff --git a/Common/src/main/resources/assets/tardim_ic/textures/blocks/red_contr.png.mcmeta b/common/src/main/resources/assets/tardim_ic/textures/block/redstone_input.png.mcmeta similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/textures/blocks/red_contr.png.mcmeta rename to common/src/main/resources/assets/tardim_ic/textures/block/redstone_input.png.mcmeta diff --git a/common/src/main/resources/assets/tardim_ic/textures/block/redstone_input_lit.png b/common/src/main/resources/assets/tardim_ic/textures/block/redstone_input_lit.png new file mode 100644 index 0000000..7809103 Binary files /dev/null and b/common/src/main/resources/assets/tardim_ic/textures/block/redstone_input_lit.png differ diff --git a/common/src/main/resources/assets/tardim_ic/textures/block/redstone_input_lit.png.mcmeta b/common/src/main/resources/assets/tardim_ic/textures/block/redstone_input_lit.png.mcmeta new file mode 100644 index 0000000..fe2f8d3 --- /dev/null +++ b/common/src/main/resources/assets/tardim_ic/textures/block/redstone_input_lit.png.mcmeta @@ -0,0 +1,7 @@ +{ + "animation": { + "frametime": 10, + "interpolate": true, + "frames": [0, 1, 2, 3] + } +} \ No newline at end of file diff --git a/Common/src/main/resources/assets/tardim_ic/textures/blocks/tardim_dock.png b/common/src/main/resources/assets/tardim_ic/textures/block/tardim_dock.png similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/textures/blocks/tardim_dock.png rename to common/src/main/resources/assets/tardim_ic/textures/block/tardim_dock.png diff --git a/Common/src/main/resources/assets/tardim_ic/textures/blocks/tardim_soviet_chronobox.png b/common/src/main/resources/assets/tardim_ic/textures/block/tardim_soviet_chronobox.png similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/textures/blocks/tardim_soviet_chronobox.png rename to common/src/main/resources/assets/tardim_ic/textures/block/tardim_soviet_chronobox.png diff --git a/Common/src/main/resources/assets/tardim_ic/textures/item/cartridges/cartridge_pins.png b/common/src/main/resources/assets/tardim_ic/textures/item/cartridges/cartridge_pins.png similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/textures/item/cartridges/cartridge_pins.png rename to common/src/main/resources/assets/tardim_ic/textures/item/cartridges/cartridge_pins.png diff --git a/Common/src/main/resources/assets/tardim_ic/textures/item/cartridges/cartridge_shell.png b/common/src/main/resources/assets/tardim_ic/textures/item/cartridges/cartridge_shell.png similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/textures/item/cartridges/cartridge_shell.png rename to common/src/main/resources/assets/tardim_ic/textures/item/cartridges/cartridge_shell.png diff --git a/Common/src/main/resources/assets/tardim_ic/textures/item/cartridges/temp/cartridge_blue.png b/common/src/main/resources/assets/tardim_ic/textures/item/cartridges/temp/cartridge_blue.png similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/textures/item/cartridges/temp/cartridge_blue.png rename to common/src/main/resources/assets/tardim_ic/textures/item/cartridges/temp/cartridge_blue.png diff --git a/Common/src/main/resources/assets/tardim_ic/textures/item/cartridges/temp/cartridge_green.png b/common/src/main/resources/assets/tardim_ic/textures/item/cartridges/temp/cartridge_green.png similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/textures/item/cartridges/temp/cartridge_green.png rename to common/src/main/resources/assets/tardim_ic/textures/item/cartridges/temp/cartridge_green.png diff --git a/Common/src/main/resources/assets/tardim_ic/textures/item/cartridges/temp/cartridge_red.png b/common/src/main/resources/assets/tardim_ic/textures/item/cartridges/temp/cartridge_red.png similarity index 100% rename from Common/src/main/resources/assets/tardim_ic/textures/item/cartridges/temp/cartridge_red.png rename to common/src/main/resources/assets/tardim_ic/textures/item/cartridges/temp/cartridge_red.png diff --git a/common/src/main/resources/data/computercraft/lua/premade/NavDash.lua b/common/src/main/resources/data/computercraft/lua/premade/NavDash.lua new file mode 100644 index 0000000..140884c --- /dev/null +++ b/common/src/main/resources/data/computercraft/lua/premade/NavDash.lua @@ -0,0 +1,5 @@ +--[[ + This is source code of my personal TARDIM Navigation Dashboard (NavDash) + + It needs a 1x2 (2 tall) monitor and a digital TARDIM interface to be available +] \ No newline at end of file diff --git a/scripts/basicTest.lua b/common/src/main/resources/data/computercraft/lua/premade/basicTest.lua similarity index 100% rename from scripts/basicTest.lua rename to common/src/main/resources/data/computercraft/lua/premade/basicTest.lua diff --git a/Common/src/main/resources/data/tardim_ic/loot_tables/blocks/digital_tardim_interface.json b/common/src/main/resources/data/tardim_ic/loot_tables/blocks/digital_tardim_interface.json similarity index 100% rename from Common/src/main/resources/data/tardim_ic/loot_tables/blocks/digital_tardim_interface.json rename to common/src/main/resources/data/tardim_ic/loot_tables/blocks/digital_tardim_interface.json diff --git a/Common/src/main/resources/data/tardim_ic/loot_tables/blocks/redstone_tardim_input.json b/common/src/main/resources/data/tardim_ic/loot_tables/blocks/redstone_tardim_input.json similarity index 100% rename from Common/src/main/resources/data/tardim_ic/loot_tables/blocks/redstone_tardim_input.json rename to common/src/main/resources/data/tardim_ic/loot_tables/blocks/redstone_tardim_input.json diff --git a/Common/src/main/resources/data/tardim_ic/recipes/digital_tardim_interface.json b/common/src/main/resources/data/tardim_ic/recipes/digital_tardim_interface.json similarity index 100% rename from Common/src/main/resources/data/tardim_ic/recipes/digital_tardim_interface.json rename to common/src/main/resources/data/tardim_ic/recipes/digital_tardim_interface.json diff --git a/Common/src/main/resources/data/tardim_ic/recipes/redstone_tardim_input.json b/common/src/main/resources/data/tardim_ic/recipes/redstone_tardim_input.json similarity index 100% rename from Common/src/main/resources/data/tardim_ic/recipes/redstone_tardim_input.json rename to common/src/main/resources/data/tardim_ic/recipes/redstone_tardim_input.json diff --git a/common/src/main/resources/pack.mcmeta b/common/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..52854ec --- /dev/null +++ b/common/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "${mod_name}", + "pack_format": 8 + } +} \ No newline at end of file diff --git a/common/src/main/resources/tardim_ic.mixins.json b/common/src/main/resources/tardim_ic.mixins.json new file mode 100644 index 0000000..1b9f9ef --- /dev/null +++ b/common/src/main/resources/tardim_ic.mixins.json @@ -0,0 +1,13 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "su.a71.tardim_ic.mixin", + "refmap": "${mod_id}.refmap.json", + "compatibilityLevel": "JAVA_17", + "mixins": [ + ], + "injectors": { + "defaultRequire": 1 + } +} + diff --git a/common/tardim-1.2.2-dev.jar b/common/tardim-1.2.2-dev.jar new file mode 100644 index 0000000..bc8522a Binary files /dev/null and b/common/tardim-1.2.2-dev.jar differ diff --git a/docs/assets/img/banner.png b/docs/assets/img/banner.png new file mode 100644 index 0000000..781ece3 Binary files /dev/null and b/docs/assets/img/banner.png differ diff --git a/docs/assets/img/banner_narrow.png b/docs/assets/img/banner_narrow.png new file mode 100644 index 0000000..47118db Binary files /dev/null and b/docs/assets/img/banner_narrow.png differ diff --git a/docs/assets/img/blocks/cartridge_blue.png b/docs/assets/img/blocks/cartridge_blue.png new file mode 100644 index 0000000..76eaaab Binary files /dev/null and b/docs/assets/img/blocks/cartridge_blue.png differ diff --git a/docs/assets/img/blocks/digital_tardim_interface.png b/docs/assets/img/blocks/digital_tardim_interface.png new file mode 100644 index 0000000..758588f Binary files /dev/null and b/docs/assets/img/blocks/digital_tardim_interface.png differ diff --git a/docs/assets/img/blocks/food_machine.png b/docs/assets/img/blocks/food_machine.png new file mode 100644 index 0000000..c8908bb Binary files /dev/null and b/docs/assets/img/blocks/food_machine.png differ diff --git a/docs/assets/img/blocks/fuel_storage.png b/docs/assets/img/blocks/fuel_storage.png new file mode 100644 index 0000000..e8275dd Binary files /dev/null and b/docs/assets/img/blocks/fuel_storage.png differ diff --git a/docs/assets/img/blocks/jammer.png b/docs/assets/img/blocks/jammer.png new file mode 100644 index 0000000..4b1ee16 Binary files /dev/null and b/docs/assets/img/blocks/jammer.png differ diff --git a/docs/assets/img/blocks/redstone_tardim_input.png b/docs/assets/img/blocks/redstone_tardim_input.png new file mode 100644 index 0000000..c69a389 Binary files /dev/null and b/docs/assets/img/blocks/redstone_tardim_input.png differ diff --git a/docs/assets/img/blocks/rotor.png b/docs/assets/img/blocks/rotor.png new file mode 100644 index 0000000..1d5906c Binary files /dev/null and b/docs/assets/img/blocks/rotor.png differ diff --git a/docs/assets/img/blocks/scanner.png b/docs/assets/img/blocks/scanner.png new file mode 100644 index 0000000..ab9c024 Binary files /dev/null and b/docs/assets/img/blocks/scanner.png differ diff --git a/docs/assets/img/blocks/tardim_dock.png b/docs/assets/img/blocks/tardim_dock.png new file mode 100644 index 0000000..5789b4f Binary files /dev/null and b/docs/assets/img/blocks/tardim_dock.png differ diff --git a/docs/assets/img/crafting/digital_interface.png b/docs/assets/img/crafting/digital_interface.png new file mode 100644 index 0000000..ccb2ea2 Binary files /dev/null and b/docs/assets/img/crafting/digital_interface.png differ diff --git a/docs/assets/img/crafting/redstone_input.png b/docs/assets/img/crafting/redstone_input.png new file mode 100644 index 0000000..3e9b36f Binary files /dev/null and b/docs/assets/img/crafting/redstone_input.png differ diff --git a/docs/assets/img/icon.png b/docs/assets/img/icon.png new file mode 100644 index 0000000..c95943c Binary files /dev/null and b/docs/assets/img/icon.png differ diff --git a/docs/assets/style.css b/docs/assets/style.css new file mode 100644 index 0000000..c55ba61 --- /dev/null +++ b/docs/assets/style.css @@ -0,0 +1,42 @@ +@font-face { + font-family: 'ComputerCraft'; + src: url('fonts/ComputerCraft.woff2') format('woff2'), + url('fonts/ComputerCraft.woff') format('woff'); + font-weight: 500; + font-style: normal; + font-display: swap; +} + +code { + font-family: ComputerCraft, monospace; +} + +.wy-side-nav-search { + background-color: #d2651d; +} + +.wy-side-nav-search input[type="text"] { + border-color: #d96b25; +} + +.wy-menu-vertical header, .wy-menu-vertical p.caption { + color: #e78e53; +} + +.section > h1 > img { + max-width: 15%; +} + + +.rst-content img { + image-rendering: pixelated; + image-rendering: -moz-crisp-edges; + image-rendering: crisp-edges; + width: 50px; +} + + +.section > p:nth-child(5) > img:nth-child(1), .section > p:nth-child(4) > img:nth-child(1) { + max-width: 100%; + width: 75%; +} \ No newline at end of file diff --git a/docs/blocks/food_machine.md b/docs/blocks/food_machine.md new file mode 100644 index 0000000..c8623f7 --- /dev/null +++ b/docs/blocks/food_machine.md @@ -0,0 +1,7 @@ +# ![Block model](../assets/img/blocks/food_machine.png) Food Machine +This block lets you exchange some of your TARDIM's fuel for food. + +I plan to make it work with datapacks and let you switch between different types of food at different prices. + +However, right now it is creative mode only and dispenses bread. If you want, you can add crafting recipe for it on your own, +but it is not recommended since I haven't finished it yet \ No newline at end of file diff --git a/docs/blocks/redstone_input.md b/docs/blocks/redstone_input.md new file mode 100644 index 0000000..b547683 --- /dev/null +++ b/docs/blocks/redstone_input.md @@ -0,0 +1,5 @@ +# ![Block model](../assets/img/blocks/redstone_tardim_input.png) Redstone TARDIM Input +This block acts same as other TARDIM control panels, but is activated when redstone signal is passed to it. + +## Crafting +![Crafting recipe](../assets/img/crafting/redstone_input.png) diff --git a/docs/commands.md b/docs/commands.md new file mode 100644 index 0000000..3c62528 --- /dev/null +++ b/docs/commands.md @@ -0,0 +1,22 @@ +# New TARDIM commands + +## Cloister bell +Usage - `/cloister-bell` + +Makes a loud cloister bell sound from the TV show, to signal warning or other notifications. Usage with redstone input recommended + +--- + +## List biomes +Usage - `/list-biomes <..search_query>` + +Lists all existing biomes for better experience with `/locate-biome` and parity with CC integration. + +Can be used with no parameters to get all biomes or with a search string to only show biomes that contain it in their name + +--- + +## List dimensions +Usage - `/list-dimensions` + +Lists all existing dimensions for better experience with travel and parity with CC integration. diff --git a/docs/computercraft/index.md b/docs/computercraft/index.md new file mode 100644 index 0000000..d5cbf26 --- /dev/null +++ b/docs/computercraft/index.md @@ -0,0 +1,25 @@ +# ComputerCraft compatibility +If you have ComputerCraft: Tweaked installed, +TARDIM: IC provides quite a few peripherals. + +The main one is new Digital TARDIM Interface, +which gives you complete control over your TARDIM. +However, some TARDIM blocks also receive getters for information related to them. + +## ComputerCraft for beginners +ComputerCraft adds working computers to minecraft, controlled by Lua language. +If you are new, [CC's official discord](https://discord.com/servers/minecraft-computer-mods-477910221872824320) has a lot of people who can help. +I also suggest taking a look at [Lua's website](https://www.lua.org/start.html) and [CC: Tweaked's documentaion](https://tweaked.cc) + +Please do not ask questions about ComputerCraft itself in TARDIM: IC's Discord. I am far from the most experienced user of that mod. + +## Notes about mod's peripherals +All of the peripherals throw if they are called outside a TARDIM. Only digital interface has ability to **set** data, others can only **get**. + +## Available peripherals +| Type | Description | +|-----------------------------------------------------------|----------------------------------------------------------------------------------------| +| [**Digital Interface**](peripherals/digital_interface.md) | Total control over your TARDIM. | +| [**Fuel Storage**](peripherals/fuel_storage.md) | Gives info about fuel. | +| [**TARDIM Scanner**](peripherals/tardim_scanner.md) | Gives info about TARDIM's inhabitants and things like existing biomes, online players. | +| [**Time Rotor**](peripherals/time_rotor.md) | Gives info about flight status, destination and current location. | diff --git a/docs/computercraft/peripherals/digital_interface.md b/docs/computercraft/peripherals/digital_interface.md new file mode 100644 index 0000000..2d664af --- /dev/null +++ b/docs/computercraft/peripherals/digital_interface.md @@ -0,0 +1,299 @@ +# ![Peripheral model](../../assets/img/blocks/digital_tardim_interface.png) Digital TARDIM Interface +This peripheral allows you to do basically anything any other TARDIM control panel can, but automatically. + +Attach name - `"digital_tardim_interface"` + +## Crafting +![Crafting recipe](../../assets/img/crafting/digital_interface.png) + + +## Methods + +### `getFuel()` +Get how much fuel the TARDIM has. + +**Returns** + +1. `number` The amount of fuel, from 0 to 100. Not rounded. + +--- + +### `calculateFuelForJourney()` + +Get how much fuel the TARDIM would use if you travelled to destination. + +**Returns** + +1. `number` The amount of fuel + +--- + +### `isLocked()` + +Check whether the TARDIM's doors are locked + +**Returns** + +1. `bool` Whether the doors are locked + +--- + +### `setLocked(locked)` + +Sets the TARDIM's lock + +**Parameters** + +1. locked `bool`: true to lock doors, false to unlock + +--- + +### `isInFlight()` + +Check whether the TARDIM is in flight + +**Returns** + +1. `bool` Whether the TARDIM is in flight + +--- + + +### `getTimeEnteredFlight()` + +Get UNIX timestamp of when the TARDIM entered flight + +**Returns** + +1. `number` Unix timestamp or -1 if TARDIM is landed + +--- + +### `getOwnerName()` + +Will write the given input to the linked display. + +**Returns** + +1. `string` The username of TARDIM's owner + +--- + +### `getCurrentLocation()` + +Retrieve the TARDIM's current location + +**Returns** + +1. `table` The location of the tardim: + + ``` + { + dimension = "minecraft:overworld", -- Dimension string + pos = { -- Coordinates + x = 1, + y = 2, + z = 3 + } + } + ``` + +--- + +### `getTravelLocation()` + +The same as `getCurrentLocation()` but for destination + +--- + +### `getCompanions()` + +Get all list of all companions in the TARDIM + +**Returns** + +1. `table` list of companions' names + +--- + +### `setDimension(dimension)` + +Set TARDIM's destination to a dimension + +**Parameters** + +1. dimension `string`: dimension's name e.g. "minecraft:overworld" + +--- + +### `setTravelLocation(x, y, z)` + +Set TARDIM's destination coordinates + +**Parameters** + +1. x `number`: x-axis of destination +2. y `number`: y-axis of destination +3. z `number`: z-axis of destination + +--- + + +### `home()` + +Set TARDIM's destination to roughly owner's respawn point + +--- + +### `locatePlayer(username)` + +Set TARDIM's destination to a player's coordinates + +**Parameters** + +1. username `string`: player's username. the player must be online. + +--- + +### `getOnlinePlayers()` + +Get all list of all online players + +**Returns** + +1. `table` list of players' names + +--- + +### `getDoorRotation()` + +Get current door rotation + +**Returns** + +1. `string` direction - "north"/"west"/"south"/"east" + +--- + +### `setDoorRotation(rotation)` + +Get current door rotation + +**Parameters** + +1. rotation `string` direction string - "north"/"west"/"south"/"east" + +--- + +### `toggleDoorRotation()` + +Toggle door rotation north -> east -> south -> west -> north + +--- + +### `coordAdd(axis, amount)` + +Add a number to the destination's coordinates + +**Parameters** + +1. axis `string` x/y/z +2. amount `number` how much to add/substract + +--- + +### `demat()` + +Dematerialise the TARDIM. Throws if TARDIM is in flight already. + +--- + +### `remat()` + +Re-materialise the TARDIM at the destination. + +**Throws if** + +1. TARDIM landing is obstructed +2. Not enough fuel for journey +3. TARDIM is still taking off +4. TARDIM has already landed + +--- + +### `locateBiome(biome)` + +Set destination to somewhere in a specific biome. + +**Parameters** + +1. biome `string` biome name e.g. minecraft:badlands or terralith:skylands_spring + +**Throws if** + +1. Biome has not been founded near +2. Biome name is wrong + +--- + +### `setSkin(skin)` + +Set TARDIM's exterior to a skin + +**Parameters** + +1. skin `string` exterior name e.g. "TARDIM Type 2k18" or "TARDIM Soviet Chronobox" + +**Throws if** + +1. Skin was not found + +--- + +### `getSkins()` + +Get all list of all available exteriors + +**Returns** + +1. `table` list of exteriors' names + +--- + +### `setSkin(skin)` + +Set TARDIM's exterior to a skin + +**Parameters** + +1. skin `string` exterior name e.g. "TARDIM Type 2k18" or "TARDIM Soviet Chronobox" + +--- + +### `cloisterBell()` + +Play the cloister bell sound in the exterior (originates from the peripheral block) + +**Throws if** + +1. There was an error playing the sound (unlikely) + +--- + +### `getBiomes()` + +Get all list of all existing biomes + +**Returns** + +1. `table` list of biomes' names + +--- + +### `getDimensions()` + +Get all list of all existing dimensions + +**Returns** + +1. `table` list of dimensions' names diff --git a/docs/computercraft/peripherals/fuel_storage.md b/docs/computercraft/peripherals/fuel_storage.md new file mode 100644 index 0000000..2cf95e9 --- /dev/null +++ b/docs/computercraft/peripherals/fuel_storage.md @@ -0,0 +1,23 @@ +# ![Peripheral model](../../assets/img/blocks/fuel_storage.png) Fuel Storage Block +This peripheral, attached to a TARDIM fuel storage block, gives you access to 2 fuel-related methods + +Attach name - `"tardim_fuel_storage"` + +## Methods + +### `getFuel()` +Get how much fuel the TARDIM has. + +**Returns** + +1. `number` The amount of fuel, from 0 to 100. Not rounded. + +--- + +### `calculateFuelForJourney()` + +Get how much fuel the TARDIM would use if you travelled to destination. + +**Returns** + +1. `number` The amount of fuel \ No newline at end of file diff --git a/docs/computercraft/peripherals/tardim_scanner.md b/docs/computercraft/peripherals/tardim_scanner.md new file mode 100644 index 0000000..68a64a7 --- /dev/null +++ b/docs/computercraft/peripherals/tardim_scanner.md @@ -0,0 +1,64 @@ +# ![Peripheral model](../../assets/img/blocks/scanner.png) TARDIM Scanner Block +This peripheral, attached to TARDIM's scanner block, lets you fetch some data related to world's environment + +Attach name - `"tardim_scanner"` + +## Methods + +### `getOwnerName()` + +Will write the given input to the linked display. + +**Returns** + +1. `string` The username of TARDIM's owner + +--- + +### `getCompanions()` + +Get all list of all companions in the TARDIM + +**Returns** + +1. `table` list of companions' names + +--- + +### `getOnlinePlayers()` + +Get all list of all online players + +**Returns** + +1. `table` list of players' names + +--- + +### `getSkins()` + +Get all list of all available exteriors + +**Returns** + +1. `table` list of exteriors' names + +--- + +### `getBiomes()` + +Get all list of all existing biomes + +**Returns** + +1. `table` list of biomes' names + +--- + +### `getDimensions()` + +Get all list of all existing dimensions + +**Returns** + +1. `table` list of dimensions' names diff --git a/docs/computercraft/peripherals/time_rotor.md b/docs/computercraft/peripherals/time_rotor.md new file mode 100644 index 0000000..6df4669 --- /dev/null +++ b/docs/computercraft/peripherals/time_rotor.md @@ -0,0 +1,52 @@ +# ![Peripheral model](../../assets/img/blocks/rotor.png) Rotor Block +This peripheral, attached to TARDIM's time rotor, allows you to get info about TARDIM's flight status. + +Attach name - `"tardim_rotor"` + +## Methods + +### `isInFlight()` + +Check whether the TARDIM is in flight + +**Returns** + +1. `bool` Whether the TARDIM is in flight + +--- + + +### `getTimeEnteredFlight()` + +Get UNIX timestamp of when the TARDIM entered flight + +**Returns** + +1. `number` Unix timestamp or -1 if TARDIM is landed + +--- + +### `getCurrentLocation()` + +Retrieve the TARDIM's current location + +**Returns** + +1. `table` The location of the tardim: + + ``` + { + dimension = "minecraft:overworld", -- Dimension string + pos = { -- Coordinates + x = 1, + y = 2, + z = 3 + } + } + ``` + +--- + +### `getTravelLocation()` + +The same as `getCurrentLocation()` but for destination diff --git a/docs/create/index.md b/docs/create/index.md new file mode 100644 index 0000000..44949c5 --- /dev/null +++ b/docs/create/index.md @@ -0,0 +1,3 @@ +# Create compatibility + +This is not yet implemented due to lack of Create Fabric for 1.20. However, I have a few working 1.19.2 display sources that I intend to add when Create is out. \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..d192106 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,4 @@ +## Welcome to TARDIM: IC docs! +This mod aims to improve TARDIM by adding new features and integration with other mods such as ComputerCraft or Create. + +Please note that v1.2 is a big jump in terms of rewrites and new features. Therefore, not all features are available yet. If you see errors in the docs, feel free to point it out in Discord. \ No newline at end of file diff --git a/docs/mixins.md b/docs/mixins.md new file mode 100644 index 0000000..2c587b7 --- /dev/null +++ b/docs/mixins.md @@ -0,0 +1,6 @@ +# Changes to vanilla TARDIM + +## New fuel system +With TARDIM: In Control, you can insert any furnace-compatible fuel into the fuel storage block without having to make a datapack for it. + +Also, buckets will no longer disappear from hopper, and only their contents will be taken. \ No newline at end of file diff --git a/docs/planned.md b/docs/planned.md new file mode 100644 index 0000000..e77c694 --- /dev/null +++ b/docs/planned.md @@ -0,0 +1,6 @@ +# Planned features +I do not guarantee these will be added or have a timeline, but here are features I designed and wish to implement in the future + +* ![Block model](assets/img/blocks/tardim_dock.png) TARDIM Dock - A block that lets you get to a location by a simple ID and handles location and rotation for you. This will also let TARDIMs land on Create: Aeronautics contraptions once that mod is out +* ![Item texture](assets/img/blocks/cartridge_blue.png) Location cartridges - No code way to save location to an item and travel there whenever you want. +* ![Wearable model](assets/img/blocks/jammer.png) Personal location jammer - Wearable item that lets you prevent others from locking onto your position. diff --git a/docs/recipes.md b/docs/recipes.md new file mode 100644 index 0000000..e69de29 diff --git a/fabric/build.gradle b/fabric/build.gradle new file mode 100644 index 0000000..d79e2ec --- /dev/null +++ b/fabric/build.gradle @@ -0,0 +1,72 @@ +plugins { + id 'java' + id 'idea' + id 'maven-publish' + id 'fabric-loom' +} +base { + archivesName = "${mod_name}-fabric-${minecraft_version}" +} +dependencies { + minecraft "com.mojang:minecraft:${minecraft_version}" + mappings loom.officialMojangMappings() + modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}" + implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1' + implementation project(":common") + + modImplementation("curse.maven:tardim-531315:4668945") +// modCompileOnly("com.simibubi.create:create-fabric-1.20.1:0.5.1-d-build.1118+mc1.20.1") + modCompileOnly("cc.tweaked:cc-tweaked-$minecraft_version-fabric-api:$cc_version") +} + +loom { + if (project(":common").file("src/main/resources/${mod_id}.accesswidener").exists()) { + accessWidenerPath.set(project(":common").file("src/main/resources/${mod_id}.accesswidener")) + } + mixin { + defaultRefmapName.set("${mod_id}.refmap.json") + } + runs { + client { + client() + setConfigName("Fabric Client") + ideConfigGenerated(true) + runDir("run") + } + server { + server() + setConfigName("Fabric Server") + ideConfigGenerated(true) + runDir("run") + } + } +} + +tasks.withType(JavaCompile).configureEach { + source(project(":common").sourceSets.main.allSource) +} +tasks.withType(Javadoc).configureEach { + source(project(":common").sourceSets.main.allJava) +} +tasks.named("sourcesJar", Jar) { + from(project(":common").sourceSets.main.allSource) +} + +processResources { + from project(":common").sourceSets.main.resources +} + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId base.archivesName.get() + from components.java + } + } + repositories { + maven { + url "file://" + System.getenv("local_maven") + } + } +} diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/TardimInControl.java b/fabric/src/main/java/su/a71/tardim_ic/TardimInControl.java similarity index 68% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/TardimInControl.java rename to fabric/src/main/java/su/a71/tardim_ic/TardimInControl.java index 785cf51..2bc3625 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/TardimInControl.java +++ b/fabric/src/main/java/su/a71/tardim_ic/TardimInControl.java @@ -1,9 +1,10 @@ -package su.a71.tardim_ic.tardim_ic; +package su.a71.tardim_ic; import net.fabricmc.api.ModInitializer; +import su.a71.tardim_ic.tardim_ic.registration.Registration; public class TardimInControl implements ModInitializer { - + @Override public void onInitialize() { Registration.register(); diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/food_machine/FoodMachineBlock.java b/fabric/src/main/java/su/a71/tardim_ic/blocks/food_machine/FoodMachineBlock.java similarity index 72% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/food_machine/FoodMachineBlock.java rename to fabric/src/main/java/su/a71/tardim_ic/blocks/food_machine/FoodMachineBlock.java index fb1565e..de2869f 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/food_machine/FoodMachineBlock.java +++ b/fabric/src/main/java/su/a71/tardim_ic/blocks/food_machine/FoodMachineBlock.java @@ -1,19 +1,13 @@ -package su.a71.tardim_ic.tardim_ic.blocks.food_machine; +package su.a71.tardim_ic.blocks.food_machine; import com.swdteam.tardim.common.init.TRDDimensions; import com.swdteam.tardim.common.init.TRDSounds; -import com.swdteam.tardim.network.NetworkHandler; -import com.swdteam.tardim.network.PacketOpenEditGui; import com.swdteam.tardim.tardim.TardimData; import com.swdteam.tardim.tardim.TardimManager; -import com.swdteam.tardim.tileentity.TileEntityBaseTardimPanel; -import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.game.DebugPackets; -import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -29,27 +23,21 @@ import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DirectionProperty; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.NotNull; -import su.a71.tardim_ic.tardim_ic.Registration; -import su.a71.tardim_ic.tardim_ic.blocks.redstone_input.RedstoneInputTileEntity; -import su.a71.tardim_ic.tardim_ic.utils.FakePlayer; +import su.a71.tardim_ic.tardim_ic.registration.Registration; import javax.annotation.Nullable; -import static net.minecraft.world.level.block.state.properties.BlockStateProperties.HORIZONTAL_FACING; - public class FoodMachineBlock extends HorizontalDirectionalBlock implements EntityBlock { public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; public FoodMachineBlock() { - super(FabricBlockSettings.of(Material.METAL).strength(2, 4).noOcclusion()); // No occlusion? + super(Properties.of().strength(2, 4).noOcclusion().mapColor(MapColor.METAL)); // No occlusion? this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH)); - //this.registerDefaultState(this.stateDefinition.any().setValue(HORIZONTAL_FACING, Direction.NORTH)); } public BlockState getStateForPlacement(BlockPlaceContext $$0) { @@ -63,7 +51,7 @@ public class FoodMachineBlock extends HorizontalDirectionalBlock implements Enti @Nullable @Override public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) { - return Registration.FOOD_MACHINE_TILEENTITY.create(pos, state); + return Registration.FOOD_MACHINE_BE.create(pos, state); } @Override @@ -71,17 +59,16 @@ public class FoodMachineBlock extends HorizontalDirectionalBlock implements Enti if (!w.isClientSide) { w.playSound(null, blockPos, TRDSounds.TARDIM_BEEP, SoundSource.BLOCKS, 0.3F, 0.5F); BlockEntity be = w.getBlockEntity(blockPos); - if (be instanceof FoodMachineTileEntity && w.dimension() == TRDDimensions.TARDIS) { + if (be instanceof FoodMachineBlockEntity && w.dimension() == TRDDimensions.TARDIS) { TardimData data = TardimManager.getFromPos(blockPos); if (data != null && data.hasPermission(player)) { - if (data.getFuel() >= 0.05) { - data.setFuel(data.getFuel() - 0.05); // Remove some fuel in exchange for food + if (data.getFuel() >= 0.2) { + data.setFuel(data.getFuel() - 0.2); // Remove some fuel in exchange for food ItemEntity food = new ItemEntity(EntityType.ITEM, w); // Select type of food here food.setItem(new ItemStack(Items.BREAD, 1)); - food.setPos(Vec3.atCenterOf(blockPos).add(new Vec3(0, 0.2, 0))); w.addFreshEntity(food); } else { diff --git a/fabric/src/main/java/su/a71/tardim_ic/blocks/food_machine/FoodMachineBlockEntity.java b/fabric/src/main/java/su/a71/tardim_ic/blocks/food_machine/FoodMachineBlockEntity.java new file mode 100644 index 0000000..4f13e0f --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/blocks/food_machine/FoodMachineBlockEntity.java @@ -0,0 +1,36 @@ +package su.a71.tardim_ic.blocks.food_machine; + +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import su.a71.tardim_ic.tardim_ic.registration.Registration; + +public class FoodMachineBlockEntity extends BlockEntity { + public int curr_food_index; + + public FoodMachineBlockEntity(BlockPos pos, BlockState state) { + super(Registration.FOOD_MACHINE_BE, pos, state); + this.curr_food_index = 0; + } + + public BlockPos getPos() { + return this.worldPosition; + } + + + @Override + public void saveAdditional(CompoundTag tag) { + tag.putInt("curr_food_index", curr_food_index); + //tag.putBoolean("is_powered", isPowered); + super.saveAdditional(tag); + } + + @Override + public void load(CompoundTag tag) { + super.load(tag); + curr_food_index = tag.getInt("curr_food_index"); + //lastPlayer = tag.getUUID("last_player"); + //event.addListener(new FuelMapReloadListener(GSON, "tardim_fuel")); + } +} diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/redstone_input/RedstoneInputBlock.java b/fabric/src/main/java/su/a71/tardim_ic/blocks/redstone_input/RedstoneInputBlock.java similarity index 75% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/redstone_input/RedstoneInputBlock.java rename to fabric/src/main/java/su/a71/tardim_ic/blocks/redstone_input/RedstoneInputBlock.java index 99ed818..55c0a7b 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/redstone_input/RedstoneInputBlock.java +++ b/fabric/src/main/java/su/a71/tardim_ic/blocks/redstone_input/RedstoneInputBlock.java @@ -1,4 +1,4 @@ -package su.a71.tardim_ic.tardim_ic.blocks.redstone_input; +package su.a71.tardim_ic.blocks.redstone_input; import com.swdteam.tardim.common.block.BlockBaseTardimPanel; import com.swdteam.tardim.common.init.TRDDimensions; @@ -26,24 +26,25 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.NotNull; -import su.a71.tardim_ic.tardim_ic.Registration; -import su.a71.tardim_ic.tardim_ic.utils.FakePlayer; +import su.a71.tardim_ic.tardim_ic.registration.Registration; +import su.a71.tardim_ic.utils.FakePlayer; import javax.annotation.Nullable; public class RedstoneInputBlock extends BlockBaseTardimPanel implements EntityBlock { + public RedstoneInputBlock() { - super(FabricBlockSettings.of(Material.METAL).strength(2, 4)); // No occlusion? + super(FabricBlockSettings.create().strength(2, 4).mapColor(MapColor.TERRACOTTA_ORANGE)); // No occlusion? this.setDefaultState((BlockState)this.getDefaultState().with(ON, false)); } @Nullable @Override public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) { - return Registration.REDSTONE_TARDIM_INPUT_TILEENTITY.create(pos, state); + return Registration.REDSTONE_INPUT_BE.create(pos, state); } @Override @@ -53,10 +54,10 @@ public class RedstoneInputBlock extends BlockBaseTardimPanel implements EntityBl w.playSound(null, blockPos, TRDSounds.TARDIM_BEEP, SoundSource.BLOCKS, 0.3F, 0.5F); BlockEntity be = w.getBlockEntity(blockPos); - if (be instanceof RedstoneInputTileEntity && w.dimension() == TRDDimensions.TARDIS) { + if (be instanceof RedstoneInputBlockEntity && w.dimension() == TRDDimensions.TARDIS) { TardimData data = TardimManager.getFromPos(blockPos); if (data != null && data.hasPermission(player)) { - ((RedstoneInputTileEntity) be).lastPlayer = player.getGameProfile().getId(); + ((RedstoneInputBlockEntity) be).lastPlayer = player.getGameProfile().getId(); NetworkHandler.sendTo((ServerPlayer)player, new PacketOpenEditGui(blockPos, 1)); return InteractionResult.CONSUME; } @@ -78,25 +79,26 @@ public class RedstoneInputBlock extends BlockBaseTardimPanel implements EntityBl DebugPackets.sendNeighborsUpdatePacket(level, blockPos); BlockEntity be = level.getBlockEntity(blockPos); - if (!(be instanceof RedstoneInputTileEntity)) { + if (!(be instanceof RedstoneInputBlockEntity)) { return; } // get redstone signal Direction direction = blockState.getValue(FACING); int redstoneSignal = level.getSignal(blockPos, direction); - if (redstoneSignal > 0 && !((RedstoneInputTileEntity) be).isPowered) { - ((RedstoneInputTileEntity) be).isPowered = true; + if (redstoneSignal > 0 && !((RedstoneInputBlockEntity) be).isPowered) { + ((RedstoneInputBlockEntity) be).isPowered = true; if (level.dimension() == TRDDimensions.TARDIS) { TardimData data = TardimManager.getFromPos(blockPos); - if (data != null && !level.isClientSide && ((RedstoneInputTileEntity) be).lastPlayer != null) { + if (data != null && !level.isClientSide && ((RedstoneInputBlockEntity) be).lastPlayer != null) { if (((TileEntityBaseTardimPanel)be).hasCommand()) { - ((TileEntityBaseTardimPanel)be).execute(new FakePlayer(level, blockPos, ((RedstoneInputTileEntity) be).lastPlayer)); + ((TileEntityBaseTardimPanel)be).execute(new FakePlayer(level, blockPos, ((RedstoneInputBlockEntity) be).lastPlayer)); } } } - } else if (redstoneSignal == 0 && ((RedstoneInputTileEntity) be).isPowered) - ((RedstoneInputTileEntity) be).isPowered = false; + } else if (redstoneSignal == 0 && ((RedstoneInputBlockEntity) be).isPowered) { + ((RedstoneInputBlockEntity) be).isPowered = false; + } } } \ No newline at end of file diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/redstone_input/RedstoneInputTileEntity.java b/fabric/src/main/java/su/a71/tardim_ic/blocks/redstone_input/RedstoneInputBlockEntity.java similarity index 71% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/redstone_input/RedstoneInputTileEntity.java rename to fabric/src/main/java/su/a71/tardim_ic/blocks/redstone_input/RedstoneInputBlockEntity.java index f75390c..1451649 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/blocks/redstone_input/RedstoneInputTileEntity.java +++ b/fabric/src/main/java/su/a71/tardim_ic/blocks/redstone_input/RedstoneInputBlockEntity.java @@ -1,21 +1,21 @@ -package su.a71.tardim_ic.tardim_ic.blocks.redstone_input; +package su.a71.tardim_ic.blocks.redstone_input; import com.swdteam.tardim.tileentity.TileEntityBaseTardimPanel; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.block.state.BlockState; -import su.a71.tardim_ic.tardim_ic.Registration; +import su.a71.tardim_ic.tardim_ic.registration.Registration; import java.util.UUID; -public class RedstoneInputTileEntity extends TileEntityBaseTardimPanel { +public class RedstoneInputBlockEntity extends TileEntityBaseTardimPanel { public boolean isPowered = false; public UUID lastPlayer = null; - public RedstoneInputTileEntity(BlockPos pos, BlockState state) { - super(Registration.REDSTONE_TARDIM_INPUT_TILEENTITY, pos, state); + public RedstoneInputBlockEntity(BlockPos pos, BlockState state) { + super(Registration.REDSTONE_INPUT_BE, pos, state); } public BlockPos getPos() { diff --git a/fabric/src/main/java/su/a71/tardim_ic/blocks/roundels/roundels.txt b/fabric/src/main/java/su/a71/tardim_ic/blocks/roundels/roundels.txt new file mode 100644 index 0000000..b8da5b9 --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/blocks/roundels/roundels.txt @@ -0,0 +1 @@ +Do we need more roundels? \ No newline at end of file diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandCloisterBell.java b/fabric/src/main/java/su/a71/tardim_ic/command/CommandCloisterBell.java similarity index 90% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandCloisterBell.java rename to fabric/src/main/java/su/a71/tardim_ic/command/CommandCloisterBell.java index eb02775..2fee5ef 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandCloisterBell.java +++ b/fabric/src/main/java/su/a71/tardim_ic/command/CommandCloisterBell.java @@ -1,4 +1,4 @@ -package su.a71.tardim_ic.tardim_ic.command; +package su.a71.tardim_ic.command; import com.swdteam.tardim.common.command.tardim.CommandTardimBase; import com.swdteam.tardim.common.command.tardim.ICommand; @@ -9,8 +9,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.sounds.SoundSource; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; +import su.a71.tardim_ic.tardim_ic.registration.Registration; -import su.a71.tardim_ic.tardim_ic.Registration; /* This command transmits the cloister bell sound in a big enough radius that you could hear it in any reasonably sized interior. @@ -23,12 +23,12 @@ public class CommandCloisterBell implements ICommand { if (data != null) { if (data.hasPermission(player)) { try { - Level lvl = player.getLevel(); + Level lvl = player.level(); if (!lvl.isClientSide) { lvl.playSound( null, pos, - Registration.CLOISTER_SOUND_EVENT, + Registration.CLOISTER_BELL, SoundSource.BLOCKS, 1.5f, 1f diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CommandInit.java b/fabric/src/main/java/su/a71/tardim_ic/command/CommandInit.java similarity index 55% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CommandInit.java rename to fabric/src/main/java/su/a71/tardim_ic/command/CommandInit.java index 406069b..c6b065a 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CommandInit.java +++ b/fabric/src/main/java/su/a71/tardim_ic/command/CommandInit.java @@ -1,16 +1,15 @@ -package su.a71.tardim_ic.tardim_ic.registration; - +package su.a71.tardim_ic.command; import com.swdteam.tardim.common.init.CommandManager; -import su.a71.tardim_ic.tardim_ic.command.CommandCloisterBell; -import su.a71.tardim_ic.tardim_ic.command.CommandListBiomes; -import su.a71.tardim_ic.tardim_ic.command.CommandListDimensions; - public class CommandInit { public static void init() { + CommandManager.register(new CommandCloisterBell()); CommandManager.register(new CommandListBiomes()); CommandManager.register(new CommandListDimensions()); - CommandManager.register(new CommandCloisterBell()); + } + + public static void addCC() { + CommandManager.register(new CommandModemTransmit()); } } diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/blocks/digital_interface/DigitalInterfaceBlock.java b/fabric/src/main/java/su/a71/tardim_ic/computercraft_compat/digital_interface/DigitalInterfaceBlock.java similarity index 64% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/blocks/digital_interface/DigitalInterfaceBlock.java rename to fabric/src/main/java/su/a71/tardim_ic/computercraft_compat/digital_interface/DigitalInterfaceBlock.java index 6aec966..9365b30 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/blocks/digital_interface/DigitalInterfaceBlock.java +++ b/fabric/src/main/java/su/a71/tardim_ic/computercraft_compat/digital_interface/DigitalInterfaceBlock.java @@ -1,13 +1,12 @@ -package su.a71.tardim_ic.tardim_ic.computercraft_compat.blocks.digital_interface; +package su.a71.tardim_ic.computercraft_compat.digital_interface; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import org.jetbrains.annotations.NotNull; -import su.a71.tardim_ic.tardim_ic.Registration; import su.a71.tardim_ic.tardim_ic.registration.ComputerCraftCompat; import javax.annotation.Nullable; @@ -16,12 +15,12 @@ import javax.annotation.Nullable; public class DigitalInterfaceBlock extends Block implements EntityBlock { public DigitalInterfaceBlock() { - super(Properties.of(Material.METAL).strength(2, 4).noOcclusion()); + super(Properties.of().strength(2, 4).noOcclusion().mapColor(MapColor.METAL)); } @Nullable @Override public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) { - return ComputerCraftCompat.DIGITAL_TARDIM_INTERFACE_TILEENTITY.create(pos, state); + return ComputerCraftCompat.DIGITAL_INTERFACE_BE.create(pos, state); } } diff --git a/fabric/src/main/java/su/a71/tardim_ic/computercraft_compat/digital_interface/DigitalInterfaceTileEntity.java b/fabric/src/main/java/su/a71/tardim_ic/computercraft_compat/digital_interface/DigitalInterfaceTileEntity.java new file mode 100644 index 0000000..fddf55a --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/computercraft_compat/digital_interface/DigitalInterfaceTileEntity.java @@ -0,0 +1,14 @@ +package su.a71.tardim_ic.computercraft_compat.digital_interface; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; + +import static su.a71.tardim_ic.tardim_ic.registration.ComputerCraftCompat.DIGITAL_INTERFACE_BE; + + +public class DigitalInterfaceTileEntity extends BlockEntity { + public DigitalInterfaceTileEntity(BlockPos pos, BlockState state) { + super(DIGITAL_INTERFACE_BE, pos, state); + } +} diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/DigitalInterfacePeripheral.java b/fabric/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/DigitalInterfacePeripheral.java similarity index 85% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/DigitalInterfacePeripheral.java rename to fabric/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/DigitalInterfacePeripheral.java index c4d3b70..3f47783 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/computercraft_compat/peripherals/DigitalInterfacePeripheral.java +++ b/fabric/src/main/java/su/a71/tardim_ic/computercraft_compat/peripherals/DigitalInterfacePeripheral.java @@ -1,11 +1,9 @@ -package su.a71.tardim_ic.tardim_ic.computercraft_compat.peripherals; +package su.a71.tardim_ic.computercraft_compat.peripherals; import com.swdteam.tardim.common.command.tardim.CommandTravel; -import com.swdteam.tardim.common.data.DimensionMapReloadListener; import com.swdteam.tardim.common.init.TRDSounds; import com.swdteam.tardim.common.init.TardimRegistry; import com.swdteam.tardim.common.item.ItemTardim; -import com.swdteam.tardim.main.Tardim; import com.swdteam.tardim.tardim.TardimData; import com.swdteam.tardim.tardim.TardimData.Location; import com.swdteam.tardim.tardim.TardimManager; @@ -20,6 +18,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; @@ -31,34 +30,28 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.phys.Vec3; -import su.a71.tardim_ic.tardim_ic.Registration; -import su.a71.tardim_ic.tardim_ic.computercraft_compat.FakeTardimPeripheralTileEntity; -import su.a71.tardim_ic.tardim_ic.utils.FakePlayer; -import static su.a71.tardim_ic.tardim_ic.Registration.LOCATION_JAMMER; +import su.a71.tardim_ic.computercraft_compat.digital_interface.DigitalInterfaceBlock; +import su.a71.tardim_ic.computercraft_compat.entity.FakeTardimPeripheralTileEntity; +import su.a71.tardim_ic.tardim_ic.registration.Registration; +import su.a71.tardim_ic.utils.FakePlayer; -import javax.annotation.Nonnull; import java.util.*; -public class DigitalInterfacePeripheral extends TardimPeripheral implements IPeripheral { +public class DigitalInterfacePeripheral extends TardimPeripheral implements IPeripheral { /** * @param tileEntity the tile entity of this peripheral * @hidden */ public DigitalInterfacePeripheral(FakeTardimPeripheralTileEntity tileEntity) { - super(tileEntity); + super(tileEntity, "digital_tardim_interface", (DigitalInterfaceBlock) tileEntity.getBlock()); } - /** Setting name for the peripheral. A computer will see it as "digital_tardim_interface_n" - * @hidden - */ - @Nonnull - @Override - public String getType() { return "digital_tardim_interface"; } - // Peripheral methods =============================================================== /** @@ -158,7 +151,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer */ @LuaFunction(mainThread = true) public final ObjectLuaTable getCurrentLocation() throws LuaException { - Location loc = getTardimData().getCurrentLocation(); + Location loc = getTardimData().getCurrentLocation(); return new ObjectLuaTable(Map.of( "dimension", loc.getLevel().location().toString(), "pos", new ObjectLuaTable(Map.of( @@ -183,7 +176,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer */ @LuaFunction(mainThread = true) public final ObjectLuaTable getTravelLocation() throws LuaException { - TardimData data = getTardimData(); + TardimData data = getTardimData(); if (data.getTravelLocation() == null) { data.setTravelLocation(data.getCurrentLocation()); } @@ -205,12 +198,12 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer */ @LuaFunction(mainThread = true) public final ObjectLuaTable getCompanions() throws LuaException { - TardimData data = getTardimData(); + TardimData data = getTardimData(); Map companions = new HashMap<>(); - for (int i = 0; i < data.getCompanions().size(); i++) { - companions.put(i + 1, data.getCompanions().get(i).getUsername()); - } - return new ObjectLuaTable(companions); + for (int i = 0; i < data.getCompanions().size(); i++) { + companions.put(i + 1, data.getCompanions().get(i).getUsername()); + } + return new ObjectLuaTable(companions); } /** @@ -218,7 +211,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer * SWDteam pls fix * @hidden */ - private static boolean isValidPathTemp(String s) { + private boolean isValidPathTemp(String s) { for(int i = 0; i < s.length(); ++i) { if (!CommandTravel.validPathChar(s.charAt(i))) { return false; @@ -227,6 +220,32 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer return true; } + /** + * DimensionMapReloadListener.toTitleCase is unavailable so we reverse engineer it! :D + * Fabric... pls fix? + * @hidden + */ + private String toTitleCase(String input) { + StringBuilder titleCase = new StringBuilder(input.length()); + boolean nextTitleCase = true; + char[] var3 = input.toCharArray(); + int var4 = var3.length; + + for(int var5 = 0; var5 < var4; ++var5) { + char c = var3[var5]; + if (Character.isSpaceChar(c)) { + nextTitleCase = true; + } else if (nextTitleCase) { + c = Character.toTitleCase(c); + nextTitleCase = false; + } + + titleCase.append(c); + } + + return titleCase.toString(); + } + /** * Set dimension for the TARDIM to travel to *

@@ -237,10 +256,10 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer */ @LuaFunction(mainThread = true) public final void setDimension(String dimension) throws LuaException { - TardimData data = getTardimData(); + TardimData data = getTardimData(); String key = dimension; - dimension = DimensionMapReloadListener.toTitleCase(dimension); + dimension = toTitleCase(dimension); if (TardimManager.DIMENSION_MAP.containsKey(dimension)) { key = (String)TardimManager.DIMENSION_MAP.get(dimension); } else { @@ -250,7 +269,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer if (!isValidPathTemp(key)) { throw new LuaException("Invalid dimension"); } else { - ResourceKey dim = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(dimension)); + ResourceKey dim = ResourceKey.create(Registries.DIMENSION, new ResourceLocation(dimension)); if (data.getTravelLocation() == null) { data.setTravelLocation(new Location(data.getCurrentLocation())); } @@ -284,7 +303,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer if (this.getTileEntity().getLevel().isClientSide()) { return; } - TardimData data = getTardimData(); + TardimData data = getTardimData(); UUID uuid = data.getOwner(); String username = data.getOwnerName(); @@ -321,21 +340,22 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer PlayerList playerList = this.getTileEntity().getLevel().getServer().getPlayerList(); ServerPlayer player = playerList.getPlayerByName(username); - if (player == null) { - throw new LuaException("Player not found"); - } - - for (ItemStack armour : player.getArmorSlots()) { - if (armour.is(LOCATION_JAMMER)) { - throw new LuaException("Player location jammed"); - }; + if (player == null) { + throw new LuaException("Player not found"); } - ResourceKey dim = player.getCommandSenderWorld().dimension(); - BlockPos pos = player.blockPosition(); +// for (ItemStack armour : player.getArmorSlots()) { +//// if (armour.is(PERSONAL_JAMMER)) { +//// throw new LuaException("Player location jammed"); +//// }; +// // TODO: Re-add +// } - setDimension(dim.location().toString()); - setTravelLocation(pos.getX(), pos.getY(), pos.getZ()); + ResourceKey dim = player.getCommandSenderWorld().dimension(); + BlockPos pos = player.blockPosition(); + + setDimension(dim.location().toString()); + setTravelLocation(pos.getX(), pos.getY(), pos.getZ()); } /** @@ -349,13 +369,13 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer return null; } - PlayerList playerList = this.getTileEntity().getLevel().getServer().getPlayerList(); + PlayerList playerList = this.getTileEntity().getLevel().getServer().getPlayerList(); Map players = new HashMap<>(); for (int i = 0; i < playerList.getPlayers().size(); i++) { players.put(i + 1, playerList.getPlayers().get(i).getGameProfile().getName()); } - return new ObjectLuaTable(players); + return new ObjectLuaTable(players); } /** @@ -364,8 +384,8 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer */ @LuaFunction(mainThread = true) public final String getDoorRotation() throws LuaException { - TardimData data = getTardimData(); - Direction rotation = data.getTravelLocation().getFacing(); + TardimData data = getTardimData(); + Direction rotation = data.getTravelLocation().getFacing(); switch (rotation) { case NORTH -> { return "north"; @@ -391,7 +411,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer */ @LuaFunction(mainThread = true) public final void setDoorRotation(String rotation) throws LuaException { - TardimData data = getTardimData(); + TardimData data = getTardimData(); switch (rotation) { case "north" -> data.getTravelLocation().setFacing(Direction.NORTH); case "east" -> data.getTravelLocation().setFacing(Direction.EAST); @@ -408,7 +428,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer */ @LuaFunction(mainThread = true) public final void toggleDoorRotation() throws LuaException { - TardimData data = getTardimData(); + TardimData data = getTardimData(); if (data.getTravelLocation() == null) { data.setTravelLocation(new Location(data.getCurrentLocation())); } @@ -435,18 +455,18 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer */ @LuaFunction(mainThread = true) public final void coordAdd(String axis, int amount) throws LuaException { - TardimData data = getTardimData(); - if (data.getTravelLocation() == null) { - data.setTravelLocation(new Location(data.getCurrentLocation())); - } + TardimData data = getTardimData(); + if (data.getTravelLocation() == null) { + data.setTravelLocation(new Location(data.getCurrentLocation())); + } - Location location = data.getTravelLocation(); - switch (axis) { - case "x" -> location.addPosition(amount, 0, 0); + Location location = data.getTravelLocation(); + switch (axis) { + case "x" -> location.addPosition(amount, 0, 0); case "y" -> location.addPosition(0, amount, 0); case "z" -> location.addPosition(0, 0, amount); default -> throw new LuaException("Invalid axis"); - } + } } /** @@ -458,7 +478,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer return; } - TardimData data = getTardimData(); + TardimData data = getTardimData(); if (data.isInFlight()) { throw new LuaException("TARDIM is already in flight"); @@ -467,17 +487,35 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer ServerLevel level = this.tileEntity.getLevel().getServer().getLevel(loc.getLevel()); ItemTardim.destroyTardim(level, loc.getPos(), Direction.NORTH); data.setInFlight(true); - if (data.getTravelLocation() == null) { + if (data.getTravelLocation() == null) { data.setTravelLocation(new Location(data.getCurrentLocation())); } // TODO: This is a horrendous way of doing this. Please fix. String level_str = "tardim:tardis_dimension"; - this.tileEntity.getLevel().getServer().getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(level_str))).playSound(null, this.tileEntity.getPos(), (SoundEvent) TRDSounds.TARDIM_TAKEOFF, SoundSource.AMBIENT, 1.0F, 1.0F); + this.tileEntity.getLevel().getServer().getLevel(ResourceKey.create(Registries.DIMENSION, new ResourceLocation(level_str))).playSound(null, this.tileEntity.getPos(), (SoundEvent) TRDSounds.TARDIM_TAKEOFF, SoundSource.AMBIENT, 1.0F, 1.0F); data.save(); } + /** + * Way to use function from Tardim (ModInitializer) + * 1WTC pls fix + * @hidden + */ + public static boolean isPosValid(Level level, BlockPos pos) { + return validPos(level, pos) && validPos(level, pos.above()) && validPos(level, pos.above().above()) && validPos(level, pos.north()) && validPos(level, pos.north().above()) && validPos(level, pos.south()) && validPos(level, pos.south().above()) && validPos(level, pos.east()) && validPos(level, pos.east().above()) && validPos(level, pos.west()) && validPos(level, pos.west().above()); + } + + /** + * @see DigitalInterfacePeripheral#isPosValid(Level, BlockPos) + * @hidden + */ + private static boolean validPos(Level l, BlockPos pos) { + BlockState blockstate = l.getBlockState(pos); + return !blockstate.canBeReplaced() && blockstate.getBlock() != Blocks.SNOW ? blockstate.isAir() : true; + } + /** * Materialize the TARDIM at the destination *

@@ -554,7 +592,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer if (Block.canSupportRigidBlock(level, landingPosButBetter.below())) { loc.setPosition(landingPosButBetter.getX(), landingPosButBetter.getY(), landingPosButBetter.getZ()); - if (Tardim.isPosValid(level, loc.getPos())) { + if (isPosValid(level, loc.getPos())) { TardimRegistry.TardimBuilder builder = TardimRegistry.getTardimBuilder(data.getTardimID()); builder.buildTardim(level, loc.getPos(), data.getTravelLocation().getFacing(), data.getId()); data.setCurrentLocation(data.getTravelLocation()); @@ -571,7 +609,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer // } String level_str = "tardim:tardis_dimension"; - this.tileEntity.getLevel().getServer().getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(level_str))).playSound(null, this.tileEntity.getPos(), (SoundEvent) TRDSounds.TARDIM_LANDING, SoundSource.AMBIENT, 1.0F, 1.0F); + this.tileEntity.getLevel().getServer().getLevel(ResourceKey.create(Registries.DIMENSION, new ResourceLocation(level_str))).playSound(null, this.tileEntity.getPos(), (SoundEvent) TRDSounds.TARDIM_LANDING, SoundSource.AMBIENT, 1.0F, 1.0F); } else { throw new LuaException("TARDIM landing obstructed. Aborting..."); @@ -607,7 +645,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer Optional biome = this.tileEntity.getLevel().getServer() .registryAccess() - .registryOrThrow(Registry.BIOME_REGISTRY) + .registryOrThrow(Registries.BIOME) .getOptional(new ResourceLocation(biome_str)); if (biome != null && biome.isPresent()) { if (data.getTravelLocation() == null) { @@ -742,7 +780,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer lvl.playSound( null, this.tileEntity.getPos(), - Registration.CLOISTER_SOUND_EVENT, + Registration.CLOISTER_BELL, SoundSource.BLOCKS, 1.5f, 1f @@ -761,7 +799,7 @@ public class DigitalInterfacePeripheral extends TardimPeripheral implements IPer @LuaFunction(mainThread = true) public final ObjectLuaTable getBiomes() throws LuaException { Map biomes = new HashMap<>(); - Registry biomeRegistry = tileEntity.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); + Registry biomeRegistry = tileEntity.getLevel().registryAccess().registryOrThrow(Registries.BIOME); Iterator biome_it = biomeRegistry.keySet().iterator(); int i = 0; while (biome_it.hasNext()) { diff --git a/fabric/src/main/java/su/a71/tardim_ic/display_source/cartridge_loader/temp_ideas.txt b/fabric/src/main/java/su/a71/tardim_ic/display_source/cartridge_loader/temp_ideas.txt new file mode 100644 index 0000000..71ed5da --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/display_source/cartridge_loader/temp_ideas.txt @@ -0,0 +1,3 @@ +Display sources for the cartridge loader + +* Inserted X/Y/Z/Dimension \ No newline at end of file diff --git a/fabric/src/main/java/su/a71/tardim_ic/display_source/dock/temp_ideas.txt b/fabric/src/main/java/su/a71/tardim_ic/display_source/dock/temp_ideas.txt new file mode 100644 index 0000000..90d344c --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/display_source/dock/temp_ideas.txt @@ -0,0 +1,5 @@ +Display sources for the docking station: + +* Owner of docked TARDIM +* Lock status +* Docked TARDIM's companion list \ No newline at end of file diff --git a/fabric/src/main/java/su/a71/tardim_ic/display_source/fuel_storage/FuelLevelDisplaySource.java b/fabric/src/main/java/su/a71/tardim_ic/display_source/fuel_storage/FuelLevelDisplaySource.java new file mode 100644 index 0000000..e31cfd8 --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/display_source/fuel_storage/FuelLevelDisplaySource.java @@ -0,0 +1,61 @@ +//package su.a71.tardim_ic.display_source.fuel_storage; +// +// +//import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext; +//import com.simibubi.create.content.redstone.displayLink.source.PercentOrProgressBarDisplaySource; +//import com.simibubi.create.foundation.gui.ModularGuiLineBuilder; +//import com.simibubi.create.foundation.utility.Lang; +// +//import com.swdteam.tardim.common.init.TRDDimensions; +//import com.swdteam.tardim.tardim.TardimData; +//import com.swdteam.tardim.tardim.TardimManager; +//import com.swdteam.tardim.tileentity.TileEntityFuelStorage; +// +//import net.minecraft.world.level.block.entity.BlockEntity; +//import net.fabricmc.api.EnvType; +//import net.fabricmc.api.Environment; +// +//import static su.a71.tardim_ic.tardim_ic.Constants.LOG; +// +//public class FuelLevelDisplaySource extends PercentOrProgressBarDisplaySource { +// @Override +// protected Float getProgress(DisplayLinkContext context) { +// if (context.level() != context.level().getServer().getLevel(TRDDimensions.TARDIS)) { +// return null; +// } +// BlockEntity te = context.getSourceBlockEntity(); +// if (!(te instanceof TileEntityFuelStorage fuelStorage)) +// return null; +// TardimData data = TardimManager.getFromPos(fuelStorage.getBlockPos()); +// LOG.info(String.valueOf((float) (data.getFuel()))); +// return (float) (data.getFuel() / 100); +// } +// +// @Override +// protected boolean progressBarActive(DisplayLinkContext context) { +// return context.sourceConfig() +// .getInt("Mode") != 0; +// } +// +// @Override +// protected String getTranslationKey() { +// return "fuel_level"; +// } +// +// @Override +// @Environment(EnvType.CLIENT) +// public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder, boolean isFirstLine) { +// super.initConfigurationWidgets(context, builder, isFirstLine); +// if (isFirstLine) +// return; +// builder.addSelectionScrollInput(0, 120, +// (si, l) -> si.forOptions(Lang.translatedOptions("display_source.fuel_level", "percent", "progress_bar")) +// .titled(Lang.translateDirect("display_source.fuel_level.display")), +// "Mode"); +// } +// +// @Override +// protected boolean allowsLabeling(DisplayLinkContext context) { +// return true; +// } +//} diff --git a/fabric/src/main/java/su/a71/tardim_ic/display_source/fuel_storage/RequiredFuelDisplaySource.java b/fabric/src/main/java/su/a71/tardim_ic/display_source/fuel_storage/RequiredFuelDisplaySource.java new file mode 100644 index 0000000..a307808 --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/display_source/fuel_storage/RequiredFuelDisplaySource.java @@ -0,0 +1,54 @@ +//package su.a71.tardim_ic.display_source.fuel_storage; +// +//import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext; +//import com.simibubi.create.content.redstone.displayLink.source.NumericSingleLineDisplaySource; +//import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats; +//import com.simibubi.create.foundation.utility.Components; +// +//import com.swdteam.tardim.common.init.TRDDimensions; +//import com.swdteam.tardim.tardim.TardimData; +//import com.swdteam.tardim.tardim.TardimManager; +//import com.swdteam.tardim.tileentity.TileEntityFuelStorage; +// +//import net.minecraft.network.chat.MutableComponent; +//import net.minecraft.world.level.block.entity.BlockEntity; +//import net.minecraft.world.phys.Vec3; +// +//public class RequiredFuelDisplaySource extends NumericSingleLineDisplaySource { +// @Override +// protected MutableComponent provideLine(DisplayLinkContext displayLinkContext, DisplayTargetStats displayTargetStats) { +// if (displayLinkContext.level() != displayLinkContext.level().getServer().getLevel(TRDDimensions.TARDIS)) +// return null; +// BlockEntity te = displayLinkContext.getSourceBlockEntity(); +// if (!(te instanceof TileEntityFuelStorage fuelStorage)) +// return null; +// TardimData data = TardimManager.getFromPos(fuelStorage.getBlockPos()); +// +// if (data.getTravelLocation() == null) return ZERO.copy(); +// +// TardimData.Location curr = data.getCurrentLocation(); +// TardimData.Location dest = data.getTravelLocation(); +// +// double fuel = 0.0; +// +// if (curr.getLevel() != dest.getLevel()) +// { +// fuel = 10.0; +// } +// +// Vec3 posA = new Vec3(curr.getPos().getX(), curr.getPos().getY(), curr.getPos().getZ()); +// Vec3 posB = new Vec3(dest.getPos().getX(), dest.getPos().getY(), dest.getPos().getZ()); +// fuel += posA.distanceTo(posB) / 100.0; +// if (fuel > 100.0) fuel = 100.0; +// +// return Components.literal(String.valueOf(fuel)); +// } +// +// protected String getTranslationKey() { +// return "required_fuel"; +// } +// +// protected boolean allowsLabeling(DisplayLinkContext context) { +// return true; +// } +//} diff --git a/fabric/src/main/java/su/a71/tardim_ic/display_source/scanner/temp_ideas.txt b/fabric/src/main/java/su/a71/tardim_ic/display_source/scanner/temp_ideas.txt new file mode 100644 index 0000000..7654e53 --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/display_source/scanner/temp_ideas.txt @@ -0,0 +1,5 @@ +Display sources for the scanner: + +* Owner name +* Companion list +* Get current TARDIM skin \ No newline at end of file diff --git a/fabric/src/main/java/su/a71/tardim_ic/display_source/time_rotor/temp_ideas.txt b/fabric/src/main/java/su/a71/tardim_ic/display_source/time_rotor/temp_ideas.txt new file mode 100644 index 0000000..bb8b488 --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/display_source/time_rotor/temp_ideas.txt @@ -0,0 +1,5 @@ +Display sources for the time rotor: + +* Both current and destination - X/Y/Z/Dimension +* Flight status YES/NO +* \ No newline at end of file diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/jammer/LocationJammerMaterial.java b/fabric/src/main/java/su/a71/tardim_ic/jammer/PersonalJammerMaterial.java similarity index 71% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/jammer/LocationJammerMaterial.java rename to fabric/src/main/java/su/a71/tardim_ic/jammer/PersonalJammerMaterial.java index b0d04bb..8fbfe52 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/jammer/LocationJammerMaterial.java +++ b/fabric/src/main/java/su/a71/tardim_ic/jammer/PersonalJammerMaterial.java @@ -1,26 +1,26 @@ -package su.a71.tardim_ic.tardim_ic.jammer; +package su.a71.tardim_ic.jammer; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; import org.jetbrains.annotations.NotNull; -public class LocationJammerMaterial implements ArmorMaterial { +public class PersonalJammerMaterial implements ArmorMaterial { private static final int[] BASE_DURABILITY = new int[] {13, 15, 16, 11}; private static final int[] PROTECTION_VALUES = new int[] {1, 1, 1, 1}; @Override - public int getDurabilityForSlot(EquipmentSlot slot) { - return BASE_DURABILITY[slot.getIndex()] * 33; + public int getDurabilityForType(ArmorItem.Type type) { + return BASE_DURABILITY[type.getSlot().getIndex()] * 33; } @Override - public int getDefenseForSlot(EquipmentSlot slot) { - return PROTECTION_VALUES[slot.getIndex()]; + public int getDefenseForType(ArmorItem.Type type) { + return PROTECTION_VALUES[type.getSlot().getIndex()]; } @Override @@ -41,7 +41,7 @@ public class LocationJammerMaterial implements ArmorMaterial { @Override public @NotNull String getName() { // Must be all lowercase - return "location jammer"; + return "personal_jammer"; } @Override diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/mixin/BetterFuelMapMixin.java b/fabric/src/main/java/su/a71/tardim_ic/mixin/BetterFuelMapMixin.java similarity index 65% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/mixin/BetterFuelMapMixin.java rename to fabric/src/main/java/su/a71/tardim_ic/mixin/BetterFuelMapMixin.java index bbaba40..f9e11b8 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/mixin/BetterFuelMapMixin.java +++ b/fabric/src/main/java/su/a71/tardim_ic/mixin/BetterFuelMapMixin.java @@ -1,7 +1,6 @@ -package su.a71.tardim_ic.tardim_ic.mixin; +package su.a71.tardim_ic.mixin; import com.swdteam.tardim.tardim.TardimManager; -import com.swdteam.tardim.tileentity.TileEntityFuelStorage; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; import org.spongepowered.asm.mixin.Mixin; @@ -9,8 +8,8 @@ import org.spongepowered.asm.mixin.Overwrite; import static com.swdteam.tardim.tardim.TardimManager.FUEL_MAP; -// This mixin aims to make TARDIM fuel system less awful by allowing users to put standard furance fuel into it. -@Mixin(value = TardimManager.class, remap = false) +// This mixin aims to make TARDIM fuel system less awful by allowing users to put standard furnace fuel into it. +@Mixin(value = TardimManager.class, remap = true) public class BetterFuelMapMixin { @Overwrite @@ -30,13 +29,4 @@ public class BetterFuelMapMixin { else return AbstractFurnaceBlockEntity.getFuel().get(i) / 8000.0; // Adapt with coal's 1600 ticks -> 0.2 fuel } - -// //@Inject(method = "getFuel(Lnet/minecraft/world/item/Item;)V", at = @At("TAIL")) -// @Overwrite -// public static void getFuel(Item i, CallbackInfo info) { -// LOG.info("We're in #TARDIM"); -// if (AbstractFurnaceBlockEntity.getFuel().containsKey(i)) { -// -// } -// } } \ No newline at end of file diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/mixin/BetterFuelStorageMixin.java b/fabric/src/main/java/su/a71/tardim_ic/mixin/BetterFuelStorageMixin.java similarity index 88% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/mixin/BetterFuelStorageMixin.java rename to fabric/src/main/java/su/a71/tardim_ic/mixin/BetterFuelStorageMixin.java index a685dea..f2d1315 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/mixin/BetterFuelStorageMixin.java +++ b/fabric/src/main/java/su/a71/tardim_ic/mixin/BetterFuelStorageMixin.java @@ -1,11 +1,10 @@ -package su.a71.tardim_ic.tardim_ic.mixin; +package su.a71.tardim_ic.mixin; import com.swdteam.tardim.common.block.BlockFuelStorage; import com.swdteam.tardim.common.init.TRDDimensions; import com.swdteam.tardim.tardim.TardimData; import com.swdteam.tardim.tardim.TardimManager; import com.swdteam.tardim.tileentity.TileEntityFuelStorage; -import net.fabricmc.loader.impl.util.log.Log; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.item.BucketItem; @@ -23,9 +22,9 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import static su.a71.tardim_ic.tardim_ic.Constants.LOG; +import static su.a71.tardim_ic.Constants.LOG; -@Mixin(value = TileEntityFuelStorage.class, remap = false) +@Mixin(value = TileEntityFuelStorage.class, remap = true) public class BetterFuelStorageMixin { // This is rather inefficient as we iterate 2 times @@ -34,7 +33,6 @@ public class BetterFuelStorageMixin { at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/HopperBlockEntity;removeItem(II)Lnet/minecraft/world/item/ItemStack;"), locals = LocalCapture.CAPTURE_FAILHARD) private static void saveLavaBuckets(Level world, BlockPos pos, BlockState state, TileEntityFuelStorage blockEntity, CallbackInfo ci) { - //CAPTURE_FAILHARD: If the calculated locals are different from the expected values, throws an error. HopperBlockEntity mixin_hopper = (HopperBlockEntity)world.getBlockEntity(blockEntity.getBlockPos().above()); for(int j = 0; j < mixin_hopper.getContainerSize(); ++j) { ItemStack stack = mixin_hopper.getItem(j); diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/mixin/Commands.java b/fabric/src/main/java/su/a71/tardim_ic/mixin/CommandsMixin.java similarity index 60% rename from Forge/src/main/java/su/a71/tardim_ic/tardim_ic/mixin/Commands.java rename to fabric/src/main/java/su/a71/tardim_ic/mixin/CommandsMixin.java index 1e9262a..c831582 100644 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/mixin/Commands.java +++ b/fabric/src/main/java/su/a71/tardim_ic/mixin/CommandsMixin.java @@ -1,18 +1,22 @@ -package su.a71.tardim_ic.tardim_ic.mixin; +package su.a71.tardim_ic.mixin; +import com.swdteam.tardim.common.init.CommandManager; import org.spongepowered.asm.mixin.Mixin; -import com.swdteam.common.init.CommandManager; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import su.a71.tardim_ic.tardim_ic.registration.CommandInit; +import su.a71.tardim_ic.command.CommandInit; +import su.a71.tardim_ic.platform.Services; -// TARDIM loads commands a bit later on Forge, so we have to use mixins for this :/ @Mixin(value = CommandManager.class, remap = false) -public abstract class Commands { +public class CommandsMixin { @Inject(method="init()V", at=@At("TAIL")) private static void init(CallbackInfo ci) { CommandInit.init(); + if (Services.PLATFORM.isModLoaded("computercraft")) { + CommandInit.addCC(); + } System.out.println("TARDIM: IC added commands using mixin"); } + } diff --git a/fabric/src/main/java/su/a71/tardim_ic/platform/FabricPlatformHelper.java b/fabric/src/main/java/su/a71/tardim_ic/platform/FabricPlatformHelper.java new file mode 100644 index 0000000..f93d790 --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/platform/FabricPlatformHelper.java @@ -0,0 +1,23 @@ +package su.a71.tardim_ic.platform; + +import su.a71.tardim_ic.platform.services.IPlatformHelper; +import net.fabricmc.loader.api.FabricLoader; + +public class FabricPlatformHelper implements IPlatformHelper { + @Override + public String getPlatformName() { + return "Fabric"; + } + + @Override + public boolean isModLoaded(String modId) { + + return FabricLoader.getInstance().isModLoaded(modId); + } + + @Override + public boolean isDevelopmentEnvironment() { + + return FabricLoader.getInstance().isDevelopmentEnvironment(); + } +} diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/soviet_chronobox/SovietChronoboxTileEntity.java b/fabric/src/main/java/su/a71/tardim_ic/soviet_chronobox/SovietChronoboxTileEntity.java similarity index 81% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/soviet_chronobox/SovietChronoboxTileEntity.java rename to fabric/src/main/java/su/a71/tardim_ic/soviet_chronobox/SovietChronoboxTileEntity.java index 0a81513..439befc 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/soviet_chronobox/SovietChronoboxTileEntity.java +++ b/fabric/src/main/java/su/a71/tardim_ic/soviet_chronobox/SovietChronoboxTileEntity.java @@ -1,10 +1,9 @@ -package su.a71.tardim_ic.tardim_ic.soviet_chronobox; +package su.a71.tardim_ic.soviet_chronobox; import com.swdteam.tardim.common.init.TRDTiles; import com.swdteam.tardim.tileentity.TileEntityTardim; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.state.BlockState; -import su.a71.tardim_ic.tardim_ic.Registration; import su.a71.tardim_ic.tardim_ic.registration.Exteriors; public class SovietChronoboxTileEntity extends TileEntityTardim { diff --git a/fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/ComputerCraftCompat.java b/fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/ComputerCraftCompat.java new file mode 100644 index 0000000..2bf3892 --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/ComputerCraftCompat.java @@ -0,0 +1,56 @@ +package su.a71.tardim_ic.tardim_ic.registration; + +import com.swdteam.tardim.common.block.BlockFuelStorage; +import com.swdteam.tardim.common.block.BlockRotor; +import com.swdteam.tardim.common.block.BlockTardimScanner; +import dan200.computercraft.api.peripheral.PeripheralLookup; +import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; +import su.a71.tardim_ic.Constants; +import su.a71.tardim_ic.computercraft_compat.digital_interface.DigitalInterfaceBlock; +import su.a71.tardim_ic.computercraft_compat.digital_interface.DigitalInterfaceTileEntity; +import su.a71.tardim_ic.computercraft_compat.entity.FakeTardimPeripheralTileEntity; +import su.a71.tardim_ic.computercraft_compat.peripherals.DigitalInterfacePeripheral; +import su.a71.tardim_ic.computercraft_compat.peripherals.FuelStoragePeripheral; +import su.a71.tardim_ic.computercraft_compat.peripherals.TardimScannerPeripheral; +import su.a71.tardim_ic.computercraft_compat.peripherals.TimeRotorPeripheral; + +import static com.swdteam.tardim.common.init.TRDBlocks.*; +import static su.a71.tardim_ic.tardim_ic.registration.Registration.registerBlock; + +public class ComputerCraftCompat { + public static final Block DIGITAL_TARDIM_INTERFACE = new DigitalInterfaceBlock(); + + public static final BlockEntityType DIGITAL_INTERFACE_BE = Registry.register( + BuiltInRegistries.BLOCK_ENTITY_TYPE, + new ResourceLocation("tardim_ic", "digital_tardim_interface"), + FabricBlockEntityTypeBuilder.create(DigitalInterfaceTileEntity::new, DIGITAL_TARDIM_INTERFACE).build() + ); + + public static void register() { + Constants.LOG.info("Loaded ComputerCraft compatibility!"); + + registerBlock("digital_tardim_interface", () -> DIGITAL_TARDIM_INTERFACE, null); + + PeripheralLookup.get().registerForBlockEntity((entity, direction) -> new DigitalInterfacePeripheral(new FakeTardimPeripheralTileEntity(entity.getBlockPos(), entity.getLevel())), DIGITAL_INTERFACE_BE); + PeripheralLookup.get().registerForBlocks((world, pos, state, blockEntity, direction) -> { + if (state.getBlock() instanceof BlockFuelStorage) { + return new FuelStoragePeripheral(new FakeTardimPeripheralTileEntity(pos, world)); + } else if (state.getBlock() instanceof BlockRotor) { + return new TimeRotorPeripheral(new FakeTardimPeripheralTileEntity(pos, world)); + } else if (state.getBlock() instanceof BlockTardimScanner) { + return new TardimScannerPeripheral(new FakeTardimPeripheralTileEntity(pos, world)); + } + return null; + }, FUEL_STORAGE, SCANNER, ROTOR); + } + + public static void addToTab(CreativeModeTab.ItemDisplayParameters itemDisplayParameters, CreativeModeTab.Output output) { + output.accept(DIGITAL_TARDIM_INTERFACE); + } +} diff --git a/fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CreateCompat.java b/fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CreateCompat.java new file mode 100644 index 0000000..fb27d1c --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CreateCompat.java @@ -0,0 +1,22 @@ +package su.a71.tardim_ic.tardim_ic.registration; + + +//import com.simibubi.create.content.redstone.displayLink.AllDisplayBehaviours; +import net.minecraft.resources.ResourceLocation; +import su.a71.tardim_ic.Constants; +//import su.a71.tardim_ic.display_source.fuel_storage.FuelLevelDisplaySource; +//import su.a71.tardim_ic.display_source.fuel_storage.RequiredFuelDisplaySource; +// +//import static com.swdteam.tardim.common.init.TRDTiles.TILE_FUEL_STORAGE; + +public class CreateCompat { + + public static void register() { + Constants.LOG.info("Loaded Create compatibility!"); +// +// AllDisplayBehaviours.assignBlockEntity(AllDisplayBehaviours.register(new ResourceLocation(Constants.MOD_ID, "fuel_storage_display_source"), new FuelLevelDisplaySource()), TILE_FUEL_STORAGE); +// AllDisplayBehaviours.assignBlockEntity(AllDisplayBehaviours.register(new ResourceLocation(Constants.MOD_ID, "fuel_required_display_source"), new RequiredFuelDisplaySource()), TILE_FUEL_STORAGE); + } + + +} diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/Exteriors.java b/fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/Exteriors.java similarity index 75% rename from Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/Exteriors.java rename to fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/Exteriors.java index 59d8352..ca07383 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/Exteriors.java +++ b/fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/Exteriors.java @@ -11,6 +11,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityT import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.datafix.fixes.References; import net.minecraft.world.level.block.Block; @@ -19,9 +20,8 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; -import su.a71.tardim_ic.tardim_ic.Constants; -import su.a71.tardim_ic.tardim_ic.soviet_chronobox.SovietChronoboxTileEntity; +import su.a71.tardim_ic.Constants; +import su.a71.tardim_ic.soviet_chronobox.SovietChronoboxTileEntity; public class Exteriors { // Soviet Chronobox @@ -33,11 +33,11 @@ public class Exteriors { private static BlockEntityType createTardimTile(String string, FabricBlockEntityTypeBuilder builder) { Type type = Util.fetchChoiceType(References.BLOCK_ENTITY, string); - return (BlockEntityType) Registry.register(Registry.BLOCK_ENTITY_TYPE, new ResourceLocation(Constants.MOD_ID, string), builder.build(type)); + return (BlockEntityType) Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, new ResourceLocation(Constants.MOD_ID, string), builder.build(type)); } public static void register() { - FLOOR_SOVIET_CHRONOBOX = Registry.register(Registry.BLOCK, new ResourceLocation(Constants.MOD_ID, "tardim_floor_soviet"), new BlockTardimFloor(FabricBlockSettings.of(Material.WOOD).sounds(SoundType.WOOD).strength(-1.0F, 3600000.0F).noLootTable().noOcclusion(), new BlockTardimFloor.TardimTileData() { + FLOOR_SOVIET_CHRONOBOX = Registry.register(BuiltInRegistries.BLOCK, new ResourceLocation(Constants.MOD_ID, "tardim_floor_soviet"), new BlockTardimFloor(FabricBlockSettings.create().sounds(SoundType.WOOD).strength(-1.0F, 3600000.0F).noLootTable().noOcclusion(), new BlockTardimFloor.TardimTileData() { public BlockEntityType getType() { return TILE_SOVIET_CHRONOBOX; } @@ -49,9 +49,8 @@ public class Exteriors { } })); TILE_SOVIET_CHRONOBOX = createTardimTile("tardim_soviet_chronobox", FabricBlockEntityTypeBuilder.create(SovietChronoboxTileEntity::new, new Block[]{FLOOR_SOVIET_CHRONOBOX})); - DOOR_SOVIET_CHRONOBOX = Registry.register(Registry.BLOCK, new ResourceLocation(Constants.MOD_ID, "tardim_door_soviet"), new BlockTardimDoors(FabricBlockSettings.of(Material.WOOD).sounds(SoundType.WOOD).strength(-1.0F, 3600000.0F).noLootTable().noOcclusion())); - ROOF_SOVIET_CHRONOBOX = Registry.register(Registry.BLOCK, new ResourceLocation(Constants.MOD_ID, "tardim_roof_soviet"), new BlockTardimRoof(FabricBlockSettings.of(Material.WOOD).sounds(SoundType.WOOD).strength(-1.0F, 3600000.0F).noLootTable().noOcclusion())); + DOOR_SOVIET_CHRONOBOX = Registry.register(BuiltInRegistries.BLOCK, new ResourceLocation(Constants.MOD_ID, "tardim_door_soviet"), new BlockTardimDoors(FabricBlockSettings.create().sounds(SoundType.WOOD).strength(-1.0F, 3600000.0F).noLootTable().noOcclusion())); + ROOF_SOVIET_CHRONOBOX = Registry.register(BuiltInRegistries.BLOCK, new ResourceLocation(Constants.MOD_ID, "tardim_roof_soviet"), new BlockTardimRoof(FabricBlockSettings.create().sounds(SoundType.WOOD).strength(-1.0F, 3600000.0F).noLootTable().noOcclusion())); TARDIM_TYPE_SOVIET = new TardimRegistry.TardimBuilder(new ResourceLocation(Constants.MOD_ID, "tardim_soviet_chronobox"), "TARDIM Soviet Chronobox", ROOF_SOVIET_CHRONOBOX, DOOR_SOVIET_CHRONOBOX, FLOOR_SOVIET_CHRONOBOX); - } } diff --git a/fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/Registration.java b/fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/Registration.java new file mode 100644 index 0000000..ad6b656 --- /dev/null +++ b/fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/Registration.java @@ -0,0 +1,82 @@ +package su.a71.tardim_ic.tardim_ic.registration; + +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; +import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; +import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; +import su.a71.tardim_ic.Constants; +import su.a71.tardim_ic.blocks.food_machine.FoodMachineBlock; +import su.a71.tardim_ic.blocks.food_machine.FoodMachineBlockEntity; +import su.a71.tardim_ic.blocks.redstone_input.RedstoneInputBlock; +import su.a71.tardim_ic.blocks.redstone_input.RedstoneInputBlockEntity; +import su.a71.tardim_ic.computercraft_compat.digital_interface.DigitalInterfaceBlock; +import su.a71.tardim_ic.computercraft_compat.digital_interface.DigitalInterfaceTileEntity; +import su.a71.tardim_ic.platform.Services; + +import java.util.function.Supplier; + +public class Registration { + public static final Block REDSTONE_INPUT = new RedstoneInputBlock(); + public static final BlockEntityType REDSTONE_INPUT_BE = Registry.register( + BuiltInRegistries.BLOCK_ENTITY_TYPE, + new ResourceLocation(Constants.MOD_ID, "redstone_tardim_input"), + FabricBlockEntityTypeBuilder.create(RedstoneInputBlockEntity::new, REDSTONE_INPUT).build() + ); + + public static final Block FOOD_MACHINE = new FoodMachineBlock(); + public static final BlockEntityType FOOD_MACHINE_BE = Registry.register( + BuiltInRegistries.BLOCK_ENTITY_TYPE, + new ResourceLocation(Constants.MOD_ID, "food_machine"), + FabricBlockEntityTypeBuilder.create(FoodMachineBlockEntity::new, FOOD_MACHINE).build() + ); + + public static final SoundEvent CLOISTER_BELL = SoundEvent.createVariableRangeEvent(new ResourceLocation(Constants.MOD_ID, "cloister")); + + public static final CreativeModeTab TAB = FabricItemGroup.builder() + .icon(() -> new ItemStack(REDSTONE_INPUT)) + .title(Component.translatable("itemGroup.tardim_ic")) + .displayItems(((itemDisplayParameters, output) -> { + output.accept(REDSTONE_INPUT); + output.accept(FOOD_MACHINE); + if (FabricLoader.getInstance().isModLoaded("computercraft")) { + ComputerCraftCompat.addToTab(itemDisplayParameters, output); + } + })) + .build(); + + public static void registerBlock(String name, Supplier supplier, CreativeModeTab tab) + { + Registry.register(BuiltInRegistries.BLOCK, new ResourceLocation(Constants.MOD_ID, name), supplier.get()); + BlockItem blockItem = new BlockItem(supplier.get(), new FabricItemSettings()); + Registry.register(BuiltInRegistries.ITEM, new ResourceLocation(Constants.MOD_ID, name), blockItem); + } + + public static void register() { + Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, new ResourceLocation("tardim_ic", "item_group"), TAB); + + registerBlock("redstone_tardim_input", () -> REDSTONE_INPUT, null); + registerBlock("food_machine", () -> FOOD_MACHINE, null); + + Registry.register(BuiltInRegistries.SOUND_EVENT, new ResourceLocation(Constants.MOD_ID, "cloister"), CLOISTER_BELL); + + Exteriors.register(); + if (FabricLoader.getInstance().isModLoaded("computercraft")) { + ComputerCraftCompat.register(); + } + if (FabricLoader.getInstance().isModLoaded("create")) { + CreateCompat.register(); + } + } +} diff --git a/fabric/src/main/resources/META-INF/services/su.a71.tardim_ic.platform.services.IPlatformHelper b/fabric/src/main/resources/META-INF/services/su.a71.tardim_ic.platform.services.IPlatformHelper new file mode 100644 index 0000000..f9931d6 --- /dev/null +++ b/fabric/src/main/resources/META-INF/services/su.a71.tardim_ic.platform.services.IPlatformHelper @@ -0,0 +1 @@ +su.a71.tardim_ic.platform.FabricPlatformHelper \ No newline at end of file diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..46f08da --- /dev/null +++ b/fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,36 @@ +{ + "schemaVersion": 1, + "id": "tardim_ic", + "version": "${version}", + "name": "TARDIM: In Control", + "description": "All of time and space, now automated and improved. This mod aims to improve your TARDIM experience", + "authors": [ + "${mod_author}" + ], + "contact": { + "homepage": "https://tardim.a71.su/", + "sources": "https://github.com/Andrew-71/tardim-in-control" + }, + "license": "MIT", + "icon": "assets/tardim_ic/icon.png", + "environment": "*", + "entrypoints": { + "main": [ + "su.a71.tardim_ic.TardimInControl" + ] + }, + "mixins": [ + "tardim_ic.mixins.json", + "tardim_ic.fabric.mixins.json" + ], + "depends": { + "fabricloader": ">=0.14", + "fabric": "*", + "minecraft": ">=1.20.1", + "java": ">=17", + "tardim": ">=1.2.2" + }, + "suggests": { + "computercraft": ">=${cc_version}" + } +} \ No newline at end of file diff --git a/fabric/src/main/resources/tardim_ic.fabric.mixins.json b/fabric/src/main/resources/tardim_ic.fabric.mixins.json new file mode 100644 index 0000000..91c2cc2 --- /dev/null +++ b/fabric/src/main/resources/tardim_ic.fabric.mixins.json @@ -0,0 +1,20 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "su.a71.tardim_ic.mixin", + "refmap": "${mod_id}.refmap.json", + "compatibilityLevel": "JAVA_17", + "mixins": [ + "CommandsMixin", + "BetterFuelStorageMixin", + "BetterFuelMapMixin" + ], + "client": [ + ], + "server": [ + ], + "injectors": { + "defaultRequire": 1 + } + } + diff --git a/Forge/build.gradle b/forge/build.gradle similarity index 51% rename from Forge/build.gradle rename to forge/build.gradle index 35c37d8..99bbaf1 100644 --- a/Forge/build.gradle +++ b/forge/build.gradle @@ -1,29 +1,27 @@ -buildscript { - repositories { - maven { url = 'https://maven.minecraftforge.net' } - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true - classpath 'org.spongepowered:mixingradle:0.7.+' - } +plugins { + id 'idea' + id 'maven-publish' + id 'net.neoforged.gradle' version '[6.0.18,6.2)' + id 'org.spongepowered.mixin' } -apply plugin: 'java' -apply plugin: 'net.minecraftforge.gradle' -apply plugin: 'eclipse' -apply plugin: 'maven-publish' -apply plugin: 'org.spongepowered.mixin' +base { + archivesName = "${mod_name}-forge-${minecraft_version}" +} +mixin { + add(sourceSets.main, "${mod_id}.refmap.json") -archivesBaseName = "${mod_name}-forge-${minecraft_version}" + config("${mod_id}.mixins.json") + config("${mod_id}.forge.mixins.json") +} minecraft { mappings channel: 'official', version: minecraft_version - - if (project.hasProperty('forge_ats_enabled') && project.findProperty('forge_ats_enabled').toBoolean()) { - // This location is hardcoded in Forge and can not be changed. - // https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123 + + // Automatically enable forge AccessTransformers if the file exists + // This location is hardcoded in Forge and can not be changed. + // https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123 + if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) { accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') - project.logger.debug('Forge Access Transformers are enabled for this project.') } runs { @@ -36,7 +34,7 @@ minecraft { mods { modClientRun { source sourceSets.main - source project(":Common").sourceSets.main + source project(":common").sourceSets.main } } } @@ -50,7 +48,7 @@ minecraft { mods { modServerRun { source sourceSets.main - source project(":Common").sourceSets.main + source project(":common").sourceSets.main } } } @@ -65,48 +63,43 @@ minecraft { mods { modDataRun { source sourceSets.main - source project(":Common").sourceSets.main + source project(":common").sourceSets.main } } } } } -mixin { - add sourceSets.main, 'refmap.tardim_ic.json' - config 'mixins.tardim_ic.json' -} - sourceSets.main.resources.srcDir 'src/generated/resources' dependencies { - minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - compileOnly project(":Common") - - implementation fg.deobf("curse.maven:tardim-531315:4453925") - implementation fg.deobf("org.squiddev:cc-tweaked-1.19.1:${cc_version}") - - annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' + minecraft "net.neoforged:forge:${minecraft_version}-${neoforged_version}" + compileOnly project(":common") + annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT:processor") } -tasks.withType(JavaCompile) { - source(project(":Common").sourceSets.main.allSource) +tasks.withType(JavaCompile).configureEach { + source(project(":common").sourceSets.main.allSource) +} +tasks.withType(Javadoc).configureEach { + source(project(":common").sourceSets.main.allJava) +} +tasks.named("sourcesJar", Jar) { + from(project(":common").sourceSets.main.allSource) } processResources { - from project(":Common").sourceSets.main.resources + from project(":common").sourceSets.main.resources } - jar.finalizedBy('reobfJar') publishing { publications { mavenJava(MavenPublication) { - groupId project.group - artifactId project.archivesBaseName - version project.version - artifact jar + artifactId base.archivesName.get() + from components.java + fg.component(it) } } repositories { diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/TardimInControl.java b/forge/src/main/java/su/a71/tardim_ic/TardiminControl.java similarity index 57% rename from Forge/src/main/java/su/a71/tardim_ic/tardim_ic/TardimInControl.java rename to forge/src/main/java/su/a71/tardim_ic/TardiminControl.java index 10c6b81..8897bcb 100644 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/TardimInControl.java +++ b/forge/src/main/java/su/a71/tardim_ic/TardiminControl.java @@ -1,18 +1,10 @@ -package su.a71.tardim_ic.tardim_ic; +package su.a71.tardim_ic; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; -import su.a71.tardim_ic.tardim_ic.registration.CommandInit; -import com.swdteam.tardim.TardimSaveHandler; - -// The value here should match an entry in the META-INF/mods.toml file @Mod(Constants.MOD_ID) public class TardimInControl { - - // Our mod id - public static final String MODID = Constants.MOD_ID; - public TardimInControl() { Registration.register(); diff --git a/forge/src/main/java/su/a71/tardim_ic/platform/ForgePlatformHelper.java b/forge/src/main/java/su/a71/tardim_ic/platform/ForgePlatformHelper.java new file mode 100644 index 0000000..66ca310 --- /dev/null +++ b/forge/src/main/java/su/a71/tardim_ic/platform/ForgePlatformHelper.java @@ -0,0 +1,26 @@ +package su.a71.tardim_ic.platform; + +import com.example.examplemod.platform.services.IPlatformHelper; +import net.minecraftforge.fml.ModList; +import net.minecraftforge.fml.loading.FMLLoader; + +public class ForgePlatformHelper implements IPlatformHelper { + + @Override + public String getPlatformName() { + + return "Forge"; + } + + @Override + public boolean isModLoaded(String modId) { + + return ModList.get().isLoaded(modId); + } + + @Override + public boolean isDevelopmentEnvironment() { + + return !FMLLoader.isProduction(); + } +} \ No newline at end of file diff --git a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/redstone_input/RedstoneInputBlock.java b/forge/src/main/java/su/a71/tardim_ic/tardim_ic/redsone_input/RedstoneInputBlock.java similarity index 80% rename from Forge/src/main/java/su/a71/tardim_ic/tardim_ic/redstone_input/RedstoneInputBlock.java rename to forge/src/main/java/su/a71/tardim_ic/tardim_ic/redsone_input/RedstoneInputBlock.java index 675132b..f1856bc 100644 --- a/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/redstone_input/RedstoneInputBlock.java +++ b/forge/src/main/java/su/a71/tardim_ic/tardim_ic/redsone_input/RedstoneInputBlock.java @@ -1,6 +1,7 @@ -package su.a71.tardim_ic.tardim_ic.redstone_input; +package su.a71.tardim_ic.tardim_ic.redsone_input; import com.swdteam.common.block.BlockBaseTardimPanel; + import com.swdteam.common.init.TRDDimensions; import com.swdteam.common.init.TRDSounds; import com.swdteam.network.NetworkHandler; @@ -28,14 +29,16 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Material; import net.minecraft.world.phys.BlockHitResult; - +import net.minecraftforge.common.util.FakePlayerFactory; +import net.minecraftforge.server.ServerLifecycleHooks; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; import su.a71.tardim_ic.tardim_ic.Registration; -import su.a71.tardim_ic.tardim_ic.utils.FakePlayer; + +import javax.annotation.Nullable; public class RedstoneInputBlock extends BlockBaseTardimPanel implements EntityBlock { + private boolean isPowered = false; public RedstoneInputBlock() { super(Properties.of(Material.METAL).strength(2, 4).noOcclusion()); } @@ -56,7 +59,6 @@ public class RedstoneInputBlock extends BlockBaseTardimPanel implements EntityBl if (be instanceof TileEntityBaseTardimPanel && w.dimension() == TRDDimensions.TARDIS) { TardimData data = TardimManager.getFromPos(blockPos); if (data != null && data.hasPermission(player)) { - ((RedstoneInputTileEntity) be).lastPlayer = player.getGameProfile().getId(); NetworkHandler.sendTo((ServerPlayer)player, new PacketOpenEditGui(1, blockPos)); return InteractionResult.CONSUME; } @@ -77,26 +79,22 @@ public class RedstoneInputBlock extends BlockBaseTardimPanel implements EntityBl public void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, BlockPos fromPos, boolean isMoving) { DebugPackets.sendNeighborsUpdatePacket(level, blockPos); - BlockEntity be = level.getBlockEntity(blockPos); - if (!(be instanceof RedstoneInputTileEntity)) { - return; - } - // get redstone signal Direction direction = blockState.getValue(FACING); int redstoneSignal = level.getSignal(blockPos, direction); - if (redstoneSignal > 0 && !((RedstoneInputTileEntity) be).isPowered) { - ((RedstoneInputTileEntity) be).isPowered = true; - if (level.dimension() == TRDDimensions.TARDIS) { + if (redstoneSignal > 0 && !isPowered) { + isPowered = true; + BlockEntity be = level.getBlockEntity(blockPos); + if (be instanceof TileEntityBaseTardimPanel && level.dimension() == TRDDimensions.TARDIS) { TardimData data = TardimManager.getFromPos(blockPos); - if (data != null && !level.isClientSide && ((RedstoneInputTileEntity) be).lastPlayer != null) { + if (data != null) { if (((TileEntityBaseTardimPanel)be).hasCommand()) { - ((TileEntityBaseTardimPanel)be).execute(new FakePlayer(level, blockPos, ((RedstoneInputTileEntity) be).lastPlayer)); + ((TileEntityBaseTardimPanel)be).execute(FakePlayerFactory.getMinecraft(ServerLifecycleHooks.getCurrentServer().getLevel(level.dimension()))); } } } - } else if (redstoneSignal == 0 && ((RedstoneInputTileEntity) be).isPowered) - ((RedstoneInputTileEntity) be).isPowered = false; + } else if (redstoneSignal == 0 && isPowered) + isPowered = false; } } diff --git a/forge/src/main/java/su/a71/tardim_ic/tardim_ic/redsone_input/RedstoneInputTileEntity.java b/forge/src/main/java/su/a71/tardim_ic/tardim_ic/redsone_input/RedstoneInputTileEntity.java new file mode 100644 index 0000000..a89f18f --- /dev/null +++ b/forge/src/main/java/su/a71/tardim_ic/tardim_ic/redsone_input/RedstoneInputTileEntity.java @@ -0,0 +1,19 @@ +package su.a71.tardim_ic.tardim_ic.redsone_input; + +import com.swdteam.tileentity.TileEntityBaseTardimPanel; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; + +import su.a71.tardim_ic.tardim_ic.Registration; + + +public class RedstoneInputTileEntity extends TileEntityBaseTardimPanel { + public RedstoneInputTileEntity(BlockPos pos, BlockState state) { + super(Registration.REDSTONE_TARDIM_INPUT_TILEENTITY.get(), pos, state); + } + + + public BlockPos getPos() { + return this.worldPosition; + } +} diff --git a/forge/src/main/java/su/a71/tardim_ic/tardim_ic/sonic/SonicProbe.java b/forge/src/main/java/su/a71/tardim_ic/tardim_ic/sonic/SonicProbe.java new file mode 100644 index 0000000..2a3cfe5 --- /dev/null +++ b/forge/src/main/java/su/a71/tardim_ic/tardim_ic/sonic/SonicProbe.java @@ -0,0 +1,22 @@ +package su.a71.tardim_ic.tardim_ic.sonic; + +import net.minecraft.world.item.Item; + +import com.swdteam.tardim.TardimData; +import com.swdteam.tardim.TardimManager; + +import com.swdteam.client.gui.GuiCommandScreen; + +public class SonicProbe extends Item { + private TardimData tardim; + public SonicProbe(Properties properties) { + super(properties.stacksTo(1)); + } + + public void setTardim(TardimData tardim) { + this.tardim = tardim; + } + + // Add tile entity + +} diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..7c9fa79 --- /dev/null +++ b/forge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,28 @@ +modLoader = "javafml" #mandatory +loaderVersion = "[46,)" #mandatory This is typically bumped every Minecraft version by Forge. See https://files.minecraftforge.net/ for a list of versions. +license = "C0-1.0" # Review your options at https://choosealicense.com/. +#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional +[[mods]] #mandatory +modId = "multiloader" #mandatory +version = "${file.jarVersion}" #mandatory +displayName = "${mod_name}" #mandatory +#updateJSONURL="https://change.me.example.invalid/updates.json" #optional (see https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/) +#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional (displayed in the mod UI) +logoFile = "multiloader.png" #optional (needs to be in the root of your mod jar (root of your 'resources' folder)) +credits = "Thanks for this example mod goes to Java" #optional +authors = "${mod_author}" #optional +description = ''' +This is a long form description of the mod. You can write whatever you want here +''' #mandatory (Supports multiline text) +[[dependencies.multiloader]] #optional +modId = "forge" #mandatory +mandatory = true #mandatory +versionRange = "[46,)" #mandatory +ordering = "NONE" # The order that this dependency should load in relation to your mod, required to be either 'BEFORE' or 'AFTER' if the dependency is not mandatory +side = "BOTH" # Side this dependency is applied on - 'BOTH', 'CLIENT' or 'SERVER' +[[dependencies.multiloader]] +modId = "minecraft" +mandatory = true +versionRange = "[1.20,1.21)" +ordering = "NONE" +side = "BOTH" diff --git a/forge/src/main/resources/META-INF/services/com.example.examplemod.platform.services.IPlatformHelper b/forge/src/main/resources/META-INF/services/com.example.examplemod.platform.services.IPlatformHelper new file mode 100644 index 0000000..ff2910d --- /dev/null +++ b/forge/src/main/resources/META-INF/services/com.example.examplemod.platform.services.IPlatformHelper @@ -0,0 +1 @@ +com.example.examplemod.platform.ForgePlatformHelper \ No newline at end of file diff --git a/forge/src/main/resources/assets/tardim_ic/blockstates/digital_tardim_interface.json b/forge/src/main/resources/assets/tardim_ic/blockstates/digital_tardim_interface.json new file mode 100644 index 0000000..e396b0d --- /dev/null +++ b/forge/src/main/resources/assets/tardim_ic/blockstates/digital_tardim_interface.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "tardim_ic:block/digital_tardim_interface" + } + } +} \ No newline at end of file diff --git a/forge/src/main/resources/assets/tardim_ic/blockstates/redstone_tardim_input.json b/forge/src/main/resources/assets/tardim_ic/blockstates/redstone_tardim_input.json new file mode 100644 index 0000000..a5718cc --- /dev/null +++ b/forge/src/main/resources/assets/tardim_ic/blockstates/redstone_tardim_input.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "tardim_ic:block/redstone_tardim_input" + } + } +} \ No newline at end of file diff --git a/forge/src/main/resources/assets/tardim_ic/icon.png b/forge/src/main/resources/assets/tardim_ic/icon.png new file mode 100644 index 0000000..87a18cf Binary files /dev/null and b/forge/src/main/resources/assets/tardim_ic/icon.png differ diff --git a/forge/src/main/resources/assets/tardim_ic/lang/en_uk.json b/forge/src/main/resources/assets/tardim_ic/lang/en_uk.json new file mode 100644 index 0000000..4d99f9d --- /dev/null +++ b/forge/src/main/resources/assets/tardim_ic/lang/en_uk.json @@ -0,0 +1,5 @@ +{ + "block.tardim_ic.digital_tardim_interface": "Digital TARDIM Interface", + "block.tardim_ic.redstone_tardim_input": "Redstone TARDIM Input", + "itemGroup.tardim_ic": "TARDIM: In Control" +} \ No newline at end of file diff --git a/forge/src/main/resources/assets/tardim_ic/lang/en_us.json b/forge/src/main/resources/assets/tardim_ic/lang/en_us.json new file mode 100644 index 0000000..4d99f9d --- /dev/null +++ b/forge/src/main/resources/assets/tardim_ic/lang/en_us.json @@ -0,0 +1,5 @@ +{ + "block.tardim_ic.digital_tardim_interface": "Digital TARDIM Interface", + "block.tardim_ic.redstone_tardim_input": "Redstone TARDIM Input", + "itemGroup.tardim_ic": "TARDIM: In Control" +} \ No newline at end of file diff --git a/forge/src/main/resources/assets/tardim_ic/lang/rpr.json b/forge/src/main/resources/assets/tardim_ic/lang/rpr.json new file mode 100644 index 0000000..d28a924 --- /dev/null +++ b/forge/src/main/resources/assets/tardim_ic/lang/rpr.json @@ -0,0 +1,5 @@ +{ + "block.tardim_ic.digital_tardim_interface": "Циферный Интерфейсъ Хронобудки", + "block.tardim_ic.redstone_tardim_input": "Краснокаменный Инпутъ Хронобудки", + "itemGroup.tardim_ic": "ТАРДИМЪ: Подъ Контрольемъ" +} \ No newline at end of file diff --git a/forge/src/main/resources/assets/tardim_ic/lang/ru_ru.json b/forge/src/main/resources/assets/tardim_ic/lang/ru_ru.json new file mode 100644 index 0000000..09b05b1 --- /dev/null +++ b/forge/src/main/resources/assets/tardim_ic/lang/ru_ru.json @@ -0,0 +1,5 @@ +{ + "block.tardim_ic.digital_tardim_interface": "Цифровой интерфейс TARDIM", + "block.tardim_ic.redstone_tardim_input": "Редстоуновый ввод TARDIM", + "itemGroup.tardim_ic": "TARDIM: In Control" +} \ No newline at end of file diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/digital_tardim_interface.json b/forge/src/main/resources/assets/tardim_ic/models/block/digital_tardim_interface.json similarity index 99% rename from Common/src/main/resources/assets/tardim_ic/models/block/digital_tardim_interface.json rename to forge/src/main/resources/assets/tardim_ic/models/block/digital_tardim_interface.json index d0300c3..d5fccbf 100644 --- a/Common/src/main/resources/assets/tardim_ic/models/block/digital_tardim_interface.json +++ b/forge/src/main/resources/assets/tardim_ic/models/block/digital_tardim_interface.json @@ -1,5 +1,5 @@ { - "credit": "Made by karoter2 with Blockbench", + "credit": "Made with Blockbench", "parent": "digital_tardim_interface", "texture_size": [64, 64], "textures": { diff --git a/Common/src/main/resources/assets/tardim_ic/models/block/redstone_tardim_input.json b/forge/src/main/resources/assets/tardim_ic/models/block/redstone_tardim_input.json similarity index 95% rename from Common/src/main/resources/assets/tardim_ic/models/block/redstone_tardim_input.json rename to forge/src/main/resources/assets/tardim_ic/models/block/redstone_tardim_input.json index ac65f2f..a133d12 100644 --- a/Common/src/main/resources/assets/tardim_ic/models/block/redstone_tardim_input.json +++ b/forge/src/main/resources/assets/tardim_ic/models/block/redstone_tardim_input.json @@ -1,5 +1,5 @@ { - "credit": "Made by karoter2 with Blockbench", + "credit": "Made with Blockbench", "parent": "block/cube_all", "ambientocclusion": false, "textures": { diff --git a/forge/src/main/resources/assets/tardim_ic/models/item/digital_tardim_interface.json b/forge/src/main/resources/assets/tardim_ic/models/item/digital_tardim_interface.json new file mode 100644 index 0000000..256cd83 --- /dev/null +++ b/forge/src/main/resources/assets/tardim_ic/models/item/digital_tardim_interface.json @@ -0,0 +1,23 @@ +{ + "parent": "tardim_ic:block/digital_tardim_interface", + "display": { + "thirdperson_righthand": { + "rotation": [ 75, 45, 0 ], + "scale": [ 0.40, 0.40, 0.40 ], + "translation": [ 0, 1, 0 ] + }, + "thirdperson_lefthand": { + "rotation": [ 75, 45, 0 ], + "scale": [ 0.40, 0.40, 0.40 ], + "translation": [ 0, 1, 0 ] + }, + "firstperson_lefthand": { + "rotation": [ 0, 45, 0 ], + "scale": [ 0.40, 0.40, 0.40 ] + }, + "firstperson_righthand": { + "rotation": [ 0, 45, 0 ], + "scale": [ 0.40, 0.40, 0.40 ] + } + } +} \ No newline at end of file diff --git a/forge/src/main/resources/assets/tardim_ic/models/item/redstone_tardim_input.json b/forge/src/main/resources/assets/tardim_ic/models/item/redstone_tardim_input.json new file mode 100644 index 0000000..4a3e535 --- /dev/null +++ b/forge/src/main/resources/assets/tardim_ic/models/item/redstone_tardim_input.json @@ -0,0 +1,23 @@ +{ + "parent": "tardim_ic:block/redstone_tardim_input", + "display": { + "thirdperson_righthand": { + "rotation": [ 75, 45, 0 ], + "scale": [ 0.40, 0.40, 0.40 ], + "translation": [ 0, 1, 0 ] + }, + "thirdperson_lefthand": { + "rotation": [ 75, 45, 0 ], + "scale": [ 0.40, 0.40, 0.40 ], + "translation": [ 0, 1, 0 ] + }, + "firstperson_lefthand": { + "rotation": [ 0, 45, 0 ], + "scale": [ 0.40, 0.40, 0.40 ] + }, + "firstperson_righthand": { + "rotation": [ 0, 45, 0 ], + "scale": [ 0.40, 0.40, 0.40 ] + } + } +} \ No newline at end of file diff --git a/forge/src/main/resources/assets/tardim_ic/textures/blocks/digital_tardim_interface.png b/forge/src/main/resources/assets/tardim_ic/textures/blocks/digital_tardim_interface.png new file mode 100644 index 0000000..d430bc6 Binary files /dev/null and b/forge/src/main/resources/assets/tardim_ic/textures/blocks/digital_tardim_interface.png differ diff --git a/forge/src/main/resources/assets/tardim_ic/textures/blocks/red_contr.png b/forge/src/main/resources/assets/tardim_ic/textures/blocks/red_contr.png new file mode 100644 index 0000000..3ed7480 Binary files /dev/null and b/forge/src/main/resources/assets/tardim_ic/textures/blocks/red_contr.png differ diff --git a/forge/src/main/resources/assets/tardim_ic/textures/blocks/red_contr.png.mcmeta b/forge/src/main/resources/assets/tardim_ic/textures/blocks/red_contr.png.mcmeta new file mode 100644 index 0000000..fe2f8d3 --- /dev/null +++ b/forge/src/main/resources/assets/tardim_ic/textures/blocks/red_contr.png.mcmeta @@ -0,0 +1,7 @@ +{ + "animation": { + "frametime": 10, + "interpolate": true, + "frames": [0, 1, 2, 3] + } +} \ No newline at end of file diff --git a/forge/src/main/resources/data/tardim_ic/loot_tables/blocks/digital_tardim_interface.json b/forge/src/main/resources/data/tardim_ic/loot_tables/blocks/digital_tardim_interface.json new file mode 100644 index 0000000..28ee895 --- /dev/null +++ b/forge/src/main/resources/data/tardim_ic/loot_tables/blocks/digital_tardim_interface.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "bonus_rolls": 0, + "entries": [ + { + "type": "minecraft:item", + "name": "tardim_ic:digital_tardim_interface", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] + } + ] +} diff --git a/forge/src/main/resources/data/tardim_ic/loot_tables/blocks/redstone_tardim_input.json b/forge/src/main/resources/data/tardim_ic/loot_tables/blocks/redstone_tardim_input.json new file mode 100644 index 0000000..a988e6a --- /dev/null +++ b/forge/src/main/resources/data/tardim_ic/loot_tables/blocks/redstone_tardim_input.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "bonus_rolls": 0, + "entries": [ + { + "type": "minecraft:item", + "name": "tardim_ic:redstone_tardim_input", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] + } + ] +} diff --git a/forge/src/main/resources/data/tardim_ic/recipes/digital_tardim_interface.json b/forge/src/main/resources/data/tardim_ic/recipes/digital_tardim_interface.json new file mode 100644 index 0000000..2721c83 --- /dev/null +++ b/forge/src/main/resources/data/tardim_ic/recipes/digital_tardim_interface.json @@ -0,0 +1,30 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "DDD", + "R0R", + "GRG" + ], + "key": { + "G": { + "item": "minecraft:gold_ingot", + "count": 1 + }, + "R": { + "item": "minecraft:redstone", + "count": 1 + }, + "0": { + "item": "minecraft:ender_eye", + "count": 1 + }, + "D": { + "item": "minecraft:polished_deepslate", + "count": 1 + } + }, + "result": { + "item": "tardim_ic:digital_tardim_interface", + "count": 1 + } +} \ No newline at end of file diff --git a/forge/src/main/resources/data/tardim_ic/recipes/redstone_tardim_input.json b/forge/src/main/resources/data/tardim_ic/recipes/redstone_tardim_input.json new file mode 100644 index 0000000..9f47666 --- /dev/null +++ b/forge/src/main/resources/data/tardim_ic/recipes/redstone_tardim_input.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "GRG", + "RBR", + "GRG" + ], + "key": { + "G": { + "item": "minecraft:gold_ingot", + "count": 1 + }, + "R": { + "item": "minecraft:redstone", + "count": 1 + }, + "B": { + "item": "minecraft:redstone_block", + "count": 1 + } + }, + "result": { + "item": "tardim_ic:redstone_tardim_input", + "count": 1 + } +} \ No newline at end of file diff --git a/forge/src/main/resources/examplemod.forge.mixins.json b/forge/src/main/resources/examplemod.forge.mixins.json new file mode 100644 index 0000000..95882ac --- /dev/null +++ b/forge/src/main/resources/examplemod.forge.mixins.json @@ -0,0 +1,17 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "com.example.examplemod.mixin", + "refmap": "${mod_id}.refmap.json", + "compatibilityLevel": "JAVA_17", + "mixins": [ + ], + "client": [ + "MixinTitleScreen" + ], + "server": [ + ], + "injectors": { + "defaultRequire": 1 + } +} \ No newline at end of file diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..20f2fe7 --- /dev/null +++ b/forge/src/main/resources/pack.mcmeta @@ -0,0 +1,7 @@ +{ + "pack": { + "description": "TARDIM: In Control resources", + "pack_format": 6, + "_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods." + } +} diff --git a/gradle.properties b/gradle.properties index debfa5c..1839400 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,23 +1,19 @@ # Project -version=1.1 +version=1.2 group=su.a71.tardim_ic # Common -minecraft_version=1.19.2 -common_runs_enabled=false -common_client_run_name=Common Client -common_server_run_name=Common Server +minecraft_version=1.20.1 # Forge -forge_version=43.1.30 -//forge_ats_enabled=true +neoforged_version=47.1.79 # Fabric -fabric_version=0.62.0+1.19.2 -fabric_loader_version=0.14.10 +fabric_version=0.86.1+1.20.1 +fabric_loader_version=0.14.21 # Mod options -mod_name=tardim_in_control +mod_name=TARDIM-IC mod_author=Andrew_7_1 mod_id=tardim_ic @@ -25,4 +21,4 @@ mod_id=tardim_ic org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -cc_version=1.100.9 \ No newline at end of file +cc_version=1.105.0 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..249e583 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661..fae0804 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index b4f908a..a69d9cb 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env bash +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MSYS* | MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,78 +140,101 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -ARGV=("$@") -eval set -- $DEFAULT_JVM_OPTS +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -IFS=$' -' read -rd '' -a JAVA_OPTS_ARR <<< "$(echo $JAVA_OPTS | xargs -n1)" -IFS=$' -' read -rd '' -a GRADLE_OPTS_ARR <<< "$(echo $GRADLE_OPTS | xargs -n1)" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) -exec "$JAVACMD" "$@" "${JAVA_OPTS_ARR[@]}" "${GRADLE_OPTS_ARR[@]}" "-Dorg.gradle.appname=$APP_BASE_NAME" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "${ARGV[@]}" + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 107acd3..f127cfd 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..60c8c7e --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,55 @@ +site_name: "Tardim: In Control" +site_description: "Documentation for mod TARDIM: In Control" +site_author: Andrew_7_1 + +copyright: Copyright © 2023 Andrey N. + +nav: + - Home: + - Home: "index.md" + - Features: + - Blocks: + - Redstone Input: blocks/redstone_input.md + - Commands: commands.md + - Changes to TARDIM: mixins.md + - ComputerCraft compatibility: + - computercraft/index.md + - Peripherals: + - Digital TARDIM Interface: computercraft/peripherals/digital_interface.md + - Fuel Storage Block: computercraft/peripherals/fuel_storage.md + - TARDIM Scanner Block: computercraft/peripherals/tardim_scanner.md + - Time Rotor Block: computercraft/peripherals/time_rotor.md + - Create compatibility: + - create/index.md +# - Display Sources: +# - Fuel Storage Block: create/sources/fuel_storage.md +# - TARDIM Scanner Block: create/sources/tardim_scanner.md +# - Time Rotor Block: create/sources/time_rotor.md + - Planned features: + - planned.md + +site_url: https://tardim.a71.su/ +repo_name: Andrew71/Tardim-In-Control +repo_url: https://git.a71.su/Andrew71/Tardim-In-Control +#edit_uri: https://git.a71.su/Andrew71/Tardim-In-Control/src/branch/1.20/docs + +theme: + name: readthedocs + + features: + - content.code.copy + - navigation.tracking + - navigation.instant + - navigation.tabs + - navigation.indexes + + font: false + palette: + scheme: slate + primary: custom + accent: custom + + favicon: assets/img/icon.png + +extra_css: + - assets/style.css \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 299e94c..edc6d10 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,10 @@ pluginManagement { repositories { gradlePluginPortal() + maven { + name = 'NeoForged' + url = 'https://maven.neoforged.net/releases' + } maven { name = 'Fabric' url = 'https://maven.fabricmc.net/' @@ -12,5 +16,12 @@ pluginManagement { } } -rootProject.name = 'tardim_ic' -include("Common", "Fabric", "Forge") \ No newline at end of file +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' +} + +// This should match the folder name of the project, or else IDEA may complain (see https://youtrack.jetbrains.com/issue/IDEA-317606) +rootProject.name = 'Tardim-In-Control' +include("common") +include("fabric") +include("forge")