Everything posted by DasKaktus
-
[SOLVED]Cant get setCreativeTab to work
How is it messed upped?
-
[SOLVED]Cant get setCreativeTab to work
I reverted back all my code to the point before i was starting debugging, the call to setCreativeTab, except that i tried the CreativeTabs.tabCombat now. Here is the call to setCreativeTab: https://github.com/DasKaktus/KaktusMod/blob/master/main/java/kaktus/mods/kaktusmod/items/armor/TurtleshellArmor.java
-
[SOLVED]Cant get setCreativeTab to work
Here is the GitHub, hope you can help me. https://github.com/DasKaktus/KaktusMod (Don't judge my poorly coding skille, first time Minecraft modder )
-
[SOLVED]Cant get setCreativeTab to work
I have now tried with setCreativeTab(CreativeTabs.tabCombat); With the same result, nothing. Im setting up a github now if you want a better overlook.
-
[SOLVED]Cant get setCreativeTab to work
http://image.baver.se/img/Yb0a2Xd http://image.baver.se/img/VdUIrAO http://image.baver.se/img/XZE2h1J Believe me now?
-
[SOLVED]Cant get setCreativeTab to work
Then this must not be true, becaus i can /give my player the items, and i can wear them. Even the potion effect of the helmet works.
-
[SOLVED]Cant get setCreativeTab to work
Can they still show up ingame if i dont register them?
-
[SOLVED]Cant get setCreativeTab to work
It is in my preinit. No the items dont show up in the search bar.
-
[SOLVED]Cant get setCreativeTab to work
Because ive tried to move the createitems call all over the place hoping to find that it would work in one place. This merely the latest snapshot of my debugging.
-
[SOLVED]Cant get setCreativeTab to work
My bad, in the top post its the clientproxy not the common.
-
[SOLVED]Cant get setCreativeTab to work
my clientproxy: package kaktus.mods.kaktusmod.proxy; import kaktus.mods.kaktusmod.Config; import kaktus.mods.kaktusmod.KaktusMod; import kaktus.mods.kaktusmod.entities.passive.EntityTurtle; import kaktus.mods.kaktusmod.entities.renderer.RenderTurtle; import kaktus.mods.kaktusmod.items.kaktusItems; import kaktus.mods.kaktusmod.entities.kaktusMobs; import kaktus.mods.kaktusmod.models.ModelTurtle; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class ClientProxy extends CommonProxy { @Override public void preInit(FMLPreInitializationEvent event) { super.preInit(event); kaktusItems.createItems(); } @Override public void init(FMLInitializationEvent event) { super.init(event); kaktusItems.registerRenders(); kaktusMobs.init(); } @Override public void postInit(FMLPostInitializationEvent event) { super.postInit(event); } }
-
[SOLVED]Cant get setCreativeTab to work
In my commonproxy.java: public void preInit(FMLPreInitializationEvent event) { kaktusItems.createItems(); and then in my kaktusItems.java file: package kaktus.mods.kaktusmod.items; import kaktus.mods.kaktusmod.Config; import kaktus.mods.kaktusmod.KaktusMod; import kaktus.mods.kaktusmod.items.armor.TurtleshellArmor; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.registry.GameRegistry; public class kaktusItems { public static Item turtleShellHelmet; public static Item turtleShellChestplate; public static Item turtleShellLeggings; public static Item turtleShellBoots; public static ArmorMaterial turtleArmorMaterial = EnumHelper.addArmorMaterial( "turtleArmorMaterial", Config.MODID + ":turtleArmorMaterial", 1000, new int[] {3, 8, 6, 3}, 30); public static void createItems(){ turtleShellHelmet = new TurtleshellArmor("turtleshellhelmet", turtleArmorMaterial, 1, 0); turtleShellChestplate = new TurtleshellArmor("turtleshellchestplate", turtleArmorMaterial, 1, 1).setCreativeTab(KaktusMod.kaktusmodcreativetab); turtleShellLeggings = new TurtleshellArmor("turtleshellleggings", turtleArmorMaterial, 2, 2).setCreativeTab(KaktusMod.kaktusmodcreativetab); turtleShellBoots = new TurtleshellArmor("turtleshellboots", turtleArmorMaterial, 1, 3).setCreativeTab(KaktusMod.kaktusmodcreativetab); registerItems(); } public static void registerItems(){ GameRegistry.registerItem(turtleShellHelmet, turtleShellHelmet.getUnlocalizedName().substring(5)); GameRegistry.registerItem(turtleShellChestplate, turtleShellChestplate.getUnlocalizedName().substring(5)); GameRegistry.registerItem(turtleShellLeggings, turtleShellLeggings.getUnlocalizedName().substring(5)); GameRegistry.registerItem(turtleShellBoots, turtleShellBoots.getUnlocalizedName().substring(5)); } public static void registerRenders(){ registerRender(turtleShellHelmet); registerRender(turtleShellChestplate); registerRender(turtleShellLeggings); registerRender(turtleShellBoots); } public static void registerRender(Item item){ Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( item, 0, new ModelResourceLocation( Config.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } } Anf then finally my armor class: package kaktus.mods.kaktusmod.items.armor; import java.util.List; import kaktus.mods.kaktusmod.Config; import kaktus.mods.kaktusmod.KaktusMod; import kaktus.mods.kaktusmod.items.kaktusItems; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class TurtleshellArmor extends ItemArmor implements ISpecialArmor { public static final Enchantment[] helmetTurtleEnchantments = { Enchantment.thorns }; public static final int[] helmetTurtleEnchantmentLevels = { 3 }; public static final PotionEffect[] helmetTurtleEffects = { new PotionEffect(Potion.waterBreathing.id, 200, 0) }; public TurtleshellArmor(String unlocalizedName, ArmorMaterial material, int renderIndex, int armorType) { super(material, renderIndex, armorType); this.setUnlocalizedName(unlocalizedName); //this.setCreativeTab(KaktusMod.kaktusmodcreativetab); this.maxStackSize = 1; } @Override public void onCreated(ItemStack itemStack, World worldIn, EntityPlayer player) { if (itemStack.getDisplayName().equals("turtleshellhelmet")) { for (int i = 0; i < helmetTurtleEnchantments.length; i++) { itemStack.addEnchantment(helmetTurtleEnchantments[i], helmetTurtleEnchantmentLevels[i]); } } } @Override @SideOnly(Side.CLIENT) public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) { ItemStack itemStack = new ItemStack(itemIn, 1, 0); if (itemIn.equals(kaktusItems.turtleShellHelmet)) { for (int i = 0; i < helmetTurtleEnchantments.length; i++) { itemStack.addEnchantment(helmetTurtleEnchantments[i], helmetTurtleEnchantmentLevels[i]); } } } @Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if (itemStack.getItem().equals(kaktusItems.turtleShellHelmet)) { this.effectPlayer(player, Potion.waterBreathing, 0); } if (this.isWearingFullSet(player, kaktusItems.turtleShellHelmet, kaktusItems.turtleShellChestplate, kaktusItems.turtleShellLeggings, kaktusItems.turtleShellBoots)) { this.effectPlayer(player, Potion.regeneration, 1); } } private void effectPlayer(EntityPlayer player, Potion potion, int amplifier) { //Always effect for 8 seconds, then refresh if (player.getActivePotionEffect(potion) == null || player.getActivePotionEffect(potion).getDuration() <= 1) player.addPotionEffect(new PotionEffect(potion.id, 159, amplifier, true, true)); } private boolean isWearingFullSet(EntityPlayer player, Item helmet, Item chestplate, Item leggings, Item boots) { return player.inventory.armorItemInSlot(3) != null && player.inventory.armorItemInSlot(3).getItem() == helmet && player.inventory.armorItemInSlot(2) != null && player.inventory.armorItemInSlot(2).getItem() == chestplate && player.inventory.armorItemInSlot(1) != null && player.inventory.armorItemInSlot(1).getItem() == leggings && player.inventory.armorItemInSlot(0) != null && player.inventory.armorItemInSlot(0).getItem() == boots; } @Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { // TODO Auto-generated method stub return null; } @Override public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { // TODO Auto-generated method stub return 0; } @Override public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { // TODO Auto-generated method stub } } And then in my kaktusItems.java:
-
[SOLVED]Cant get setCreativeTab to work
Here is my main mod file: package kaktus.mods.kaktusmod; import kaktus.mods.kaktusmod.entities.passive.EntityTurtle; import kaktus.mods.kaktusmod.proxy.CommonProxy; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.common.registry.LanguageRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.common.util.EnumHelper; @Mod(modid = Config.MODID, name = Config.MODNAME, version = Config.VERSION, acceptedMinecraftVersions = "[1.8]", dependencies = "required-after:Forge@[11.14.3.1450,)") public class KaktusMod { @SidedProxy(clientSide = "kaktus.mods.kaktusmod.proxy.ClientProxy", serverSide = "kaktus.mods.kaktusmod.proxy.ServerProxy") public static CommonProxy proxy; @Mod.Instance(Config.MODID) public static KaktusMod instance; public static final KaktusTab kaktusmodcreativetab = new KaktusTab("KaktusModTab"); @EventHandler public void preinit(FMLPreInitializationEvent event) { proxy.preInit(event); } @EventHandler public void init(FMLInitializationEvent event) { proxy.init(event); } @EventHandler public void postInit(FMLPostInitializationEvent event) { proxy.postInit(event); } }
-
[SOLVED]Cant get setCreativeTab to work
Hi. I'm having trouble getting my items to show up on the custom creative tab that i made. The items can be spawned by /give command. And all textures are correct. Even my custom creative tab shows, but its empty.. I create my custom tab in my main mod file: public static final KaktusTab kaktusmodcreativetab = new KaktusTab("KaktusModTab"); My KaktusTab.java: package kaktus.mods.kaktusmod; import kaktus.mods.kaktusmod.items.kaktusItems; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class KaktusTab extends CreativeTabs{ public KaktusTab(String label) { super(label); this.setBackgroundImageName("kaktusmod.png"); } @Override public Item getTabIconItem() { return kaktusItems.turtleShellHelmet; } } And my createitems routine: turtleShellChestplate = new TurtleshellArmor("turtleshellchestplate", turtleArmorMaterial, 1, 1).setCreativeTab(KaktusMod.kaktusmodcreativetab); I have also tried this in my custom armor class constructor: this.setCreativeTab(KaktusMod.kaktusmodcreativetab); So anyone knows what im doing wrong?
IPS spam blocked by CleanTalk.