diff --git a/.gitignore b/.gitignore index 40eecfb..6e89b75 100644 --- a/.gitignore +++ b/.gitignore @@ -79,5 +79,8 @@ run # Blender *.blend1 +# Affinity lock files +*.af*~lock~ + # File generated by JDT.LS .factorypath diff --git a/assets/awareness_block.afdesign b/assets/awareness_block.afdesign new file mode 100644 index 0000000..f5283cb Binary files /dev/null and b/assets/awareness_block.afdesign differ diff --git a/assets/awareness_block.bbmodel b/assets/awareness_block.bbmodel new file mode 100644 index 0000000..befd144 --- /dev/null +++ b/assets/awareness_block.bbmodel @@ -0,0 +1 @@ +{"meta":{"format_version":"4.9","model_format":"java_block","box_uv":false},"name":"awareness_block","parent":"","ambientocclusion":true,"front_gui_light":false,"visible_box":[1,1,0],"variable_placeholders":"","variable_placeholder_buttons":[],"unhandled_root_fields":{},"resolution":{"width":64,"height":64},"elements":[{"name":"cube","box_uv":false,"rescale":false,"locked":false,"render_order":"default","allow_mirror_modeling":true,"from":[0,0,0],"to":[16,16,16],"autouv":0,"color":5,"origin":[0,0,0],"faces":{"north":{"uv":[0,0,21.33333333333333,64],"texture":0},"east":{"uv":[0,0,21.33333333333333,64],"texture":0},"south":{"uv":[0,0,21.333333333333336,64],"texture":0},"west":{"uv":[0,0,21.33333333333333,64],"texture":0},"up":{"uv":[42.6666666666667,64,21.333333333333325,0],"texture":0},"down":{"uv":[64,0,42.666666666666664,64],"texture":0}},"type":"cube","uuid":"093840f4-e7a5-ccc7-4565-3d95fec652e1"}],"outliner":["093840f4-e7a5-ccc7-4565-3d95fec652e1"],"textures":[{"path":"/Users/blakerain/dev/bans-minecraft/utamacraft/src/main/resources/assets/utamacraft/textures/block/awareness_block.png","name":"awareness_block.png","folder":"block","namespace":"utamacraft","id":"0","width":48,"height":16,"uv_width":64,"uv_height":64,"particle":true,"layers_enabled":false,"sync_to_project":"","render_mode":"default","render_sides":"auto","frame_time":1,"frame_order_type":"loop","frame_order":"","frame_interpolate":false,"visible":true,"internal":true,"saved":true,"uuid":"a4330a6a-e91c-51be-5e67-a49d5592f046","relative_path":"../../src/main/resources/assets/utamacraft/textures/block/awareness_block.png","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAQCAYAAABQrvyxAAAAAXNSR0IArs4c6QAABV9JREFUSEtlVk2PFFUUPe9VdTd7ozA9/TGOusYQcGUARSFx5WKii9EMwY0bRFzAOMwOM+BKxLgwMcj4sSCZnSsVo2JMDErUv+ACZLpn2p2Z7qp65pz7Xk0TKplU1VTf9+4599xzn5vtzoUsy1EWE3ifISDAe49QBVShQuY9qhDAi98RKlRVBec8nAPa7RlkWYayLC0uxPgQ9Lss86iqFO+1TlWVMd7h/v1/kOc5JpOJ1mE874y1eHsGnNbi97Ks4L2Dcw5ubv6pwA3KooDPvJI4/NY1bTR9/XTlpF6ZStqEuPq9jjZIABjPqygKbc4I/o5gFR+m4wNGo5EAEUCe5fCKASaTMUisxQclmxIgoY08F8GuN/dEKCZk32uX586u49aHp7D43g18tfpqRA8cPXsdP3ywBO+ckoBjMSr0+z0Uqh4Td7pzMxKScROxl5LfrY6BqQRgvDNW4owjy7wTUKPREDG78VQB9w9wcCiphE5vLlRliUajhcNnruHW1VNYvHgDX66+IgYITuCdx5Ez1/DjlZPagKwx4W5nFopvNmumTGIOeZ5hMiki+4yx/1u8ARsOBijKEnv2tPQ/yrQsC3jnBWBnvFPHqMqSrjNgXKvd6QXqudlo4tnTn4r9QwefxsLCAjY2Nur7b3f+xLmPv8alN19SFVzU+8y+vVqw2WjU8qJ8qGsyxasuPxClRhCm53v37qpqrVZL7/wbj8doNVuSCBdVb1nRMYnVVr9SQp3e41QlMp+rAj9/9AYur118IPmXT7+PlaXjWFv/FheWTtjCUQLdTkfPpndL9sGy7zZwavDEPt+Hw4GSzBvUO4FZ/1AiNJREQqaEg/q0Km1/VbQ392RgEMmiRBKAc8sX6pKurX+D5ddfwOUvbgoIHYrouVu/11XSXJwLJubTu/UGv6n9zenEtDnLaLQtWZAUAqdsUiX4npyJazNHytIcio0NuG5/XhJiQ3KR59/5HHScZw4dwO3f/xDrK0snQBDnF48h4wLJMgH1wDSAVInpxpXmy1IyMFtMlgtsDYdw3nrCbNOcR7ILUE4kgVUhMAIsCgLz+u56/XlBISKCYIJHznymShw8sB+/3r4j5lkBMk9n4e9YXjJIG01y4hpMMFmpefa0i4TIYLJGYGtrS+uIQO2fI+c8iHZNh0sNwP3lTFVZO5Fs1Lqf2oqdDSfb/O+Xq6D+pXs5iERu+owDjTb6UHz07OTfWjvFS+dJciW2t20OUONFSceyAWmkWCXSoDQzoFVbxTjQJCGiT1HyeQBH394FsPzaMVuR31QFY5kbzLZnxF4dL5+mVjkDyJRNXmPREk9V4vNgc1OMJqdS9QLQaDZQFmXsDfaLgeH+XFsDjwDNhWyAsLuJ7PvVvfXwSA/HLw3APrTmM7dhQ8629yl3Picd8zsTsXFv7KeJmo4VFu+xuXlfFaV06P+UnFj3RlLqDzV2PN6k/UmE6/TmQ+psIiJR3737qJL8+y71adep65Z4ah5ZnQd63Y4ab9oaH5aOSc6Amd0q3jk1MS3UXEaObkeEKB2SOj345HIImIw5YB1cOswlZ2AynyzuNl6v/Yg2fHFtYJMkHSOibRoAY5+MyYX4LTaw6TmKeqquxmiF4dZQkpBl+gy5bNSUQLeZDk+zgXez3TgHlFXclItQkzdXHsPC2l/YWNlfJ29a91qUk5ig5/pdOxtFr58+mSZQaRhpcsZGTKz+OxrVAyvNER0ElYedOqfPPuxRJkCyJDf2gBDJGivpkbrTcInDQxrnkTn5b/R1gul22nWJk3RM3/R+rmn8Kz4OJsK1I7XDYDBUD/FbLT3nNXGn/5eO3LwzjtUhmP8BPwfdeSKKTmYAAAAASUVORK5CYII="}],"display":{"thirdperson_righthand":{"scale":[0.25,0.25,0.25]},"thirdperson_lefthand":{"scale":[0.25,0.25,0.25]},"firstperson_righthand":{"scale":[0.5,0.5,0.5]},"firstperson_lefthand":{"scale":[0.5,0.5,0.5]},"ground":{"scale":[0.5,0.5,0.5]},"gui":{"rotation":[21,137,0],"scale":[0.66,0.66,0.66]},"head":{"translation":[0,1.75,0],"scale":[0.9,0.9,0.9]},"fixed":{"translation":[0,0,0.75],"scale":[1,1,0.05]}}} \ No newline at end of file diff --git a/assets/bulb.afdesign b/assets/bulb.afdesign index 8449655..ebae20b 100644 Binary files a/assets/bulb.afdesign and b/assets/bulb.afdesign differ diff --git a/assets/noise.blend b/assets/noise.blend new file mode 100644 index 0000000..61a83b9 Binary files /dev/null and b/assets/noise.blend differ diff --git a/assets/noise.png b/assets/noise.png new file mode 100644 index 0000000..d308149 Binary files /dev/null and b/assets/noise.png differ diff --git a/build.gradle b/build.gradle index ff8aa77..b6dde1a 100644 --- a/build.gradle +++ b/build.gradle @@ -149,6 +149,10 @@ repositories { name = "Illusive Soulworks maven" url = "https://maven.theillusivec4.top/" } + + maven { + url = "https://www.cursemaven.com" + } } dependencies { @@ -175,6 +179,9 @@ dependencies { // Mekanism: useful for testing energy and so on. runtimeOnly(fg.deobf("mekanism:Mekanism:${minecraft_version}-${mekanism_version}")) + + // Storage Drawers: useful for testing different storage interfaces. + runtimeOnly(fg.deobf("curse.maven:storage-drawers-223852:3884263")) } mixin { diff --git a/gradle.properties b/gradle.properties index c912f91..b897d5c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -56,7 +56,7 @@ mod_name=Utamacraft Mod # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=MIT License # The mod version. See https://semver.org/ -mod_version=0.2.3-1.19 +mod_version=0.2.4-1.19 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html @@ -64,4 +64,4 @@ mod_group_id=net.banutama.utamacraft # The authors of the mod. This is a simple text string that is used for display purposes in the mod list. mod_authors=BanUtama, InstaGibKyd # The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. -mod_description=The mod for Ban's Minecraft Server \ No newline at end of file +mod_description=The mod for Ban's Minecraft Server diff --git a/src/main/java/net/banutama/utamacraft/CCRegistration.java b/src/main/java/net/banutama/utamacraft/CCRegistration.java index 34dc4d4..ec5c50e 100644 --- a/src/main/java/net/banutama/utamacraft/CCRegistration.java +++ b/src/main/java/net/banutama/utamacraft/CCRegistration.java @@ -2,8 +2,10 @@ package net.banutama.utamacraft; import dan200.computercraft.api.ForgeComputerCraftAPI; import dan200.computercraft.api.turtle.TurtleUpgradeSerialiser; +import net.banutama.utamacraft.block.entity.AwarenessBlockEntity; import net.banutama.utamacraft.block.entity.InsolatorBlockEntity; import net.banutama.utamacraft.integrations.computercraft.PeripheralProvider; +import net.banutama.utamacraft.integrations.computercraft.peripheral.AwarenessBlockPeripheral; import net.banutama.utamacraft.integrations.computercraft.peripheral.InsolatorPeripheral; import net.banutama.utamacraft.integrations.computercraft.turtles.TurtlePlayerUpgrade; import net.minecraft.resources.ResourceLocation; @@ -29,6 +31,8 @@ public class CCRegistration { TURTLE_SERIALIZERS.register(bus); peripheralProvider.registerBlockPeripheral(InsolatorPeripheral::new, InsolatorBlockEntity.class::isInstance); + peripheralProvider.registerBlockPeripheral(AwarenessBlockPeripheral::new, + AwarenessBlockEntity.class::isInstance); ForgeComputerCraftAPI.registerPeripheralProvider(peripheralProvider); } diff --git a/src/main/java/net/banutama/utamacraft/block/custom/AwarenessBlock.java b/src/main/java/net/banutama/utamacraft/block/custom/AwarenessBlock.java new file mode 100644 index 0000000..7238f2b --- /dev/null +++ b/src/main/java/net/banutama/utamacraft/block/custom/AwarenessBlock.java @@ -0,0 +1,37 @@ +package net.banutama.utamacraft.block.custom; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import net.banutama.utamacraft.block.entity.ModBlockEntities; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.RenderShape; +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.shapes.VoxelShape; + +public class AwarenessBlock extends BaseEntityBlock { + public static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 16, 16); + + public AwarenessBlock() { + super(getProperties()); + } + + public static Block.Properties getProperties() { + return Block.Properties.of(Material.METAL).strength(6.0f).requiresCorrectToolForDrops().noOcclusion(); + } + + @Override + public @NotNull RenderShape getRenderShape(@NotNull BlockState state) { + return RenderShape.MODEL; + } + + @Nullable + @Override + public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) { + return ModBlockEntities.AWARENESS_BLOCK.get().create(pos, state); + } +} diff --git a/src/main/java/net/banutama/utamacraft/block/custom/ModBlocks.java b/src/main/java/net/banutama/utamacraft/block/custom/ModBlocks.java index 8c133e0..08bd37f 100644 --- a/src/main/java/net/banutama/utamacraft/block/custom/ModBlocks.java +++ b/src/main/java/net/banutama/utamacraft/block/custom/ModBlocks.java @@ -17,34 +17,29 @@ import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; - public class ModBlocks { - public static final DeferredRegister BLOCKS = - DeferredRegister.create(ForgeRegistries.BLOCKS, Utamacraft.MOD_ID); + public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, + Utamacraft.MOD_ID); - public static final RegistryObject ETHEREAL_GLASS = - registerBlock("ethereal_glass", EtherealGlassBlock::new); - public static final RegistryObject ETHEREAL_GLASS_TINTED = - registerBlock("ethereal_glass_tinted", EtherealGlassTintedBlock::new); - public static final RegistryObject TUNGSTEN_ORE = - registerBlock("tungsten_ore", - () -> new DropExperienceBlock(BlockBehaviour.Properties.of(Material.STONE) - .strength(6.0f) - .requiresCorrectToolForDrops(), - UniformInt.of(3, 7))); - public static final RegistryObject DEEPSLATE_TUNGSTEN_ORE = - registerBlock("deepslate_tungsten_ore", - () -> new DropExperienceBlock(BlockBehaviour.Properties.of(Material.STONE) - .strength(6.0f) - .requiresCorrectToolForDrops(), - UniformInt.of(3, 7))); - public static final RegistryObject TUNGSTEN_BLOCK = - registerBlock("tungsten_block", - () -> new Block(BlockBehaviour.Properties.of(Material.METAL) - .strength(12.0f) - .requiresCorrectToolForDrops())); - public static final RegistryObject INSOLATOR = - registerBlock("insolator", InsolatorBlock::new); + public static final RegistryObject ETHEREAL_GLASS = registerBlock("ethereal_glass", EtherealGlassBlock::new); + public static final RegistryObject ETHEREAL_GLASS_TINTED = registerBlock("ethereal_glass_tinted", + EtherealGlassTintedBlock::new); + public static final RegistryObject TUNGSTEN_ORE = registerBlock("tungsten_ore", + () -> new DropExperienceBlock(BlockBehaviour.Properties.of(Material.STONE) + .strength(6.0f) + .requiresCorrectToolForDrops(), + UniformInt.of(3, 7))); + public static final RegistryObject DEEPSLATE_TUNGSTEN_ORE = registerBlock("deepslate_tungsten_ore", + () -> new DropExperienceBlock(BlockBehaviour.Properties.of(Material.STONE) + .strength(6.0f) + .requiresCorrectToolForDrops(), + UniformInt.of(3, 7))); + public static final RegistryObject TUNGSTEN_BLOCK = registerBlock("tungsten_block", + () -> new Block(BlockBehaviour.Properties.of(Material.METAL) + .strength(12.0f) + .requiresCorrectToolForDrops())); + public static final RegistryObject INSOLATOR = registerBlock("insolator", InsolatorBlock::new); + public static final RegistryObject AWARENESS_BLOCK = registerBlock("awareness_block", AwarenessBlock::new); private static RegistryObject registerBlock(String name, Supplier block) { RegistryObject registered_block = BLOCKS.register(name, block); @@ -53,7 +48,8 @@ public class ModBlocks { } private static void registerBlockItem(String name, RegistryObject block) { - ModItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties().tab(ModCreativeModeTab.TAB))); + ModItems.ITEMS.register(name, + () -> new BlockItem(block.get(), new Item.Properties().tab(ModCreativeModeTab.TAB))); } public static void register(IEventBus bus) { diff --git a/src/main/java/net/banutama/utamacraft/block/entity/AwarenessBlockEntity.java b/src/main/java/net/banutama/utamacraft/block/entity/AwarenessBlockEntity.java new file mode 100644 index 0000000..5723540 --- /dev/null +++ b/src/main/java/net/banutama/utamacraft/block/entity/AwarenessBlockEntity.java @@ -0,0 +1,11 @@ +package net.banutama.utamacraft.block.entity; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; + +public class AwarenessBlockEntity extends BlockEntity { + public AwarenessBlockEntity(BlockPos pos, BlockState state) { + super(ModBlockEntities.AWARENESS_BLOCK.get(), pos, state); + } +} diff --git a/src/main/java/net/banutama/utamacraft/block/entity/ModBlockEntities.java b/src/main/java/net/banutama/utamacraft/block/entity/ModBlockEntities.java index c1c200c..50e5dda 100644 --- a/src/main/java/net/banutama/utamacraft/block/entity/ModBlockEntities.java +++ b/src/main/java/net/banutama/utamacraft/block/entity/ModBlockEntities.java @@ -16,6 +16,10 @@ public class ModBlockEntities { "insolator", () -> BlockEntityType.Builder.of(InsolatorBlockEntity::new, ModBlocks.INSOLATOR.get()).build(null)); + public static final RegistryObject> AWARENESS_BLOCK = BLOCK_ENTITIES.register( + "awareness_block", + () -> BlockEntityType.Builder.of(AwarenessBlockEntity::new, ModBlocks.AWARENESS_BLOCK.get()).build(null)); + public static void register(IEventBus bus) { BLOCK_ENTITIES.register(bus); } diff --git a/src/main/java/net/banutama/utamacraft/integrations/computercraft/peripheral/AwarenessBlockPeripheral.java b/src/main/java/net/banutama/utamacraft/integrations/computercraft/peripheral/AwarenessBlockPeripheral.java new file mode 100644 index 0000000..2dbdea2 --- /dev/null +++ b/src/main/java/net/banutama/utamacraft/integrations/computercraft/peripheral/AwarenessBlockPeripheral.java @@ -0,0 +1,128 @@ +package net.banutama.utamacraft.integrations.computercraft.peripheral; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.jetbrains.annotations.NotNull; + +import dan200.computercraft.api.lua.IArguments; +import dan200.computercraft.api.lua.LuaException; +import dan200.computercraft.api.lua.LuaFunction; +import dan200.computercraft.api.lua.MethodResult; +import net.banutama.utamacraft.block.entity.AwarenessBlockEntity; +import net.banutama.utamacraft.util.LuaConverter; +import net.banutama.utamacraft.util.WorldScan; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.common.capabilities.ForgeCapabilities; +import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.registries.ForgeRegistries; + +public class AwarenessBlockPeripheral extends BasePeripheral { + public static final String PERIPHERAL_TYPE = "awareness_block"; + + protected AwarenessBlockPeripheral(BasePeripheralOwner owner) { + super(PERIPHERAL_TYPE, owner); + } + + public AwarenessBlockPeripheral(BlockEntity blockEntity) { + this(new BlockEntityPeripheralOwner(blockEntity)); + } + + @LuaFunction(mainThread = true) + public final @NotNull MethodResult scan(@NotNull IArguments arguments) throws LuaException { + int radius = arguments.getInt(0); + if (radius < 1) { + return MethodResult.of(null, "Radius must be greater than zero"); + } + + if (!(owner instanceof BlockEntityPeripheralOwner blockOwner)) { + return MethodResult.of(null, "Owner of this AwarenessBlockPeripheral is not a BlockEntityPeripheralOwner"); + } + + BlockEntity blockEntity = blockOwner.getBlockEntity(); + if (!(blockEntity instanceof AwarenessBlockEntity block)) { + return MethodResult.of(null, + "Owner of this AwarenessBlockEntity has a BlockEntityProviderOwner with a BlockEntity that is not an AwarenessBlockEntity"); + } + + Level level = blockEntity.getLevel(); + BlockPos origin = blockEntity.getBlockPos(); + + Map result = new HashMap<>(); + + { + Map originMap = new HashMap<>(); + originMap.put("x", origin.getX()); + originMap.put("y", origin.getY()); + originMap.put("z", origin.getZ()); + result.put("origin", originMap); + } + + List> blocks = new ArrayList<>(); + WorldScan.scanBlocks(level, origin, radius, (state, pos) -> { + blocks.add(describeBlock(level, origin, state, pos)); + }); + + result.put("blocks", blocks); + + return MethodResult.of(result); + } + + private static HashMap describeBlock(Level level, BlockPos origin, BlockState state, BlockPos pos) { + HashMap blockInfo = new HashMap<>(5); + + blockInfo.put("x", pos.getX() - origin.getX()); + blockInfo.put("y", pos.getY() - origin.getY()); + blockInfo.put("z", pos.getZ() - origin.getZ()); + + Block block = state.getBlock(); + ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block); + blockInfo.put("name", name == null ? "unknown" : name.toString()); + blockInfo.put("tags", LuaConverter.tagsToList(() -> block.builtInRegistryHolder().tags())); + + describeBlockEntity(blockInfo, level, pos); + + return blockInfo; + } + + private static void describeBlockEntity(HashMap blockInfo, Level level, BlockPos pos) { + BlockEntity blockEntity = level.getBlockEntity(pos); + + if (blockEntity == null) { + return; + } + + describeInventories(blockInfo, blockEntity); + } + + private static void describeInventories(HashMap blockInfo, BlockEntity entity) { + IItemHandler mainInventory = entity.getCapability(ForgeCapabilities.ITEM_HANDLER).resolve().orElse(null); + + if (mainInventory != null) { + blockInfo.put("inventory", describeInventory(mainInventory)); + } + } + + private static HashMap describeInventory(IItemHandler inventory) { + List> slots = new ArrayList<>(); + for (int i = 0; i < inventory.getSlots(); ++i) { + HashMap itemInfo = new HashMap<>(2); + ResourceLocation itemName = ForgeRegistries.ITEMS.getKey(inventory.getStackInSlot(i).getItem()); + itemInfo.put("name", itemName == null ? "unknown" : itemName.toString()); + itemInfo.put("count", inventory.getStackInSlot(i).getCount()); + slots.add(itemInfo); + } + + HashMap inventoryInfo = new HashMap<>(2); + inventoryInfo.put("size", inventory.getSlots()); + inventoryInfo.put("slots", slots); + return inventoryInfo; + } +} diff --git a/src/main/java/net/banutama/utamacraft/util/LuaConverter.java b/src/main/java/net/banutama/utamacraft/util/LuaConverter.java new file mode 100644 index 0000000..3264543 --- /dev/null +++ b/src/main/java/net/banutama/utamacraft/util/LuaConverter.java @@ -0,0 +1,19 @@ +package net.banutama.utamacraft.util; + +import java.util.List; +import java.util.function.Supplier; +import java.util.stream.Stream; + +import org.jetbrains.annotations.NotNull; + +import net.minecraft.tags.TagKey; + +public class LuaConverter { + public static List tagsToList(@NotNull Supplier>> tags) { + return tags.get().map(LuaConverter::tagToString).toList(); + } + + public static String tagToString(@NotNull TagKey tag) { + return tag.registry().location() + "/" + tag.location(); + } +} diff --git a/src/main/java/net/banutama/utamacraft/util/WorldScan.java b/src/main/java/net/banutama/utamacraft/util/WorldScan.java new file mode 100644 index 0000000..26f588c --- /dev/null +++ b/src/main/java/net/banutama/utamacraft/util/WorldScan.java @@ -0,0 +1,29 @@ +package net.banutama.utamacraft.util; + +import java.util.function.BiConsumer; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; + +public class WorldScan { + public static void scanBlocks(Level level, BlockPos origin, int r, + BiConsumer consumer) { + int ox = origin.getX(); + int oy = origin.getY(); + int oz = origin.getZ(); + + for (int x = ox - r; x <= ox + r; ++x) { + for (int y = oy - r; y <= oy + r; ++y) { + for (int z = oz - r; z <= oz + r; ++z) { + BlockPos pos = new BlockPos(x, y, z); + BlockState state = level.getBlockState(pos); + + if (!state.isAir()) { + consumer.accept(state, pos); + } + } + } + } + } +} diff --git a/src/main/resources/assets/utamacraft/blockstates/awareness_block.json b/src/main/resources/assets/utamacraft/blockstates/awareness_block.json new file mode 100644 index 0000000..2f6250d --- /dev/null +++ b/src/main/resources/assets/utamacraft/blockstates/awareness_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "utamacraft:block/awareness_block" + } + } +} diff --git a/src/main/resources/assets/utamacraft/lang/en_us.json b/src/main/resources/assets/utamacraft/lang/en_us.json index a1efa20..3e0008a 100644 --- a/src/main/resources/assets/utamacraft/lang/en_us.json +++ b/src/main/resources/assets/utamacraft/lang/en_us.json @@ -1,20 +1,26 @@ { + "block.utamacraft.awareness_block": "Awareness Block", "block.utamacraft.deepslate_tungsten_ore": "Deepslate Tungsten Ore", "block.utamacraft.ethereal_glass": "Ethereal Glass", "block.utamacraft.ethereal_glass_tinted": "Tinted Ethereal Glass", "block.utamacraft.insolator": "Insolator", "block.utamacraft.tungsten_block": "Tungsten Block", "block.utamacraft.tungsten_ore": "Tungsten Ore", + "block_entity.utamacraft.awareness_block": "Awareness Block", "block_entity.utamacraft.insolator": "Insolator", + "gui.utamacraft.insolator.dump": "Dump", + "gui.utamacraft.insolator.dump.tooltip": "Dump the fluid contents of the Insolator", + "gui.utamacraft.insolator.dump.tooltip.empty": "No fluid contents to dump from Insolator", + "item.utamacraft.awareness_block": "Awareness Block", "item.utamacraft.bulb": "Bulb", "item.utamacraft.fiber_glass": "Fiberglass", "item.utamacraft.fire_ward": "Fire Ward Necklace", "item.utamacraft.insolator": "Insolator", "item.utamacraft.pcb": "Printed Circuit Board", "item.utamacraft.player_peripheral": "Player peripheral", - "item.utamacraft.tungsten_raw": "Raw Tungsten", "item.utamacraft.tungsten_block": "Tungsten Block", "item.utamacraft.tungsten_ingot": "Tungsten Ingot", + "item.utamacraft.tungsten_raw": "Raw Tungsten", "itemGroup.utamacraft_tab": "Utamacraft", "tooltip.utamacraft.energy": "Energy", "tooltip.utamacraft.energy.amount": "%s FE", @@ -22,11 +28,8 @@ "tooltip.utamacraft.ethereal_glass": "Glass that is not solid to players", "tooltip.utamacraft.ethereal_glass_tinted": "Glass that is not solid to players and blocks light", "tooltip.utamacraft.fire_ward": "Protects the player from fire damage", - "tooltip.utamacraft.fluid.empty": "Empty", "tooltip.utamacraft.fluid.amount": "%s mB", "tooltip.utamacraft.fluid.amount.with_capacity": "%s / %s mB", - "turtle.utamacraft.player_turtle": "Player", - "gui.utamacraft.insolator.dump": "Dump", - "gui.utamacraft.insolator.dump.tooltip": "Dump the fluid contents of the Insolator", - "gui.utamacraft.insolator.dump.tooltip.empty": "No fluid contents to dump from Insolator" + "tooltip.utamacraft.fluid.empty": "Empty", + "turtle.utamacraft.player_turtle": "Player" } diff --git a/src/main/resources/assets/utamacraft/models/block/awareness_block.json b/src/main/resources/assets/utamacraft/models/block/awareness_block.json new file mode 100644 index 0000000..f371a0d --- /dev/null +++ b/src/main/resources/assets/utamacraft/models/block/awareness_block.json @@ -0,0 +1,51 @@ +{ + "credit": "Made with Blockbench", + "texture_size": [64, 64], + "textures": { + "0": "utamacraft:block/awareness_block", + "particle": "utamacraft:block/awareness_block" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 5.33333, 16], "texture": "#0"}, + "east": {"uv": [0, 0, 5.33333, 16], "texture": "#0"}, + "south": {"uv": [0, 0, 5.33333, 16], "texture": "#0"}, + "west": {"uv": [0, 0, 5.33333, 16], "texture": "#0"}, + "up": {"uv": [10.66667, 16, 5.33333, 0], "texture": "#0"}, + "down": {"uv": [16, 0, 10.66667, 16], "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "scale": [0.25, 0.25, 0.25] + }, + "thirdperson_lefthand": { + "scale": [0.25, 0.25, 0.25] + }, + "firstperson_righthand": { + "scale": [0.5, 0.5, 0.5] + }, + "firstperson_lefthand": { + "scale": [0.5, 0.5, 0.5] + }, + "ground": { + "scale": [0.5, 0.5, 0.5] + }, + "gui": { + "rotation": [21, 137, 0], + "scale": [0.66, 0.66, 0.66] + }, + "head": { + "translation": [0, 1.75, 0], + "scale": [0.9, 0.9, 0.9] + }, + "fixed": { + "translation": [0, 0, 0.75], + "scale": [1, 1, 0.05] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/utamacraft/models/item/awareness_block.json b/src/main/resources/assets/utamacraft/models/item/awareness_block.json new file mode 100644 index 0000000..8e9b899 --- /dev/null +++ b/src/main/resources/assets/utamacraft/models/item/awareness_block.json @@ -0,0 +1,3 @@ +{ + "parent": "utamacraft:block/awareness_block" +} diff --git a/src/main/resources/assets/utamacraft/textures/block/awareness_block.png b/src/main/resources/assets/utamacraft/textures/block/awareness_block.png new file mode 100644 index 0000000..5f3b287 Binary files /dev/null and b/src/main/resources/assets/utamacraft/textures/block/awareness_block.png differ diff --git a/updates.json b/updates.json index 390b45e..ae096b1 100644 --- a/updates.json +++ b/updates.json @@ -1,6 +1,7 @@ { "homepage": "https://git.blakerain.com/bans-minecraft/utamacraft", "1.19.2": { + "0.2.4-1.19": "Add some fixes and new textures", "0.2.3-1.19": "Add CC peripheral for Insolator", "0.2.2-1.19": "Fix bugs with Insolator", "0.2.1-1.19": "Fixed mixin bug", @@ -10,7 +11,7 @@ "0.0.1-1.19": "Initial release" }, "promos": { - "1.19.2-latest": "0.2.3-1.19", - "1.19.2-recommended": "0.2.3-1.19" + "1.19.2-latest": "0.2.4-1.19", + "1.19.2-recommended": "0.2.4-1.19" } -} \ No newline at end of file +}