diff --git a/gradle.properties b/gradle.properties index 41672b9..d8a2e1d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,14 +7,14 @@ org.gradle.configuration-cache=false # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=26.1 -loader_version=0.18.4 -loom_version=1.15-SNAPSHOT +minecraft_version=26.2-pre-2 +loader_version=0.19.2 +loom_version=1.16-SNAPSHOT # Mod Properties -mod_version=26.1.0.2 +mod_version=26.2.0.0 maven_group=de.jottyfan.minecraft archives_base_name=quickly # Dependencies -fabric_api_version=0.144.0+26.1 \ No newline at end of file +fabric_api_version=0.150.1+26.2 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 23449a2..5dd3c01 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/de/jottyfan/minecraft/Quickly.java b/src/main/java/de/jottyfan/minecraft/Quickly.java index 96e23e5..f498feb 100644 --- a/src/main/java/de/jottyfan/minecraft/Quickly.java +++ b/src/main/java/de/jottyfan/minecraft/Quickly.java @@ -30,8 +30,8 @@ public class Quickly implements ModInitializer { public void onInitialize() { LOGGER.info("loading {}", MOD_ID); - List items = QuicklyItems.registerModItems(); - List blocks = QuicklyBlocks.registerModBlocks(); + List items = QuicklyItems.registeredModItems(); + List blocks = QuicklyBlocks.registeredModBlocks(); QuicklyBlockEntity.registerBlockEntities(); QuicklyFeatures.registerFeatures(); QuicklyComposter.registerComposterItems(); diff --git a/src/main/java/de/jottyfan/minecraft/block/QuicklyBlocks.java b/src/main/java/de/jottyfan/minecraft/block/QuicklyBlocks.java index d720a37..bc69b5d 100644 --- a/src/main/java/de/jottyfan/minecraft/block/QuicklyBlocks.java +++ b/src/main/java/de/jottyfan/minecraft/block/QuicklyBlocks.java @@ -102,7 +102,7 @@ public class QuicklyBlocks { return BuiltInRegistries.BLOCK.getValue(identifier); } - public static final List registerModBlocks() { + public static final List registeredModBlocks() { Quickly.LOGGER.debug("register blocks"); List set = new ArrayList<>(); set.add(KELPBUNDLE); diff --git a/src/main/java/de/jottyfan/minecraft/item/QHoe.java b/src/main/java/de/jottyfan/minecraft/item/QHoe.java index b412b57..552046c 100644 --- a/src/main/java/de/jottyfan/minecraft/item/QHoe.java +++ b/src/main/java/de/jottyfan/minecraft/item/QHoe.java @@ -23,6 +23,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; /** * @@ -50,7 +51,7 @@ public class QHoe extends HoeItem implements ToolRangeable { for (int z = -range.getzRange(); z <= range.getzRange(); z++) { if (!isCrop) { removePossibleGrass(context.getLevel(), new BlockPos(x, y, z)); - BlockHitResult bhr = new BlockHitResult(context.getClickedPos().getCenter(), Direction.UP, + BlockHitResult bhr = new BlockHitResult(Vec3.atCenterOf(context.getClickedPos()), Direction.UP, context.getClickedPos().offset(x, y, z), false); UseOnContext ctx = new UseOnContext(context.getPlayer(), context.getHand(), bhr); super.useOn(ctx); @@ -81,7 +82,7 @@ public class QHoe extends HoeItem implements ToolRangeable { if (block instanceof CropBlock cBlock) { if (cBlock.isMaxAge(blockState)) { LootParams.Builder builder = new LootParams.Builder((ServerLevel) level) - .withParameter(LootContextParams.ORIGIN, pos.getCenter()) + .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos)) .withParameter(LootContextParams.BLOCK_STATE, blockState) .withOptionalParameter(LootContextParams.BLOCK_ENTITY, level.getBlockEntity(pos)) .withParameter(LootContextParams.TOOL, ItemStack.EMPTY); diff --git a/src/main/java/de/jottyfan/minecraft/item/QShears.java b/src/main/java/de/jottyfan/minecraft/item/QShears.java index 9436b9a..8d332ab 100644 --- a/src/main/java/de/jottyfan/minecraft/item/QShears.java +++ b/src/main/java/de/jottyfan/minecraft/item/QShears.java @@ -40,38 +40,24 @@ public class QShears extends ShearsItem { sheep.setSheared(true); sheep.playAmbientSound(); DyeColor color = sheep.getColor(); - Item item = Items.WHITE_WOOL; - if (color.equals(DyeColor.BLACK)) { - item = Items.BLACK_WOOL; - } else if (color.equals(DyeColor.GRAY)) { - item = Items.GRAY_WOOL; - } else if (color.equals(DyeColor.LIGHT_GRAY)) { - item = Items.LIGHT_GRAY_WOOL; - } else if (color.equals(DyeColor.BROWN)) { - item = Items.BROWN_WOOL; - } else if (color.equals(DyeColor.BLUE)) { - item = Items.BLUE_WOOL; - } else if (color.equals(DyeColor.LIGHT_BLUE)) { - item = Items.LIGHT_BLUE_WOOL; - } else if (color.equals(DyeColor.GREEN)) { - item = Items.GREEN_WOOL; - } else if (color.equals(DyeColor.LIME)) { - item = Items.LIME_WOOL; - } else if (color.equals(DyeColor.CYAN)) { - item = Items.CYAN_WOOL; - } else if (color.equals(DyeColor.MAGENTA)) { - item = Items.MAGENTA_WOOL; - } else if (color.equals(DyeColor.ORANGE)) { - item = Items.ORANGE_WOOL; - } else if (color.equals(DyeColor.PINK)) { - item = Items.PINK_WOOL; - } else if (color.equals(DyeColor.PURPLE)) { - item = Items.PURPLE_WOOL; - } else if (color.equals(DyeColor.RED)) { - item = Items.RED_WOOL; - } else if (color.equals(DyeColor.YELLOW)) { - item = Items.YELLOW_WOOL; - } + Item item = switch (color) { + case BLACK -> Items.WOOL.black(); + case GRAY -> Items.WOOL.gray(); + case LIGHT_GRAY -> Items.WOOL.lightGray(); + case BROWN -> Items.WOOL.brown(); + case BLUE -> Items.WOOL.blue(); + case LIGHT_BLUE -> Items.WOOL.lightBlue(); + case GREEN -> Items.WOOL.green(); + case LIME -> Items.WOOL.lime(); + case CYAN -> Items.WOOL.cyan(); + case MAGENTA -> Items.WOOL.magenta(); + case ORANGE -> Items.WOOL.orange(); + case PINK -> Items.WOOL.pink(); + case PURPLE -> Items.WOOL.purple(); + case RED -> Items.WOOL.red(); + case YELLOW -> Items.WOOL.yellow(); + default -> Items.WOOL.white(); + }; user.level().addFreshEntity(new ItemEntity(user.level(), pos.x, pos.y, pos.z, new ItemStack(item, amount))); return InteractionResult.SUCCESS; } diff --git a/src/main/java/de/jottyfan/minecraft/item/QuicklyItems.java b/src/main/java/de/jottyfan/minecraft/item/QuicklyItems.java index 95f7a00..2e48675 100644 --- a/src/main/java/de/jottyfan/minecraft/item/QuicklyItems.java +++ b/src/main/java/de/jottyfan/minecraft/item/QuicklyItems.java @@ -101,7 +101,7 @@ public class QuicklyItems { return Registry.register(BuiltInRegistries.ITEM, identifier, item); } - public static final List registerModItems() { + public static final List registeredModItems() { Quickly.LOGGER.debug("adding Items"); List set = new ArrayList<>(); set.add(STUB); diff --git a/src/main/java/de/jottyfan/minecraft/loot/QuicklyLootTables.java b/src/main/java/de/jottyfan/minecraft/loot/QuicklyLootTables.java index cacdefe..d6f9c20 100644 --- a/src/main/java/de/jottyfan/minecraft/loot/QuicklyLootTables.java +++ b/src/main/java/de/jottyfan/minecraft/loot/QuicklyLootTables.java @@ -6,8 +6,10 @@ import net.minecraft.resources.Identifier; import net.minecraft.world.item.Item; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.entries.LootItem; +import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction; import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; +import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; /** * @@ -27,6 +29,14 @@ public class QuicklyLootTables { tableBuilder.withPool(harvestItemByChance(QuicklyItems.CANOLASEED, 0.03f)); } } + if (key.identifier().equals(Identifier.fromNamespaceAndPath("minecraft", "chests/simple_dungeon"))) { + LootPool.Builder poolBuilder = LootPool.lootPool().setRolls(UniformGenerator.between(1.0f, 8.0f)); + for (Item item : QuicklyItems.registeredModItems()) { + poolBuilder.add( + LootItem.lootTableItem(item).apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0f, 5.0f)))); + } + tableBuilder.withPool(poolBuilder); + } }); } diff --git a/src/main/resources/data/quickly/loot_table/blocks/blockcanolaplant.json b/src/main/resources/data/quickly/loot_table/blocks/blockcanolaplant.json deleted file mode 100644 index 95609d6..0000000 --- a/src/main/resources/data/quickly/loot_table/blocks/blockcanolaplant.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "quickly:canola", - "functions": [ - { - "function": "minecraft:set_count", - "count": { - "min": 1, - "max": 2 - }, - "add": false - } - ], - "conditions": [ - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "properties": { - "age": "7" - } - } - } - } - ] - } - ] - }, - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "quickly:canolaseed", - "functions": [ - { - "function": "minecraft:apply_bonus", - "enchantment": "minecraft:fortune", - "formula": "minecraft:binomial_with_bonus_count", - "parameters": { - "extra": 2, - "probability": 0.5 - } - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/src/main/resources/data/quickly/loot_table/blocks/blockcottonplant.json b/src/main/resources/data/quickly/loot_table/blocks/blockcottonplant.json deleted file mode 100644 index c363114..0000000 --- a/src/main/resources/data/quickly/loot_table/blocks/blockcottonplant.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "quickly:cotton", - "functions": [ - { - "function": "minecraft:set_count", - "count": { - "min": 1, - "max": 3 - } - } - ], - "conditions": [ - { - "condition": "minecraft:location_check", - "predicate": { - "block": { - "properties": { - "age": "7" - } - } - } - } - ] - } - ] - }, - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "quickly:cottonseed", - "functions": [ - { - "function": "minecraft:apply_bonus", - "enchantment": "minecraft:fortune", - "formula": "minecraft:binomial_with_bonus_count", - "parameters": { - "extra": 2, - "probability": 0.5 - } - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/stonecutting_sulfor.json b/src/main/resources/data/quickly/recipe/stonecutting_sulfor.json new file mode 100644 index 0000000..29debbb --- /dev/null +++ b/src/main/resources/data/quickly/recipe/stonecutting_sulfor.json @@ -0,0 +1,8 @@ +{ + "type": "minecraft:stonecutting", + "ingredient": "minecraft:sulfur_spike", + "result": { + "id": "quickly:sulfor", + "count": 2 + } +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 781dccc..e2be0d9 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -23,8 +23,8 @@ ] }, "depends": { - "fabricloader": ">=0.18.4", - "minecraft": "~26.1-", + "fabricloader": ">=0.19.2", + "minecraft": "~26.2-", "java": ">=25", "fabric-api": "*" }