Skip to content

Commit

Permalink
Merge pull request #13 from GTNewHorizons/use-llamalad7-mixinextras
Browse files Browse the repository at this point in the history
Use llamalad7 MixinExtras
  • Loading branch information
Alexdoru authored Oct 14, 2023
2 parents 5c6173f + e47cf55 commit c2d2374
Show file tree
Hide file tree
Showing 14 changed files with 211 additions and 123 deletions.
268 changes: 190 additions & 78 deletions build.gradle

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ enableModernJavaSyntax = true

# Enables injecting missing generics into the decompiled source code for a better coding experience
# Turns most publically visible List, Map, etc. into proper List<Type>, Map<K, V> types
enableGenericInjection = false
enableGenericInjection = true

# Generate a class with String fields for the mod id, name, version and group name named with the fields below
generateGradleTokenClass = com.gtnewhorizons.gravisuiteneo.Tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

@Mod(
acceptedMinecraftVersions = "[1.7.10]",
dependencies = "required-after:GraviSuite@[1.7.10-2.0.3];required-after:IC2;required-after:gtnhmixins;after:gregtech",
dependencies = "required-after:GraviSuite@[1.7.10-2.0.3];required-after:IC2;after:gregtech",
modid = GraviSuiteNeo.MODID,
name = GraviSuiteNeo.MODNAME,
version = GraviSuiteNeo.VERSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public static double getImpactRadius(float plasmaEfficiency) {
return 6.0 * plasmaEfficiency;
}

@SuppressWarnings("unchecked")
@Override
protected void onImpact(MovingObjectPosition mop) {
if (this.finalTicksForDestruction != -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public void registerIcons(IIconRegister iconRegister) {
}

@Override
@SideOnly(Side.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
return GraviSuiteNeo.MODID + ":textures/armor/armor_epic_lappack.png";
}
Expand Down Expand Up @@ -75,7 +74,6 @@ public boolean onTick(EntityPlayer player, ItemStack itemstack) {
}

@Override
@SideOnly(Side.CLIENT)
public EnumRarity getRarity(ItemStack var1) {
return EnumRarity.epic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import com.gtnewhorizons.gravisuiteneo.common.Properties;
import com.gtnewhorizons.gravisuiteneo.util.FluidHelper;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gravisuite.IItemTickListener;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
Expand Down Expand Up @@ -140,10 +138,8 @@ public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) {
* IFluidContainerItem end
*/

@SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack stack, EntityPlayer player, @SuppressWarnings("rawtypes") List tooltip,
boolean advancedTooltip) {
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advancedTooltip) {
tooltip.addAll(getToolTipInfo(stack));
}

Expand Down Expand Up @@ -184,7 +180,6 @@ public Item getEmptyItem(ItemStack itemStack) {
}

@Override
@SideOnly(Side.CLIENT)
public EnumRarity getRarity(ItemStack p_77613_1_) {
return EnumRarity.uncommon;
}
Expand Down Expand Up @@ -219,10 +214,8 @@ public Item getChargedItem(ItemStack itemStack) {
return this;
}

@SuppressWarnings("unchecked")
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs creativeTab, @SuppressWarnings("rawtypes") List subItems) {
public void getSubItems(Item item, CreativeTabs creativeTab, List<ItemStack> subItems) {
final ItemStack stack = new ItemStack(this, 1);
ElectricItem.manager.charge(stack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false);
final ItemStack fullStack = new ItemStack(this, 1, this.getMaxDamage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import com.gtnewhorizons.gravisuiteneo.common.Properties;
import com.gtnewhorizons.gravisuiteneo.inventory.InventoryItem;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gravisuite.EntityPlasmaBall;
import gravisuite.GraviSuite;
import gravisuite.ServerProxy;
Expand Down Expand Up @@ -127,9 +125,8 @@ public boolean hasAmmunition(ItemStack itemStack) {
return this.getAmmunition(itemStack) != null;
}

@SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, @SuppressWarnings("rawtypes") List tooltip,
public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> tooltip,
boolean advancedTooltips) {
if (this.hasAmmunition(itemStack)) {
tooltip.addAll(ItemPlasmaCell.getToolTipInfo(this.getAmmunition(itemStack)));
Expand All @@ -139,7 +136,6 @@ public void addInformation(ItemStack itemStack, EntityPlayer player, @SuppressWa
}

@Override
@SideOnly(Side.CLIENT)
public EnumRarity getRarity(ItemStack p_77613_1_) {
return EnumRarity.epic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;

import com.gtnewhorizon.mixinextras.injector.WrapWithCondition;
import com.gtnewhorizons.gravisuiteneo.common.EntityPlasmaBallMKII;
import com.gtnewhorizons.gravisuiteneo.common.Properties;
import com.llamalad7.mixinextras.injector.WrapWithCondition;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import gravisuite.EntityPlasmaBall;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ public abstract class MixinItemAdvChainsaw extends ItemTool {
@Shadow(remap = false)
private int energyPerOperation;

@SuppressWarnings("rawtypes")
@Shadow(remap = false)
public Set mineableBlocks;
public Set<Block> mineableBlocks;

@Shadow(remap = false)
public abstract void saveToolMode(ItemStack itemstack, Integer toolMode);
Expand All @@ -52,7 +51,6 @@ public abstract class MixinItemAdvChainsaw extends ItemTool {
* @author Namikon, glowredman
* @reason Gravitation Suite Neo
*/
@SuppressWarnings("unchecked")
@Overwrite(remap = false)
public void init() {
for (String blockName : Properties.AdvTweaks.getAdvChainsawAdditionalMineableBlocks()) {
Expand Down Expand Up @@ -166,12 +164,10 @@ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer
* @author Namikon, glowredman
* @reason Gravitation Suite Neo
*/
@SuppressWarnings("unchecked")
@Overwrite
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, @SuppressWarnings("rawtypes") List tooltip,
boolean advancedTooltips) {
final Integer toolMode = ItemAdvChainsaw.readToolMode(item);
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advancedTooltips) {
final int toolMode = ItemAdvChainsaw.readToolMode(item);
StringBuilder line = new StringBuilder();
line.append(EnumChatFormatting.GOLD);
line.append(StatCollector.translateToLocal("message.text.mode"));
Expand Down Expand Up @@ -292,8 +288,7 @@ private boolean detectTree(World world, int x, int y, int z, Block wood) {
return numLeaves > 3;
}

private MixinItemAdvChainsaw(float p_i45333_1_, ToolMaterial p_i45333_2_,
@SuppressWarnings("rawtypes") Set p_i45333_3_) {
private MixinItemAdvChainsaw(float p_i45333_1_, ToolMaterial p_i45333_2_, Set<Block> p_i45333_3_) {
super(p_i45333_1_, p_i45333_2_, p_i45333_3_);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,15 @@ public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPl
return itemStackIn;
}

@SuppressWarnings("unchecked")
@Inject(
at = @At(
remap = false,
target = "Lgravisuite/ItemAdvDDrill;readToolMode(Lnet/minecraft/item/ItemStack;)Ljava/lang/Integer;",
value = "INVOKE"),
method = "addInformation")
@SideOnly(Side.CLIENT)
private void gravisuiteneo$addXPInformation(ItemStack itemstack, EntityPlayer player,
@SuppressWarnings("rawtypes") List tooltip, boolean advancedTooltip, CallbackInfo ci) {
private void gravisuiteneo$addXPInformation(ItemStack itemstack, EntityPlayer player, List<String> tooltip,
boolean advancedTooltip, CallbackInfo ci) {
if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
return;
}
Expand Down Expand Up @@ -256,11 +255,10 @@ public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPl
}
}

@SuppressWarnings("unchecked")
@Inject(at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILEXCEPTION, method = "addInformation")
@SideOnly(Side.CLIENT)
private void gravisuiteneo$addOtherModeInformation(ItemStack itemstack, EntityPlayer player,
@SuppressWarnings("rawtypes") List tooltip, boolean advancedTooltips, CallbackInfo ci, Integer toolMode) {
private void gravisuiteneo$addOtherModeInformation(ItemStack itemstack, EntityPlayer player, List<String> tooltip,
boolean advancedTooltips, CallbackInfo ci, Integer toolMode) {
if (toolMode == 4) {
tooltip.add(
EnumChatFormatting.GOLD + StatCollector.translateToLocal("message.text.mode")
Expand Down Expand Up @@ -486,7 +484,7 @@ public void setLevel(ItemStack pItemStack, int pLevel) {
LevelableToolHelper.saveToolXP(pItemStack, LevelableToolHelper.getXPForLevel(Math.min(2, pLevel)));
}

private MixinItemAdvDDrill(float p_i45333_1_, ToolMaterial p_i45333_2_, Set<?> p_i45333_3_) {
private MixinItemAdvDDrill(float p_i45333_1_, ToolMaterial p_i45333_2_, Set<Block> p_i45333_3_) {
super(p_i45333_1_, p_i45333_2_, p_i45333_3_);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import com.gtnewhorizon.mixinextras.injector.ModifyExpressionValue;
import com.gtnewhorizons.gravisuiteneo.common.Properties;
import com.gtnewhorizons.gravisuiteneo.util.QuantumShieldHelper;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
Expand Down Expand Up @@ -82,11 +82,10 @@ public class MixinItemGraviChestPlate {
QuantumShieldHelper.curePotions(itemStack, player, false);
}

@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
@Inject(at = @At("TAIL"), method = "addInformation")
private void gravisuiteneo$addShieldInformation(ItemStack itemStack, EntityPlayer player,
@SuppressWarnings("rawtypes") List tooltip, boolean advancedTooltips, CallbackInfo ci) {
private void gravisuiteneo$addShieldInformation(ItemStack itemStack, EntityPlayer player, List<String> tooltip,
boolean advancedTooltips, CallbackInfo ci) {
String shieldStatus;
if (QuantumShieldHelper.readShieldMode(itemStack)) {
shieldStatus = EnumChatFormatting.GREEN + StatCollector.translateToLocal("message.text.on");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import com.gtnewhorizon.mixinextras.injector.ModifyReturnValue;
import com.gtnewhorizons.gravisuiteneo.GraviSuiteNeo;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;

import gravisuite.ItemSimpleItems;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@ public int getHarvestLevel(ItemStack stack, String toolClass) {
return 3;
}

@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
@Inject(
at = @At(remap = false, target = "Ljava/util/List;add(Ljava/lang/Object;)Z", value = "INVOKE"),
method = "addInformation")
private void gravisuiteneo$addSilktouchInformation(ItemStack itemstack, EntityPlayer player,
@SuppressWarnings("rawtypes") List tooltip, boolean advancedTooltips, CallbackInfo ci) {
private void gravisuiteneo$addSilktouchInformation(ItemStack itemstack, EntityPlayer player, List<String> tooltip,
boolean advancedTooltips, CallbackInfo ci) {
tooltip.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("message.vajra.clickRightForSilk"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ public static void curePotions(ItemStack itemstack, EntityPlayer player, boolean

if (medkitCure) {
// A generic approach to remove *ANY* negative potion effect that is declared as such
@SuppressWarnings("unchecked")
Iterator<PotionEffect> iterator = player.getActivePotionEffects().iterator();

List<Integer> toRemove = new ArrayList<>();
Expand Down

0 comments on commit c2d2374

Please sign in to comment.