Skip to content

Commit

Permalink
Give skyslimes a chance of diamond or emerald modifier
Browse files Browse the repository at this point in the history
Need to implement something like tags for this in the future
  • Loading branch information
KnightMiner committed May 23, 2022
1 parent 3f7a8a8 commit 23137f0
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import slimeknights.tconstruct.library.tools.nbt.ToolStack;
import slimeknights.tconstruct.tools.TinkerModifiers;
import slimeknights.tconstruct.tools.TinkerTools;
import slimeknights.tconstruct.tools.data.ModifierIds;
import slimeknights.tconstruct.tools.item.ArmorSlotType;
import slimeknights.tconstruct.world.TinkerWorld;

Expand Down Expand Up @@ -91,6 +92,7 @@ protected void populateDefaultEquipmentSlots(DifficultyInstance difficulty) {
modifiers = modifiers.withModifier(TinkerModifiers.dyed.getId(), 1);
}

// TODO: make this less hardcoded?
// add some random defense modifiers
int max = tool.getFreeSlots(SlotType.DEFENSE);
for (int i = 0; i < max; i++) {
Expand All @@ -100,6 +102,12 @@ protected void populateDefaultEquipmentSlots(DifficultyInstance difficulty) {
persistentData.addSlots(SlotType.DEFENSE, -1);
modifiers = modifiers.withModifier(randomDefense(random.nextInt(6)), 1);
}
// chance of diamond or emerald
if (tool.getFreeSlots(SlotType.UPGRADE) > 0 && random.nextFloat() < 0.5f * multiplier) {
persistentData.addSlots(SlotType.UPGRADE, -1);
modifiers = modifiers.withModifier(random.nextBoolean() ? ModifierIds.emerald : ModifierIds.diamond, 1);
}

tool.setUpgrades(modifiers);

// finally, give the slime the helmet
Expand Down

0 comments on commit 23137f0

Please sign in to comment.