Skip to content

Commit

Permalink
Fix crashes related to high level enchantments. (#38)
Browse files Browse the repository at this point in the history
* Fix crashes with high level enchantments.

* bs+d
  • Loading branch information
AbdielKavash authored Apr 12, 2024
1 parent 1f27b14 commit 180509a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
16 changes: 8 additions & 8 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

dependencies {
api('com.github.GTNewHorizons:Baubles:1.0.4:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-312-GTNH:api')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-348-GTNH:api')

api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')

compileOnly('com.github.GTNewHorizons:Botania:1.10.6-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderCore:0.3.1:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderIO:2.6.4:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:Botania:1.10.12-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderCore:0.4.6:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderIO:2.7.1:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:EnderStorage:1.5.0:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:waila:1.7.0:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.11.11-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.4.7:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:waila:1.7.2:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.11.14-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.4.8:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:CodeChickenLib:1.2.1:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.6-GTNH:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.9-GTNH:api') {transitive=false}

compileOnly('curse.maven:computercraft-67504:2269339')
compileOnly('curse.maven:cofh-lib-220333:2388748')
Expand Down
11 changes: 6 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ channel = stable
mappingsVersion = 12

# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/

# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
Expand Down Expand Up @@ -61,6 +61,9 @@ gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =

# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =

# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
Expand Down Expand Up @@ -114,7 +117,7 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true

# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true

# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
Expand All @@ -123,7 +126,7 @@ includeWellKnownRepositories = true
usesMavenPublishing = true

# Maven repository to publish the mod to.
# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/

# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
Expand Down Expand Up @@ -187,5 +190,3 @@ curseForgeRelations =
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true

# Non-GTNH properties
gradleTokenGroupName =
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.21'
}


Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void onEntityDamaged(LivingHurtEvent event) {
int finalStrike = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.finalStrike, heldItem);
if (finalStrike > 0) {
Random rand = new Random();
if (rand.nextInt(20 - finalStrike) == 0) {
if ((finalStrike >= 19 || rand.nextInt(20 - finalStrike) == 0)) {
event.ammount *= 3;
}
}
Expand Down Expand Up @@ -154,10 +154,14 @@ public void onEntityUpdate(LivingUpdateEvent event) {

int quickDraw = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.idQuickDraw, heldItem);
ItemStack usingItem = player.itemInUse;
int time = player.itemInUseCount;
if (quickDraw > 0 && usingItem != null && usingItem.getItem() instanceof ItemBow)
if ((usingItem.getItem().getMaxItemUseDuration(usingItem) - time) % (6 - quickDraw) == 0)
player.itemInUseCount = time - 1;
if (quickDraw > 0 && usingItem != null && usingItem.getItem() instanceof ItemBow) {
int speedup = quickDraw / 6;
quickDraw = quickDraw % 6;
if (player.itemInUseCount % (6 - quickDraw) == 0) {
speedup++;
}
player.itemInUseCount = Math.max(2, player.itemInUseCount - speedup);
}
}
}

Expand Down

0 comments on commit 180509a

Please sign in to comment.