Skip to content

Commit

Permalink
Merge pull request #19 from GTNewHorizons/fix-howler-crash
Browse files Browse the repository at this point in the history
Fix crash when right clicking howler with any gtmetaitem
  • Loading branch information
Dream-Master authored Apr 18, 2024
2 parents 457baaa + 3a11b2c commit f7a1a24
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 30 deletions.
10 changes: 5 additions & 5 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
dependencies {
api("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")

compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-310-GTNH:dev") {
compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-348-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:waila:1.6.5:dev") {
compileOnly("com.github.GTNewHorizons:waila:1.7.3:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev") {
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.5.25-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:OpenComputers:1.10.6-GTNH:dev") {
compileOnly("com.github.GTNewHorizons:OpenComputers:1.10.10-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.25:dev") {
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.153:dev") {
transitive = false
}

Expand Down
19 changes: 10 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ 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.
developmentEnvironmentUserName = "Developer"

# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = false
enableModernJavaSyntax = true

# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
Expand All @@ -50,24 +50,27 @@ enableGenericInjection = false
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass =
generateGradleTokenClass = shedar.mods.ic2.nuclearcontrol.Tags

# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenVersion = VERSION

# [DEPRECATED] Mod ID replacement token.
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";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile = IC2NuclearControl.java
replaceGradleTokenInFile =

# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
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 =
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 @@ -57,7 +57,7 @@
@Mod(
modid = "IC2NuclearControl",
name = "Nuclear Control 2",
version = "GRADLETOKEN_VERSION",
version = Tags.VERSION,
dependencies = "required-after:IC2; after:gregtech;",
guiFactory = "shedar.mods.ic2.nuclearcontrol.gui.GuiFactory")
public class IC2NuclearControl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,23 +403,24 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p
float f3) {
int blockType = world.getBlockMetadata(x, y, z);
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileEntityHowlerAlarm) {
if (tileEntity instanceof TileEntityHowlerAlarm tileHowler) {
if (player.getCurrentEquippedItem() != null && DyeUtil.isADye(player.getCurrentEquippedItem())) {
((TileEntityHowlerAlarm) tileEntity)
.setColor(ItemDye.field_150922_c[DyeUtil.getDyeId(player.getCurrentEquippedItem())]);
world.markBlockForUpdate(x, y, z);
if (!player.capabilities.isCreativeMode) {
if (player.inventory.getCurrentItem().stackSize == 1) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
} else {
player.inventory.getCurrentItem().stackSize--;
int dyeId = DyeUtil.getDyeId(player.getCurrentEquippedItem());
if (dyeId >= 0) {
tileHowler.setColor(ItemDye.field_150922_c[dyeId]);
world.markBlockForUpdate(x, y, z);
if (!player.capabilities.isCreativeMode) {
if (player.inventory.getCurrentItem().stackSize == 1) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
} else {
player.inventory.getCurrentItem().stackSize--;
}
}
return true;
}
return true;
} else if (player.getCurrentEquippedItem() != null) {
if (player.getCurrentEquippedItem().getItem() instanceof ItemToolPainter) {
ItemToolPainter p = (ItemToolPainter) player.getCurrentEquippedItem().getItem();
((TileEntityHowlerAlarm) tileEntity).setColor(ItemDye.field_150922_c[p.color]);
if (player.getCurrentEquippedItem().getItem() instanceof ItemToolPainter toolPainter) {
tileHowler.setColor(ItemDye.field_150922_c[toolPainter.color]);
world.markBlockForUpdate(x, y, z);
player.getCurrentEquippedItem().damageItem(1, player);
return true;
Expand Down

0 comments on commit f7a1a24

Please sign in to comment.