From 28c1ae42f4c025f6cf0c9fccbec347ac65d8514f Mon Sep 17 00:00:00 2001 From: jottyfan Date: Fri, 31 Jul 2020 18:17:02 +0200 Subject: [PATCH] finetuning --- .../quickiefabric/init/RegistryManager.java | 8 +- .../quickiefabric/tools/ToolRangeableAxe.java | 87 +----------------- .../resources/assets/quickiefabric/icon.png | Bin 0 -> 1803 bytes src/main/resources/fabric.mod.json | 6 +- ....mixins.json => quickiefabric.mixins.json} | 0 5 files changed, 8 insertions(+), 93 deletions(-) create mode 100644 src/main/resources/assets/quickiefabric/icon.png rename src/main/resources/{modid.mixins.json => quickiefabric.mixins.json} (100%) diff --git a/src/main/java/de/jottyfan/minecraft/quickiefabric/init/RegistryManager.java b/src/main/java/de/jottyfan/minecraft/quickiefabric/init/RegistryManager.java index 040ddeb..5fa1ac4 100644 --- a/src/main/java/de/jottyfan/minecraft/quickiefabric/init/RegistryManager.java +++ b/src/main/java/de/jottyfan/minecraft/quickiefabric/init/RegistryManager.java @@ -129,7 +129,7 @@ public class RegistryManager { * @param block the block to set * @param chance the chance for the replacement */ - public static void generateOreForBlocks(Biome biome, List placeOn, List placeIn, List placeUnder, Block block, float chance) { + public static void generateOreInBlocks(Biome biome, List placeOn, List placeIn, List placeUnder, Block block, float chance) { SimpleBlockFeatureConfig sbfc = new SimpleBlockFeatureConfig(block.getDefaultState(), placeOn, placeIn, placeUnder); biome.addFeature(GenerationStep.Feature.LOCAL_MODIFICATIONS, Feature.SIMPLE_BLOCK.configure(sbfc).withChance(chance).feature); } @@ -154,9 +154,9 @@ public class RegistryManager { List dirtlike = new ArrayList<>(); dirtlike.add(Blocks.DIRT.getDefaultState()); dirtlike.add(Blocks.GRASS.getDefaultState()); - RegistryManager.generateOreForBlocks(biome, dirtlike, dirtlike, dirtlike, QuickieBlocks.DIRT_SALPETER, 1.0f); - RegistryManager.generateOreForBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.SAND_SALPETER, 1.0f); - RegistryManager.generateOreForBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.ORE_SAND_SALPETER, 1.0f); + RegistryManager.generateOreInBlocks(biome, dirtlike, dirtlike, dirtlike, QuickieBlocks.DIRT_SALPETER, 1.0f); + RegistryManager.generateOreInBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.SAND_SALPETER, 1.0f); + RegistryManager.generateOreInBlocks(biome, sandlike, sandlike, sandlike, QuickieBlocks.ORE_SAND_SALPETER, 1.0f); RegistryManager.generateOreForTarget(biome, OreFeatureConfig.Target.NATURAL_STONE, QuickieBlocks.ORE_SULPHOR, 16, 4, 4, 196, 255); RegistryManager.generateOreForTarget(biome, OreFeatureConfig.Target.NATURAL_STONE, QuickieBlocks.ORE_SALPETER, 12, 10, 4, 196, 255); } diff --git a/src/main/java/de/jottyfan/minecraft/quickiefabric/tools/ToolRangeableAxe.java b/src/main/java/de/jottyfan/minecraft/quickiefabric/tools/ToolRangeableAxe.java index 739825e..7cca2ec 100644 --- a/src/main/java/de/jottyfan/minecraft/quickiefabric/tools/ToolRangeableAxe.java +++ b/src/main/java/de/jottyfan/minecraft/quickiefabric/tools/ToolRangeableAxe.java @@ -1,31 +1,12 @@ package de.jottyfan.minecraft.quickiefabric.tools; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; import java.util.List; -import java.util.Map.Entry; -import java.util.Set; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import net.minecraft.block.Block; import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; -import net.minecraft.entity.ItemEntity; -import net.minecraft.entity.LivingEntity; import net.minecraft.item.AxeItem; import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; import net.minecraft.item.ToolMaterial; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.DefaultedRegistry; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.World; /** * @@ -34,70 +15,10 @@ import net.minecraft.world.World; */ public class ToolRangeableAxe extends AxeItem implements ToolRangeable { - private final static Logger LOGGER = LogManager.getLogger(ToolRangeableAxe.class); - protected ToolRangeableAxe(ToolMaterial material, float attachDamage, float attackSpeedIn, Settings settings) { super(material, attachDamage, attackSpeedIn, settings); } - - /** - * generate a block list of the resource locations in set - * - * @param set - * the set to be used as source for the block list - * @return a block list, at least an empty one - */ - private List generateBlockList(Set set) { - List blocks = new ArrayList<>(); - Set rls = new HashSet<>(set); // copy to omit changes on the set - DefaultedRegistry allBlocks = Registry.BLOCK; - Set, Block>> entries = allBlocks.getEntries(); - for (Entry, Block> entry : entries) { - Iterator i = rls.iterator(); - while (i.hasNext()) { - Identifier rl = i.next(); - if (rl.equals(entry.getKey().getValue())) { - blocks.add(entry.getValue()); - i.remove(); // speed up algorithm - } - } - } - return blocks; - } - - /** - * this method only exists because of try to find a way in fabric to break the neighbor blocks also - * - */ -// @Override -// public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) { -// LOGGER.info("start finishUsing"); -// -// BlockPos blockpos = user.getBlockPos(); -// LOGGER.info("at position %s", blockpos.toString()); -// BlockState blockStateAbove = world.getBlockState(blockpos.up()); -// BlockState blockStateCurrent = world.getBlockState(blockpos); -// LOGGER.info("compare name of %s and %s: %s =?= %s", blockpos.toString(), blockpos.up().toString(), blockStateCurrent.getBlock().getName(), blockStateAbove.getBlock().getName()); -// if (blockStateAbove.getBlock().getName().equals(blockStateCurrent.getBlock().getName())) { -// LOGGER.info("found equal block above"); -// -// // found same block above -// ItemStack droppedStack = new ItemStack(blockStateAbove.getBlock().asItem()); -// -// // TODO: merge all item stacks of all blocks into one to reduce lag -// double x = blockpos.up().getX(); -// double y = blockpos.up().getY(); -// double z = blockpos.up().getZ(); -// ItemEntity itemEntity = new ItemEntity(world, x, y, z, droppedStack); -// -// world.spawnEntity(itemEntity); -// world.removeBlock(blockpos.up(), false); -// } else { -// LOGGER.info("blocks are not equal"); -// } -// return super.finishUsing(stack, world, user); -// } - + @Override public HarvestRange getRange() { return null; // no limit @@ -120,12 +41,6 @@ public class ToolRangeableAxe extends AxeItem implements ToolRangeable { return blockList; } } -// for (Set identifiers : BIOMESOPLENTY_AXE) { -// Identifier blockIdentifier = block.getBlock().getRegistryName(); -// if (identifiers.contains(blockIdentifier)) { -// return generateBlockList(identifiers); -// } -// } return null; } } diff --git a/src/main/resources/assets/quickiefabric/icon.png b/src/main/resources/assets/quickiefabric/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..0e4cf1a653acdbe2499e2603b7ebce650c11e6de GIT binary patch literal 1803 zcmV+m2lV)fP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+TB=La^yA){pTri1Ong!9*1jHZjj^Wagp5JwrA{_ zseD9oixfx#;CleXvg!Z)J4M*M~XUyj#uSZXY+&?Hv{S1`nfqWFP9s`%fV@PNlut%}UN0IQc?Dl)v+p-~P zeB44k^T!!qFyLqA!%5`e14W0YV;f^g=qp_o{qgl9&&}ofq5O%`yGNhMADA`^&}%?m7z%g$ zp`84i+&ogcczduM!fp9U?!pA*;ksCxzcHGQ(f97M3)pfvo4U5LdYD%xT5DCXQ)NK> z=>&V;3AZ98D(GwovVyx(A_irH95u=`sIRtCg^P|mN3_h9g{py2K}O=b=yvm_!4bqa zQ4n1b4gx9PzR)t8mbpp_!;RD+dI-u0OMdG%Uzs$Zg7&FNB}v=0@%iyNNXy4-eMF&5aA^lq@T{z1X<2`#7}gJ z7|LF}^WFy^z53*HkT5eWgcxQ;%~7I@K86^h#uT$rQKw#mMpaFk6DL8%^$GcyG^La? zjAm%gSe-E;=fXvbE53vhiT9U6YE3maZqks)EwtFQrItH&gi?3i_t0b4 zo_Zb#wIRa|Kf;JZM=~SdtQ}h4-QQr14r{!aniJ#A8l*8^DrlAyKRE+q>%k??1DGa!Qh1aoFm_XXzO^Y#&I zEw2xqEQV$pPEf5N`-ZKVHFL4hY*!aW@T1mzHt^l{|D{Np=Gn<&!=I&&u$X-m zdb>p4ey26xS`gz{y{I5;>;UC( zvfrF&?QYwHyFDYww)=yPj?yJ;Z6mV`9G1dXh|L_raOU1KQ2KqmV59?4)xIJdpAQuO zHJWYDaz${dS?Z83W4|^p%}PmUka4UZna+mP&;>n?h#N28Gr**tHn#Y-5K%kE+X-08 zTHmth^2n!_cIdh&x8{0E!AMm`NO0hIhR+8+t52@&6ang;&Z6l0xH1218z1e$%x&EA zcA_2;VADwqcZwCAFViQ%YN*wt6H$e;Lp$l1@ge?6KtC*Fe*8BE!Qo z`#Ss$SPgG|LZ$D5H^j*@TU~T&0*1bT(p}R?` zpKa=H%}*xuzEf*h?Z`omCkL&&%UvC_JO6=zRJ_-H513#4WWNUUlWp@0#=pYaf38Rd z&UwlF3(Hg}XZv8z0{{R3dr(YNMS%bSEdT&i0043T06!ZWK^`9e0037(L0CgWSwuun zPXJm*Mq5WmT}nz_OG{o$OI}P&UrkM5PEKG?PhwF~Vp39LQ&VJARBKmPd|Fz4U0r`) zUw~m@fn#HVWMqP5WP)X7gJ)-iX=#RRY=>=ahi-0%Z*SDpl<4TiAUJsZ00001bW%=J z06^y0W&i*H0b)x>L;#2d9Y_EG010qNS#tmY3ljhU3ljkVnw%H_000McNliru;|dK8 z8!UI|H`)LI02y>eSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{004tYL_t&- z({;}44uUWY1>hc#iWQWB;sxX)vhDq!(2)fd6VAW$rD;pF65y}*&xL@SYxyI1=(bbp zBdGLH>nvi-^Hm=VT&O(pf-tysFMT>h@dVZ)4f)=Tm*aj5LnOxFoVWF+%orl%1-m#+ t0P#zmI0CH9XT@4)BHzbkStk)%%^M;82s`bMC>{U+002ovPDHLkV1iB`PJ93W literal 0 HcmV?d00001 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index c41960f..4b6c2aa 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,6 +1,6 @@ { "schemaVersion": 1, - "id": "modid", + "id": "quickiefabric", "version": "${version}", "name": "quickiefabric", @@ -14,7 +14,7 @@ }, "license": "MIT", - "icon": "assets/modid/icon.png", + "icon": "assets/quickiefabric/icon.png", "environment": "*", "entrypoints": { @@ -23,7 +23,7 @@ ] }, "mixins": [ - "modid.mixins.json" + "quickiefabric.mixins.json" ], "depends": { "fabricloader": ">=0.7.4", diff --git a/src/main/resources/modid.mixins.json b/src/main/resources/quickiefabric.mixins.json similarity index 100% rename from src/main/resources/modid.mixins.json rename to src/main/resources/quickiefabric.mixins.json