Skip to content

Commit

Permalink
fixed the tools not working
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed Jan 27, 2025
1 parent 9d0a04f commit fdd5fe9
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 86 deletions.
114 changes: 57 additions & 57 deletions MODIFIERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,125 +2,125 @@
This is a full list of modifiers in the game and a description of what they do.
## Breakers
These effects are applied when breaking blocks.
### Veiny
**id:** `veiny` | **crafting:** `minecraft:diamond_pickaxe` ![diamond_pickaxe](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/diamond_pickaxe.png) | **needs:** `1`
### Learning
**id:** `learning` | **crafting:** `minecraft:book` ![book](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/book.png)

**Decription:** Breaking any block while crouching will cause all blocks of the same type adjacent to it to break up to 5 in each direction.
**Decription:** After breaking 10 blocks as allowed by this tool, gain 3 experience points.
### Magnetic
**id:** `attracting` | **crafting:** `minecraft:iron_block` ![iron_block](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/iron_block.png) | **needs:** `1`
**id:** `attracting` | **crafting:** `minecraft:iron_block` ![iron_block](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/iron_block.png)

**Decription:** Upon breaking a block (allowed by tool type), all items at that block's position will teleport to you.
### Veiny
**id:** `veiny` | **crafting:** `minecraft:diamond_pickaxe` ![diamond_pickaxe](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/diamond_pickaxe.png)

**Decription:** Breaking any block while crouching will cause all blocks of the same type adjacent to it to break up to 5 in each direction.
### Melting
**id:** `melting` | **crafting:** `minecraft:lava_bucket` ![lava_bucket](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/lava_bucket.png) | **needs:** `1`
**id:** `melting` | **crafting:** `minecraft:lava_bucket` ![lava_bucket](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/lava_bucket.png)

**Decription:** Items dropped by blocks broken with this tool will be smelted.
### Learning
**id:** `learning` | **crafting:** `minecraft:book` ![book](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/book.png) | **needs:** `12`

**Decription:** After breaking 10 blocks as allowed by this tool, gain 3 experience points.
### Explosive
**id:** `explode` | **crafting:** `minecraft:tnt` ![tnt](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/tnt.png) | **needs:** `8`
**id:** `explode` | **crafting:** `minecraft:tnt` ![tnt](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/tnt.png)

**Decription:** Upon breaking a block (allowed by tool type), the current block position will explode causing damage to surrounding blocks.
## Holders
These effects are applied when holding the tool.
### Tomb Raider
**id:** `spawner` | **crafting:** `minecraft:mossy_cobblestone` ![mossy_cobblestone](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/mossy_cobblestone.png) | **needs:** `12`
**id:** `spawner` | **crafting:** `minecraft:mossy_cobblestone` ![mossy_cobblestone](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/mossy_cobblestone.png)

**Decription:** While holding the spawners around you will glow.
### Hasty
**id:** `hasty` | **crafting:** `minecraft:sugar` ![sugar](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/sugar.png) | **needs:** `16`

**Decription:** While holding the tool, get the Haste I effect.
### Appley
**id:** `absorption` | **crafting:** `minecraft:golden_apple` ![golden_apple](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/golden_apple.png) | **needs:** `1`

**Decription:** While holding the tool, get the absorption I effect.
### Healing
**id:** `regeneration` | **crafting:** `minecraft:glowstone` ![glowstone](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/glowstone.png) | **needs:** `8`

**Decription:** While holding the tool, get the regeneration I effect.
### Heat Resistant
**id:** `fire_resistance` | **crafting:** `minecraft:magma_cream` ![magma_cream](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/magma_cream.png) | **needs:** `1`
**id:** `fire_resistance` | **crafting:** `minecraft:magma_cream` ![magma_cream](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/magma_cream.png)

**Decription:** While holding the tool, get the fire resistance I effect.
### Filling
**id:** `filling` | **crafting:** `minecraft:cake` ![cake](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/cake.png) | **needs:** `1`
**id:** `filling` | **crafting:** `minecraft:cake` ![cake](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/cake.png)

**Decription:** While holding the tool, get the saturation I effect.
### Resistant
**id:** `resistance` | **crafting:** `minecraft:turtle_scute` ![turtle_scute](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/turtle_scute.png) | **needs:** `5`
### Appley
**id:** `absorption` | **crafting:** `minecraft:golden_apple` ![golden_apple](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/golden_apple.png)

**Decription:** While holding the tool, get the resistance I effect.
**Decription:** While holding the tool, get the absorption I effect.
### Living
**id:** `living` | **crafting:** `minecraft:moss_block` ![moss_block](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/moss_block.png)

**Decription:** While holding the tool, it will randomly heal itself
### Rainy
**id:** `rainy` | **crafting:** `minecraft:cauldron` ![cauldron](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/cauldron.png) | **needs:** `1`
**id:** `rainy` | **crafting:** `minecraft:cauldron` ![cauldron](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/cauldron.png)

**Decription:** While holding the tool in the rain, mine faster!
### Living
**id:** `living` | **crafting:** `minecraft:moss_block` ![moss_block](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/moss_block.png) | **needs:** `4`
### Resistant
**id:** `resistance` | **crafting:** `minecraft:turtle_scute` ![turtle_scute](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/turtle_scute.png)

**Decription:** While holding the tool, it will randomly heal itself
**Decription:** While holding the tool, get the resistance I effect.
### Healing
**id:** `regeneration` | **crafting:** `minecraft:glowstone` ![glowstone](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/glowstone.png)

**Decription:** While holding the tool, get the regeneration I effect.
### Detecting
**id:** `detecting` | **crafting:** `minecraft:spyglass` ![spyglass](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/spyglass.png) | **needs:** `1`
**id:** `detecting` | **crafting:** `minecraft:spyglass` ![spyglass](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/spyglass.png)

**Decription:** While holding the tool, ores around you will glow.
### Hasty
**id:** `hasty` | **crafting:** `minecraft:sugar` ![sugar](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/sugar.png)

**Decription:** While holding the tool, get the Haste I effect.
## Users
These effects are applied when right clicking.
### Fire Starter
**id:** `fire_place` | **crafting:** `minecraft:flint_and_steel` ![flint_and_steel](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/flint_and_steel.png) | **needs:** `1`
**id:** `fire_place` | **crafting:** `minecraft:flint_and_steel` ![flint_and_steel](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/flint_and_steel.png)

**Decription:** Right clicking on the top of a block while crouching with the tool in hand will start a fire and use 2 durability points.
### Flame Thrower
**id:** `flame_thrower` | **crafting:** `minecraft:fire_charge` ![fire_charge](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/fire_charge.png) | **needs:** `12`
**id:** `flame_thrower` | **crafting:** `minecraft:fire_charge` ![fire_charge](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/fire_charge.png)

**Decription:** Right clicking throws a fire ball.
## Hurters
These effects are applied when hurting enemies.
### Necrotic
**id:** `necrotic` | **crafting:** `minecraft:wither_skeleton_skull` ![wither_skeleton_skull](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/wither_skeleton_skull.png) | **needs:** `1`

**Decription:** Heals 10% of damage dealt to target.
### Bezerk
**id:** `bezerk` | **crafting:** `minecraft:beef` ![beef](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/beef.png) | **needs:** `16`
### Flaming
**id:** `flaming` | **crafting:** `minecraft:blaze_rod` ![blaze_rod](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/blaze_rod.png)

**Decription:** Deals more damage at lower player health.
**Decription:** Sets enemy on fire for 2 seconds.
### Withering
**id:** `wither` | **crafting:** `minecraft:wither_rose` ![wither_rose](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/wither_rose.png) | **needs:** `1`
**id:** `wither` | **crafting:** `minecraft:wither_rose` ![wither_rose](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/wither_rose.png)

**Decription:** When attacking with tool, apply the wither I effect to the target for 3 seconds.
### Poisonous
**id:** `poison` | **crafting:** `minecraft:poisonous_potato` ![poisonous_potato](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/poisonous_potato.png) | **needs:** `4`
**id:** `poison` | **crafting:** `minecraft:poisonous_potato` ![poisonous_potato](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/poisonous_potato.png)

**Decription:** When attacking with tool, apply the poison I effect to the target for 5 seconds.
### Charged
**id:** `charged` | **crafting:** `minecraft:lightning_rod` ![lightning_rod](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/lightning_rod.png) | **needs:** `1`
**id:** `charged` | **crafting:** `minecraft:lightning_rod` ![lightning_rod](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/lightning_rod.png)

**Decription:** After 7 seconds, hitting and enemy will summon a lightning bolt and empty the charge meter.
### Blinding
**id:** `blinding` | **crafting:** `minecraft:carrot` ![carrot](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/carrot.png) | **needs:** `24`

**Decription:** When attacking with tool, apply the blindness I effect to the target for 4 seconds.
### Dexterous
**id:** `combo` | **crafting:** `minecraft:chorus_fruit` ![chorus_fruit](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/chorus_fruit.png) | **needs:** `1`
**id:** `combo` | **crafting:** `minecraft:chorus_fruit` ![chorus_fruit](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/chorus_fruit.png)

**Decription:** Hitting enemies within 2 seconds after hitting them deals an extra 25% damage.
### Flaming
**id:** `flaming` | **crafting:** `minecraft:blaze_rod` ![blaze_rod](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/blaze_rod.png) | **needs:** `1`

**Decription:** Sets enemy on fire for 2 seconds.
### Critical
**id:** `critical` | **crafting:** `minecraft:ghast_tear` ![ghast_tear](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/ghast_tear.png) | **needs:** `1`
**id:** `critical` | **crafting:** `minecraft:ghast_tear` ![ghast_tear](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/ghast_tear.png)

**Decription:** Always critically strikes enemy.
### Necrotic
**id:** `necrotic` | **crafting:** `minecraft:wither_skeleton_skull` ![wither_skeleton_skull](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/wither_skeleton_skull.png)

**Decription:** Heals 10% of damage dealt to target.
### Bezerk
**id:** `bezerk` | **crafting:** `minecraft:beef` ![beef](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/beef.png)

**Decription:** Deals more damage at lower player health.
### Blinding
**id:** `blinding` | **crafting:** `minecraft:carrot` ![carrot](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/carrot.png)

**Decription:** When attacking with tool, apply the blindness I effect to the target for 4 seconds.
## Stats
These effects are used to calculate stats for tools.
### Busted
**id:** `busted` | **crafting:** `minecraft:cracked_stone_bricks` ![cracked_stone_bricks](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/cracked_stone_bricks.png) | **needs:** `3`
**id:** `busted` | **crafting:** `minecraft:cracked_stone_bricks` ![cracked_stone_bricks](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/cracked_stone_bricks.png)

**Decription:** Dig speed is increased as tool durability drops.
## Misc.
These effects are general and don't fit into any other categories.
### Unbreaking
**id:** `unbreaking` | **crafting:** `minecraft:obsidian` ![obsidian](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/obsidian.png) | **needs:** `8`
**id:** `unbreaking` | **crafting:** `minecraft:obsidian` ![obsidian](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/obsidian.png)

**Decription:** This tool has a 20% chance of not taking damage.
2 changes: 1 addition & 1 deletion src/main/java/dev/marston/randomloot/GenWiki.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private static void writeMod(Modifier m, FileWriter f) throws IOException {

write("**id:** `" + tag + "` | **crafting:** `" + recipe + "` ![" + stripItemName(recipe)
+ "](https://raw.githubusercontent.com/anish-shanbhag/minecraft-api/master/public/images/items/"
+ stripItemName(recipe) + ".png) | **needs:** `" + count + "`", f);
+ stripItemName(recipe) + ".png)", f);
write("", f);
write("**Decription:** " + m.description(), f);
}
Expand Down
20 changes: 9 additions & 11 deletions src/main/java/dev/marston/randomloot/loot/LootItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import com.mojang.serialization.MapCodec;
import dev.marston.randomloot.Config;
import dev.marston.randomloot.RandomLoot;
import dev.marston.randomloot.items.ModItems;
import dev.marston.randomloot.loot.modifiers.*;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.item.properties.numeric.RangeSelectItemModelProperty;
import net.minecraft.core.BlockPos;
import net.minecraft.core.component.DataComponentMap;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.level.ServerPlayer;
Expand Down Expand Up @@ -37,10 +39,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.*;

public class LootItem extends Item {

Expand All @@ -59,6 +58,7 @@ public String toString() {
}
}


public LootItem(Properties p) {
super(p.stacksTo(1).durability(100));
}
Expand Down Expand Up @@ -186,19 +186,17 @@ public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) {
}



@Override
public @NotNull ItemAttributeModifiers getDefaultAttributeModifiers(ItemStack stack) {

if (!Objects.equals(stack.getEquipmentSlot(), EquipmentSlot.MAINHAND)) {
return super.getDefaultAttributeModifiers(stack);
}

ToolType tt = LootUtils.getToolType(stack);

float attack = getAttackDamage(stack, tt);
float speed = getAttackSpeed(stack, tt);

return ItemAttributeModifiers.builder().add(
Attributes.ATTACK_DAMAGE, new AttributeModifier(Item.BASE_ATTACK_DAMAGE_ID, getAttackDamage(stack, tt), AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND)
.add(Attributes.ATTACK_SPEED, new AttributeModifier(Item.BASE_ATTACK_SPEED_ID, getAttackSpeed(stack, tt), AttributeModifier.Operation.ADD_VALUE),
Attributes.ATTACK_DAMAGE, new AttributeModifier(Item.BASE_ATTACK_DAMAGE_ID, attack, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND)
.add(Attributes.ATTACK_SPEED, new AttributeModifier(Item.BASE_ATTACK_SPEED_ID, speed, AttributeModifier.Operation.ADD_VALUE),
EquipmentSlotGroup.MAINHAND).build();
}

Expand Down
Loading

0 comments on commit fdd5fe9

Please sign in to comment.