Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package net.sweenus.simplyswords.compat;

import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.sweenus.simplyswords.SimplySwords;
import net.sweenus.simplyswords.config.Config;
import net.sweenus.simplyswords.config.ConfigDefaultValues;
import net.sweenus.simplyswords.item.*;

public class DragonLootCompat {

//Compat for Advanced Netherite
static float longsword_modifier = Config.weaponAttribute.typeDamageModifier.longsword_damageModifier;
static float twinblade_modifier = Config.weaponAttribute.typeDamageModifier.twinblade_damageModifier;
static float rapier_modifier = Config.weaponAttribute.typeDamageModifier.rapier_damageModifier;
static float katana_modifier = Config.weaponAttribute.typeDamageModifier.katana_damageModifier;
static float sai_modifier = Config.weaponAttribute.typeDamageModifier.sai_damageModifier;
static float spear_modifier = Config.weaponAttribute.typeDamageModifier.spear_damageModifier;
static float glaive_modifier = Config.weaponAttribute.typeDamageModifier.glaive_damageModifier;
static float warglaive_modifier = Config.weaponAttribute.typeDamageModifier.warglaive_damageModifier;
static float cutlass_modifier = Config.weaponAttribute.typeDamageModifier.cutlass_damageModifier;
static float claymore_modifier = Config.weaponAttribute.typeDamageModifier.claymore_damageModifier;
static float greataxe_modifier = Config.weaponAttribute.typeDamageModifier.greataxe_damageModifier;
static float greathammer_modifier = Config.weaponAttribute.typeDamageModifier.greathammer_damageModifier;
static float chakram_modifier = Config.weaponAttribute.typeDamageModifier.chakram_damageModifier;
static float scythe_modifier = Config.weaponAttribute.typeDamageModifier.scythe_damageModifier;
static float halberd_modifier = Config.weaponAttribute.typeDamageModifier.halberd_damageModifier;

static float longsword_attackspeed = Config.weaponAttribute.typeAttackSpeed.longsword_attackSpeed;
static float twinblade_attackspeed = Config.weaponAttribute.typeAttackSpeed.twinblade_attackSpeed;
static float rapier_attackspeed = Config.weaponAttribute.typeAttackSpeed.rapier_attackSpeed;
static float sai_attackspeed = Config.weaponAttribute.typeAttackSpeed.sai_attackSpeed;
static float spear_attackspeed = Config.weaponAttribute.typeAttackSpeed.spear_attackSpeed;
static float katana_attackspeed = Config.weaponAttribute.typeAttackSpeed.katana_attackSpeed;
static float glaive_attackspeed = Config.weaponAttribute.typeAttackSpeed.glaive_attackSpeed;
static float warglaive_attackspeed = Config.weaponAttribute.typeAttackSpeed.warglaive_attackSpeed;
static float cutlass_attackspeed = Config.weaponAttribute.typeAttackSpeed.cutlass_attackSpeed;
static float claymore_attackspeed = Config.weaponAttribute.typeAttackSpeed.claymore_attackSpeed;
static float greataxe_attackspeed = Config.weaponAttribute.typeAttackSpeed.greataxe_attackSpeed;
static float greathammer_attackspeed = Config.weaponAttribute.typeAttackSpeed.greathammer_attackSpeed;
static float chakram_attackspeed = Config.weaponAttribute.typeAttackSpeed.chakram_attackSpeed;
static float scythe_attackspeed = Config.weaponAttribute.typeAttackSpeed.scythe_attackSpeed;
static float halberd_attackspeed = Config.weaponAttribute.typeAttackSpeed.halberd_attackSpeed;

static int dragon_scale_modifier = Config.weaponAttribute.materialDamageModifier.dragon_scale_damageModifier.get();

/* 1.21

//Dragon Scale
public static final Item DRAGON_SCALE_LONGSWORD = registerItem( "dragon_loot_compat/dragon_longsword",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + longsword_modifier), longsword_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_TWINBLADE = registerItem( "dragon_loot_compat/dragon_twinblade",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + twinblade_modifier), twinblade_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_RAPIER = registerItem( "dragon_loot_compat/dragon_rapier",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + rapier_modifier), rapier_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_KATANA = registerItem( "dragon_loot_compat/dragon_katana",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + katana_modifier), katana_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_SAI = registerItem( "dragon_loot_compat/dragon_sai",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + sai_modifier), sai_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_SPEAR = registerItem( "dragon_loot_compat/dragon_spear",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + spear_modifier), spear_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_GLAIVE = registerItem( "dragon_loot_compat/dragon_glaive",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + glaive_modifier), glaive_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_WARGLAIVE = registerItem( "dragon_loot_compat/dragon_warglaive",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + warglaive_modifier), warglaive_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_CUTLASS = registerItem( "dragon_loot_compat/dragon_cutlass",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + cutlass_modifier), cutlass_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_CLAYMORE = registerItem( "dragon_loot_compat/dragon_claymore",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + claymore_modifier), claymore_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_GREATHAMMER = registerItem( "dragon_loot_compat/dragon_greathammer",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + greathammer_modifier), greathammer_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_GREATAXE = registerItem( "dragon_loot_compat/dragon_greataxe",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + greataxe_modifier), greataxe_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_CHAKRAM = registerItem( "dragon_loot_compat/dragon_chakram",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + chakram_modifier), chakram_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_SCYTHE = registerItem( "dragon_loot_compat/dragon_scythe",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + scythe_modifier), scythe_attackspeed,
"dragonloot:dragon_scale"));

public static final Item DRAGON_SCALE_HALBERD = registerItem( "dragon_loot_compat/dragon_halberd",
new SimplySwordsNetheriteSwordItem(ModToolMaterial.DRAGON_SCALE, (int)(dragon_scale_modifier + halberd_modifier), halberd_attackspeed,
"dragonloot:dragon_scale"));


private static Item registerItem(String name, Item item) {
return Registry.register(Registries.ITEM, new Identifier(SimplySwords.MOD_ID, name), item);
}

public static void registerModItems() {
SimplySwords.LOGGER.info("Registering Dragon Loot compat Items for " + SimplySwords.MOD_ID);
}

*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ public static class MaterialDamageModifier extends ConfigSection {
public ValidatedCondition<Float> gobberNether_damageModifier = createCondition(3.0f, "gobber2");
public ValidatedCondition<Float> gobberEnd_damageModifier = createCondition(6.0f, "gobber2");

//advanced netherite compat - all mod-loaded gated, unsure if the modname field is correct
public ValidatedCondition<Float> netheriteIron_damageModifier = createCondition(3.0f, "advanced_netherite");
public ValidatedCondition<Float> netheriteGold_damageModifier = createCondition(3.0f, "advanced_netherite");
public ValidatedCondition<Float> netheriteEmerald_damageModifier = createCondition(3.0f, "advanced_netherite");
public ValidatedCondition<Float> netheriteDiamond_damageModifier = createCondition(3.0f, "advanced_netherite");

public ValidatedCondition<Float> dragonScale_damageModifier = createCondition(3.0f, "advanced_netherite");


private ValidatedCondition<Float> createCondition(float defaultValue, String modNeeded) {
return new ValidatedFloat(defaultValue)
.toCondition(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//This class is intended to duplicate the behavior of the weapons from Advanced Netherite,
//for example, being fire resistant, and having material specific bonuses. Not fully implemented, I haven't figured out how to bring over the attributes from the mod.

//I think dragonloot can just use the netheriteSwordItem class because it's a smithing template upgrade and just has better stats
package net.sweenus.simplyswords.item;

import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.registry.Registries;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.text.TextColor;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
import net.sweenus.simplyswords.SimplySwords;
import net.sweenus.simplyswords.util.HelperMethods;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class AdvancedNetheriteSwordItem extends SwordItem {
String[] repairIngredient;

public AdvancedNetheriteSwordItem(ToolMaterial toolMaterial, int attackDamage, float attackSpeed, String... repairIngredient) {
super(toolMaterial, attackDamage, attackSpeed,
new Settings().arch$tab(SimplySwords.SIMPLYSWORDS).fireproof());
this.repairIngredient = repairIngredient;
}

@Override
public boolean canRepair(ItemStack stack, ItemStack ingredient) {
List<Item> potentialIngredients = new ArrayList<>(List.of());
Arrays.stream(repairIngredient).toList().forEach(repIngredient ->
potentialIngredients.add(
Registries.ITEM.get(new Identifier(repIngredient))));


return potentialIngredients.contains(ingredient.getItem());
}

@Override
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) {
if (!attacker.getWorld().isClient()) {
HelperMethods.playHitSounds(attacker, target);
}
return super.postHit(stack, target, attacker);
}


@Override
public void appendTooltip(ItemStack itemStack, World world, List<Text> tooltip, TooltipContext tooltipContext) {

//Netherite alloys use GRAY, GOLD, DARK_GREEN, and AQUA colors

if (this.getName(itemStack).getString().contains("Netherite-Iron"));
//Add Netherite-Iron tooltip
else if (this.getName(itemStack).getString().contains("Netherite-Gold"));
//Add Netherite-Gold tooltip
else if (this.getName(itemStack).getString().contains("Netherite-Emerald"));
//Add Netherite-Emerald tooltip
else if (this.getName(itemStack).getString().contains("Netherite-Diamond"));
//Add Netherite-Iron, -Gold, AND -Emerald tooltips

super.appendTooltip(itemStack,world, tooltip, tooltipContext);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ public enum ModToolMaterial implements ToolMaterial {
GOBBER_NETHER(6, 5200, 12.0F, 9.0F, 25, Items.DIAMOND),
GOBBER_END(7, 8000, 14.0F, 9.0F, 30, Items.DIAMOND);

//Items.DIAMOND might need to be replaced, in 1.20 this field was always like this and didn't actually represent the anvil item but i have no idea if that has changed
//ADVANCED NETHERITE
NETHERITE_IRON(5, 2281, 12.0F, 4.0F, 15, Items.DIAMOND),
NETHERITE_GOLD(5, 2313, 20.0F, 5.0F, 25, Items.DIAMOND),
NETHERITE_EMERALD(5, 2651, 29.0F, 6.0F, 20, Items.DIAMOND),
NETHERITE_DIAMOND(5, 3092, 39.0F, 7.0F, 15, Items.DIAMOND),

//DRAGON LOOT
DRAGON_SCALE(5, 2479 ,12.0f , 5, 20, Items.DIAMOND);

private final int miningLevel;
private final int itemDurability;
private final float miningSpeed;
Expand Down
Loading