Skip to content

Commit

Permalink
Various Fixes (#39)
Browse files Browse the repository at this point in the history
* Update BS + dpes

* Fix annotations & generics

* Remove some commented-out code

* Change to Tags class

* create Terminus aspect during preInit

* Apply spotless

* Add comments for unmapped methods/fields

* Use AT in favor of reflection

* Fix server-side crash
  • Loading branch information
glowredman authored Jul 12, 2024
1 parent ca60012 commit 91bfbb3
Show file tree
Hide file tree
Showing 71 changed files with 208 additions and 618 deletions.
20 changes: 10 additions & 10 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
// Add your dependencies here

dependencies {
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev")
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.6.14-GTNH:dev")

compileOnly("com.github.GTNewHorizons:ForestryMC:4.8.2:api") {
compileOnly("com.github.GTNewHorizons:ForestryMC:4.9.7:api") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:Botania:1.10.3-GTNH:dev") {
compileOnly("com.github.GTNewHorizons:Botania:1.11.3-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:Mantle:0.4.0:dev") {
compileOnly("com.github.GTNewHorizons:Mantle:0.4.1:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.11.5-GTNH:dev") {
compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.12.5-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:BloodMagic:1.4.3:dev") {
compileOnly("com.github.GTNewHorizons:BloodMagic:1.6.2:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:CraftTweaker:3.3.0:dev") {
compileOnly("com.github.GTNewHorizons:CraftTweaker:3.3.1:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.4.8:dev") {
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.5.31:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.25:dev") {
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.48.72:dev") {
transitive = false
}

Expand All @@ -41,5 +41,5 @@ dependencies {
transitive = false
}

runtimeOnly("com.github.GTNewHorizons:GTNHLib:0.1.0:dev")
runtimeOnly("com.github.GTNewHorizons:GTNHLib:0.3.2:dev")
}
23 changes: 12 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,41 +33,44 @@ 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.
enableGenericInjection = false
enableGenericInjection = true

# 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 = fox.spiteful.avaritia.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 = Avaritia.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 All @@ -77,7 +80,7 @@ apiPackage =
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile =
accessTransformersFile = Avaritia_at.cfg

# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
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.8-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.23'
}


8 changes: 2 additions & 6 deletions src/main/java/fox/spiteful/avaritia/Avaritia.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import fox.spiteful.avaritia.achievements.Achievements;
import fox.spiteful.avaritia.blocks.LudicrousBlocks;
import fox.spiteful.avaritia.compat.Compat;
Expand All @@ -29,7 +27,7 @@
@Mod(
modid = "Avaritia",
name = "Avaritia",
version = "GRADLETOKEN_VERSION",
version = Tags.VERSION,
dependencies = "after:Thaumcraft;after:AWWayofTime;after:Botania")
public class Avaritia {

Expand All @@ -44,14 +42,12 @@ public class Avaritia {
public static CreativeTabs tab = new CreativeTabs("avaritia") {

@Override
@SideOnly(Side.CLIENT)
public Item getTabIconItem() {
return LudicrousItems.resource;
}

@Override
@SideOnly(Side.CLIENT)
public int func_151243_f() {
public int func_151243_f() { // getIconItemDamage
return 5;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.IChatComponent;
Expand All @@ -17,16 +16,13 @@ public DamageSourceInfinitySword(Entity source) {
super("infinity", source);
}

public IChatComponent func_151519_b(EntityLivingBase p_151519_1_) {
ItemStack itemstack = this.damageSourceEntity instanceof EntityLivingBase
? ((EntityLivingBase) this.damageSourceEntity).getHeldItem()
: null;
@Override
public IChatComponent func_151519_b(EntityLivingBase p_151519_1_) { // getDeathMessage
String s = "death.attack.infinity";
int rando = randy.nextInt(5);
if (rando != 0) s = s + "." + rando;
return new ChatComponentTranslation(
s,
new Object[] { p_151519_1_.func_145748_c_(), this.damageSourceEntity.func_145748_c_() });
// func_145748_c_ = getFormattedCommandSenderName
return new ChatComponentTranslation(s, p_151519_1_.func_145748_c_(), this.damageSourceEntity.func_145748_c_());
}

@Override
Expand Down
17 changes: 2 additions & 15 deletions src/main/java/fox/spiteful/avaritia/PotionHelper.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
package fox.spiteful.avaritia;

import java.lang.reflect.Field;
import java.util.ArrayList;

import net.minecraft.potion.Potion;

import org.apache.logging.log4j.Level;

import cpw.mods.fml.relauncher.ReflectionHelper;

public class PotionHelper {

private static ArrayList<Potion> badPotions;

public static void healthInspection() {
badPotions = new ArrayList<Potion>();
try {
Field stupidMojangPrivateVariable = ReflectionHelper
.findField(Potion.class, "isBadEffect", "field_76418_K");

for (Potion potion : Potion.potionTypes) {
if (potion != null && stupidMojangPrivateVariable.getBoolean(potion)) badPotions.add(potion);
}
} catch (Exception e) {
Lumberjack.log(Level.ERROR, e, "Failure to get potions");
e.printStackTrace();
for (Potion potion : Potion.potionTypes) {
if (potion != null && potion.isBadEffect) badPotions.add(potion);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@

public class AchievementTrigger {

/*
* @SubscribeEvent public void onItemPickedUp(PlayerEvent.ItemPickupEvent event) { ItemStack stack =
* event.pickedUp.getEntityItem(); }
*/

@SubscribeEvent
public void onItemCrafted(PlayerEvent.ItemCraftedEvent event) {
if (event.crafting != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public class LudicrousAchievement extends Achievement {

public static List<Achievement> achievements = new ArrayList();
public static List<Achievement> achievements = new ArrayList<>();

public LudicrousAchievement(String name, int x, int y, ItemStack icon, Achievement parent) {
super("achievement.avaritia:" + name, "avaritia:" + name, x, y, icon, parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public void registerBlockIcons(IIconRegister iconRegister) {
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
if (side == 1) return top;
int facing = 2;
Expand All @@ -56,7 +55,6 @@ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
if (side == 1) return top;
if (side == 3) return front;
Expand All @@ -79,6 +77,7 @@ public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityCompressor();
}

@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityCompressor) {
Expand All @@ -96,6 +95,7 @@ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase p

}

@Override
public void breakBlock(World world, int x, int y, int z, Block block, int wut) {
TileEntityCompressor compressor = (TileEntityCompressor) world.getTileEntity(x, y, z);

Expand Down Expand Up @@ -137,7 +137,7 @@ public void breakBlock(World world, int x, int y, int z, Block block, int wut) {
}
}

world.func_147453_f(x, y, z, block);
world.func_147453_f(x, y, z, block); // updateNeighborsAboutBlockChange
}

super.breakBlock(world, x, y, z, block, wut);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public void registerBlockIcons(IIconRegister iconRegister) {
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
if (side == 0) return bottom;
if (side == 1) return top;
Expand All @@ -66,6 +65,7 @@ public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityDireCrafting();
}

@Override
public void breakBlock(World world, int x, int y, int z, Block block, int wut) {
TileEntityDireCrafting craft = (TileEntityDireCrafting) world.getTileEntity(x, y, z);

Expand Down Expand Up @@ -106,7 +106,7 @@ public void breakBlock(World world, int x, int y, int z, Block block, int wut) {
}
}

world.func_147453_f(x, y, z, block);
world.func_147453_f(x, y, z, block); // updateNeighborsAboutBlockChange
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public void registerBlockIcons(IIconRegister iconRegister) {
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
if (side == 1) return top;
int facing = 2;
Expand All @@ -56,7 +55,6 @@ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
if (side == 1) return top;
if (side == 3) return front;
Expand All @@ -79,6 +77,7 @@ public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityNeutron();
}

@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityNeutron) {
Expand All @@ -96,6 +95,7 @@ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase p

}

@Override
public void breakBlock(World world, int x, int y, int z, Block block, int wut) {
TileEntityNeutron collector = (TileEntityNeutron) world.getTileEntity(x, y, z);

Expand Down Expand Up @@ -134,7 +134,7 @@ public void breakBlock(World world, int x, int y, int z, Block block, int wut) {
}
}

world.func_147453_f(x, y, z, block);
world.func_147453_f(x, y, z, block); // updateNeighborsAboutBlockChange
}

super.breakBlock(world, x, y, z, block, wut);
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/fox/spiteful/avaritia/blocks/BlockResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,22 @@ public BlockResource() {
setCreativeTab(Avaritia.tab);
}

@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int side, int metadata) {
return this.icons[metadata % types.length];
}

@Override
public int damageDropped(int metadata) {
return metadata;
}

@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
for (int x = 0; x < types.length; x++) list.add(new ItemStack(item, 1, x));
}

@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.icons = new IIcon[types.length];
Expand Down
Loading

0 comments on commit 91bfbb3

Please sign in to comment.