Skip to content

Commit

Permalink
Combatify 1.2.0 1.21 Fabric - It is alive!
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandra-Myers committed Jul 21, 2024
1 parent d90cfa9 commit c9637a3
Show file tree
Hide file tree
Showing 119 changed files with 568 additions and 610 deletions.
11 changes: 4 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -32,12 +32,9 @@ dependencies {
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation include("net.atlas:atlas-lib:1.0.2")
modApi "com.terraformersmc:modmenu:10.0.0-alpha.1"
modApi "me.shedaniel.cloth:cloth-config-fabric:14.0.125"

modCompileOnly("eu.pb4:polymer-core:0.8.0-beta.6+1.20.5")
modRuntimeOnly("eu.pb4:polymer-core:0.8.0-beta.6+1.20.5")
modImplementation include("net.atlas:atlas-lib:1.0.3-1.21")
modApi "com.terraformersmc:modmenu:11.0.1"
modApi "me.shedaniel.cloth:cloth-config-fabric:15.0.127"

implementation "com.moandjiezana.toml:toml4j:${project.toml4j_version}"
includeClasspath("com.moandjiezana.toml:toml4j:${project.toml4j_version}") {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ org.gradle.jvmargs = -Xmx3G
org.gradle.parallel = true

# Mod Properties
version = 1.20.6-1.2.0-Fabric
version = 1.21-1.2.0-Fabric
maven_group = net.atlas
archives_base_name = combatify
loader_version=0.15.10
fabric_version=0.98.0+1.20.6
minecraft_version=1.20.6
loader_version=0.16.0
fabric_version=0.100.7+1.21
minecraft_version=1.21
toml4j_version=0.7.2
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Binary file removed libs/CookeyMod.jar
Binary file not shown.
Binary file not shown.
13 changes: 7 additions & 6 deletions src/main/java/net/atlas/combatify/Combatify.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import com.google.common.collect.HashBiMap;
import net.atlas.atlaslib.util.ArrayListExtensions;
import net.atlas.atlaslib.util.PrefixLogger;
import net.atlas.combatify.attributes.CustomAttributes;
import net.atlas.combatify.config.CombatifyGeneralConfig;
import net.atlas.combatify.config.ConfigurableItemData;
import net.atlas.combatify.config.ItemConfig;
import net.atlas.combatify.enchantment.DefendingEnchantment;
import net.atlas.combatify.extensions.ExtendedTier;
import net.atlas.combatify.extensions.ItemExtensions;
import net.atlas.combatify.item.CombatifyItemTags;
Expand Down Expand Up @@ -72,6 +72,7 @@ public class Combatify implements ModInitializer {
public static Map<String, BlockingType> registeredTypes = new HashMap<>();
public static BiMap<String, Tier> tiers = HashBiMap.create();
public static final PrefixLogger LOGGER = new PrefixLogger(LogManager.getLogger("Combatify"));
public static final ResourceLocation CHARGED_REACH_ID = id("charged_reach");
public static final BlockingType SWORD = defineDefaultBlockingType(new SwordBlockingType("sword").setToolBlocker(true).setDisablement(false).setCrouchable(false).setBlockHit(true).setRequireFullCharge(false).setSwordBlocking(true).setDelay(false));
public static final BlockingType SHIELD = defineDefaultBlockingType(new ShieldBlockingType("shield"));
public static final BlockingType SHIELD_NO_BANNER = defineDefaultBlockingType(new NonBannerShieldBlockingType("shield_no_banner"));
Expand Down Expand Up @@ -133,11 +134,11 @@ public void onInitialize() {
Event<ItemGroupEvents.ModifyEntries> event = ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.COMBAT);
event.register(entries -> entries.addAfter(Items.SHIELD, TieredShieldItem.WOODEN_SHIELD, TieredShieldItem.IRON_SHIELD, TieredShieldItem.GOLD_SHIELD, TieredShieldItem.DIAMOND_SHIELD, TieredShieldItem.NETHERITE_SHIELD));
}
if (CONFIG.defender())
DefendingEnchantment.registerEnchants();

CustomAttributes.registerAttributes();
if (Combatify.CONFIG.percentageDamageEffects()) {
MobEffects.DAMAGE_BOOST.value().addAttributeModifier(Attributes.ATTACK_DAMAGE, "648D7064-6A60-4F59-8ABE-C2C23A6DD7A9", 0.2, AttributeModifier.Operation.ADD_MULTIPLIED_TOTAL);
MobEffects.WEAKNESS.value().addAttributeModifier(Attributes.ATTACK_DAMAGE, "22653B89-116E-49DC-9B6B-9971489B5BE5", -0.2, AttributeModifier.Operation.ADD_MULTIPLIED_TOTAL);
MobEffects.DAMAGE_BOOST.value().addAttributeModifier(Attributes.ATTACK_DAMAGE, ResourceLocation.withDefaultNamespace("effect.strength"), 0.2, AttributeModifier.Operation.ADD_MULTIPLIED_TOTAL);
MobEffects.WEAKNESS.value().addAttributeModifier(Attributes.ATTACK_DAMAGE, ResourceLocation.withDefaultNamespace("effect.weakness"), -0.2, AttributeModifier.Operation.ADD_MULTIPLIED_TOTAL);
}
}
@SuppressWarnings("all")
Expand Down Expand Up @@ -183,7 +184,7 @@ public static <T extends BlockingType> T registerBlockingType(T blockingType) {
return blockingType;
}
public static ResourceLocation id(String path) {
return new ResourceLocation(MOD_ID, path);
return ResourceLocation.fromNamespaceAndPath(MOD_ID, path);
}
public static void defineDefaultWeaponType(WeaponType type) {
defaultWeaponTypes.put(type.name, type);
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/net/atlas/combatify/CombatifyClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public class CombatifyClient implements ClientModInitializer {

private ModConfig config;
private Keybinds keybinds;
public static final ModelLayerLocation WOODEN_SHIELD_MODEL_LAYER = new ModelLayerLocation(new ResourceLocation("combatify", "wooden_shield"),"main");
public static final ModelLayerLocation IRON_SHIELD_MODEL_LAYER = new ModelLayerLocation(new ResourceLocation("combatify", "iron_shield"),"main");
public static final ModelLayerLocation GOLDEN_SHIELD_MODEL_LAYER = new ModelLayerLocation(new ResourceLocation("combatify", "golden_shield"),"main");
public static final ModelLayerLocation DIAMOND_SHIELD_MODEL_LAYER = new ModelLayerLocation(new ResourceLocation("combatify", "diamond_shield"),"main");
public static final ModelLayerLocation NETHERITE_SHIELD_MODEL_LAYER = new ModelLayerLocation(new ResourceLocation("combatify", "netherite_shield"),"main");
public static final ModelLayerLocation WOODEN_SHIELD_MODEL_LAYER = new ModelLayerLocation(Combatify.id("wooden_shield"),"main");
public static final ModelLayerLocation IRON_SHIELD_MODEL_LAYER = new ModelLayerLocation(Combatify.id("iron_shield"),"main");
public static final ModelLayerLocation GOLDEN_SHIELD_MODEL_LAYER = new ModelLayerLocation(Combatify.id("golden_shield"),"main");
public static final ModelLayerLocation DIAMOND_SHIELD_MODEL_LAYER = new ModelLayerLocation(Combatify.id("diamond_shield"),"main");
public static final ModelLayerLocation NETHERITE_SHIELD_MODEL_LAYER = new ModelLayerLocation(Combatify.id("netherite_shield"),"main");
public static final OptionInstance<Boolean> autoAttack = OptionInstance.createBoolean("options.autoAttack", true);
public static final OptionInstance<Boolean> shieldCrouch = OptionInstance.createBoolean("options.shieldCrouch", true);
public static final OptionInstance<Boolean> rhythmicAttacks = OptionInstance.createBoolean("options.rhythmicAttack",true);
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/net/atlas/combatify/attributes/CustomAttributes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package net.atlas.combatify.attributes;

import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.RangedAttribute;

public class CustomAttributes {
public static final Holder<Attribute> SHIELD_DISABLE_TIME = register(
"generic.shield_disable_time", new RangedAttribute("attribute.name.generic.shield_disable_time", 0.0, -1024.0, 2048.0)
);
public static final Holder<Attribute> SHIELD_DISABLE_REDUCTION = register(
"generic.shield_disable_reduction", new RangedAttribute("attribute.name.generic.shield_disable_reduction", 0.0, -1024.0, 2048.0)
);

private static Holder<Attribute> register(String string, Attribute attribute) {
return Registry.registerForHolder(BuiltInRegistries.ATTRIBUTE, ResourceLocation.withDefaultNamespace(string), attribute);
}

public static void registerAttributes() {

}
}
10 changes: 0 additions & 10 deletions src/main/java/net/atlas/combatify/compat/PolymerCompat.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class CombatifyGeneralConfig extends AtlasConfig {
private BooleanHolder dispensableTridents;
private BooleanHolder snowballKB;
private BooleanHolder resetOnItemChange;
private BooleanHolder vanillaSweep;
private BooleanHolder sweepWithSweeping;
private BooleanHolder sweepingNegatedForTamed;
private BooleanHolder ctsMomentumPassedToProjectiles;
Expand All @@ -62,7 +61,6 @@ public class CombatifyGeneralConfig extends AtlasConfig {
private BooleanHolder autoAttackAllowed;
private BooleanHolder configOnlyWeapons;
private BooleanHolder tieredShields;
private BooleanHolder defender;
private BooleanHolder attackReach;
private BooleanHolder armorPiercingDisablesShields;
private BooleanHolder attackSpeed;
Expand All @@ -80,8 +78,6 @@ public class CombatifyGeneralConfig extends AtlasConfig {
private DoubleHolder healingTime;
private DoubleHolder instantTippedArrowEffectMultiplier;
private DoubleHolder shieldDisableTime;
private DoubleHolder cleavingDisableTime;
private DoubleHolder defenderDisableReduction;
private DoubleHolder breachArmorPiercing;
private DoubleHolder snowballDamage;
private DoubleHolder eggDamage;
Expand Down Expand Up @@ -208,9 +204,6 @@ public void defineConfigHolders() {
tridentVoidReturn = createBoolean("tridentVoidReturn", true);
tridentVoidReturn.tieToCategory(ctsB);
tridentVoidReturn.setupTooltip(1);
vanillaSweep = createBoolean("vanillaSweep", false);
vanillaSweep.tieToCategory(ctsB);
vanillaSweep.setupTooltip(1);
weaponTypesEnabled = createBoolean("weaponTypesEnabled", true);
weaponTypesEnabled.tieToCategory(ctsB);
weaponTypesEnabled.setupTooltip(3);
Expand All @@ -233,9 +226,6 @@ public void defineConfigHolders() {
instantTippedArrowEffectMultiplier = createInRange("instantTippedArrowEffectMultiplier", 0.125, 0, 4);
instantTippedArrowEffectMultiplier.tieToCategory(ctsD);
instantTippedArrowEffectMultiplier.setupTooltip(1);
cleavingDisableTime = createInRange("cleavingDisableTime", 0.5, 0, 10);
cleavingDisableTime.tieToCategory(ctsD);
cleavingDisableTime.setupTooltip(1);
shieldDisableTime = createInRange("shieldDisableTime", 1.6, 0, 10);
shieldDisableTime.tieToCategory(ctsD);
shieldDisableTime.setupTooltip(1);
Expand All @@ -255,10 +245,6 @@ public void defineConfigHolders() {
configOnlyWeapons.tieToCategory(extraB);
configOnlyWeapons.setRestartRequired(true);
configOnlyWeapons.setupTooltip(1);
defender = createBoolean("defender", false);
defender.tieToCategory(extraB);
defender.setRestartRequired(true);
defender.setupTooltip(1);
tieredShields = createBoolean("tieredShields", false);
tieredShields.tieToCategory(extraB);
tieredShields.setRestartRequired(true);
Expand Down Expand Up @@ -313,9 +299,6 @@ public void defineConfigHolders() {
shieldChargePercentage.tieToCategory(extraI);
shieldChargePercentage.setupTooltip(1);

defenderDisableReduction = createInRange("defenderDisableReduction", 0.5, 0, 10);
defenderDisableReduction.tieToCategory(extraD);
defenderDisableReduction.setupTooltip(1);
breachArmorPiercing = createInRange("breachArmorPiercing", 0.15, 0, 1);
breachArmorPiercing.tieToCategory(extraD);
breachArmorPiercing.setupTooltip(2);
Expand Down Expand Up @@ -430,9 +413,6 @@ public Boolean snowballKB() {
public Boolean resetOnItemChange() {
return resetOnItemChange.get();
}
public Boolean vanillaSweep() {
return vanillaSweep.get();
}
public Boolean sweepWithSweeping() {
return sweepWithSweeping.get();
}
Expand Down Expand Up @@ -505,9 +485,6 @@ public Boolean configOnlyWeapons() {
public Boolean tieredShields() {
return tieredShields.get();
}
public Boolean defender() {
return defender.get();
}
public Boolean attackReach() {
return attackReach.get();
}
Expand Down Expand Up @@ -565,12 +542,6 @@ public Double instantTippedArrowEffectMultiplier() {
public Double shieldDisableTime() {
return shieldDisableTime.get();
}
public Double cleavingDisableTime() {
return cleavingDisableTime.get();
}
public Double defenderDisableReduction() {
return defenderDisableReduction.get();
}
public Double breachArmorPiercing() {
return breachArmorPiercing.get();
}
Expand Down
18 changes: 2 additions & 16 deletions src/main/java/net/atlas/combatify/config/ConfigurableItemData.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public class ConfigurableItemData {
buf.writeDouble(configurableItemData.blockKbRes == null ? -10 : configurableItemData.blockKbRes);
buf.writeInt(configurableItemData.enchantability == null ? -10 : configurableItemData.enchantability);
buf.writeInt(configurableItemData.isEnchantable == null ? -10 : configurableItemData.isEnchantable ? 1 : 0);
buf.writeInt(configurableItemData.hasSwordEnchants == null ? -10 : configurableItemData.hasSwordEnchants ? 1 : 0);
buf.writeInt(configurableItemData.isPrimaryForSwordEnchants == null ? -10 : configurableItemData.isPrimaryForSwordEnchants ? 1 : 0);
buf.writeInt(configurableItemData.useDuration == null ? -10 : configurableItemData.useDuration);
buf.writeDouble(configurableItemData.piercingLevel == null ? -10 : configurableItemData.piercingLevel);
buf.writeInt(configurableItemData.canSweep == null ? -10 : configurableItemData.canSweep ? 1 : 0);
Expand Down Expand Up @@ -66,11 +64,7 @@ public class ConfigurableItemData {
Double blockKbRes = buf.readDouble();
Integer enchantlevel = buf.readInt();
int isEnchantableAsInt = buf.readInt();
int hasSwordEnchantsAsInt = buf.readInt();
int isPrimaryForSwordEnchantsAsInt = buf.readInt();
Boolean isEnchantable = null;
Boolean hasSwordEnchants = null;
Boolean isPrimaryForSwordEnchants = null;
Integer useDuration = buf.readInt();
Double piercingLevel = buf.readDouble();
int canSweepAsInt = buf.readInt();
Expand Down Expand Up @@ -105,10 +99,6 @@ public class ConfigurableItemData {
enchantlevel = null;
if (isEnchantableAsInt != -10)
isEnchantable = isEnchantableAsInt == 1;
if (hasSwordEnchantsAsInt != -10)
hasSwordEnchants = hasSwordEnchantsAsInt == 1;
if (isPrimaryForSwordEnchantsAsInt != -10)
isPrimaryForSwordEnchants = isPrimaryForSwordEnchantsAsInt == 1;
if (useDuration == -10)
useDuration = null;
if (piercingLevel == -10)
Expand All @@ -123,7 +113,7 @@ public class ConfigurableItemData {
toughness = null;
if (armourKbRes == -10)
armourKbRes = null;
return new ConfigurableItemData(damage, speed, reach, chargedReach, stackSize, cooldown, cooldownAfter, type, bType, blockStrength, blockKbRes, enchantlevel, isEnchantable, hasSwordEnchants, isPrimaryForSwordEnchants, useDuration, piercingLevel, canSweep, tier, durability, defense, toughness, armourKbRes, ingredient, toolMineable);
return new ConfigurableItemData(damage, speed, reach, chargedReach, stackSize, cooldown, cooldownAfter, type, bType, blockStrength, blockKbRes, enchantlevel, isEnchantable, useDuration, piercingLevel, canSweep, tier, durability, defense, toughness, armourKbRes, ingredient, toolMineable);
});
public final Double damage;
public final Double speed;
Expand All @@ -139,8 +129,6 @@ public class ConfigurableItemData {
public final Double blockKbRes;
public final Integer enchantability;
public final Boolean isEnchantable;
public final Boolean hasSwordEnchants;
public final Boolean isPrimaryForSwordEnchants;
public final Integer useDuration;
public final Double piercingLevel;
public final Boolean canSweep;
Expand All @@ -151,7 +139,7 @@ public class ConfigurableItemData {
public final Ingredient repairIngredient;
public final TagKey<Block> toolMineableTag;

ConfigurableItemData(Double attackDamage, Double attackSpeed, Double attackReach, Double chargedReach, Integer stackSize, Integer cooldown, Boolean cooldownAfter, WeaponType weaponType, BlockingType blockingType, Double blockStrength, Double blockKbRes, Integer enchantability, Boolean isEnchantable, Boolean hasSwordEnchants, Boolean isPrimaryForSwordEnchants, Integer useDuration, Double piercingLevel, Boolean canSweep, Tier tier, Integer durability, Integer defense, Double toughness, Double armourKbRes, Ingredient repairIngredient, TagKey<Block> toolMineableTag) {
ConfigurableItemData(Double attackDamage, Double attackSpeed, Double attackReach, Double chargedReach, Integer stackSize, Integer cooldown, Boolean cooldownAfter, WeaponType weaponType, BlockingType blockingType, Double blockStrength, Double blockKbRes, Integer enchantability, Boolean isEnchantable, Integer useDuration, Double piercingLevel, Boolean canSweep, Tier tier, Integer durability, Integer defense, Double toughness, Double armourKbRes, Ingredient repairIngredient, TagKey<Block> toolMineableTag) {
damage = clamp(attackDamage, -10, 1000);
speed = clamp(attackSpeed, -1, 7.5);
reach = clamp(attackReach, 0, 1024);
Expand All @@ -166,8 +154,6 @@ public class ConfigurableItemData {
this.blockKbRes = clamp(blockKbRes, 0, 1);
this.enchantability = clamp(enchantability, 0, 1000);
this.isEnchantable = isEnchantable;
this.hasSwordEnchants = hasSwordEnchants;
this.isPrimaryForSwordEnchants = isPrimaryForSwordEnchants;
this.useDuration = clamp(useDuration, 1, 1000);
this.piercingLevel = clamp(piercingLevel, 0, 1);
this.canSweep = canSweep;
Expand Down
Loading

0 comments on commit c9637a3

Please sign in to comment.