Skip to content

Commit

Permalink
added autosmelting
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed Jan 11, 2024
1 parent 3fc176b commit e43e77c
Show file tree
Hide file tree
Showing 7 changed files with 291 additions and 35 deletions.
64 changes: 34 additions & 30 deletions MODIFIERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
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.
### Magnetic
**id:** `attracting` | **crafting:** `minecraft:iron_block`

**Decription:** Upon breaking a block (allowed by tool type), all items at that block's position will teleport to you.
### Melting
**id:** `melting` | **crafting:** `minecraft:magma_cream`

**Decription:** Items dropped by blocks broken with this tool will be smelted.
### Veiny
**id:** `veiny` | **crafting:** `minecraft:diamond_pickaxe`

Expand All @@ -14,12 +22,12 @@ These effects are applied when breaking blocks.
**id:** `explode` | **crafting:** `minecraft:tnt`

**Decription:** Upon breaking a block (allowed by tool type), the current block position will explode causing damage to surrounding blocks.
### Magnetic
**id:** `attracting` | **crafting:** `minecraft:iron_block`

**Decription:** Upon breaking a block (allowed by tool type), all items at that block's position will teleport to you.
## Holders
These effects are applied when holding the tool.
### Detecting
**id:** `detecting` | **crafting:** `minecraft:spyglass`

**Decription:** While holding the tool, ores around you will glow.
### Filling
**id:** `filling` | **crafting:** `minecraft:cake`

Expand All @@ -32,10 +40,6 @@ These effects are applied when holding the tool.
**id:** `spawner` | **crafting:** `minecraft:mossy_cobblestone`

**Decription:** While holding the spawners around you will glow.
### Detecting
**id:** `detecting` | **crafting:** `minecraft:spyglass`

**Decription:** While holding the tool, ores around you will glow.
### Appley
**id:** `absorption` | **crafting:** `minecraft:golden_apple`

Expand All @@ -50,28 +54,28 @@ These effects are applied when right clicking.
**id:** `torch_place` | **crafting:** `minecraft:glowstone`

**Decription:** Right clicking on the top of a block with the tool in hand will place a torch and use 10 durability points.
### Fire Starter
**id:** `fire_place` | **crafting:** `minecraft:flint_and_steel`

**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.
### Heartha's Grace
**id:** `dirt_place` | **crafting:** `minecraft:dirt`

**Decription:** Right clicking on the top of a block with the tool in hand will place a dirt block and use 1 durability points.
### Fire Starter
**id:** `fire_place` | **crafting:** `minecraft:flint_and_steel`

**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.
## Hurters
These effects are applied when hurting enemies.
### Critical
**id:** `critical` | **crafting:** `minecraft:ghast_tear`
### Withering
**id:** `wither` | **crafting:** `minecraft:wither_rose`

**Decription:** Always critically strikes enemy.
### Charged
**id:** `charged` | **crafting:** `minecraft:lightning_rod`
**Decription:** When attacking with tool, apply the wither effect to the target.
### Necrotic
**id:** `necrotic` | **crafting:** `minecraft:wither_skeleton_skull`

**Decription:** After 7 seconds, hitting and enemy will summon a lightning bolt and empty the charge meter.
### Blinding
**id:** `blinding` | **crafting:** `minecraft:carrot`
**Decription:** Heals 10% of damage dealt to target.
### Dexterous
**id:** `combo` | **crafting:** `minecraft:chorus_fruit`

**Decription:** When attacking with tool, apply the blindness effect to the target.
**Decription:** Hitting enemies within 2 seconds after hitting them deals an extra 25% damage.
### Poisonous
**id:** `poison` | **crafting:** `minecraft:poisonous_potato`

Expand All @@ -80,15 +84,15 @@ These effects are applied when hurting enemies.
**id:** `flaming` | **crafting:** `minecraft:blaze_rod`

**Decription:** Sets enemy on fire for 2 seconds.
### Dexterous
**id:** `combo` | **crafting:** `minecraft:chorus_fruit`
### Charged
**id:** `charged` | **crafting:** `minecraft:lightning_rod`

**Decription:** Hitting enemies within 2 seconds after hitting them deals an extra 25% damage.
### Necrotic
**id:** `necrotic` | **crafting:** `minecraft:wither_skeleton_skull`
**Decription:** After 7 seconds, hitting and enemy will summon a lightning bolt and empty the charge meter.
### Blinding
**id:** `blinding` | **crafting:** `minecraft:carrot`

**Decription:** Heals 10% of damage dealt to target.
### Withering
**id:** `wither` | **crafting:** `minecraft:wither_rose`
**Decription:** When attacking with tool, apply the blindness effect to the target.
### Critical
**id:** `critical` | **crafting:** `minecraft:ghast_tear`

**Decription:** When attacking with tool, apply the wither effect to the target.
**Decription:** Always critically strikes enemy.
7 changes: 6 additions & 1 deletion src/main/java/dev/marston/randomloot/GenWiki.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ private static void write(String s, FileWriter f) throws IOException {

private static void writeMod(Modifier m, FileWriter f) throws IOException {
String tag = m.tagName();
String recipe = readRecipe(tag);
String recipe = "n/a";
try {
recipe = readRecipe(tag);
} catch (Exception e) {
RandomLootMod.LOGGER.warn("failed to find recipe for " + tag + ".");
}
write("### " + m.name(), f);
write("**id:** `" + tag + "` | **crafting:** `" + recipe + "`", f);
write("", f);
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/dev/marston/randomloot/loot/LootItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,6 @@ public boolean mineBlock(ItemStack stack, Level level, BlockState blockState, Bl
for (Modifier mod : mods) {

if (mod instanceof BlockBreakModifier) {
if (!Config.traitEnabled(mod.tagName())) {
continue;
}
BlockBreakModifier bbm = (BlockBreakModifier) mod;

bbm.startBreak(stack, pos, player);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package dev.marston.randomloot.loot.modifiers;

import net.minecraft.world.Container;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;

public class DummyContainer implements Container {

ItemStack item;

public DummyContainer(ItemStack stack) {
item = stack;
}

public DummyContainer() {
this(ItemStack.EMPTY);
}

@Override
public void clearContent() {
item = ItemStack.EMPTY;

}

@Override
public int getContainerSize() {
return 1;
}

@Override
public boolean isEmpty() {
return item.isEmpty();
}

@Override
public ItemStack getItem(int _index) {
return item;
}

@Override
public ItemStack removeItem(int _x, int _y) {
item = ItemStack.EMPTY;
return item;
}

@Override
public ItemStack removeItemNoUpdate(int _index) {
item = ItemStack.EMPTY;
return item;
}

@Override
public void setItem(int _index, ItemStack stack) {
item = stack;
}

@Override
public void setChanged() {

}

@Override
public boolean stillValid(Player p_18946_) {

return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import dev.marston.randomloot.loot.modifiers.breakers.Attracting;
import dev.marston.randomloot.loot.modifiers.breakers.Explode;
import dev.marston.randomloot.loot.modifiers.breakers.Learning;
import dev.marston.randomloot.loot.modifiers.breakers.Melting;
import dev.marston.randomloot.loot.modifiers.breakers.Veiny;
import dev.marston.randomloot.loot.modifiers.holders.Effect;
import dev.marston.randomloot.loot.modifiers.holders.Hasty;
Expand Down Expand Up @@ -34,6 +35,7 @@ public class ModifierRegistry {
public static Modifier LEARNING = register(new Learning());
public static Modifier ATTRACTING = register(new Attracting());
public static Modifier VEINY = register(new Veiny());
public static Modifier MELTING = register(new Melting());

public static Modifier TORCH_PLACE = register(new TorchPlace());
public static Modifier DIRT_PLACE = register(new DirtPlace());
Expand All @@ -59,7 +61,7 @@ public class ModifierRegistry {
public static Modifier ORE_FINDER = register(new OreFinder());
public static Modifier SPAWNER_FINDER = register(new TreasureFinder());

public static final Set<Modifier> BREAKERS = Set.of(EXPLODE, LEARNING, ATTRACTING, VEINY);
public static final Set<Modifier> BREAKERS = Set.of(EXPLODE, LEARNING, ATTRACTING, VEINY, MELTING);
public static final Set<Modifier> USERS = Set.of(TORCH_PLACE, DIRT_PLACE, FIRE_PLACE);
public static final Set<Modifier> HURTERS = Set.of(CRITICAL, CHARGING, FLAMING, COMBO, DRAINING, POISONOUS,
WITHERING, BLINDING);
Expand Down
Loading

0 comments on commit e43e77c

Please sign in to comment.