From 58aa4f32594c0d69adfc88c904727d889d1c5e04 Mon Sep 17 00:00:00 2001 From: ThunderSphun Date: Wed, 5 Jan 2022 08:42:52 +0100 Subject: [PATCH 01/11] added gitignore --- .gitignore | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 From ed8a563507f4e5d7262e31945c8976436909b93d Mon Sep 17 00:00:00 2001 From: ThunderSphun Date: Wed, 5 Jan 2022 08:43:05 +0100 Subject: [PATCH 02/11] updated gitignore --- .gitignore | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/.gitignore b/.gitignore index e69de29..2086e04 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,111 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/intellij +# Edit at https://www.toptal.com/developers/gitignore?templates=intellij + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +# End of https://www.toptal.com/developers/gitignore/api/intellij \ No newline at end of file From 105c35bb74b1abeac9c3b332f6a5f23b7c99d292 Mon Sep 17 00:00:00 2001 From: ThunderSphun Date: Wed, 5 Jan 2022 08:51:30 +0100 Subject: [PATCH 03/11] updated gitignore once more --- .gitignore | 114 ++--------------------------------------------------- 1 file changed, 4 insertions(+), 110 deletions(-) diff --git a/.gitignore b/.gitignore index 2086e04..8ba8551 100644 --- a/.gitignore +++ b/.gitignore @@ -1,111 +1,5 @@ +.gradle +.idea -# Created by https://www.toptal.com/developers/gitignore/api/intellij -# Edit at https://www.toptal.com/developers/gitignore?templates=intellij - -### Intellij ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# AWS User-specific -.idea/**/aws.xml - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -### Intellij Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -# https://plugins.jetbrains.com/plugin/7973-sonarlint -.idea/**/sonarlint/ - -# SonarQube Plugin -# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin -.idea/**/sonarIssues.xml - -# Markdown Navigator plugin -# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced -.idea/**/markdown-navigator.xml -.idea/**/markdown-navigator-enh.xml -.idea/**/markdown-navigator/ - -# Cache file creation bug -# See https://youtrack.jetbrains.com/issue/JBR-2257 -.idea/$CACHE_FILE$ - -# CodeStream plugin -# https://plugins.jetbrains.com/plugin/12206-codestream -.idea/codestream.xml - -# End of https://www.toptal.com/developers/gitignore/api/intellij \ No newline at end of file +build +run \ No newline at end of file From 73c2670fda9dd2ee5f980dcd230684e7aa656588 Mon Sep 17 00:00:00 2001 From: ThunderSphun Date: Wed, 5 Jan 2022 08:52:12 +0100 Subject: [PATCH 04/11] made code coherent with java style guide --- src/main/java/gd/rf/acro/scf/ClientInit.java | 20 +- .../rf/acro/scf/CobblestoneFunnelBlock.java | 237 ++++++++---------- src/main/java/gd/rf/acro/scf/ConfigUtils.java | 158 ++++++------ src/main/java/gd/rf/acro/scf/SCF.java | 163 ++++++------ 4 files changed, 263 insertions(+), 315 deletions(-) diff --git a/src/main/java/gd/rf/acro/scf/ClientInit.java b/src/main/java/gd/rf/acro/scf/ClientInit.java index 42e07a6..e8b1bad 100644 --- a/src/main/java/gd/rf/acro/scf/ClientInit.java +++ b/src/main/java/gd/rf/acro/scf/ClientInit.java @@ -2,18 +2,16 @@ import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; -import net.minecraft.item.ItemStack; import net.minecraft.sound.SoundEvents; public class ClientInit implements ClientModInitializer { - @Override - public void onInitializeClient() { - ClientSidePacketRegistry.INSTANCE.register(SCF.SEND_SOUND, - (packetContext, attachedData) -> { - if(attachedData.readInt()==1) - { - packetContext.getPlayer().playSound(SoundEvents.BLOCK_LAVA_EXTINGUISH,1,1); - } - }); - } + @Override + public void onInitializeClient() { + ClientSidePacketRegistry.INSTANCE.register(SCF.SEND_SOUND, + (packetContext, attachedData) -> { + if (attachedData.readInt() == 1) { + packetContext.getPlayer().playSound(SoundEvents.BLOCK_LAVA_EXTINGUISH, 1, 1); + } + }); + } } diff --git a/src/main/java/gd/rf/acro/scf/CobblestoneFunnelBlock.java b/src/main/java/gd/rf/acro/scf/CobblestoneFunnelBlock.java index 953fe95..b4ffa09 100644 --- a/src/main/java/gd/rf/acro/scf/CobblestoneFunnelBlock.java +++ b/src/main/java/gd/rf/acro/scf/CobblestoneFunnelBlock.java @@ -1,13 +1,10 @@ package gd.rf.acro.scf; -import io.github.cottonmc.resources.BuiltinResources; -import io.github.cottonmc.resources.CottonResources; import io.netty.buffer.Unpooled; import net.fabricmc.fabric.api.network.ServerSidePacketRegistry; import net.fabricmc.fabric.api.server.PlayerStream; import net.minecraft.block.Block; import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; import net.minecraft.block.ShapeContext; import net.minecraft.client.item.TooltipContext; import net.minecraft.entity.LivingEntity; @@ -15,7 +12,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.network.PacketByteBuf; import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundEvents; import net.minecraft.tag.FluidTags; import net.minecraft.text.LiteralText; import net.minecraft.text.Text; @@ -30,144 +26,121 @@ import net.minecraft.world.World; import org.apache.commons.lang3.RandomUtils; -import java.util.Arrays; -import java.util.HashMap; import java.util.List; import java.util.Random; public class CobblestoneFunnelBlock extends Block { - private int level; - private int period; - - - - public CobblestoneFunnelBlock(Settings settings, int tlevel, int tperiod) { - super(settings); - level=tlevel; - period=tperiod; - - } - - @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(2,1,2,14,16,14); - } - - @Override - public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - super.scheduledTick(state, world, pos, random); - if(hasLavaAndWater(pos,world) && world.getBlockState(pos.down()).isAir()) - { - PacketByteBuf packetByteBuf = new PacketByteBuf(Unpooled.buffer()); - packetByteBuf.writeInt(1); - PlayerStream.around(world,pos,5).forEach(pp->ServerSidePacketRegistry.INSTANCE.sendToPlayer(pp,SCF.SEND_SOUND,packetByteBuf)); - if(level==-1) - { - level=SCF.ORES.length; - } - long picked = RandomUtils.nextLong(0,countTotalWeights()); - System.out.println("picked: "+picked); - world.setBlockState(pos.down(),Registry.BLOCK.get(Identifier.tryParse(getOreFromBigNumber(picked))).getDefaultState()); - } - world.getBlockTickScheduler().schedule(pos,this,period); - } - - private boolean hasLavaAndWater(BlockPos pos, World world) - { - boolean hasWater = false; - boolean hasLava = false; - if(FluidTags.WATER.contains(world.getBlockState(pos.east()).getFluidState().getFluid())) - { - hasWater=true; - } - if(FluidTags.LAVA.contains(world.getBlockState(pos.east()).getFluidState().getFluid())) - { - hasLava=true; - } - - if(FluidTags.WATER.contains(world.getBlockState(pos.west()).getFluidState().getFluid())) - { - hasWater=true; - } - if(FluidTags.LAVA.contains(world.getBlockState(pos.west()).getFluidState().getFluid())) - { - hasLava=true; - } - - if(FluidTags.WATER.contains(world.getBlockState(pos.south()).getFluidState().getFluid())) - { - hasWater=true; - } - if(FluidTags.LAVA.contains(world.getBlockState(pos.south()).getFluidState().getFluid())) - { - hasLava=true; - } - - if(FluidTags.WATER.contains(world.getBlockState(pos.north()).getFluidState().getFluid())) - { - hasWater=true; - } - if(FluidTags.LAVA.contains(world.getBlockState(pos.north()).getFluidState().getFluid())) - { - hasLava=true; - } - - - return hasLava && hasWater; - } - - @Override - public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { - super.onPlaced(world, pos, state, placer, itemStack); - world.getBlockTickScheduler().schedule(pos,this,period); - - } - - @Override - public void buildTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options) { - super.buildTooltip(stack, world, tooltip, options); - tooltip.add(new LiteralText("1 block every "+period/20f+" second(s)")); - if(level==-1) - { - level=SCF.ORES.length; - } - tooltip.add(new LiteralText("best block out: "+Registry.BLOCK.get(Identifier.tryParse(SCF.ORES[level-1])).getName().getString())); - tooltip.add(new LiteralText("(shift-use the block to see others!)")); - } + private int level; + private final int period; + private final static VoxelShape SHAPE = Block.createCuboidShape(2, 1, 2, 14, 16, 14); + + public CobblestoneFunnelBlock(Settings settings, int level, int period) { + super(settings); + this.level = level; + this.period = period; + } + + @Override + @SuppressWarnings("deprecation") + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return SHAPE; + } + + @Override + @SuppressWarnings("deprecation") + public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + super.scheduledTick(state, world, pos, random); + if (hasLavaAndWater(pos, world) && world.getBlockState(pos.down()).isAir()) { + PacketByteBuf packetByteBuf = new PacketByteBuf(Unpooled.buffer()); + packetByteBuf.writeInt(1); + PlayerStream.around(world, pos, 5).forEach(pp -> ServerSidePacketRegistry.INSTANCE.sendToPlayer(pp, SCF.SEND_SOUND, packetByteBuf)); + if (this.level == -1) { + this.level = SCF.ORES.length; + } + long picked = RandomUtils.nextLong(0, countTotalWeights()); + System.out.println("picked: " + picked); + world.setBlockState(pos.down(), Registry.BLOCK.get(Identifier.tryParse(getOreFromBigNumber(picked))).getDefaultState()); + } + world.getBlockTickScheduler().schedule(pos, this, this.period); + } + + private boolean hasLavaAndWater(BlockPos pos, World world) { + boolean hasWater = false; + boolean hasLava = false; + if (FluidTags.WATER.contains(world.getBlockState(pos.east()).getFluidState().getFluid())) { + hasWater = true; + } else if (FluidTags.LAVA.contains(world.getBlockState(pos.east()).getFluidState().getFluid())) { + hasLava = true; + } + + if (FluidTags.WATER.contains(world.getBlockState(pos.west()).getFluidState().getFluid())) { + hasWater = true; + } else if (FluidTags.LAVA.contains(world.getBlockState(pos.west()).getFluidState().getFluid())) { + hasLava = true; + } + + if (FluidTags.WATER.contains(world.getBlockState(pos.south()).getFluidState().getFluid())) { + hasWater = true; + } else if (FluidTags.LAVA.contains(world.getBlockState(pos.south()).getFluidState().getFluid())) { + hasLava = true; + } + + if (FluidTags.WATER.contains(world.getBlockState(pos.north()).getFluidState().getFluid())) { + hasWater = true; + } else if (FluidTags.LAVA.contains(world.getBlockState(pos.north()).getFluidState().getFluid())) { + hasLava = true; + } + + return hasLava && hasWater; + } + + @Override + public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { + super.onPlaced(world, pos, state, placer, itemStack); + world.getBlockTickScheduler().schedule(pos, this, this.period); + } + + @Override + public void buildTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options) { + super.buildTooltip(stack, world, tooltip, options); + tooltip.add(new LiteralText("1 block every " + (this.period / 20f) + " second(s)")); + if (this.level == -1) { + this.level = SCF.ORES.length; + } + tooltip.add(new LiteralText("best block out: " + Registry.BLOCK.get(Identifier.tryParse(SCF.ORES[this.level - 1])).getName().getString())); + tooltip.add(new LiteralText("(shift-use the block to see others!)")); + } @Override + @SuppressWarnings("deprecation") public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if(player.isSneaking() && hand==Hand.MAIN_HAND && world.isClient) - { - for (int i = 0; i < level; i++) { - player.sendMessage(new LiteralText(Registry.BLOCK.get(Identifier.tryParse(SCF.ORES[i])).getName().getString()),false); + if (player.isSneaking() && hand == Hand.MAIN_HAND && world.isClient) { + for (int i = 0; i < this.level; i++) { + player.sendMessage(new LiteralText(Registry.BLOCK.get(Identifier.tryParse(SCF.ORES[i])).getName().getString()), false); } } return super.onUse(state, world, pos, player, hand, hit); } - private long countTotalWeights() - { - long clap = 0; - for (int i = 0; i < level; i++) { - clap+=Integer.parseInt(SCF.WEIGHTS[i]); - } - System.out.println("total: "+clap); - return clap+1; //to include the last number - } - private String getOreFromBigNumber(long bigNumber) - { - int counter =0; - long inter = 0; - while (interbigNumber) - { - return SCF.ORES[counter]; - } - counter++; - } - return SCF.ORES[counter]; - } + private long countTotalWeights() { + long clap = 0; + for (int i = 0; i < this.level; i++) { + clap += Integer.parseInt(SCF.WEIGHTS[i]); + } + System.out.println("total: " + clap); + return clap + 1; //to include the last number + } + + private String getOreFromBigNumber(long bigNumber) { + int counter = 0; + long inter = 0; + while (inter < bigNumber) { + inter += Integer.parseInt(SCF.WEIGHTS[counter]); + if (inter > bigNumber) { + return SCF.ORES[counter]; + } + counter++; + } + return SCF.ORES[counter]; + } } diff --git a/src/main/java/gd/rf/acro/scf/ConfigUtils.java b/src/main/java/gd/rf/acro/scf/ConfigUtils.java index 4b8b4f8..bae95e7 100644 --- a/src/main/java/gd/rf/acro/scf/ConfigUtils.java +++ b/src/main/java/gd/rf/acro/scf/ConfigUtils.java @@ -11,89 +11,77 @@ import java.util.Map; public class ConfigUtils { - - public static Map config = new HashMap<>(); - - - public static Map loadConfigs() - { - File file = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/config.acfg"); - try { - List lines = FileUtils.readLines(file,"utf-8"); - lines.forEach(line-> - { - if(line.charAt(0)!='#') - { - String noSpace = line.replace(" ",""); - String[] entry = noSpace.split("="); - config.put(entry[0],entry[1]); - } - }); - } catch (IOException e) { - e.printStackTrace(); - } - return config; - } - - public static void generateConfigs(List input) - { - File file = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/config.acfg"); - - try { - FileUtils.writeLines(file,input); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public static Map checkConfigs() - { - if(new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/config.acfg").exists()) - { - return loadConfigs(); - } - generateConfigs(makeDefaults()); - return loadConfigs(); - } - - private static List makeDefaults() - { - List defaults = new ArrayList<>(); - defaults.add("#cobblestone funnel ore level (default 5)"); - defaults.add("cobblelvl=5"); - defaults.add("#cobblestone funnel speed (default 60)"); - defaults.add("cobblespeed=60"); - - defaults.add("#copper funnel ore level (default 9)"); - defaults.add("copperlvl=9"); - defaults.add("#copper funnel speed (default 60)"); - defaults.add("copperspeed=60"); - - defaults.add("#bronze funnel ore level (default 9)"); - defaults.add("bronzelvl=9"); - defaults.add("#bronze funnel speed (default 30)"); - defaults.add("bronzespeed=30"); - - defaults.add("#iron funnel ore level (default 14)"); - defaults.add("ironlvl=14"); - defaults.add("#iron funnel speed (default 50)"); - defaults.add("ironspeed=50"); - - defaults.add("#gold funnel ore level (default 17)"); - defaults.add("goldlvl=17"); - defaults.add("#gold funnel speed (default 40)"); - defaults.add("goldspeed=40"); - - defaults.add("#diamond funnel ore level (default -1)"); - defaults.add("diamondlvl=-1"); - defaults.add("#diamond funnel speed (default 40)"); - defaults.add("diamondspeed=40"); - - defaults.add("#netherite funnel ore level (default -1)"); - defaults.add("netheritelvl=-1"); - defaults.add("#netherite funnel speed (default 20)"); - defaults.add("netheritespeed=20"); - return defaults; - } - + public static Map config = new HashMap<>(); + private static final File file = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/config.acfg"); + + public static Map loadConfigs() { + try { + List lines = FileUtils.readLines(file, "utf-8"); + lines.forEach(line -> { + if (line.charAt(0) != '#') { + String noSpace = line.replace(" ", ""); + String[] entry = noSpace.split("="); + config.put(entry[0], entry[1]); + } + }); + } catch (IOException e) { + e.printStackTrace(); + } + return config; + } + + public static void generateConfigs(List input) { + try { + FileUtils.writeLines(file, input); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static Map checkConfigs() { + if (file.exists()) { + return loadConfigs(); + } + generateConfigs(makeDefaults()); + return loadConfigs(); + } + + private static List makeDefaults() { + List defaults = new ArrayList<>(); + defaults.add("#cobblestone funnel ore level (default 5)"); + defaults.add("cobblelvl=5"); + defaults.add("#cobblestone funnel speed (default 60)"); + defaults.add("cobblespeed=60"); + + defaults.add("#copper funnel ore level (default 9)"); + defaults.add("copperlvl=9"); + defaults.add("#copper funnel speed (default 60)"); + defaults.add("copperspeed=60"); + + defaults.add("#bronze funnel ore level (default 9)"); + defaults.add("bronzelvl=9"); + defaults.add("#bronze funnel speed (default 30)"); + defaults.add("bronzespeed=30"); + + defaults.add("#iron funnel ore level (default 14)"); + defaults.add("ironlvl=14"); + defaults.add("#iron funnel speed (default 50)"); + defaults.add("ironspeed=50"); + + defaults.add("#gold funnel ore level (default 17)"); + defaults.add("goldlvl=17"); + defaults.add("#gold funnel speed (default 40)"); + defaults.add("goldspeed=40"); + + defaults.add("#diamond funnel ore level (default -1)"); + defaults.add("diamondlvl=-1"); + defaults.add("#diamond funnel speed (default 40)"); + defaults.add("diamondspeed=40"); + + defaults.add("#netherite funnel ore level (default -1)"); + defaults.add("netheritelvl=-1"); + defaults.add("#netherite funnel speed (default 20)"); + defaults.add("netheritespeed=20"); + return defaults; + } } diff --git a/src/main/java/gd/rf/acro/scf/SCF.java b/src/main/java/gd/rf/acro/scf/SCF.java index 6c5b02b..22b233c 100644 --- a/src/main/java/gd/rf/acro/scf/SCF.java +++ b/src/main/java/gd/rf/acro/scf/SCF.java @@ -9,7 +9,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; -import net.minecraft.loot.LootTables; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; import org.apache.commons.io.FileUtils; @@ -17,91 +16,11 @@ import java.io.File; import java.io.IOException; import java.util.Arrays; -import java.util.HashMap; -import java.util.List; import java.util.Map; public class SCF implements ModInitializer { - public static final Identifier SEND_SOUND = new Identifier("scf","send_sound"); - public static String[] ORES = {}; - public static String[] WEIGHTS = {}; - public static final ItemGroup TAB = FabricItemGroupBuilder.build( - new Identifier("scf", "tab"), - () -> new ItemStack(SCF.COBBLESTONE_FUNNEL_BLOCK)); - @Override - public void onInitialize() { - // This code runs as soon as Minecraft is in a mod-load-ready state. - // However, some things (like resources) may still be uninitialized. - // Proceed with mild caution. - ConfigUtils.checkConfigs(); - registerBlocks(); - registerItems(); - readOreTable(); - System.out.println("Hello Fabric world!"); - } - public static CobblestoneFunnelBlock COBBLESTONE_FUNNEL_BLOCK; - public static CobblestoneFunnelBlock COPPER_FUNNEL_BLOCK; - public static CobblestoneFunnelBlock BRONZE_FUNNEL_BLOCK; - public static CobblestoneFunnelBlock IRON_FUNNEL_BLOCK; - public static CobblestoneFunnelBlock GOLD_FUNNEL_BLOCK; - public static CobblestoneFunnelBlock DIAMOND_FUNNEL_BLOCK; - public static CobblestoneFunnelBlock NETHERITE_FUNNEL_BLOCK; - private void registerBlocks() - { - Map c = ConfigUtils.config; - COBBLESTONE_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f,0),Integer.parseInt(c.get("cobblelvl")),Integer.parseInt(c.get("cobblespeed"))); - COPPER_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f,0),Integer.parseInt(c.get("copperlvl")),Integer.parseInt(c.get("copperspeed"))); - BRONZE_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f,0),Integer.parseInt(c.get("bronzelvl")),Integer.parseInt(c.get("bronzespeed"))); - IRON_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f,0),Integer.parseInt(c.get("ironlvl")),Integer.parseInt(c.get("ironspeed"))); - GOLD_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f,0),Integer.parseInt(c.get("goldlvl")),Integer.parseInt(c.get("goldspeed"))); - DIAMOND_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f,0),Integer.parseInt(c.get("diamondlvl")),Integer.parseInt(c.get("diamondspeed"))); - NETHERITE_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f,0),Integer.parseInt(c.get("netheritelvl")),Integer.parseInt(c.get("netheritespeed"))); - - - - Registry.register(Registry.BLOCK,new Identifier("scf","cobblestone_funnel"),COBBLESTONE_FUNNEL_BLOCK); - Registry.register(Registry.BLOCK,new Identifier("scf","copper_funnel"),COPPER_FUNNEL_BLOCK); - Registry.register(Registry.BLOCK,new Identifier("scf","bronze_funnel"),BRONZE_FUNNEL_BLOCK); - Registry.register(Registry.BLOCK,new Identifier("scf","iron_funnel"),IRON_FUNNEL_BLOCK); - Registry.register(Registry.BLOCK,new Identifier("scf","gold_funnel"),GOLD_FUNNEL_BLOCK); - Registry.register(Registry.BLOCK,new Identifier("scf","diamond_funnel"),DIAMOND_FUNNEL_BLOCK); - Registry.register(Registry.BLOCK,new Identifier("scf","netherite_funnel"),NETHERITE_FUNNEL_BLOCK); - } - private void registerItems() - { - Registry.register(Registry.ITEM,new Identifier("scf","cobblestone_funnel"),new BlockItem(COBBLESTONE_FUNNEL_BLOCK,new Item.Settings().group(TAB))); - Registry.register(Registry.ITEM,new Identifier("scf","copper_funnel"),new BlockItem(COPPER_FUNNEL_BLOCK,new Item.Settings().group(TAB))); - Registry.register(Registry.ITEM,new Identifier("scf","bronze_funnel"),new BlockItem(BRONZE_FUNNEL_BLOCK,new Item.Settings().group(TAB))); - Registry.register(Registry.ITEM,new Identifier("scf","iron_funnel"),new BlockItem(IRON_FUNNEL_BLOCK,new Item.Settings().group(TAB))); - Registry.register(Registry.ITEM,new Identifier("scf","gold_funnel"),new BlockItem(GOLD_FUNNEL_BLOCK,new Item.Settings().group(TAB))); - Registry.register(Registry.ITEM,new Identifier("scf","diamond_funnel"),new BlockItem(DIAMOND_FUNNEL_BLOCK,new Item.Settings().group(TAB))); - Registry.register(Registry.ITEM,new Identifier("scf","netherite_funnel"),new BlockItem(NETHERITE_FUNNEL_BLOCK,new Item.Settings().group(TAB))); - } - - private void readOreTable() - { - File file = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/funnel_blocks.acfg"); - File file2 = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/funnel_blocks_weights.acfg"); - try - { - if(!file.exists()) - { - FileUtils.writeLines(file, Arrays.asList(cRES)); - } - ORES= FileUtils.readLines(file,"utf-8").toArray(ORES); - - if(!file2.exists()) - { - FileUtils.writeLines(file2, Arrays.asList(cResRolls)); - } - WEIGHTS= FileUtils.readLines(file2,"utf-8").toArray(WEIGHTS); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static final String[] cRES = - { + public static final Identifier SEND_SOUND = new Identifier("scf", "send_sound"); + private static final String[] cRES = { "minecraft:cobblestone", "minecraft:stone", "minecraft:coal_ore", @@ -129,11 +48,9 @@ private void readOreTable() "c:sapphire_ore", "c:ruby_ore", "minecraft:ancient_debris", - }; - private static final String[] cResRolls = - { + private static final String[] cResRolls = { "100", "100", "100", @@ -161,6 +78,78 @@ private void readOreTable() "20", "20", "1" - }; + + public static String[] ORES = {}; + public static String[] WEIGHTS = {}; + + public static CobblestoneFunnelBlock COBBLESTONE_FUNNEL_BLOCK; + public static CobblestoneFunnelBlock COPPER_FUNNEL_BLOCK; + public static CobblestoneFunnelBlock BRONZE_FUNNEL_BLOCK; + public static CobblestoneFunnelBlock IRON_FUNNEL_BLOCK; + public static CobblestoneFunnelBlock GOLD_FUNNEL_BLOCK; + public static CobblestoneFunnelBlock DIAMOND_FUNNEL_BLOCK; + public static CobblestoneFunnelBlock NETHERITE_FUNNEL_BLOCK; + + public static final ItemGroup TAB = FabricItemGroupBuilder.build( + new Identifier("scf", "tab"), + () -> new ItemStack(SCF.COBBLESTONE_FUNNEL_BLOCK)); + + @Override + public void onInitialize() { + ConfigUtils.checkConfigs(); + + registerBlocks(); + registerItems(); + + readOreTable(); + } + + private void registerBlocks() { + Map c = ConfigUtils.config; + + COBBLESTONE_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("cobblelvl")), Integer.parseInt(c.get("cobblespeed"))); + COPPER_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("copperlvl")), Integer.parseInt(c.get("copperspeed"))); + BRONZE_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("bronzelvl")), Integer.parseInt(c.get("bronzespeed"))); + IRON_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("ironlvl")), Integer.parseInt(c.get("ironspeed"))); + GOLD_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("goldlvl")), Integer.parseInt(c.get("goldspeed"))); + DIAMOND_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("diamondlvl")), Integer.parseInt(c.get("diamondspeed"))); + NETHERITE_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("netheritelvl")), Integer.parseInt(c.get("netheritespeed"))); + + Registry.register(Registry.BLOCK, new Identifier("scf", "cobblestone_funnel"), COBBLESTONE_FUNNEL_BLOCK); + Registry.register(Registry.BLOCK, new Identifier("scf", "copper_funnel"), COPPER_FUNNEL_BLOCK); + Registry.register(Registry.BLOCK, new Identifier("scf", "bronze_funnel"), BRONZE_FUNNEL_BLOCK); + Registry.register(Registry.BLOCK, new Identifier("scf", "iron_funnel"), IRON_FUNNEL_BLOCK); + Registry.register(Registry.BLOCK, new Identifier("scf", "gold_funnel"), GOLD_FUNNEL_BLOCK); + Registry.register(Registry.BLOCK, new Identifier("scf", "diamond_funnel"), DIAMOND_FUNNEL_BLOCK); + Registry.register(Registry.BLOCK, new Identifier("scf", "netherite_funnel"), NETHERITE_FUNNEL_BLOCK); + } + + private void registerItems() { + Registry.register(Registry.ITEM, new Identifier("scf", "cobblestone_funnel"), new BlockItem(COBBLESTONE_FUNNEL_BLOCK, new Item.Settings().group(TAB))); + Registry.register(Registry.ITEM, new Identifier("scf", "copper_funnel"), new BlockItem(COPPER_FUNNEL_BLOCK, new Item.Settings().group(TAB))); + Registry.register(Registry.ITEM, new Identifier("scf", "bronze_funnel"), new BlockItem(BRONZE_FUNNEL_BLOCK, new Item.Settings().group(TAB))); + Registry.register(Registry.ITEM, new Identifier("scf", "iron_funnel"), new BlockItem(IRON_FUNNEL_BLOCK, new Item.Settings().group(TAB))); + Registry.register(Registry.ITEM, new Identifier("scf", "gold_funnel"), new BlockItem(GOLD_FUNNEL_BLOCK, new Item.Settings().group(TAB))); + Registry.register(Registry.ITEM, new Identifier("scf", "diamond_funnel"), new BlockItem(DIAMOND_FUNNEL_BLOCK, new Item.Settings().group(TAB))); + Registry.register(Registry.ITEM, new Identifier("scf", "netherite_funnel"), new BlockItem(NETHERITE_FUNNEL_BLOCK, new Item.Settings().group(TAB))); + } + + private void readOreTable() { + File block = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/funnel_blocks.acfg"); + File weight = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/funnel_blocks_weights.acfg"); + try { + if (!block.exists()) { + FileUtils.writeLines(block, Arrays.asList(cRES)); + } + if (!weight.exists()) { + FileUtils.writeLines(weight, Arrays.asList(cResRolls)); + } + + ORES = FileUtils.readLines(block, "utf-8").toArray(ORES); + WEIGHTS = FileUtils.readLines(weight, "utf-8").toArray(WEIGHTS); + } catch (IOException e) { + e.printStackTrace(); + } + } } From c31bc2dad141835587f559f846c454f32019d5db Mon Sep 17 00:00:00 2001 From: ThunderSphun Date: Wed, 5 Jan 2022 10:15:12 +0100 Subject: [PATCH 05/11] added helper for registering a funnel --- ...stoneFunnelBlock.java => FunnelBlock.java} | 292 +++++++++--------- src/main/java/gd/rf/acro/scf/SCF.java | 180 ++++++----- 2 files changed, 250 insertions(+), 222 deletions(-) rename src/main/java/gd/rf/acro/scf/{CobblestoneFunnelBlock.java => FunnelBlock.java} (95%) diff --git a/src/main/java/gd/rf/acro/scf/CobblestoneFunnelBlock.java b/src/main/java/gd/rf/acro/scf/FunnelBlock.java similarity index 95% rename from src/main/java/gd/rf/acro/scf/CobblestoneFunnelBlock.java rename to src/main/java/gd/rf/acro/scf/FunnelBlock.java index b4ffa09..258eb64 100644 --- a/src/main/java/gd/rf/acro/scf/CobblestoneFunnelBlock.java +++ b/src/main/java/gd/rf/acro/scf/FunnelBlock.java @@ -1,146 +1,146 @@ -package gd.rf.acro.scf; - -import io.netty.buffer.Unpooled; -import net.fabricmc.fabric.api.network.ServerSidePacketRegistry; -import net.fabricmc.fabric.api.server.PlayerStream; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.client.item.TooltipContext; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.tag.FluidTags; -import net.minecraft.text.LiteralText; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.Identifier; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import org.apache.commons.lang3.RandomUtils; - -import java.util.List; -import java.util.Random; - -public class CobblestoneFunnelBlock extends Block { - private int level; - private final int period; - private final static VoxelShape SHAPE = Block.createCuboidShape(2, 1, 2, 14, 16, 14); - - public CobblestoneFunnelBlock(Settings settings, int level, int period) { - super(settings); - this.level = level; - this.period = period; - } - - @Override - @SuppressWarnings("deprecation") - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return SHAPE; - } - - @Override - @SuppressWarnings("deprecation") - public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - super.scheduledTick(state, world, pos, random); - if (hasLavaAndWater(pos, world) && world.getBlockState(pos.down()).isAir()) { - PacketByteBuf packetByteBuf = new PacketByteBuf(Unpooled.buffer()); - packetByteBuf.writeInt(1); - PlayerStream.around(world, pos, 5).forEach(pp -> ServerSidePacketRegistry.INSTANCE.sendToPlayer(pp, SCF.SEND_SOUND, packetByteBuf)); - if (this.level == -1) { - this.level = SCF.ORES.length; - } - long picked = RandomUtils.nextLong(0, countTotalWeights()); - System.out.println("picked: " + picked); - world.setBlockState(pos.down(), Registry.BLOCK.get(Identifier.tryParse(getOreFromBigNumber(picked))).getDefaultState()); - } - world.getBlockTickScheduler().schedule(pos, this, this.period); - } - - private boolean hasLavaAndWater(BlockPos pos, World world) { - boolean hasWater = false; - boolean hasLava = false; - if (FluidTags.WATER.contains(world.getBlockState(pos.east()).getFluidState().getFluid())) { - hasWater = true; - } else if (FluidTags.LAVA.contains(world.getBlockState(pos.east()).getFluidState().getFluid())) { - hasLava = true; - } - - if (FluidTags.WATER.contains(world.getBlockState(pos.west()).getFluidState().getFluid())) { - hasWater = true; - } else if (FluidTags.LAVA.contains(world.getBlockState(pos.west()).getFluidState().getFluid())) { - hasLava = true; - } - - if (FluidTags.WATER.contains(world.getBlockState(pos.south()).getFluidState().getFluid())) { - hasWater = true; - } else if (FluidTags.LAVA.contains(world.getBlockState(pos.south()).getFluidState().getFluid())) { - hasLava = true; - } - - if (FluidTags.WATER.contains(world.getBlockState(pos.north()).getFluidState().getFluid())) { - hasWater = true; - } else if (FluidTags.LAVA.contains(world.getBlockState(pos.north()).getFluidState().getFluid())) { - hasLava = true; - } - - return hasLava && hasWater; - } - - @Override - public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { - super.onPlaced(world, pos, state, placer, itemStack); - world.getBlockTickScheduler().schedule(pos, this, this.period); - } - - @Override - public void buildTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options) { - super.buildTooltip(stack, world, tooltip, options); - tooltip.add(new LiteralText("1 block every " + (this.period / 20f) + " second(s)")); - if (this.level == -1) { - this.level = SCF.ORES.length; - } - tooltip.add(new LiteralText("best block out: " + Registry.BLOCK.get(Identifier.tryParse(SCF.ORES[this.level - 1])).getName().getString())); - tooltip.add(new LiteralText("(shift-use the block to see others!)")); - } - - @Override - @SuppressWarnings("deprecation") - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if (player.isSneaking() && hand == Hand.MAIN_HAND && world.isClient) { - for (int i = 0; i < this.level; i++) { - player.sendMessage(new LiteralText(Registry.BLOCK.get(Identifier.tryParse(SCF.ORES[i])).getName().getString()), false); - } - } - return super.onUse(state, world, pos, player, hand, hit); - } - - private long countTotalWeights() { - long clap = 0; - for (int i = 0; i < this.level; i++) { - clap += Integer.parseInt(SCF.WEIGHTS[i]); - } - System.out.println("total: " + clap); - return clap + 1; //to include the last number - } - - private String getOreFromBigNumber(long bigNumber) { - int counter = 0; - long inter = 0; - while (inter < bigNumber) { - inter += Integer.parseInt(SCF.WEIGHTS[counter]); - if (inter > bigNumber) { - return SCF.ORES[counter]; - } - counter++; - } - return SCF.ORES[counter]; - } -} +package gd.rf.acro.scf; + +import io.netty.buffer.Unpooled; +import net.fabricmc.fabric.api.network.ServerSidePacketRegistry; +import net.fabricmc.fabric.api.server.PlayerStream; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.client.item.TooltipContext; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.tag.FluidTags; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.Identifier; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.Registry; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; +import org.apache.commons.lang3.RandomUtils; + +import java.util.List; +import java.util.Random; + +public class FunnelBlock extends Block { + private int level; + private final int period; + private final static VoxelShape SHAPE = Block.createCuboidShape(2, 1, 2, 14, 16, 14); + + public FunnelBlock(Settings settings, int level, int period) { + super(settings); + this.level = level; + this.period = period; + } + + @Override + @SuppressWarnings("deprecation") + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return SHAPE; + } + + @Override + @SuppressWarnings("deprecation") + public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + super.scheduledTick(state, world, pos, random); + if (hasLavaAndWater(pos, world) && world.getBlockState(pos.down()).isAir()) { + PacketByteBuf packetByteBuf = new PacketByteBuf(Unpooled.buffer()); + packetByteBuf.writeInt(1); + PlayerStream.around(world, pos, 5).forEach(pp -> ServerSidePacketRegistry.INSTANCE.sendToPlayer(pp, SCF.SEND_SOUND, packetByteBuf)); + if (this.level == -1) { + this.level = SCF.ORES.length; + } + long picked = RandomUtils.nextLong(0, countTotalWeights()); + System.out.println("picked: " + picked); + world.setBlockState(pos.down(), Registry.BLOCK.get(Identifier.tryParse(getOreFromBigNumber(picked))).getDefaultState()); + } + world.getBlockTickScheduler().schedule(pos, this, this.period); + } + + private boolean hasLavaAndWater(BlockPos pos, World world) { + boolean hasWater = false; + boolean hasLava = false; + if (FluidTags.WATER.contains(world.getBlockState(pos.east()).getFluidState().getFluid())) { + hasWater = true; + } else if (FluidTags.LAVA.contains(world.getBlockState(pos.east()).getFluidState().getFluid())) { + hasLava = true; + } + + if (FluidTags.WATER.contains(world.getBlockState(pos.west()).getFluidState().getFluid())) { + hasWater = true; + } else if (FluidTags.LAVA.contains(world.getBlockState(pos.west()).getFluidState().getFluid())) { + hasLava = true; + } + + if (FluidTags.WATER.contains(world.getBlockState(pos.south()).getFluidState().getFluid())) { + hasWater = true; + } else if (FluidTags.LAVA.contains(world.getBlockState(pos.south()).getFluidState().getFluid())) { + hasLava = true; + } + + if (FluidTags.WATER.contains(world.getBlockState(pos.north()).getFluidState().getFluid())) { + hasWater = true; + } else if (FluidTags.LAVA.contains(world.getBlockState(pos.north()).getFluidState().getFluid())) { + hasLava = true; + } + + return hasLava && hasWater; + } + + @Override + public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { + super.onPlaced(world, pos, state, placer, itemStack); + world.getBlockTickScheduler().schedule(pos, this, this.period); + } + + @Override + public void buildTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options) { + super.buildTooltip(stack, world, tooltip, options); + tooltip.add(new LiteralText("1 block every " + (this.period / 20f) + " second(s)")); + if (this.level == -1) { + this.level = SCF.ORES.length; + } + tooltip.add(new LiteralText("best block out: " + Registry.BLOCK.get(Identifier.tryParse(SCF.ORES[this.level - 1])).getName().getString())); + tooltip.add(new LiteralText("(shift-use the block to see others!)")); + } + + @Override + @SuppressWarnings("deprecation") + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + if (player.isSneaking() && hand == Hand.MAIN_HAND && world.isClient) { + for (int i = 0; i < this.level; i++) { + player.sendMessage(new LiteralText(Registry.BLOCK.get(Identifier.tryParse(SCF.ORES[i])).getName().getString()), false); + } + } + return super.onUse(state, world, pos, player, hand, hit); + } + + private long countTotalWeights() { + long clap = 0; + for (int i = 0; i < this.level; i++) { + clap += Integer.parseInt(SCF.WEIGHTS[i]); + } + System.out.println("total: " + clap); + return clap + 1; //to include the last number + } + + private String getOreFromBigNumber(long bigNumber) { + int counter = 0; + long inter = 0; + while (inter < bigNumber) { + inter += Integer.parseInt(SCF.WEIGHTS[counter]); + if (inter > bigNumber) { + return SCF.ORES[counter]; + } + counter++; + } + return SCF.ORES[counter]; + } +} diff --git a/src/main/java/gd/rf/acro/scf/SCF.java b/src/main/java/gd/rf/acro/scf/SCF.java index 22b233c..75c00ae 100644 --- a/src/main/java/gd/rf/acro/scf/SCF.java +++ b/src/main/java/gd/rf/acro/scf/SCF.java @@ -4,12 +4,14 @@ import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; import net.minecraft.block.Material; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; +import net.minecraft.util.Pair; import net.minecraft.util.registry.Registry; import org.apache.commons.io.FileUtils; @@ -21,100 +23,123 @@ public class SCF implements ModInitializer { public static final Identifier SEND_SOUND = new Identifier("scf", "send_sound"); private static final String[] cRES = { - "minecraft:cobblestone", - "minecraft:stone", - "minecraft:coal_ore", - "c:tin_ore", - "c:copper_ore", - "minecraft:iron_ore", - "c:zinc_ore", - "c:aluminum_ore", - "c:lead_ore", - "c:silver_ore", - "minecraft:redstone_ore", - "minecraft:nether_quartz_ore", - "minecraft:gold_ore", - "c:uranium_ore", - "minecraft:diamond_ore", - "c:platinum_ore", - "c:tungsten_ore", - "c:osmium_ore", - "c:palladium_ore", - "c:amethyst_ore", - "c:iridium_ore", - "c:topaz_ore", - "c:cobalt_ore", - "c:peridot_ore", - "c:sapphire_ore", - "c:ruby_ore", - "minecraft:ancient_debris", - }; + "minecraft:cobblestone", + "minecraft:stone", + "minecraft:coal_ore", + "c:tin_ore", + "c:copper_ore", + "minecraft:iron_ore", + "c:zinc_ore", + "c:aluminum_ore", + "c:lead_ore", + "c:silver_ore", + "minecraft:redstone_ore", + "minecraft:nether_quartz_ore", + "minecraft:gold_ore", + "c:uranium_ore", + "minecraft:diamond_ore", + "c:platinum_ore", + "c:tungsten_ore", + "c:osmium_ore", + "c:palladium_ore", + "c:amethyst_ore", + "c:iridium_ore", + "c:topaz_ore", + "c:cobalt_ore", + "c:peridot_ore", + "c:sapphire_ore", + "c:ruby_ore", + "minecraft:ancient_debris", + }; private static final String[] cResRolls = { - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "20", - "20", - "20", - "20", - "20", - "20", - "20", - "20", - "20", - "20", - "20", - "20", - "1" - }; + "100", + "100", + "100", + "100", + "100", + "100", + "100", + "100", + "100", + "100", + "100", + "100", + "100", + "100", + "20", + "20", + "20", + "20", + "20", + "20", + "20", + "20", + "20", + "20", + "20", + "20", + "1" + }; public static String[] ORES = {}; public static String[] WEIGHTS = {}; - public static CobblestoneFunnelBlock COBBLESTONE_FUNNEL_BLOCK; - public static CobblestoneFunnelBlock COPPER_FUNNEL_BLOCK; - public static CobblestoneFunnelBlock BRONZE_FUNNEL_BLOCK; - public static CobblestoneFunnelBlock IRON_FUNNEL_BLOCK; - public static CobblestoneFunnelBlock GOLD_FUNNEL_BLOCK; - public static CobblestoneFunnelBlock DIAMOND_FUNNEL_BLOCK; - public static CobblestoneFunnelBlock NETHERITE_FUNNEL_BLOCK; - public static final ItemGroup TAB = FabricItemGroupBuilder.build( new Identifier("scf", "tab"), () -> new ItemStack(SCF.COBBLESTONE_FUNNEL_BLOCK)); + public static Block COBBLESTONE_FUNNEL_BLOCK; + public static Block COPPER_FUNNEL_BLOCK; + public static Block BRONZE_FUNNEL_BLOCK; + public static Block IRON_FUNNEL_BLOCK; + public static Block GOLD_FUNNEL_BLOCK; + public static Block DIAMOND_FUNNEL_BLOCK; + public static Block NETHERITE_FUNNEL_BLOCK; + @Override public void onInitialize() { ConfigUtils.checkConfigs(); - registerBlocks(); - registerItems(); + COBBLESTONE_FUNNEL_BLOCK = registerFunnel("cobblestone_funnel", "cobblelvl", "cobblespeed"); + COPPER_FUNNEL_BLOCK = registerFunnel("copper_funnel", "copperlvl", "copperspeed"); + BRONZE_FUNNEL_BLOCK = registerFunnel("bronze_funnel", "bronzelvl", "bronzespeed"); + IRON_FUNNEL_BLOCK = registerFunnel("iron_funnel", "ironlvl", "ironspeed"); + GOLD_FUNNEL_BLOCK = registerFunnel("gold_funnel", "goldlvl", "goldspeed"); + DIAMOND_FUNNEL_BLOCK = registerFunnel("diamond_funnel", "diamondlvl", "diamondspeed"); + NETHERITE_FUNNEL_BLOCK = registerFunnel("netherite_funnel", "netheritelvl", "netheritespeed"); readOreTable(); } + private FunnelBlock registerFunnel(String id, String level, String speed) { + FunnelBlock block = Registry.register(Registry.BLOCK, + new Identifier("scf", id), + new FunnelBlock( + AbstractBlock.Settings + .of(Material.STONE) + .ticksRandomly() + .strength(1.5f, 0), + Integer.parseInt(ConfigUtils.config.get(level)), + Integer.parseInt(ConfigUtils.config.get(speed)))); + + Registry.register(Registry.ITEM, + new Identifier("scf", id), + new BlockItem(block, new Item.Settings().group(TAB))); + + return block; + } + private void registerBlocks() { Map c = ConfigUtils.config; - COBBLESTONE_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("cobblelvl")), Integer.parseInt(c.get("cobblespeed"))); - COPPER_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("copperlvl")), Integer.parseInt(c.get("copperspeed"))); - BRONZE_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("bronzelvl")), Integer.parseInt(c.get("bronzespeed"))); - IRON_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("ironlvl")), Integer.parseInt(c.get("ironspeed"))); - GOLD_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("goldlvl")), Integer.parseInt(c.get("goldspeed"))); - DIAMOND_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("diamondlvl")), Integer.parseInt(c.get("diamondspeed"))); - NETHERITE_FUNNEL_BLOCK = new CobblestoneFunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("netheritelvl")), Integer.parseInt(c.get("netheritespeed"))); + COBBLESTONE_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("cobblelvl")), Integer.parseInt(c.get("cobblespeed"))); + COPPER_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("copperlvl")), Integer.parseInt(c.get("copperspeed"))); + BRONZE_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("bronzelvl")), Integer.parseInt(c.get("bronzespeed"))); + IRON_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("ironlvl")), Integer.parseInt(c.get("ironspeed"))); + GOLD_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("goldlvl")), Integer.parseInt(c.get("goldspeed"))); + DIAMOND_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("diamondlvl")), Integer.parseInt(c.get("diamondspeed"))); + NETHERITE_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("netheritelvl")), Integer.parseInt(c.get("netheritespeed"))); Registry.register(Registry.BLOCK, new Identifier("scf", "cobblestone_funnel"), COBBLESTONE_FUNNEL_BLOCK); Registry.register(Registry.BLOCK, new Identifier("scf", "copper_funnel"), COPPER_FUNNEL_BLOCK); @@ -141,13 +166,16 @@ private void readOreTable() { try { if (!block.exists()) { FileUtils.writeLines(block, Arrays.asList(cRES)); + ORES = Arrays.asList(cRES).toArray(ORES); + } else { + ORES = FileUtils.readLines(block, "utf-8").toArray(ORES); } if (!weight.exists()) { FileUtils.writeLines(weight, Arrays.asList(cResRolls)); + WEIGHTS = Arrays.asList(cResRolls).toArray(WEIGHTS); + } else { + WEIGHTS = FileUtils.readLines(weight, "utf-8").toArray(WEIGHTS); } - - ORES = FileUtils.readLines(block, "utf-8").toArray(ORES); - WEIGHTS = FileUtils.readLines(weight, "utf-8").toArray(WEIGHTS); } catch (IOException e) { e.printStackTrace(); } From f9067b9deb1ed2557cac63d4c14c414fad5d7366 Mon Sep 17 00:00:00 2001 From: ThunderSphun Date: Wed, 5 Jan 2022 10:36:05 +0100 Subject: [PATCH 06/11] removed the need for client initializer --- src/main/java/gd/rf/acro/scf/ClientInit.java | 17 ---------- src/main/java/gd/rf/acro/scf/FunnelBlock.java | 11 ++++--- src/main/java/gd/rf/acro/scf/SCF.java | 31 +------------------ src/main/resources/fabric.mod.json | 3 +- 4 files changed, 9 insertions(+), 53 deletions(-) delete mode 100644 src/main/java/gd/rf/acro/scf/ClientInit.java diff --git a/src/main/java/gd/rf/acro/scf/ClientInit.java b/src/main/java/gd/rf/acro/scf/ClientInit.java deleted file mode 100644 index e8b1bad..0000000 --- a/src/main/java/gd/rf/acro/scf/ClientInit.java +++ /dev/null @@ -1,17 +0,0 @@ -package gd.rf.acro.scf; - -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; -import net.minecraft.sound.SoundEvents; - -public class ClientInit implements ClientModInitializer { - @Override - public void onInitializeClient() { - ClientSidePacketRegistry.INSTANCE.register(SCF.SEND_SOUND, - (packetContext, attachedData) -> { - if (attachedData.readInt() == 1) { - packetContext.getPlayer().playSound(SoundEvents.BLOCK_LAVA_EXTINGUISH, 1, 1); - } - }); - } -} diff --git a/src/main/java/gd/rf/acro/scf/FunnelBlock.java b/src/main/java/gd/rf/acro/scf/FunnelBlock.java index 258eb64..a3a7029 100644 --- a/src/main/java/gd/rf/acro/scf/FunnelBlock.java +++ b/src/main/java/gd/rf/acro/scf/FunnelBlock.java @@ -12,6 +12,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.network.PacketByteBuf; import net.minecraft.server.world.ServerWorld; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvent; +import net.minecraft.sound.SoundEvents; import net.minecraft.tag.FluidTags; import net.minecraft.text.LiteralText; import net.minecraft.text.Text; @@ -51,11 +54,11 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { super.scheduledTick(state, world, pos, random); if (hasLavaAndWater(pos, world) && world.getBlockState(pos.down()).isAir()) { - PacketByteBuf packetByteBuf = new PacketByteBuf(Unpooled.buffer()); - packetByteBuf.writeInt(1); - PlayerStream.around(world, pos, 5).forEach(pp -> ServerSidePacketRegistry.INSTANCE.sendToPlayer(pp, SCF.SEND_SOUND, packetByteBuf)); + if (!world.isClient) { + world.playSound(null, pos, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1, 1); + } if (this.level == -1) { - this.level = SCF.ORES.length; + this.level = SCF.ORES.length; } long picked = RandomUtils.nextLong(0, countTotalWeights()); System.out.println("picked: " + picked); diff --git a/src/main/java/gd/rf/acro/scf/SCF.java b/src/main/java/gd/rf/acro/scf/SCF.java index 75c00ae..5b1dd6c 100644 --- a/src/main/java/gd/rf/acro/scf/SCF.java +++ b/src/main/java/gd/rf/acro/scf/SCF.java @@ -130,39 +130,10 @@ private FunnelBlock registerFunnel(String id, String level, String speed) { return block; } - private void registerBlocks() { - Map c = ConfigUtils.config; - - COBBLESTONE_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("cobblelvl")), Integer.parseInt(c.get("cobblespeed"))); - COPPER_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("copperlvl")), Integer.parseInt(c.get("copperspeed"))); - BRONZE_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("bronzelvl")), Integer.parseInt(c.get("bronzespeed"))); - IRON_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("ironlvl")), Integer.parseInt(c.get("ironspeed"))); - GOLD_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("goldlvl")), Integer.parseInt(c.get("goldspeed"))); - DIAMOND_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("diamondlvl")), Integer.parseInt(c.get("diamondspeed"))); - NETHERITE_FUNNEL_BLOCK = new FunnelBlock(AbstractBlock.Settings.of(Material.STONE).ticksRandomly().strength(1.5f, 0), Integer.parseInt(c.get("netheritelvl")), Integer.parseInt(c.get("netheritespeed"))); - - Registry.register(Registry.BLOCK, new Identifier("scf", "cobblestone_funnel"), COBBLESTONE_FUNNEL_BLOCK); - Registry.register(Registry.BLOCK, new Identifier("scf", "copper_funnel"), COPPER_FUNNEL_BLOCK); - Registry.register(Registry.BLOCK, new Identifier("scf", "bronze_funnel"), BRONZE_FUNNEL_BLOCK); - Registry.register(Registry.BLOCK, new Identifier("scf", "iron_funnel"), IRON_FUNNEL_BLOCK); - Registry.register(Registry.BLOCK, new Identifier("scf", "gold_funnel"), GOLD_FUNNEL_BLOCK); - Registry.register(Registry.BLOCK, new Identifier("scf", "diamond_funnel"), DIAMOND_FUNNEL_BLOCK); - Registry.register(Registry.BLOCK, new Identifier("scf", "netherite_funnel"), NETHERITE_FUNNEL_BLOCK); - } - - private void registerItems() { - Registry.register(Registry.ITEM, new Identifier("scf", "cobblestone_funnel"), new BlockItem(COBBLESTONE_FUNNEL_BLOCK, new Item.Settings().group(TAB))); - Registry.register(Registry.ITEM, new Identifier("scf", "copper_funnel"), new BlockItem(COPPER_FUNNEL_BLOCK, new Item.Settings().group(TAB))); - Registry.register(Registry.ITEM, new Identifier("scf", "bronze_funnel"), new BlockItem(BRONZE_FUNNEL_BLOCK, new Item.Settings().group(TAB))); - Registry.register(Registry.ITEM, new Identifier("scf", "iron_funnel"), new BlockItem(IRON_FUNNEL_BLOCK, new Item.Settings().group(TAB))); - Registry.register(Registry.ITEM, new Identifier("scf", "gold_funnel"), new BlockItem(GOLD_FUNNEL_BLOCK, new Item.Settings().group(TAB))); - Registry.register(Registry.ITEM, new Identifier("scf", "diamond_funnel"), new BlockItem(DIAMOND_FUNNEL_BLOCK, new Item.Settings().group(TAB))); - Registry.register(Registry.ITEM, new Identifier("scf", "netherite_funnel"), new BlockItem(NETHERITE_FUNNEL_BLOCK, new Item.Settings().group(TAB))); - } - private void readOreTable() { File block = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/funnel_blocks.acfg"); File weight = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/funnel_blocks_weights.acfg"); + try { if (!block.exists()) { FileUtils.writeLines(block, Arrays.asList(cRES)); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index b91f32e..c159a2a 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -20,8 +20,7 @@ "entrypoints": { "main": [ "gd.rf.acro.scf.SCF" - ], - "client": ["gd.rf.acro.scf.ClientInit"] + ] }, "mixins": [ "modid.mixins.json" From bca99d2561280fb9b0a647e05618ba504a73dd3b Mon Sep 17 00:00:00 2001 From: ThunderSphun Date: Wed, 5 Jan 2022 14:32:21 +0100 Subject: [PATCH 07/11] changed code to use vanillas weightedList --- src/main/java/gd/rf/acro/scf/ConfigUtils.java | 33 +++---- src/main/java/gd/rf/acro/scf/FunnelBlock.java | 98 ++++++++----------- src/main/java/gd/rf/acro/scf/OreManager.java | 92 +++++++++++++++++ src/main/java/gd/rf/acro/scf/SCF.java | 86 +--------------- 4 files changed, 150 insertions(+), 159 deletions(-) create mode 100644 src/main/java/gd/rf/acro/scf/OreManager.java diff --git a/src/main/java/gd/rf/acro/scf/ConfigUtils.java b/src/main/java/gd/rf/acro/scf/ConfigUtils.java index bae95e7..48d93e7 100644 --- a/src/main/java/gd/rf/acro/scf/ConfigUtils.java +++ b/src/main/java/gd/rf/acro/scf/ConfigUtils.java @@ -39,47 +39,46 @@ public static void generateConfigs(List input) { } public static Map checkConfigs() { - if (file.exists()) { - return loadConfigs(); + if (!file.exists()) { + generateConfigs(makeDefaults()); } - generateConfigs(makeDefaults()); return loadConfigs(); } private static List makeDefaults() { List defaults = new ArrayList<>(); - defaults.add("#cobblestone funnel ore level (default 5)"); - defaults.add("cobblelvl=5"); + defaults.add("#cobblestone funnel ore level (default 0)"); + defaults.add("cobblelvl=0"); defaults.add("#cobblestone funnel speed (default 60)"); defaults.add("cobblespeed=60"); - defaults.add("#copper funnel ore level (default 9)"); - defaults.add("copperlvl=9"); + defaults.add("#copper funnel ore level (default 1)"); + defaults.add("copperlvl=1"); defaults.add("#copper funnel speed (default 60)"); defaults.add("copperspeed=60"); - defaults.add("#bronze funnel ore level (default 9)"); - defaults.add("bronzelvl=9"); + defaults.add("#bronze funnel ore level (default 1)"); + defaults.add("bronzelvl=1"); defaults.add("#bronze funnel speed (default 30)"); defaults.add("bronzespeed=30"); - defaults.add("#iron funnel ore level (default 14)"); - defaults.add("ironlvl=14"); + defaults.add("#iron funnel ore level (default 2)"); + defaults.add("ironlvl=2"); defaults.add("#iron funnel speed (default 50)"); defaults.add("ironspeed=50"); - defaults.add("#gold funnel ore level (default 17)"); - defaults.add("goldlvl=17"); + defaults.add("#gold funnel ore level (default 3)"); + defaults.add("goldlvl=3"); defaults.add("#gold funnel speed (default 40)"); defaults.add("goldspeed=40"); - defaults.add("#diamond funnel ore level (default -1)"); - defaults.add("diamondlvl=-1"); + defaults.add("#diamond funnel ore level (default 4)"); + defaults.add("diamondlvl=4"); defaults.add("#diamond funnel speed (default 40)"); defaults.add("diamondspeed=40"); - defaults.add("#netherite funnel ore level (default -1)"); - defaults.add("netheritelvl=-1"); + defaults.add("#netherite funnel ore level (default 5)"); + defaults.add("netheritelvl=5"); defaults.add("#netherite funnel speed (default 20)"); defaults.add("netheritespeed=20"); return defaults; diff --git a/src/main/java/gd/rf/acro/scf/FunnelBlock.java b/src/main/java/gd/rf/acro/scf/FunnelBlock.java index a3a7029..fe9b7cd 100644 --- a/src/main/java/gd/rf/acro/scf/FunnelBlock.java +++ b/src/main/java/gd/rf/acro/scf/FunnelBlock.java @@ -1,19 +1,15 @@ package gd.rf.acro.scf; -import io.netty.buffer.Unpooled; -import net.fabricmc.fabric.api.network.ServerSidePacketRegistry; -import net.fabricmc.fabric.api.server.PlayerStream; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.ShapeContext; import net.minecraft.client.item.TooltipContext; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.Fluid; import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketByteBuf; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvents; import net.minecraft.tag.FluidTags; import net.minecraft.text.LiteralText; @@ -23,6 +19,8 @@ import net.minecraft.util.Identifier; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.registry.Registry; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; @@ -33,98 +31,84 @@ import java.util.Random; public class FunnelBlock extends Block { - private int level; + private final static VoxelShape SHAPE = Block.createCuboidShape(2, 1, 2, 14, 16, 14); private final int period; - private final static VoxelShape SHAPE = Block.createCuboidShape(2, 1, 2, 14, 16, 14); + private int level; public FunnelBlock(Settings settings, int level, int period) { super(settings); this.level = level; this.period = period; + + if (this.level < 0 || this.level >= OreManager.WEIGHTED_LIST_COLLECTION.size()) { + this.level = MathHelper.clamp(this.level, 0, OreManager.WEIGHTED_LIST_COLLECTION.size() - 1); + } } @Override - @SuppressWarnings("deprecation") + @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return SHAPE; } @Override - @SuppressWarnings("deprecation") + @SuppressWarnings("deprecation") public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { super.scheduledTick(state, world, pos, random); if (hasLavaAndWater(pos, world) && world.getBlockState(pos.down()).isAir()) { if (!world.isClient) { world.playSound(null, pos, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1, 1); } - if (this.level == -1) { - this.level = SCF.ORES.length; - } - long picked = RandomUtils.nextLong(0, countTotalWeights()); - System.out.println("picked: " + picked); - world.setBlockState(pos.down(), Registry.BLOCK.get(Identifier.tryParse(getOreFromBigNumber(picked))).getDefaultState()); + + System.out.println(OreManager.WEIGHTED_LIST_COLLECTION); + System.out.println(OreManager.WEIGHTED_LIST_COLLECTION.get(this.level)); + Identifier randomBlockId = OreManager.WEIGHTED_LIST_COLLECTION.get(this.level).pickRandom(world.random); + world.setBlockState(pos.down(), Registry.BLOCK.get(randomBlockId).getDefaultState()); } world.getBlockTickScheduler().schedule(pos, this, this.period); } private boolean hasLavaAndWater(BlockPos pos, World world) { - boolean hasWater = false; - boolean hasLava = false; - if (FluidTags.WATER.contains(world.getBlockState(pos.east()).getFluidState().getFluid())) { - hasWater = true; - } else if (FluidTags.LAVA.contains(world.getBlockState(pos.east()).getFluidState().getFluid())) { - hasLava = true; - } + Direction.Type offsets = Direction.Type.HORIZONTAL; - if (FluidTags.WATER.contains(world.getBlockState(pos.west()).getFluidState().getFluid())) { - hasWater = true; - } else if (FluidTags.LAVA.contains(world.getBlockState(pos.west()).getFluidState().getFluid())) { - hasLava = true; - } - - if (FluidTags.WATER.contains(world.getBlockState(pos.south()).getFluidState().getFluid())) { - hasWater = true; - } else if (FluidTags.LAVA.contains(world.getBlockState(pos.south()).getFluidState().getFluid())) { - hasLava = true; - } - - if (FluidTags.WATER.contains(world.getBlockState(pos.north()).getFluidState().getFluid())) { - hasWater = true; - } else if (FluidTags.LAVA.contains(world.getBlockState(pos.north()).getFluidState().getFluid())) { - hasLava = true; - } + boolean hasWater = offsets.stream().anyMatch(e -> FluidTags.WATER.contains(this.getFluidAtPos(pos.offset(e), world))); + boolean hasLava = offsets.stream().anyMatch(e -> FluidTags.LAVA.contains(this.getFluidAtPos(pos.offset(e), world))); return hasLava && hasWater; } + private Fluid getFluidAtPos(BlockPos pos, World world) { + return world.getBlockState(pos).getFluidState().getFluid(); + } + @Override public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { super.onPlaced(world, pos, state, placer, itemStack); world.getBlockTickScheduler().schedule(pos, this, this.period); } +// @Override +// public void buildTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options) { +// super.buildTooltip(stack, world, tooltip, options); +// tooltip.add(new LiteralText("1 block every " + (this.period / 20f) + " second(s)")); +// if (this.level == -1) { +// this.level = SCF.ORES.length; +// } +// tooltip.add(new LiteralText("best block out: " + Registry.BLOCK.get(Identifier.tryParse(OreManager.ORES.get(this.level - 1))).getName().getString())); +// tooltip.add(new LiteralText("(shift-use the block to see others!)")); +// } + @Override - public void buildTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options) { - super.buildTooltip(stack, world, tooltip, options); - tooltip.add(new LiteralText("1 block every " + (this.period / 20f) + " second(s)")); - if (this.level == -1) { - this.level = SCF.ORES.length; + @SuppressWarnings("deprecation") + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + if (player.isSneaking() && hand == Hand.MAIN_HAND && world.isClient) { + for (int i = 0; i < this.level; i++) { + player.sendMessage(new LiteralText(Registry.BLOCK.get(Identifier.tryParse(SCF.ORES[i])).getName().getString()), false); + } } - tooltip.add(new LiteralText("best block out: " + Registry.BLOCK.get(Identifier.tryParse(SCF.ORES[this.level - 1])).getName().getString())); - tooltip.add(new LiteralText("(shift-use the block to see others!)")); + return super.onUse(state, world, pos, player, hand, hit); } - @Override - @SuppressWarnings("deprecation") - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if (player.isSneaking() && hand == Hand.MAIN_HAND && world.isClient) { - for (int i = 0; i < this.level; i++) { - player.sendMessage(new LiteralText(Registry.BLOCK.get(Identifier.tryParse(SCF.ORES[i])).getName().getString()), false); - } - } - return super.onUse(state, world, pos, player, hand, hit); - } - private long countTotalWeights() { long clap = 0; for (int i = 0; i < this.level; i++) { diff --git a/src/main/java/gd/rf/acro/scf/OreManager.java b/src/main/java/gd/rf/acro/scf/OreManager.java new file mode 100644 index 0000000..177a17b --- /dev/null +++ b/src/main/java/gd/rf/acro/scf/OreManager.java @@ -0,0 +1,92 @@ +package gd.rf.acro.scf; + +import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.util.Identifier; +import net.minecraft.util.collection.WeightedList; +import org.apache.commons.io.FileUtils; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class OreManager { + private static final String[] ores_default = { + // ore/tag, funnel tier, weight + "minecraft:cobblestone,0,100", + "minecraft:stone,0,100", + "minecraft:coal_ore,0,100", + "c:tin_ore,0,100", + "c:copper_ore,0,100", + "minecraft:iron_ore,1,100", + "c:zinc_ore,1,100", + "c:aluminum_ore,1,100", + "c:lead_ore,1,100", + "c:silver_ore,2,100", + "minecraft:redstone_ore,2,100", + "minecraft:nether_quartz_ore,2,100", + "minecraft:gold_ore,2,100", + "c:uranium_ore,2,100", + "minecraft:diamond_ore,3,20", + "c:platinum_ore,3,20", + "c:tungsten_ore,3,20", + "c:osmium_ore,4,20", + "c:palladium_ore,4,20", + "c:amethyst_ore,4,20", + "c:iridium_ore,4,20", + "c:topaz_ore,4,20", + "c:cobalt_ore,4,20", + "c:peridot_ore,4,20", + "c:sapphire_ore,4,20", + "c:ruby_ore,4,20", + "minecraft:ancient_debris,4,1" + }; + + public static final List> WEIGHTED_LIST_COLLECTION = new ArrayList<>(); + + public static void makeOreTable() { + File file = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/ores.acfg"); + + try { + if (!file.exists()) { + FileUtils.writeLines(file, Arrays.asList(ores_default)); + } + + FileUtils.readLines(file, "utf-8").parallelStream() + .map(e -> e.replace(" ", "")) // remove spaces + .filter(e -> e.matches("([a-z0-9_.-]+:)?[a-z0-9_.-]+,\\d+,\\d+")) // is valid format + .map(e -> e.split(",")) // split arguments + .sorted((a, b) -> -a[1].compareTo(b[1])) // sort it so that highest tier is done first + .forEachOrdered(OreManager::setWeights); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static void setWeights(String[] ctx) { + try { + Identifier id = new Identifier(ctx[0]); + int tier = Integer.parseInt(ctx[1]); + int weight = Integer.parseInt(ctx[2]); + + if (tier < 0) { + System.err.println("invalid config tier"); + System.err.println(ctx[0] + ", [" + ctx[1] + "], " + ctx[2]); + return; + } + + for (int i = WEIGHTED_LIST_COLLECTION.size(); i <= tier; i++) { + WEIGHTED_LIST_COLLECTION.add(new WeightedList<>()); + } + + for (int i = tier; i < WEIGHTED_LIST_COLLECTION.size(); i++) { + WEIGHTED_LIST_COLLECTION.get(i).add(id, weight); + } + } catch (NumberFormatException e) { + e.printStackTrace(); + System.err.println("invalid config identifier"); + System.err.println("[" + ctx[0] + "], " + ctx[1] + ", " + ctx[2]); + } + } +} diff --git a/src/main/java/gd/rf/acro/scf/SCF.java b/src/main/java/gd/rf/acro/scf/SCF.java index 5b1dd6c..95a16fd 100644 --- a/src/main/java/gd/rf/acro/scf/SCF.java +++ b/src/main/java/gd/rf/acro/scf/SCF.java @@ -21,67 +21,6 @@ import java.util.Map; public class SCF implements ModInitializer { - public static final Identifier SEND_SOUND = new Identifier("scf", "send_sound"); - private static final String[] cRES = { - "minecraft:cobblestone", - "minecraft:stone", - "minecraft:coal_ore", - "c:tin_ore", - "c:copper_ore", - "minecraft:iron_ore", - "c:zinc_ore", - "c:aluminum_ore", - "c:lead_ore", - "c:silver_ore", - "minecraft:redstone_ore", - "minecraft:nether_quartz_ore", - "minecraft:gold_ore", - "c:uranium_ore", - "minecraft:diamond_ore", - "c:platinum_ore", - "c:tungsten_ore", - "c:osmium_ore", - "c:palladium_ore", - "c:amethyst_ore", - "c:iridium_ore", - "c:topaz_ore", - "c:cobalt_ore", - "c:peridot_ore", - "c:sapphire_ore", - "c:ruby_ore", - "minecraft:ancient_debris", - }; - - private static final String[] cResRolls = { - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "100", - "20", - "20", - "20", - "20", - "20", - "20", - "20", - "20", - "20", - "20", - "20", - "20", - "1" - }; - public static String[] ORES = {}; public static String[] WEIGHTS = {}; @@ -100,6 +39,7 @@ public class SCF implements ModInitializer { @Override public void onInitialize() { ConfigUtils.checkConfigs(); + OreManager.makeOreTable(); COBBLESTONE_FUNNEL_BLOCK = registerFunnel("cobblestone_funnel", "cobblelvl", "cobblespeed"); COPPER_FUNNEL_BLOCK = registerFunnel("copper_funnel", "copperlvl", "copperspeed"); @@ -108,8 +48,6 @@ public void onInitialize() { GOLD_FUNNEL_BLOCK = registerFunnel("gold_funnel", "goldlvl", "goldspeed"); DIAMOND_FUNNEL_BLOCK = registerFunnel("diamond_funnel", "diamondlvl", "diamondspeed"); NETHERITE_FUNNEL_BLOCK = registerFunnel("netherite_funnel", "netheritelvl", "netheritespeed"); - - readOreTable(); } private FunnelBlock registerFunnel(String id, String level, String speed) { @@ -129,26 +67,4 @@ private FunnelBlock registerFunnel(String id, String level, String speed) { return block; } - - private void readOreTable() { - File block = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/funnel_blocks.acfg"); - File weight = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/funnel_blocks_weights.acfg"); - - try { - if (!block.exists()) { - FileUtils.writeLines(block, Arrays.asList(cRES)); - ORES = Arrays.asList(cRES).toArray(ORES); - } else { - ORES = FileUtils.readLines(block, "utf-8").toArray(ORES); - } - if (!weight.exists()) { - FileUtils.writeLines(weight, Arrays.asList(cResRolls)); - WEIGHTS = Arrays.asList(cResRolls).toArray(WEIGHTS); - } else { - WEIGHTS = FileUtils.readLines(weight, "utf-8").toArray(WEIGHTS); - } - } catch (IOException e) { - e.printStackTrace(); - } - } } From 1fe63d2fadb046d1b0c9bf3e3e569ad2a7b38fa1 Mon Sep 17 00:00:00 2001 From: ThunderSphun Date: Wed, 5 Jan 2022 16:19:44 +0100 Subject: [PATCH 08/11] made text use lang file --- src/main/java/gd/rf/acro/scf/ConfigUtils.java | 97 +++++++++---------- src/main/java/gd/rf/acro/scf/FunnelBlock.java | 78 ++++++++------- src/main/java/gd/rf/acro/scf/SCF.java | 3 +- .../acro/scf/mixin/WeightedListAccessor.java | 13 +++ .../scf/mixin/WeightedListEntryAccessor.java | 11 +++ src/main/resources/assets/scf/lang/en_us.json | 6 +- src/main/resources/modid.mixins.json | 2 + 7 files changed, 118 insertions(+), 92 deletions(-) create mode 100644 src/main/java/gd/rf/acro/scf/mixin/WeightedListAccessor.java create mode 100644 src/main/java/gd/rf/acro/scf/mixin/WeightedListEntryAccessor.java diff --git a/src/main/java/gd/rf/acro/scf/ConfigUtils.java b/src/main/java/gd/rf/acro/scf/ConfigUtils.java index 48d93e7..755af20 100644 --- a/src/main/java/gd/rf/acro/scf/ConfigUtils.java +++ b/src/main/java/gd/rf/acro/scf/ConfigUtils.java @@ -5,32 +5,26 @@ import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class ConfigUtils { - public static Map config = new HashMap<>(); + public static Map config = new HashMap<>(); private static final File file = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/config.acfg"); - public static Map loadConfigs() { + public static Map loadConfigs() { try { - List lines = FileUtils.readLines(file, "utf-8"); - lines.forEach(line -> { - if (line.charAt(0) != '#') { - String noSpace = line.replace(" ", ""); - String[] entry = noSpace.split("="); - config.put(entry[0], entry[1]); - } - }); + FileUtils.readLines(file, "utf-8").stream() + .map(e -> e.replace(" ", "")) // remove spaces + .filter(e -> e.matches("^[^#]\\w+=\\d+$")) // is valid format + .map(e -> e.split("=")) // split arguments + .forEach(entry -> config.put(entry[0], Integer.parseInt(entry[1]))); } catch (IOException e) { e.printStackTrace(); } return config; } - public static void generateConfigs(List input) { + private static void generateConfigs(List input) { try { FileUtils.writeLines(file, input); } catch (IOException e) { @@ -38,7 +32,7 @@ public static void generateConfigs(List input) { } } - public static Map checkConfigs() { + public static Map checkConfigs() { if (!file.exists()) { generateConfigs(makeDefaults()); } @@ -46,41 +40,40 @@ public static Map checkConfigs() { } private static List makeDefaults() { - List defaults = new ArrayList<>(); - defaults.add("#cobblestone funnel ore level (default 0)"); - defaults.add("cobblelvl=0"); - defaults.add("#cobblestone funnel speed (default 60)"); - defaults.add("cobblespeed=60"); - - defaults.add("#copper funnel ore level (default 1)"); - defaults.add("copperlvl=1"); - defaults.add("#copper funnel speed (default 60)"); - defaults.add("copperspeed=60"); - - defaults.add("#bronze funnel ore level (default 1)"); - defaults.add("bronzelvl=1"); - defaults.add("#bronze funnel speed (default 30)"); - defaults.add("bronzespeed=30"); - - defaults.add("#iron funnel ore level (default 2)"); - defaults.add("ironlvl=2"); - defaults.add("#iron funnel speed (default 50)"); - defaults.add("ironspeed=50"); - - defaults.add("#gold funnel ore level (default 3)"); - defaults.add("goldlvl=3"); - defaults.add("#gold funnel speed (default 40)"); - defaults.add("goldspeed=40"); - - defaults.add("#diamond funnel ore level (default 4)"); - defaults.add("diamondlvl=4"); - defaults.add("#diamond funnel speed (default 40)"); - defaults.add("diamondspeed=40"); - - defaults.add("#netherite funnel ore level (default 5)"); - defaults.add("netheritelvl=5"); - defaults.add("#netherite funnel speed (default 20)"); - defaults.add("netheritespeed=20"); - return defaults; + return Arrays.asList( + "#cobblestone funnel ore level (default 0)", + "cobblelvl=0", + "#cobblestone funnel speed (default 60)", + "cobblespeed=60", + "", + "#copper funnel ore level (default 1)", + "copperlvl=1", + "#copper funnel speed (default 60)", + "copperspeed=60", + "", + "#bronze funnel ore level (default 1)", + "bronzelvl=1", + "#bronze funnel speed (default 30)", + "bronzespeed=30", + "", + "#iron funnel ore level (default 2)", + "ironlvl=2", + "#iron funnel speed (default 50)", + "ironspeed=50", + "", + "#gold funnel ore level (default 3)", + "goldlvl=3", + "#gold funnel speed (default 40)", + "goldspeed=40", + "", + "#diamond funnel ore level (default 4)", + "diamondlvl=4", + "#diamond funnel speed (default 40)", + "diamondspeed=40", + "", + "#netherite funnel ore level (default 5)", + "netheritelvl=5", + "#netherite funnel speed (default 20)", + "netheritespeed=20"); } } diff --git a/src/main/java/gd/rf/acro/scf/FunnelBlock.java b/src/main/java/gd/rf/acro/scf/FunnelBlock.java index fe9b7cd..2fa386a 100644 --- a/src/main/java/gd/rf/acro/scf/FunnelBlock.java +++ b/src/main/java/gd/rf/acro/scf/FunnelBlock.java @@ -1,22 +1,27 @@ package gd.rf.acro.scf; +import gd.rf.acro.scf.mixin.WeightedListAccessor; +import gd.rf.acro.scf.mixin.WeightedListEntryAccessor; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.ShapeContext; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.item.TooltipContext; +import net.minecraft.client.options.GameOptions; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.item.ItemStack; +import net.minecraft.server.MinecraftServer; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; import net.minecraft.tag.FluidTags; -import net.minecraft.text.LiteralText; -import net.minecraft.text.Text; +import net.minecraft.text.*; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.Identifier; +import net.minecraft.util.collection.WeightedList; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -25,8 +30,8 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; import net.minecraft.world.World; -import org.apache.commons.lang3.RandomUtils; +import java.util.Comparator; import java.util.List; import java.util.Random; @@ -55,14 +60,13 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po @SuppressWarnings("deprecation") public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { super.scheduledTick(state, world, pos, random); + if (hasLavaAndWater(pos, world) && world.getBlockState(pos.down()).isAir()) { if (!world.isClient) { world.playSound(null, pos, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1, 1); } - System.out.println(OreManager.WEIGHTED_LIST_COLLECTION); - System.out.println(OreManager.WEIGHTED_LIST_COLLECTION.get(this.level)); - Identifier randomBlockId = OreManager.WEIGHTED_LIST_COLLECTION.get(this.level).pickRandom(world.random); + Identifier randomBlockId = OreManager.WEIGHTED_LIST_COLLECTION.get(this.level).pickRandom(random); world.setBlockState(pos.down(), Registry.BLOCK.get(randomBlockId).getDefaultState()); } world.getBlockTickScheduler().schedule(pos, this, this.period); @@ -87,47 +91,47 @@ public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity p world.getBlockTickScheduler().schedule(pos, this, this.period); } -// @Override -// public void buildTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options) { -// super.buildTooltip(stack, world, tooltip, options); -// tooltip.add(new LiteralText("1 block every " + (this.period / 20f) + " second(s)")); -// if (this.level == -1) { -// this.level = SCF.ORES.length; -// } -// tooltip.add(new LiteralText("best block out: " + Registry.BLOCK.get(Identifier.tryParse(OreManager.ORES.get(this.level - 1))).getName().getString())); -// tooltip.add(new LiteralText("(shift-use the block to see others!)")); -// } + @Override + public void buildTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options) { + super.buildTooltip(stack, world, tooltip, options); + + if (world != null) { + Identifier id = this.getGreatestWeight(); + GameOptions gameOptions = MinecraftClient.getInstance().options; + + tooltip.add(new TranslatableText("util.scf.blocks_per_second", + this.period / 20f)); + tooltip.add(new TranslatableText("util.scf.best_block", + new TranslatableText("block." + id.getNamespace() + "." + id.getPath()))); + tooltip.add(new TranslatableText("util.scf.extra_info", + new TranslatableText(gameOptions.keySneak.getTranslationKey()), + new TranslatableText(gameOptions.keyUse.getTranslationKey()) + )); + } + } @Override @SuppressWarnings("deprecation") public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if (player.isSneaking() && hand == Hand.MAIN_HAND && world.isClient) { - for (int i = 0; i < this.level; i++) { - player.sendMessage(new LiteralText(Registry.BLOCK.get(Identifier.tryParse(SCF.ORES[i])).getName().getString()), false); - } + MutableText text = new TranslatableText("util.scf.funnel_output"); + this.getList().stream().forEach(e -> text.append(new LiteralText("\n ")) + .append(new TranslatableText("block." + e.getNamespace() + "." + e.getPath()))); + + player.sendMessage(text, false); } return super.onUse(state, world, pos, player, hand, hit); } - private long countTotalWeights() { - long clap = 0; - for (int i = 0; i < this.level; i++) { - clap += Integer.parseInt(SCF.WEIGHTS[i]); - } - System.out.println("total: " + clap); - return clap + 1; //to include the last number + private WeightedList getList() { + return OreManager.WEIGHTED_LIST_COLLECTION.get(this.level); } - private String getOreFromBigNumber(long bigNumber) { - int counter = 0; - long inter = 0; - while (inter < bigNumber) { - inter += Integer.parseInt(SCF.WEIGHTS[counter]); - if (inter > bigNumber) { - return SCF.ORES[counter]; - } - counter++; - } - return SCF.ORES[counter]; + private Identifier getGreatestWeight() { + return ((WeightedListAccessor) this.getList()).getEntries().stream() + .sorted(Comparator.comparing(WeightedList.Entry::getElement)) + .min(Comparator.comparingInt(e -> ((WeightedListEntryAccessor) e).getWeight())) + .map(WeightedList.Entry::getElement) + .orElse(null); } } diff --git a/src/main/java/gd/rf/acro/scf/SCF.java b/src/main/java/gd/rf/acro/scf/SCF.java index 95a16fd..6f45674 100644 --- a/src/main/java/gd/rf/acro/scf/SCF.java +++ b/src/main/java/gd/rf/acro/scf/SCF.java @@ -58,8 +58,7 @@ private FunnelBlock registerFunnel(String id, String level, String speed) { .of(Material.STONE) .ticksRandomly() .strength(1.5f, 0), - Integer.parseInt(ConfigUtils.config.get(level)), - Integer.parseInt(ConfigUtils.config.get(speed)))); + ConfigUtils.config.get(level), ConfigUtils.config.get(speed))); Registry.register(Registry.ITEM, new Identifier("scf", id), diff --git a/src/main/java/gd/rf/acro/scf/mixin/WeightedListAccessor.java b/src/main/java/gd/rf/acro/scf/mixin/WeightedListAccessor.java new file mode 100644 index 0000000..f686780 --- /dev/null +++ b/src/main/java/gd/rf/acro/scf/mixin/WeightedListAccessor.java @@ -0,0 +1,13 @@ +package gd.rf.acro.scf.mixin; + +import net.minecraft.util.collection.WeightedList; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import java.util.List; + +@Mixin(WeightedList.class) +public interface WeightedListAccessor { + @Accessor + List> getEntries(); +} diff --git a/src/main/java/gd/rf/acro/scf/mixin/WeightedListEntryAccessor.java b/src/main/java/gd/rf/acro/scf/mixin/WeightedListEntryAccessor.java new file mode 100644 index 0000000..c7a63eb --- /dev/null +++ b/src/main/java/gd/rf/acro/scf/mixin/WeightedListEntryAccessor.java @@ -0,0 +1,11 @@ +package gd.rf.acro.scf.mixin; + +import net.minecraft.util.collection.WeightedList; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(WeightedList.Entry.class) +public interface WeightedListEntryAccessor { + @Accessor + int getWeight(); +} diff --git a/src/main/resources/assets/scf/lang/en_us.json b/src/main/resources/assets/scf/lang/en_us.json index bb1f854..88d2fa6 100644 --- a/src/main/resources/assets/scf/lang/en_us.json +++ b/src/main/resources/assets/scf/lang/en_us.json @@ -6,5 +6,9 @@ "block.scf.diamond_funnel": "Diamond Funnel", "block.scf.bronze_funnel": "Bronze Funnel", "block.scf.netherite_funnel": "Netherite Funnel", - "itemGroup.scf.tab": "Super Cobblestone Funnels" + "itemGroup.scf.tab": "Super Cobblestone Funnels", + "util.scf.funnel_output": "Possible blocks that get generated:", + "util.scf.blocks_per_second": "1 block every %f second(s)", + "util.scf.best_block": "best block out: %s", + "util.scf.extra_info": "(%s-%s the block to see others!)" } \ No newline at end of file diff --git a/src/main/resources/modid.mixins.json b/src/main/resources/modid.mixins.json index 36473e2..ac180ac 100644 --- a/src/main/resources/modid.mixins.json +++ b/src/main/resources/modid.mixins.json @@ -4,6 +4,8 @@ "package": "gd.rf.acro.scf.mixin", "compatibilityLevel": "JAVA_8", "mixins": [ + "WeightedListAccessor", + "WeightedListEntryAccessor" ], "client": [ ], From 15c2d7240283dcfa423906b8a83731c785f0916c Mon Sep 17 00:00:00 2001 From: ThunderSphun Date: Wed, 5 Jan 2022 16:49:08 +0100 Subject: [PATCH 09/11] made use of logger class --- src/main/java/gd/rf/acro/scf/ConfigUtils.java | 7 +- src/main/java/gd/rf/acro/scf/FunnelBlock.java | 17 ++-- src/main/java/gd/rf/acro/scf/OreManager.java | 83 +++++++++++++------ src/main/java/gd/rf/acro/scf/SCF.java | 4 +- 4 files changed, 72 insertions(+), 39 deletions(-) diff --git a/src/main/java/gd/rf/acro/scf/ConfigUtils.java b/src/main/java/gd/rf/acro/scf/ConfigUtils.java index 755af20..5ae0c30 100644 --- a/src/main/java/gd/rf/acro/scf/ConfigUtils.java +++ b/src/main/java/gd/rf/acro/scf/ConfigUtils.java @@ -5,20 +5,22 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Path; import java.util.*; public class ConfigUtils { public static Map config = new HashMap<>(); - private static final File file = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/config.acfg"); + private static final File file = Path.of(FabricLoader.getInstance().getConfigDirectory().getPath(), "SCF", "config.acfg").toFile(); public static Map loadConfigs() { try { FileUtils.readLines(file, "utf-8").stream() - .map(e -> e.replace(" ", "")) // remove spaces + .map(e -> e.replaceAll("\\s", "")) // remove spaces .filter(e -> e.matches("^[^#]\\w+=\\d+$")) // is valid format .map(e -> e.split("=")) // split arguments .forEach(entry -> config.put(entry[0], Integer.parseInt(entry[1]))); } catch (IOException e) { + // something went wrong with loading the files e.printStackTrace(); } return config; @@ -28,6 +30,7 @@ private static void generateConfigs(List input) { try { FileUtils.writeLines(file, input); } catch (IOException e) { + // something went wrong with creating the files e.printStackTrace(); } } diff --git a/src/main/java/gd/rf/acro/scf/FunnelBlock.java b/src/main/java/gd/rf/acro/scf/FunnelBlock.java index 2fa386a..ae86f34 100644 --- a/src/main/java/gd/rf/acro/scf/FunnelBlock.java +++ b/src/main/java/gd/rf/acro/scf/FunnelBlock.java @@ -12,7 +12,6 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.item.ItemStack; -import net.minecraft.server.MinecraftServer; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; @@ -45,8 +44,8 @@ public FunnelBlock(Settings settings, int level, int period) { this.level = level; this.period = period; - if (this.level < 0 || this.level >= OreManager.WEIGHTED_LIST_COLLECTION.size()) { - this.level = MathHelper.clamp(this.level, 0, OreManager.WEIGHTED_LIST_COLLECTION.size() - 1); + if (this.level < 0 || this.level >= OreManager.weightedListCollection.size()) { + this.level = MathHelper.clamp(this.level, 0, OreManager.weightedListCollection.size() - 1); } } @@ -66,7 +65,7 @@ public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Ran world.playSound(null, pos, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1, 1); } - Identifier randomBlockId = OreManager.WEIGHTED_LIST_COLLECTION.get(this.level).pickRandom(random); + Identifier randomBlockId = OreManager.weightedListCollection.get(this.level).pickRandom(random); world.setBlockState(pos.down(), Registry.BLOCK.get(randomBlockId).getDefaultState()); } world.getBlockTickScheduler().schedule(pos, this, this.period); @@ -99,10 +98,8 @@ public void buildTooltip(ItemStack stack, BlockView world, List tooltip, T Identifier id = this.getGreatestWeight(); GameOptions gameOptions = MinecraftClient.getInstance().options; - tooltip.add(new TranslatableText("util.scf.blocks_per_second", - this.period / 20f)); - tooltip.add(new TranslatableText("util.scf.best_block", - new TranslatableText("block." + id.getNamespace() + "." + id.getPath()))); + tooltip.add(new TranslatableText("util.scf.blocks_per_second", this.period / 20f)); + tooltip.add(new TranslatableText("util.scf.best_block", Registry.BLOCK.get(id).getName())); tooltip.add(new TranslatableText("util.scf.extra_info", new TranslatableText(gameOptions.keySneak.getTranslationKey()), new TranslatableText(gameOptions.keyUse.getTranslationKey()) @@ -116,7 +113,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt if (player.isSneaking() && hand == Hand.MAIN_HAND && world.isClient) { MutableText text = new TranslatableText("util.scf.funnel_output"); this.getList().stream().forEach(e -> text.append(new LiteralText("\n ")) - .append(new TranslatableText("block." + e.getNamespace() + "." + e.getPath()))); + .append(Registry.BLOCK.get(e).getName())); player.sendMessage(text, false); } @@ -124,7 +121,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt } private WeightedList getList() { - return OreManager.WEIGHTED_LIST_COLLECTION.get(this.level); + return OreManager.weightedListCollection.get(this.level); } private Identifier getGreatestWeight() { diff --git a/src/main/java/gd/rf/acro/scf/OreManager.java b/src/main/java/gd/rf/acro/scf/OreManager.java index 177a17b..aa2a47d 100644 --- a/src/main/java/gd/rf/acro/scf/OreManager.java +++ b/src/main/java/gd/rf/acro/scf/OreManager.java @@ -2,17 +2,20 @@ import net.fabricmc.loader.api.FabricLoader; import net.minecraft.util.Identifier; +import net.minecraft.util.InvalidIdentifierException; import net.minecraft.util.collection.WeightedList; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class OreManager { - private static final String[] ores_default = { + public static final List> weightedListCollection = new ArrayList<>(); + private static final String[] DEFAULT_ORES = { // ore/tag, funnel tier, weight "minecraft:cobblestone,0,100", "minecraft:stone,0,100", @@ -43,50 +46,80 @@ public class OreManager { "minecraft:ancient_debris,4,1" }; - public static final List> WEIGHTED_LIST_COLLECTION = new ArrayList<>(); - public static void makeOreTable() { - File file = new File(FabricLoader.getInstance().getConfigDirectory().getPath() + "/SCF/ores.acfg"); + File file = Path.of(FabricLoader.getInstance().getConfigDirectory().getPath(), "SCF", "ores.acfg").toFile(); - try { - if (!file.exists()) { - FileUtils.writeLines(file, Arrays.asList(ores_default)); + if (!file.exists()) { + try { + FileUtils.writeLines(file, Arrays.asList(DEFAULT_ORES)); + } catch (IOException e) { + // something went wrong with creating the files + e.printStackTrace(); } + } - FileUtils.readLines(file, "utf-8").parallelStream() - .map(e -> e.replace(" ", "")) // remove spaces + try { + List lines = FileUtils.readLines(file, "utf-8"); + + lines.parallelStream() + .map(e -> e.replaceAll("\\s", "")) // remove spaces .filter(e -> e.matches("([a-z0-9_.-]+:)?[a-z0-9_.-]+,\\d+,\\d+")) // is valid format .map(e -> e.split(",")) // split arguments .sorted((a, b) -> -a[1].compareTo(b[1])) // sort it so that highest tier is done first .forEachOrdered(OreManager::setWeights); + + lines.parallelStream() + .map(e -> e.replace("\\s", "")) // remove spaces + .filter(e -> !e.matches("([a-z0-9_.-]+:)?[a-z0-9_.-]+,\\d+,\\d+")) // is not valid format + .forEachOrdered(e -> { + SCF.LOGGER.warning("invalid format"); + SCF.LOGGER.warning(e); + }); } catch (IOException e) { + // something went wrong with loading the files e.printStackTrace(); } } private static void setWeights(String[] ctx) { + Identifier id; + int tier; + int weight; + try { - Identifier id = new Identifier(ctx[0]); - int tier = Integer.parseInt(ctx[1]); - int weight = Integer.parseInt(ctx[2]); + id = new Identifier(ctx[0]); + } catch (InvalidIdentifierException e) { + SCF.LOGGER.warning("invalid config identifier"); + SCF.LOGGER.warning("[" + ctx[0] + "], " + ctx[1] + ", " + ctx[2]); + return; + } - if (tier < 0) { - System.err.println("invalid config tier"); - System.err.println(ctx[0] + ", [" + ctx[1] + "], " + ctx[2]); - return; - } + try { + tier = Integer.parseInt(ctx[1]); - for (int i = WEIGHTED_LIST_COLLECTION.size(); i <= tier; i++) { - WEIGHTED_LIST_COLLECTION.add(new WeightedList<>()); + if (tier < 0) { + throw new NumberFormatException(); } + } catch (NumberFormatException e) { + SCF.LOGGER.warning("invalid tier number"); + SCF.LOGGER.warning(ctx[0] + ", [" + ctx[1] + "], " + ctx[2]); + return; + } - for (int i = tier; i < WEIGHTED_LIST_COLLECTION.size(); i++) { - WEIGHTED_LIST_COLLECTION.get(i).add(id, weight); - } + try { + weight = Integer.parseInt(ctx[2]); } catch (NumberFormatException e) { - e.printStackTrace(); - System.err.println("invalid config identifier"); - System.err.println("[" + ctx[0] + "], " + ctx[1] + ", " + ctx[2]); + SCF.LOGGER.warning("invalid weight number"); + SCF.LOGGER.warning(ctx[0] + ", " + ctx[1] + ", [" + ctx[2] + "]"); + return; + } + + for (int i = weightedListCollection.size(); i <= tier; i++) { + weightedListCollection.add(new WeightedList<>()); + } + + for (int i = tier; i < weightedListCollection.size(); i++) { + weightedListCollection.get(i).add(id, weight); } } } diff --git a/src/main/java/gd/rf/acro/scf/SCF.java b/src/main/java/gd/rf/acro/scf/SCF.java index 6f45674..6fd41cf 100644 --- a/src/main/java/gd/rf/acro/scf/SCF.java +++ b/src/main/java/gd/rf/acro/scf/SCF.java @@ -19,10 +19,10 @@ import java.io.IOException; import java.util.Arrays; import java.util.Map; +import java.util.logging.Logger; public class SCF implements ModInitializer { - public static String[] ORES = {}; - public static String[] WEIGHTS = {}; + public static final Logger LOGGER = Logger.getLogger("SCF"); public static final ItemGroup TAB = FabricItemGroupBuilder.build( new Identifier("scf", "tab"), From 65b088787d128f31c49e12c045518205dd1c0f74 Mon Sep 17 00:00:00 2001 From: ThunderSphun Date: Wed, 5 Jan 2022 17:18:16 +0100 Subject: [PATCH 10/11] added comments --- src/main/java/gd/rf/acro/scf/FunnelBlock.java | 36 +++++++++++------ src/main/java/gd/rf/acro/scf/OreManager.java | 16 +++++++- src/main/java/gd/rf/acro/scf/SCF.java | 39 ++++++++++--------- 3 files changed, 60 insertions(+), 31 deletions(-) diff --git a/src/main/java/gd/rf/acro/scf/FunnelBlock.java b/src/main/java/gd/rf/acro/scf/FunnelBlock.java index ae86f34..3d5fcc4 100644 --- a/src/main/java/gd/rf/acro/scf/FunnelBlock.java +++ b/src/main/java/gd/rf/acro/scf/FunnelBlock.java @@ -37,22 +37,22 @@ public class FunnelBlock extends Block { private final static VoxelShape SHAPE = Block.createCuboidShape(2, 1, 2, 14, 16, 14); private final int period; - private int level; + private int tier; - public FunnelBlock(Settings settings, int level, int period) { + public FunnelBlock(Settings settings, int tier, int period) { super(settings); - this.level = level; + this.tier = tier; this.period = period; - if (this.level < 0 || this.level >= OreManager.weightedListCollection.size()) { - this.level = MathHelper.clamp(this.level, 0, OreManager.weightedListCollection.size() - 1); + if (this.tier < 0 || this.tier >= OreManager.weightedListCollection.size()) { // makes sure tier doesn't exceed bounds + this.tier = MathHelper.clamp(this.tier, 0, OreManager.weightedListCollection.size() - 1); } } @Override @SuppressWarnings("deprecation") public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return SHAPE; + return SHAPE; // storing an object in memory is faster } @Override @@ -62,10 +62,11 @@ public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Ran if (hasLavaAndWater(pos, world) && world.getBlockState(pos.down()).isAir()) { if (!world.isClient) { + // playing sound is build in by mojang world.playSound(null, pos, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1, 1); } - Identifier randomBlockId = OreManager.weightedListCollection.get(this.level).pickRandom(random); + Identifier randomBlockId = OreManager.weightedListCollection.get(this.tier).pickRandom(random); world.setBlockState(pos.down(), Registry.BLOCK.get(randomBlockId).getDefaultState()); } world.getBlockTickScheduler().schedule(pos, this, this.period); @@ -80,6 +81,12 @@ private boolean hasLavaAndWater(BlockPos pos, World world) { return hasLava && hasWater; } + /** + * Returns fluid at the given position + * @param pos The position to check + * @param world The world to check in + * @return The fluid at the given position + */ private Fluid getFluidAtPos(BlockPos pos, World world) { return world.getBlockState(pos).getFluidState().getFluid(); } @@ -92,12 +99,13 @@ public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity p @Override public void buildTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options) { - super.buildTooltip(stack, world, tooltip, options); + if (world != null) { // prevents many calls to this method during startup + super.buildTooltip(stack, world, tooltip, options); - if (world != null) { Identifier id = this.getGreatestWeight(); GameOptions gameOptions = MinecraftClient.getInstance().options; + // uses translatable texts for multi-lang support tooltip.add(new TranslatableText("util.scf.blocks_per_second", this.period / 20f)); tooltip.add(new TranslatableText("util.scf.best_block", Registry.BLOCK.get(id).getName())); tooltip.add(new TranslatableText("util.scf.extra_info", @@ -111,9 +119,10 @@ public void buildTooltip(ItemStack stack, BlockView world, List tooltip, T @SuppressWarnings("deprecation") public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if (player.isSneaking() && hand == Hand.MAIN_HAND && world.isClient) { + // uses translatable texts for multi-lang support MutableText text = new TranslatableText("util.scf.funnel_output"); this.getList().stream().forEach(e -> text.append(new LiteralText("\n ")) - .append(Registry.BLOCK.get(e).getName())); + .append(Registry.BLOCK.get(e).getName())); // puts each entry on a new line slightly indented player.sendMessage(text, false); } @@ -121,9 +130,14 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt } private WeightedList getList() { - return OreManager.weightedListCollection.get(this.level); + return OreManager.weightedListCollection.get(this.tier); } + /** + * Gets the identifier of the block with the biggest weight for this tier + * + * @return The identifier of the block with the biggest weight for this tier + */ private Identifier getGreatestWeight() { return ((WeightedListAccessor) this.getList()).getEntries().stream() .sorted(Comparator.comparing(WeightedList.Entry::getElement)) diff --git a/src/main/java/gd/rf/acro/scf/OreManager.java b/src/main/java/gd/rf/acro/scf/OreManager.java index aa2a47d..928609e 100644 --- a/src/main/java/gd/rf/acro/scf/OreManager.java +++ b/src/main/java/gd/rf/acro/scf/OreManager.java @@ -49,6 +49,7 @@ public class OreManager { public static void makeOreTable() { File file = Path.of(FabricLoader.getInstance().getConfigDirectory().getPath(), "SCF", "ores.acfg").toFile(); + // write default values if no file exists if (!file.exists()) { try { FileUtils.writeLines(file, Arrays.asList(DEFAULT_ORES)); @@ -61,6 +62,7 @@ public static void makeOreTable() { try { List lines = FileUtils.readLines(file, "utf-8"); + // load all data lines.parallelStream() .map(e -> e.replaceAll("\\s", "")) // remove spaces .filter(e -> e.matches("([a-z0-9_.-]+:)?[a-z0-9_.-]+,\\d+,\\d+")) // is valid format @@ -68,6 +70,7 @@ public static void makeOreTable() { .sorted((a, b) -> -a[1].compareTo(b[1])) // sort it so that highest tier is done first .forEachOrdered(OreManager::setWeights); + // let user know if the config format was wrong lines.parallelStream() .map(e -> e.replace("\\s", "")) // remove spaces .filter(e -> !e.matches("([a-z0-9_.-]+:)?[a-z0-9_.-]+,\\d+,\\d+")) // is not valid format @@ -81,6 +84,12 @@ public static void makeOreTable() { } } + /** + * A helper to set all the weights + * Must be called with the highest tier first + * + * @param ctx The params for this value, in the order [Identifier, tier, weight] + */ private static void setWeights(String[] ctx) { Identifier id; int tier; @@ -89,6 +98,7 @@ private static void setWeights(String[] ctx) { try { id = new Identifier(ctx[0]); } catch (InvalidIdentifierException e) { + // shouldn't happen with regex check SCF.LOGGER.warning("invalid config identifier"); SCF.LOGGER.warning("[" + ctx[0] + "], " + ctx[1] + ", " + ctx[2]); return; @@ -98,9 +108,10 @@ private static void setWeights(String[] ctx) { tier = Integer.parseInt(ctx[1]); if (tier < 0) { - throw new NumberFormatException(); + throw new NumberFormatException(); // get into the catch } } catch (NumberFormatException e) { + // shouldn't happen with regex check SCF.LOGGER.warning("invalid tier number"); SCF.LOGGER.warning(ctx[0] + ", [" + ctx[1] + "], " + ctx[2]); return; @@ -109,15 +120,18 @@ private static void setWeights(String[] ctx) { try { weight = Integer.parseInt(ctx[2]); } catch (NumberFormatException e) { + // shouldn't happen with regex check SCF.LOGGER.warning("invalid weight number"); SCF.LOGGER.warning(ctx[0] + ", " + ctx[1] + ", [" + ctx[2] + "]"); return; } + // add new lists if they don't exist yet for (int i = weightedListCollection.size(); i <= tier; i++) { weightedListCollection.add(new WeightedList<>()); } + // fill the list with their weights for (int i = tier; i < weightedListCollection.size(); i++) { weightedListCollection.get(i).add(id, weight); } diff --git a/src/main/java/gd/rf/acro/scf/SCF.java b/src/main/java/gd/rf/acro/scf/SCF.java index 6fd41cf..9d9289b 100644 --- a/src/main/java/gd/rf/acro/scf/SCF.java +++ b/src/main/java/gd/rf/acro/scf/SCF.java @@ -2,7 +2,6 @@ import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; -import net.fabricmc.loader.api.FabricLoader; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.Material; @@ -11,23 +10,13 @@ import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; -import net.minecraft.util.Pair; import net.minecraft.util.registry.Registry; -import org.apache.commons.io.FileUtils; -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.Map; import java.util.logging.Logger; public class SCF implements ModInitializer { public static final Logger LOGGER = Logger.getLogger("SCF"); - public static final ItemGroup TAB = FabricItemGroupBuilder.build( - new Identifier("scf", "tab"), - () -> new ItemStack(SCF.COBBLESTONE_FUNNEL_BLOCK)); - public static Block COBBLESTONE_FUNNEL_BLOCK; public static Block COPPER_FUNNEL_BLOCK; public static Block BRONZE_FUNNEL_BLOCK; @@ -36,6 +25,10 @@ public class SCF implements ModInitializer { public static Block DIAMOND_FUNNEL_BLOCK; public static Block NETHERITE_FUNNEL_BLOCK; + public static final ItemGroup TAB = FabricItemGroupBuilder.build( + new Identifier("scf", "tab"), + () -> new ItemStack(SCF.COBBLESTONE_FUNNEL_BLOCK)); + @Override public void onInitialize() { ConfigUtils.checkConfigs(); @@ -50,15 +43,23 @@ public void onInitialize() { NETHERITE_FUNNEL_BLOCK = registerFunnel("netherite_funnel", "netheritelvl", "netheritespeed"); } - private FunnelBlock registerFunnel(String id, String level, String speed) { + /** + * Helper method for creating a funnel block and item + * + * @param id The id of the funnel, with a default namespace of scf + * @param tier The name of the tier according to the config + * @param speed The speed the funnel generates blocks, in seconds + * @return The created block + */ + private FunnelBlock registerFunnel(String id, String tier, String speed) { FunnelBlock block = Registry.register(Registry.BLOCK, - new Identifier("scf", id), - new FunnelBlock( - AbstractBlock.Settings - .of(Material.STONE) - .ticksRandomly() - .strength(1.5f, 0), - ConfigUtils.config.get(level), ConfigUtils.config.get(speed))); + new Identifier("scf", id), + new FunnelBlock( + AbstractBlock.Settings + .of(Material.STONE) + .ticksRandomly() + .strength(1.5f, 0), + ConfigUtils.config.get(tier), ConfigUtils.config.get(speed))); Registry.register(Registry.ITEM, new Identifier("scf", id), From 3a41879be8f7d67b3882d0248126d1a735421bde Mon Sep 17 00:00:00 2001 From: ThunderSphun Date: Wed, 5 Jan 2022 20:09:15 +0100 Subject: [PATCH 11/11] updated changes to 1.17 --- .gitignore | 2 + build.gradle | 12 +- gradle.properties | 15 +- gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/java/gd/rf/acro/scf/ConfigUtils.java | 63 ++- src/main/java/gd/rf/acro/scf/FunnelBlock.java | 13 +- src/main/java/gd/rf/acro/scf/OreManager.java | 43 +- src/main/java/gd/rf/acro/scf/SCF.java | 20 +- src/main/resources/assets/scf/lang/en_us.json | 2 + .../scf/models/block/silver_funnel.json | 499 ++++++++++++++++++ .../assets/scf/models/block/tin_funnel.json | 499 ++++++++++++++++++ .../assets/scf/models/item/silver_funnel.json | 3 + .../assets/scf/models/item/tin_funnel.json | 3 + .../textures/block/bronze_storage_block.png | Bin 0 -> 260 bytes .../textures/block/copper_storage_block.png | Bin 0 -> 259 bytes .../textures/block/silver_storage_block.png | Bin 0 -> 253 bytes .../scf/textures/block/tin_storage_block.png | Bin 0 -> 240 bytes .../scf/loot_tables/blocks/silver_funnel.json | 19 + .../scf/loot_tables/blocks/tin_funnel.json | 19 + src/main/resources/fabric.mod.json | 3 +- 20 files changed, 1128 insertions(+), 89 deletions(-) create mode 100644 src/main/resources/assets/scf/models/block/silver_funnel.json create mode 100644 src/main/resources/assets/scf/models/block/tin_funnel.json create mode 100644 src/main/resources/assets/scf/models/item/silver_funnel.json create mode 100644 src/main/resources/assets/scf/models/item/tin_funnel.json create mode 100644 src/main/resources/assets/scf/textures/block/bronze_storage_block.png create mode 100644 src/main/resources/assets/scf/textures/block/copper_storage_block.png create mode 100644 src/main/resources/assets/scf/textures/block/silver_storage_block.png create mode 100644 src/main/resources/assets/scf/textures/block/tin_storage_block.png create mode 100644 src/main/resources/data/scf/loot_tables/blocks/silver_funnel.json create mode 100644 src/main/resources/data/scf/loot_tables/blocks/tin_funnel.json diff --git a/.gitignore b/.gitignore index 8ba8551..784fa1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .gradle .idea +remappedSrc +out build run \ No newline at end of file diff --git a/build.gradle b/build.gradle index 53840a8..06d4081 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.4-SNAPSHOT' + id 'fabric-loom' version '0.10-SNAPSHOT' id 'maven-publish' } @@ -9,12 +9,7 @@ targetCompatibility = JavaVersion.VERSION_1_8 archivesBaseName = project.archives_base_name version = project.mod_version group = project.maven_group -repositories { - maven { - name = "Cotton" - url = "https://server.bbkr.space/artifactory/libs-release/" - } -} + dependencies { //to change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" @@ -22,7 +17,6 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation "io.github.cottonmc:cotton-resources:${cotton_resources_version}" // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. // You may need to force-disable transitiveness on them. @@ -79,4 +73,4 @@ publishing { // uncomment to publish to the local maven // mavenLocal() } -} +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index d79747c..b3cfb11 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,16 +3,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use - minecraft_version=1.16.1 - yarn_mappings=1.16.1+build.1 - loader_version=0.8.8+build.202 +minecraft_version=1.17.1 +yarn_mappings=1.17.1+build.65 +loader_version=0.12.12 # Mod Properties - mod_version = 1.1.1 + mod_version = 1.2 maven_group = gd.rf.acro.scf - archives_base_name = SCF-1.16 + archives_base_name = SCF-1.16.4 # Dependencies - # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api - fabric_version=0.13.1+build.370-1.16 - cotton_resources_version=1.7.1 +# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api +fabric_version=0.45.1+1.17 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 622ab64..f371643 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-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/gd/rf/acro/scf/ConfigUtils.java b/src/main/java/gd/rf/acro/scf/ConfigUtils.java index 5ae0c30..42352e7 100644 --- a/src/main/java/gd/rf/acro/scf/ConfigUtils.java +++ b/src/main/java/gd/rf/acro/scf/ConfigUtils.java @@ -5,18 +5,19 @@ import java.io.File; import java.io.IOException; -import java.nio.file.Path; +import java.nio.file.Paths; import java.util.*; public class ConfigUtils { public static Map config = new HashMap<>(); - private static final File file = Path.of(FabricLoader.getInstance().getConfigDirectory().getPath(), "SCF", "config.acfg").toFile(); + private static final File file = Paths.get(FabricLoader.getInstance().getConfigDir().toString(), "SCF", "config.acfg").toFile(); public static Map loadConfigs() { try { - FileUtils.readLines(file, "utf-8").stream() + List lines = FileUtils.readLines(file, "utf-8"); + lines.stream() .map(e -> e.replaceAll("\\s", "")) // remove spaces - .filter(e -> e.matches("^[^#]\\w+=\\d+$")) // is valid format + .filter(e -> e.matches("^[^#]\\w+(-\\w+)*=\\d+$")) // is valid format .map(e -> e.split("=")) // split arguments .forEach(entry -> config.put(entry[0], Integer.parseInt(entry[1]))); } catch (IOException e) { @@ -35,48 +36,58 @@ private static void generateConfigs(List input) { } } - public static Map checkConfigs() { + public static void checkConfigs() { if (!file.exists()) { generateConfigs(makeDefaults()); } - return loadConfigs(); + loadConfigs(); } private static List makeDefaults() { return Arrays.asList( "#cobblestone funnel ore level (default 0)", - "cobblelvl=0", + "cobble-tier=0", "#cobblestone funnel speed (default 60)", - "cobblespeed=60", + "cobble-speed=60", "", "#copper funnel ore level (default 1)", - "copperlvl=1", + "copper-tier=1", "#copper funnel speed (default 60)", - "copperspeed=60", + "copper-speed=60", "", - "#bronze funnel ore level (default 1)", - "bronzelvl=1", - "#bronze funnel speed (default 30)", - "bronzespeed=30", + "#tin funnel tier (default 1)", + "tin-tier=1", + "#tin funnel speed (default 60)", + "tin-speed=60", "", - "#iron funnel ore level (default 2)", - "ironlvl=2", + "#bronze funnel ore level (default 2)", + "bronze-tier=2", + "#bronze funnel speed (default 50)", + "bronze-speed=50", + "", + "#silver funnel tier (default 3)", + "silver-tier=3", + "#silver funnel speed (default 60)", + "silver-speed=60", + "", + "#iron funnel ore level (default 3)", + "iron-tier=3", "#iron funnel speed (default 50)", - "ironspeed=50", + "iron-speed=50", "", - "#gold funnel ore level (default 3)", - "goldlvl=3", + "#gold funnel ore level (default 4)", + "gold-tier=4", "#gold funnel speed (default 40)", - "goldspeed=40", + "gold-speed=40", "", - "#diamond funnel ore level (default 4)", - "diamondlvl=4", + "#diamond funnel ore level (default 5)", + "diamond-tier=5", "#diamond funnel speed (default 40)", - "diamondspeed=40", + "diamond-speed=40", "", - "#netherite funnel ore level (default 5)", - "netheritelvl=5", + "#netherite funnel ore level (default 6)", + "netherite-tier=6", "#netherite funnel speed (default 20)", - "netheritespeed=20"); + "netherite-speed=20"); } } diff --git a/src/main/java/gd/rf/acro/scf/FunnelBlock.java b/src/main/java/gd/rf/acro/scf/FunnelBlock.java index 3d5fcc4..927b8a4 100644 --- a/src/main/java/gd/rf/acro/scf/FunnelBlock.java +++ b/src/main/java/gd/rf/acro/scf/FunnelBlock.java @@ -7,7 +7,7 @@ import net.minecraft.block.ShapeContext; import net.minecraft.client.MinecraftClient; import net.minecraft.client.item.TooltipContext; -import net.minecraft.client.options.GameOptions; +import net.minecraft.client.option.GameOptions; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; @@ -66,8 +66,10 @@ public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Ran world.playSound(null, pos, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1, 1); } - Identifier randomBlockId = OreManager.weightedListCollection.get(this.tier).pickRandom(random); - world.setBlockState(pos.down(), Registry.BLOCK.get(randomBlockId).getDefaultState()); + Identifier randomBlockId = OreManager.weightedListCollection.get(this.tier).shuffle().stream().findFirst().orElse(null); + if (randomBlockId != null) { + world.setBlockState(pos.down(), Registry.BLOCK.get(randomBlockId).getDefaultState()); + } } world.getBlockTickScheduler().schedule(pos, this, this.period); } @@ -98,9 +100,9 @@ public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity p } @Override - public void buildTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options) { + public void appendTooltip(ItemStack stack, BlockView world, List tooltip, TooltipContext options) { if (world != null) { // prevents many calls to this method during startup - super.buildTooltip(stack, world, tooltip, options); + super.appendTooltip(stack, world, tooltip, options); Identifier id = this.getGreatestWeight(); GameOptions gameOptions = MinecraftClient.getInstance().options; @@ -138,6 +140,7 @@ private WeightedList getList() { * * @return The identifier of the block with the biggest weight for this tier */ + @SuppressWarnings("unchecked") private Identifier getGreatestWeight() { return ((WeightedListAccessor) this.getList()).getEntries().stream() .sorted(Comparator.comparing(WeightedList.Entry::getElement)) diff --git a/src/main/java/gd/rf/acro/scf/OreManager.java b/src/main/java/gd/rf/acro/scf/OreManager.java index 928609e..c22b35b 100644 --- a/src/main/java/gd/rf/acro/scf/OreManager.java +++ b/src/main/java/gd/rf/acro/scf/OreManager.java @@ -8,7 +8,7 @@ import java.io.File; import java.io.IOException; -import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -16,38 +16,21 @@ public class OreManager { public static final List> weightedListCollection = new ArrayList<>(); private static final String[] DEFAULT_ORES = { - // ore/tag, funnel tier, weight - "minecraft:cobblestone,0,100", - "minecraft:stone,0,100", - "minecraft:coal_ore,0,100", - "c:tin_ore,0,100", - "c:copper_ore,0,100", - "minecraft:iron_ore,1,100", - "c:zinc_ore,1,100", - "c:aluminum_ore,1,100", - "c:lead_ore,1,100", - "c:silver_ore,2,100", - "minecraft:redstone_ore,2,100", - "minecraft:nether_quartz_ore,2,100", - "minecraft:gold_ore,2,100", - "c:uranium_ore,2,100", - "minecraft:diamond_ore,3,20", - "c:platinum_ore,3,20", - "c:tungsten_ore,3,20", - "c:osmium_ore,4,20", - "c:palladium_ore,4,20", - "c:amethyst_ore,4,20", - "c:iridium_ore,4,20", - "c:topaz_ore,4,20", - "c:cobalt_ore,4,20", - "c:peridot_ore,4,20", - "c:sapphire_ore,4,20", - "c:ruby_ore,4,20", - "minecraft:ancient_debris,4,1" + // ore, funnel tier, weight + "minecraft:cobblestone,0,512", + "minecraft:stone,0,512", + "minecraft:coal_ore,0,256", + "minecraft:copper_ore,0,128", + "minecraft:iron_ore,0,128", + "minecraft:redstone_ore,1,64", + "minecraft:nether_quartz_ore,1,64", + "minecraft:gold_ore,1,64", + "minecraft:diamond_ore,2,16", + "minecraft:ancient_debris,2,1", }; public static void makeOreTable() { - File file = Path.of(FabricLoader.getInstance().getConfigDirectory().getPath(), "SCF", "ores.acfg").toFile(); + File file = Paths.get(FabricLoader.getInstance().getConfigDir().toString(), "SCF", "ores.acfg").toFile(); // write default values if no file exists if (!file.exists()) { diff --git a/src/main/java/gd/rf/acro/scf/SCF.java b/src/main/java/gd/rf/acro/scf/SCF.java index 9d9289b..90e8f9c 100644 --- a/src/main/java/gd/rf/acro/scf/SCF.java +++ b/src/main/java/gd/rf/acro/scf/SCF.java @@ -18,9 +18,11 @@ public class SCF implements ModInitializer { public static final Logger LOGGER = Logger.getLogger("SCF"); public static Block COBBLESTONE_FUNNEL_BLOCK; + public static Block IRON_FUNNEL_BLOCK; public static Block COPPER_FUNNEL_BLOCK; + public static Block TIN_FUNNEL_BLOCK; public static Block BRONZE_FUNNEL_BLOCK; - public static Block IRON_FUNNEL_BLOCK; + public static Block SILVER_FUNNEL_BLOCK; public static Block GOLD_FUNNEL_BLOCK; public static Block DIAMOND_FUNNEL_BLOCK; public static Block NETHERITE_FUNNEL_BLOCK; @@ -34,13 +36,15 @@ public void onInitialize() { ConfigUtils.checkConfigs(); OreManager.makeOreTable(); - COBBLESTONE_FUNNEL_BLOCK = registerFunnel("cobblestone_funnel", "cobblelvl", "cobblespeed"); - COPPER_FUNNEL_BLOCK = registerFunnel("copper_funnel", "copperlvl", "copperspeed"); - BRONZE_FUNNEL_BLOCK = registerFunnel("bronze_funnel", "bronzelvl", "bronzespeed"); - IRON_FUNNEL_BLOCK = registerFunnel("iron_funnel", "ironlvl", "ironspeed"); - GOLD_FUNNEL_BLOCK = registerFunnel("gold_funnel", "goldlvl", "goldspeed"); - DIAMOND_FUNNEL_BLOCK = registerFunnel("diamond_funnel", "diamondlvl", "diamondspeed"); - NETHERITE_FUNNEL_BLOCK = registerFunnel("netherite_funnel", "netheritelvl", "netheritespeed"); + COBBLESTONE_FUNNEL_BLOCK = registerFunnel("cobblestone_funnel", "cobble-tier", "cobble-speed"); + IRON_FUNNEL_BLOCK = registerFunnel("iron_funnel", "iron-tier", "iron-speed"); + COPPER_FUNNEL_BLOCK = registerFunnel("copper_funnel", "copper-tier", "copper-speed"); + TIN_FUNNEL_BLOCK = registerFunnel("tin_funnel", "tin-tier", "tin-speed"); + BRONZE_FUNNEL_BLOCK = registerFunnel("bronze_funnel", "bronze-tier", "bronze-speed"); + SILVER_FUNNEL_BLOCK = registerFunnel("silver_funnel", "silver-tier", "silver-speed"); + GOLD_FUNNEL_BLOCK = registerFunnel("gold_funnel", "gold-tier", "gold-speed"); + DIAMOND_FUNNEL_BLOCK = registerFunnel("diamond_funnel", "diamond-tier", "diamond-speed"); + NETHERITE_FUNNEL_BLOCK = registerFunnel("netherite_funnel", "netherite-tier", "netherite-speed"); } /** diff --git a/src/main/resources/assets/scf/lang/en_us.json b/src/main/resources/assets/scf/lang/en_us.json index 88d2fa6..0e44661 100644 --- a/src/main/resources/assets/scf/lang/en_us.json +++ b/src/main/resources/assets/scf/lang/en_us.json @@ -2,6 +2,8 @@ "block.scf.cobblestone_funnel": "Cobblestone Funnel", "block.scf.iron_funnel": "Iron Funnel", "block.scf.copper_funnel": "Copper Funnel", + "block.scf.tin_funnel": "Tin Funnel", + "block.scf.silver_funnel": "Silver Funnel", "block.scf.gold_funnel": "Gold Funnel", "block.scf.diamond_funnel": "Diamond Funnel", "block.scf.bronze_funnel": "Bronze Funnel", diff --git a/src/main/resources/assets/scf/models/block/silver_funnel.json b/src/main/resources/assets/scf/models/block/silver_funnel.json new file mode 100644 index 0000000..b506873 --- /dev/null +++ b/src/main/resources/assets/scf/models/block/silver_funnel.json @@ -0,0 +1,499 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "0": "scf:block/silver_storage_block", + "particle": "scf:block/silver_storage_block" + }, + "elements": [ + { + "from": [0, 10, 6], + "to": [2, 11, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [-7, 18, 14]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [14, 10, 6], + "to": [16, 11, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [7, 18, 14]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [13, 1, 3], + "to": [14, 8, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [6, 9, 11]}, + "faces": { + "north": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "east": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "west": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [3, 1, 13], + "to": [13, 8, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, 6]}, + "faces": { + "north": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [3, 1, 2], + "to": [13, 8, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, -5]}, + "faces": { + "north": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [2, 1, 3], + "to": [3, 8, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [-5, 9, 11]}, + "faces": { + "north": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "east": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "west": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [13, 8, 3], + "to": [14, 10, 7], + "rotation": {"angle": 0, "axis": "y", "origin": [6, 16, 11]}, + "faces": { + "north": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [9, 8, 13], + "to": [13, 10, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, 6]}, + "faces": { + "north": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [9, 8, 2], + "to": [13, 10, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, -5]}, + "faces": { + "north": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [2, 8, 3], + "to": [3, 10, 7], + "rotation": {"angle": 0, "axis": "y", "origin": [-5, 16, 11]}, + "faces": { + "north": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [13, 8, 9], + "to": [14, 10, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [6, 16, 17]}, + "faces": { + "north": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [3, 8, 13], + "to": [7, 10, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, 6]}, + "faces": { + "north": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [3, 8, 2], + "to": [7, 10, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, -5]}, + "faces": { + "north": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [2, 8, 9], + "to": [3, 10, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [-5, 16, 17]}, + "faces": { + "north": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [13, 10, 3], + "to": [14, 16, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [6, 18, 11]}, + "faces": { + "north": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "east": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "west": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [3, 15, 3], + "to": [13, 16, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [-4, 23, 11]}, + "faces": { + "north": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 10], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 10], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [3, 10, 13], + "to": [13, 16, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, 6]}, + "faces": { + "north": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [3, 10, 2], + "to": [13, 16, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, -5]}, + "faces": { + "north": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [2, 10, 3], + "to": [3, 16, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [-5, 18, 11]}, + "faces": { + "north": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "east": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "west": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [6, 10, 0], + "to": [10, 11, 2], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 9]}, + "faces": { + "north": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "texture": "#0"} + } + }, + { + "from": [6, 10, 14], + "to": [10, 11, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 23]}, + "faces": { + "north": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "texture": "#0"} + } + }, + { + "from": [0, 7, 6], + "to": [2, 8, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [-7, 15, 14]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [14, 7, 6], + "to": [16, 8, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [7, 15, 14]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [6, 7, 0], + "to": [10, 8, 2], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 9]}, + "faces": { + "north": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "texture": "#0"} + } + }, + { + "from": [6, 7, 14], + "to": [10, 8, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 23]}, + "faces": { + "north": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "texture": "#0"} + } + }, + { + "from": [0, 8, 9], + "to": [2, 10, 10], + "rotation": {"angle": 0, "axis": "x", "origin": [-7, 16, 2]}, + "faces": { + "north": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [14, 8, 9], + "to": [16, 10, 10], + "rotation": {"angle": 0, "axis": "x", "origin": [7, 16, 2]}, + "faces": { + "north": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [9, 8, 0], + "to": [10, 10, 2], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 9]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [9, 8, 14], + "to": [10, 10, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 23]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [0, 8, 6], + "to": [2, 10, 7], + "rotation": {"angle": 0, "axis": "x", "origin": [-7, 16, -1]}, + "faces": { + "north": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [14, 8, 6], + "to": [16, 10, 7], + "rotation": {"angle": 0, "axis": "x", "origin": [7, 16, -1]}, + "faces": { + "north": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [6, 8, 0], + "to": [7, 10, 2], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 9]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [6, 8, 14], + "to": [7, 10, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 23]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [0, 0, 0], + "to": [3, 1, 16], + "faces": { + "north": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 3, 16], "texture": "#0"}, + "down": {"uv": [0, 0, 3, 16], "texture": "#0"} + } + }, + { + "from": [13, 0, 0], + "to": [16, 1, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [21, 8, 8]}, + "faces": { + "north": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 3, 16], "texture": "#0"}, + "down": {"uv": [0, 0, 3, 16], "texture": "#0"} + } + }, + { + "from": [3, 0, 0], + "to": [13, 1, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [11, 8, 8]}, + "faces": { + "north": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 3, 10], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 3, 10], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [3, 0, 13], + "to": [13, 1, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [11, 8, 21]}, + "faces": { + "north": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 3, 10], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 3, 10], "rotation": 270, "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "scale": [0.5, 0.5, 0.5] + }, + "gui": { + "rotation": [28, -46, 0], + "translation": [0, 1, 0], + "scale": [0.5, 0.5, 0.5] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/scf/models/block/tin_funnel.json b/src/main/resources/assets/scf/models/block/tin_funnel.json new file mode 100644 index 0000000..f73d359 --- /dev/null +++ b/src/main/resources/assets/scf/models/block/tin_funnel.json @@ -0,0 +1,499 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "0": "scf:block/tin_storage_block", + "particle": "scf:block/tin_storage_block" + }, + "elements": [ + { + "from": [0, 10, 6], + "to": [2, 11, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [-7, 18, 14]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [14, 10, 6], + "to": [16, 11, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [7, 18, 14]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [13, 1, 3], + "to": [14, 8, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [6, 9, 11]}, + "faces": { + "north": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "east": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "west": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [3, 1, 13], + "to": [13, 8, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, 6]}, + "faces": { + "north": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [3, 1, 2], + "to": [13, 8, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, -5]}, + "faces": { + "north": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [2, 1, 3], + "to": [3, 8, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [-5, 9, 11]}, + "faces": { + "north": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "east": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 7], "texture": "#0"}, + "west": {"uv": [0, 0, 10, 7], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [13, 8, 3], + "to": [14, 10, 7], + "rotation": {"angle": 0, "axis": "y", "origin": [6, 16, 11]}, + "faces": { + "north": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [9, 8, 13], + "to": [13, 10, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, 6]}, + "faces": { + "north": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [9, 8, 2], + "to": [13, 10, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, -5]}, + "faces": { + "north": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [2, 8, 3], + "to": [3, 10, 7], + "rotation": {"angle": 0, "axis": "y", "origin": [-5, 16, 11]}, + "faces": { + "north": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [13, 8, 9], + "to": [14, 10, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [6, 16, 17]}, + "faces": { + "north": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [3, 8, 13], + "to": [7, 10, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, 6]}, + "faces": { + "north": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [3, 8, 2], + "to": [7, 10, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, -5]}, + "faces": { + "north": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [2, 8, 9], + "to": [3, 10, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [-5, 16, 17]}, + "faces": { + "north": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 2], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [13, 10, 3], + "to": [14, 16, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [6, 18, 11]}, + "faces": { + "north": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "east": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "west": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [3, 15, 3], + "to": [13, 16, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [-4, 23, 11]}, + "faces": { + "north": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 10], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 10], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [3, 10, 13], + "to": [13, 16, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, 6]}, + "faces": { + "north": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [3, 10, 2], + "to": [13, 16, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [5, 18, -5]}, + "faces": { + "north": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "west": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [2, 10, 3], + "to": [3, 16, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [-5, 18, 11]}, + "faces": { + "north": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "east": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "south": {"uv": [0, 0, 1, 6], "texture": "#0"}, + "west": {"uv": [0, 0, 10, 6], "texture": "#0"}, + "up": {"uv": [0, 0, 10, 1], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 10, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [6, 10, 0], + "to": [10, 11, 2], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 9]}, + "faces": { + "north": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "texture": "#0"} + } + }, + { + "from": [6, 10, 14], + "to": [10, 11, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 23]}, + "faces": { + "north": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "texture": "#0"} + } + }, + { + "from": [0, 7, 6], + "to": [2, 8, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [-7, 15, 14]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [14, 7, 6], + "to": [16, 8, 10], + "rotation": {"angle": 0, "axis": "y", "origin": [7, 15, 14]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [6, 7, 0], + "to": [10, 8, 2], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 9]}, + "faces": { + "north": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "texture": "#0"} + } + }, + { + "from": [6, 7, 14], + "to": [10, 8, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 23]}, + "faces": { + "north": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 4, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 4, 2], "texture": "#0"}, + "down": {"uv": [0, 0, 4, 2], "texture": "#0"} + } + }, + { + "from": [0, 8, 9], + "to": [2, 10, 10], + "rotation": {"angle": 0, "axis": "x", "origin": [-7, 16, 2]}, + "faces": { + "north": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [14, 8, 9], + "to": [16, 10, 10], + "rotation": {"angle": 0, "axis": "x", "origin": [7, 16, 2]}, + "faces": { + "north": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [9, 8, 0], + "to": [10, 10, 2], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 9]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [9, 8, 14], + "to": [10, 10, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 23]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [0, 8, 6], + "to": [2, 10, 7], + "rotation": {"angle": 0, "axis": "x", "origin": [-7, 16, -1]}, + "faces": { + "north": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [14, 8, 6], + "to": [16, 10, 7], + "rotation": {"angle": 0, "axis": "x", "origin": [7, 16, -1]}, + "faces": { + "north": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [6, 8, 0], + "to": [7, 10, 2], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 9]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [6, 8, 14], + "to": [7, 10, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [2, 16, 23]}, + "faces": { + "north": {"uv": [0, 0, 2, 1], "rotation": 90, "texture": "#0"}, + "east": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "south": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#0"}, + "up": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"}, + "down": {"uv": [0, 0, 2, 1], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [0, 0, 0], + "to": [3, 1, 16], + "faces": { + "north": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 3, 16], "texture": "#0"}, + "down": {"uv": [0, 0, 3, 16], "texture": "#0"} + } + }, + { + "from": [13, 0, 0], + "to": [16, 1, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [21, 8, 8]}, + "faces": { + "north": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 3, 16], "texture": "#0"}, + "down": {"uv": [0, 0, 3, 16], "texture": "#0"} + } + }, + { + "from": [3, 0, 0], + "to": [13, 1, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [11, 8, 8]}, + "faces": { + "north": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 3, 10], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 3, 10], "rotation": 270, "texture": "#0"} + } + }, + { + "from": [3, 0, 13], + "to": [13, 1, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [11, 8, 21]}, + "faces": { + "north": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "east": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "south": {"uv": [0, 0, 10, 1], "texture": "#0"}, + "west": {"uv": [0, 0, 3, 1], "texture": "#0"}, + "up": {"uv": [0, 0, 3, 10], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 3, 10], "rotation": 270, "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "scale": [0.5, 0.5, 0.5] + }, + "gui": { + "rotation": [28, -46, 0], + "translation": [0, 1, 0], + "scale": [0.5, 0.5, 0.5] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/scf/models/item/silver_funnel.json b/src/main/resources/assets/scf/models/item/silver_funnel.json new file mode 100644 index 0000000..3963239 --- /dev/null +++ b/src/main/resources/assets/scf/models/item/silver_funnel.json @@ -0,0 +1,3 @@ +{ + "parent": "scf:block/silver_funnel" +} \ No newline at end of file diff --git a/src/main/resources/assets/scf/models/item/tin_funnel.json b/src/main/resources/assets/scf/models/item/tin_funnel.json new file mode 100644 index 0000000..2e63cea --- /dev/null +++ b/src/main/resources/assets/scf/models/item/tin_funnel.json @@ -0,0 +1,3 @@ +{ + "parent": "scf:block/tin_funnel" +} \ No newline at end of file diff --git a/src/main/resources/assets/scf/textures/block/bronze_storage_block.png b/src/main/resources/assets/scf/textures/block/bronze_storage_block.png new file mode 100644 index 0000000000000000000000000000000000000000..60b61442868fe9619f299b18888e3bc399755acb GIT binary patch literal 260 zcmV+f0sH=mP)S>><1QjeEl;b?hNM;!PUGsU!FOoYcx!dE)zUxJWOz}V!OxUi3`vfPNF3*CWf;r< zK+9By_D+~Y>MauB2U05%2SN}AipVClvd!fhBhpZQ5fy~DUVj1G$TzzrLK-6g0000< KMNUMnLSTYhd}$E? literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/scf/textures/block/copper_storage_block.png b/src/main/resources/assets/scf/textures/block/copper_storage_block.png new file mode 100644 index 0000000000000000000000000000000000000000..c977d020314e122b07e0942bd42e1f4a7aa55b38 GIT binary patch literal 259 zcmV+e0sQ`nP)u?9lfgEAR`A{%4_CSVqv_sQ|!gXDxezs>m`y0JeB!+8&+ z)=3l{KHksAXPy8QsRmxR6F@QysK_q&i==3MCXXtEt5MTHpasCM20T>`rX^0ew~NNOeFG_JlHe1}$zw^m16E&WqXh8MLN{7kvUkmRU{#Br`xhOzt) zv`l4a?}SOD-XZ~hAhjZKAOvBch-^|T+fuGEA`RsiQ9*d?^%oQlQll&nnK}Rf002ov JPDHLkV1lbBX7T_4 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/scf/textures/block/silver_storage_block.png b/src/main/resources/assets/scf/textures/block/silver_storage_block.png new file mode 100644 index 0000000000000000000000000000000000000000..b580ae0331b461920e67a6ecf1c3a99623fce2f3 GIT binary patch literal 253 zcmV~i{YOdQt{67tVmMJ^HlGKO|2w!WAxkL zGd$IC$3Vhm=$~qsmLKYC@IB=g14*ljL_1e2L(BgF^KNi;ev&$1sk=0.7.4", "fabric": "*", - "minecraft": "1.16.x", - "cotton-resources": ">=1.5.1" + "minecraft": "1.17.x" }, "suggests": { "flamingo": "*"