mirror of
https://github.com/GTNewHorizons/Baubles-Expanded.git
synced 2026-10-26 14:23:55 +00:00
Refactor bauble methods into abstract class (#3)
* Refactor some bauble methods into an abstract class * This was needed to stop TC4 from deploading the OG version * remove unneeded clientonly * Add note
This commit is contained in:
1 parent
8afc29f5ab
commit
4f4741d21e
4 files changed
+76
-63
No files matched your search
+5
-5
@@ -11,7 +11,7 @@ modId = BaublesExpanded
|
||||
|
||||
# Root package of the mod, used to find various classes in other properties,
|
||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||
modGroup =
|
||||
modGroup = baubles
|
||||
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||
@@ -50,10 +50,10 @@ 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 = baubles.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 =
|
||||
@@ -70,7 +70,7 @@ gradleTokenGroupName =
|
||||
# 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 = Baubles.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.
|
||||
@@ -102,7 +102,7 @@ mixinsPackage =
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass = thaumcraft.codechicken.core.launch.DepLoader
|
||||
coreModClass =
|
||||
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package baubles.common;
|
||||
|
||||
import baubles.api.expanded.BaubleItemHelper;
|
||||
import baubles.api.expanded.IBaubleExpanded;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* To be used to create standalone (i.e can't be used outside a bauble slot) bauble
|
||||
*/
|
||||
public abstract class BaubleItemBase extends Item implements IBaubleExpanded {
|
||||
|
||||
public BaubleItemBase(){
|
||||
super();
|
||||
setCreativeTab(CreativeTabs.tabTools);
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer player) {
|
||||
return BaubleItemHelper.onBaubleRightClick(itemStackIn, worldIn, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean debug) {
|
||||
BaubleItemHelper.addSlotInformation(tooltip, getBaubleTypes(stack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack itemStack, int a) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack itemStack, EntityLivingBase player) {}
|
||||
|
||||
@Override
|
||||
public void onEquipped(ItemStack itemStack, EntityLivingBase player) {}
|
||||
|
||||
@Override
|
||||
public void onUnequipped(ItemStack itemStack, EntityLivingBase player) {}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package baubles.common;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import baubles.Tags;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -25,7 +26,7 @@ public class Baubles {
|
||||
|
||||
public static final String MODID = "Baubles";
|
||||
public static final String MODNAME = "Baubles";
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
public static final String VERSION = Tags.VERSION;
|
||||
|
||||
@SidedProxy(clientSide = "baubles.client.ClientProxy", serverSide = "baubles.common.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@@ -4,31 +4,26 @@ import java.util.List;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import baubles.api.expanded.BaubleItemHelper;
|
||||
import baubles.api.expanded.IBaubleExpanded;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemDebugger extends Item implements IBaubleExpanded {
|
||||
public class ItemDebugger extends BaubleItemBase {
|
||||
|
||||
private IIcon[] icons;
|
||||
|
||||
public ItemDebugger() {
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setHasSubtypes(true);
|
||||
setCreativeTab(BaublesConfig.hideDebugItem ? null : CreativeTabs.tabTools);
|
||||
if (BaublesConfig.hideDebugItem){
|
||||
setCreativeTab(null);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister ir) {
|
||||
@@ -38,14 +33,12 @@ public class ItemDebugger extends Item implements IBaubleExpanded {
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return icons[meta >= icons.length ? 0 : meta];
|
||||
}
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return icons[meta >= icons.length ? 0 : meta];
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
@@ -53,11 +46,6 @@ public class ItemDebugger extends Item implements IBaubleExpanded {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer player) {
|
||||
return BaubleItemHelper.onBaubleRightClick(itemStackIn, worldIn, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBaubleTypes(ItemStack itemStack) {
|
||||
String type;
|
||||
@@ -75,41 +63,6 @@ public class ItemDebugger extends Item implements IBaubleExpanded {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean debug) {
|
||||
BaubleItemHelper.addSlotInformation(tooltip, getBaubleTypes(stack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack itemStack, EntityLivingBase player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack itemStack, int a) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEquipped(ItemStack itemStack, EntityLivingBase player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnequipped(ItemStack itemStack, EntityLivingBase player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquip(ItemStack itemStack, EntityLivingBase player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUnequip(ItemStack itemStack, EntityLivingBase player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getBackgroundIconForSlotType(String type) {
|
||||
if(type != null && BaubleExpandedSlots.isTypeRegistered(type)) {
|
||||
return icons[BaubleExpandedSlots.getIndexOfTypeInRegisteredTypes(type)];
|
||||
|
||||
Reference in new issue
Block a user