diff --git a/Common/src/main/java/su/a71/tardim_ic/tardim_ic/Constants.java b/Common/src/main/java/su/a71/tardim_ic/tardim_ic/Constants.java index 1789b8c..0cb4157 100644 --- a/Common/src/main/java/su/a71/tardim_ic/tardim_ic/Constants.java +++ b/Common/src/main/java/su/a71/tardim_ic/tardim_ic/Constants.java @@ -2,12 +2,9 @@ package su.a71.tardim_ic.tardim_ic; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import org.apache.logging.log4j.LogManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Random; - public class Constants { public static final String MOD_ID; diff --git a/Common/src/main/resources/data/computercraft/lua/premade/NavDash.lua b/Common/src/main/resources/data/computercraft/lua/premade/NavDash.lua index bbd4d8d..140884c 100644 --- a/Common/src/main/resources/data/computercraft/lua/premade/NavDash.lua +++ b/Common/src/main/resources/data/computercraft/lua/premade/NavDash.lua @@ -1,3 +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/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 index 3d3be0e..d11e342 100644 --- 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 @@ -12,7 +12,6 @@ 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; @@ -67,10 +66,10 @@ public class Registration { 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.ITEM, new ResourceLocation(Constants.MOD_ID, "redstone_tardim_input"), new BlockItem(REDSTONE_TARDIM_INPUT, new Item.Properties().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.ITEM, new ResourceLocation(Constants.MOD_ID, "food_machine"), new BlockItem(FOOD_MACHINE, new Item.Properties().tab(TARDIM_IC_TAB))); Registry.register(Registry.SOUND_EVENT, CLOISTER_SOUND, CLOISTER_SOUND_EVENT); 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 index 90b4eaf..129451c 100644 --- 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 @@ -6,10 +6,13 @@ 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.network.chat.Component; +import net.minecraft.network.chat.contents.TranslatableContents; 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.Overwrite; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -22,7 +25,8 @@ import static su.a71.tardim_ic.tardim_ic.Registration.PERSONAL_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")) +// @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()) { @@ -32,4 +36,33 @@ public class JammerMixin { //// }; //// } // } + + @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; + } + } + 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/Fabric/src/main/resources/mixins.tardim_ic.json b/Fabric/src/main/resources/mixins.tardim_ic.json index d945634..1335fd3 100644 --- a/Fabric/src/main/resources/mixins.tardim_ic.json +++ b/Fabric/src/main/resources/mixins.tardim_ic.json @@ -5,7 +5,8 @@ "refmap": "refmap.tardim_ic.json", "mixins": [ "BetterFuelMapMixin", - "BetterFuelStorageMixin" + "BetterFuelStorageMixin", + "JammerMixin" ], "client": [ ], diff --git a/README.md b/README.md index 23dc7a9..c662628 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ### All of time and space, *now automated and improved*. 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 new blocks, redstone, +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) computers or [Create](https://github.com/Creators-of-Create/Create) ### Features: @@ -18,12 +18,6 @@ TODO: Re-make this for 1.2 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. - ### FAQ **Is this for Fabric or Forge?** @@ -34,7 +28,7 @@ And another thing: the method that sets destination dimension can't check if the **Will there be a 1.20 version and beyond?** : Right now my focus on 1.19.2, but I will try my best to move to later versions as soon as this mod is fully stable, -and dependencies are out. +and dependencies are out. The intention is to follow latest versions. **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. diff --git a/TODO.txt b/TODO.txt index 69557d0..b4683b0 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,30 +1,44 @@ TODO for 1.2 and beyond +re-written 21.06.23 + +NEW ==================== 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. + Cartridge Loader + 2 buttons, one to load information from a cartridge, another to write it. + Has a slot where when r-clicked with a cartridge inserts it/Takes it out + TARDIM Dock + Has a GUI, where you can configure: + * Name/id + * Landing facing + * White/Blacklist of users who can land + * (Potentially) Fallback id if this one is disabled + When configured, a CC method/TARDIM command can take you to it + When powered by a lever, no TARDIM can land (and potentially take off) + Food Machine + 2 buttons. One changed chosen food (hopefully shown on screen), another throws it out. + Uses a bit of fuel but you get FOOD! +Items + Personal Jammer + When worn, other players are unable to locate the user with /locate command + Location cartridge + Contains coordinates, dimension of place and date when it was written to (potentially other metadata using CC) + Can be locked like a map + Potentially can be inserted into a disk drive peripheral + 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 + CC: + * Look into what other things can be improved, how to automate doc creation + * Add creative digital TARDIM interface... (maybe remove TARDIM from item name?) + * Add a craftable treasure disk with pre-installed useful programs + Create: + Update to 0.5.1, add more display sources -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. + Datapack-driven way to control where a TARDIM can land and at what price. - -Achievements/Advancements: +Achievements: +(need to decide on root) "Nobody needs soup more than me" Get soup from TARDIM's food machine @@ -40,18 +54,41 @@ Achievements/Advancements: "???" Register a dock - "I prefer jelly" + "It appears to be... jammed!" + "I've lost the bleeps, I lost the sweeps, and I lost the creeps." 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 +UPDATES ================ -Treasure Disk with pre-installed code that users might enjoy +Blocks: + Redstone TARDIM Interface - add powered blockstate + (TARDIM) Fuel Storage - add comparator output based on fuel (0 - 9 I think) + (TARDIM) Time Rotor - add comparator/redstone output when in flight -Datapack-driven way to control where a TARDIM can travel and at what price (For instance, for liftoff) +Code: + Add config&datapack support (e.g. disable compat, more food machine food, only getters from digital interface) + Make 1WTC fix package names on forge and further improve multi-loader structure + (so that it's not just Fabric to Forge translation at last second). + Overall some code from TARDIM: IC might make its way into TARDIM hopefully + Try to smash all TODOs and warnings +Outside appearance: + Make a proper wiki/docs with CC methods, item recipes and explanations. Maybe even technical things. + Update README and Modrinth/Curse pages + Look into re-licensing and/or making proper public facing source code + Improve Discord server -Possibly an enchantment that works same as personal jammer \ No newline at end of file +LOOK INTO ============== +Things to overall re-search +* Applications for SWD Discord moderator. Could be a path to actually getting the bloody source code access +* Making TARDIM doors sync between TARDIM and external dimension +* Some kind of CC scanner method to see the outside (and?) GUI panel that lets you see said outside (or pre-installed iso. program) + see: dev9551's isometric renderer (or pine3d) +* Advanced drive/fuel storage for interstellar travel. Like a "stores 10000 fuel but you have to use it at once" +* Change block appearance based on item name when placed (like Supplementaries) +* More Create compat: engine powered by tardim fuel and way to "wind up" the TARDIM +* (Likely only if access to TARDIM source) Weblate for localisation +* Possibly an enchantment that works same as personal jammer \ No newline at end of file