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 new file mode 100644 index 0000000..c98028b Binary files /dev/null and b/Common/src/main/resources/assets/minecraft/textures/models/armor/personal_jammer.png differ diff --git a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListBiomes.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListBiomes.java new file mode 100644 index 0000000..eb6e399 --- /dev/null +++ b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListBiomes.java @@ -0,0 +1,54 @@ +package su.a71.tardim_ic.tardim_ic.command; + +import com.swdteam.tardim.common.command.tardim.CommandTardimBase; +import com.swdteam.tardim.common.command.tardim.ICommand; +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.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/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListDimensions.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListDimensions.java new file mode 100644 index 0000000..ead9842 --- /dev/null +++ b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListDimensions.java @@ -0,0 +1,45 @@ +package su.a71.tardim_ic.tardim_ic.command; + +import com.swdteam.tardim.common.command.tardim.CommandTardimBase; +import com.swdteam.tardim.common.command.tardim.ICommand; +import com.swdteam.tardim.tardim.TardimData; +import com.swdteam.tardim.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/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfacePeripheral.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfacePeripheral.java index e89d3f1..d3a1d5a 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfacePeripheral.java +++ b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfacePeripheral.java @@ -868,4 +868,40 @@ public class DigitalInterfacePeripheral implements IPeripheral { 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/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CommandInit.java b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CommandInit.java index ca5e64d..8071a5e 100644 --- a/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CommandInit.java +++ b/Fabric/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CommandInit.java @@ -4,9 +4,11 @@ package su.a71.tardim_ic.tardim_ic.registration; 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; public class CommandInit { public static void init() { + CommandManager.register(new CommandListBiomes()); CommandManager.register(new CommandCloisterBell()); } } diff --git a/Fabric/src/main/resources/fabric.mod.json b/Fabric/src/main/resources/fabric.mod.json index 2da5547..dec8061 100644 --- a/Fabric/src/main/resources/fabric.mod.json +++ b/Fabric/src/main/resources/fabric.mod.json @@ -22,6 +22,7 @@ ] }, "mixins": [ + "mixins.tardim_ic.json" ], "depends": { diff --git a/Fabric/src/main/resources/mixins.tardim_ic.json b/Fabric/src/main/resources/mixins.tardim_ic.json index f2465f8..6fc1843 100644 --- a/Fabric/src/main/resources/mixins.tardim_ic.json +++ b/Fabric/src/main/resources/mixins.tardim_ic.json @@ -4,7 +4,6 @@ "compatibilityLevel": "JAVA_17", "refmap": "refmap.tardim_ic.json", "mixins": [ - "JammerMixin" ], "client": [ ], 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 new file mode 100644 index 0000000..1455788 --- /dev/null +++ b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListBiomes.java @@ -0,0 +1,54 @@ +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 new file mode 100644 index 0000000..2ff16ea --- /dev/null +++ b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/command/CommandListDimensions.java @@ -0,0 +1,47 @@ +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/digital_interface/DigitalInterfacePeripheral.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/digital_interface/DigitalInterfacePeripheral.java index 9c51db9..7df5118 100644 --- 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 @@ -33,9 +33,12 @@ 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.*; @@ -93,7 +96,6 @@ public class DigitalInterfacePeripheral implements IPeripheral { return tileEntity; } - /** * Get TARDIM's data, which we need for *every* function *

@@ -846,4 +848,40 @@ public class DigitalInterfacePeripheral implements IPeripheral { 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/registration/CommandInit.java b/Forge/src/main/java/su/a71/tardim_ic/tardim_ic/registration/CommandInit.java index 1b25632..20be2d0 100644 --- 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 @@ -1,6 +1,8 @@ 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; @@ -9,5 +11,7 @@ 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/TODO.txt b/TODO.txt new file mode 100644 index 0000000..f8a0bee --- /dev/null +++ b/TODO.txt @@ -0,0 +1,47 @@ +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 + 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 \ No newline at end of file