2
0
Fork 0

Added creative tabs

frozen
Shinare 1 year ago
parent 866f0db550
commit c9d8830b04

@ -382,6 +382,7 @@ public class CinderLoE {
recipes.registerRecipes(); // Register recipes at com.zivilon.cinder_loe.recipes.java
setupTradeEntries();
LOTRWeaponStats.registerMeleeReach(Whip.class, 1.5F);
LoECreativeTabs.setupIcons();
}

@ -0,0 +1,47 @@
package com.zivilon.cinder_loe;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class LoECreativeTabs extends CreativeTabs {
public static LoECreativeTabs tabBlockLoE = new LoECreativeTabs("tabBlockLoE");
public static LoECreativeTabs tabCombatLoE = new LoECreativeTabs("tabCombatLoE");
public static LoECreativeTabs tabSpawnLoE = new LoECreativeTabs("tabSpawnLoE");
public static LoECreativeTabs tabMiscLoE = new LoECreativeTabs("tabMiscLoE");
public static LoECreativeTabs tabFoodLoE = new LoECreativeTabs("tabFoodLoE");
public static LoECreativeTabs tabDecoLoE = new LoECreativeTabs("tabDecoLoE");
public ItemStack theIcon;
public LoECreativeTabs(String label) {
super(label);
}
public static void setupIcons() {
tabBlockLoE.theIcon = new ItemStack(CinderLoE.fishBarrel);
tabCombatLoE.theIcon = new ItemStack(CinderLoE.swordAsh);
tabSpawnLoE.theIcon = new ItemStack(CinderLoE.renegadeSpawnEgg);
tabMiscLoE.theIcon = new ItemStack(CinderLoE.bonemold);
tabFoodLoE.theIcon = new ItemStack(CinderLoE.onion);
tabDecoLoE.theIcon = new ItemStack(CinderLoE.silverChain);
}
@SideOnly(Side.CLIENT)
public String getTranslatedTabLabel() {
return StatCollector.translateToLocal("cinder_loe.creativetab." + getTabLabel());
}
@SideOnly(Side.CLIENT)
public Item getTabIconItem() {
return this.theIcon.getItem();
}
public ItemStack getIconItemStack() {
return this.theIcon;
}
}

@ -2,12 +2,11 @@ package com.zivilon.cinder_loe.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import lotr.common.LOTRCreativeTabs;
import com.zivilon.cinder_loe.LoECreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.IIcon;
import java.lang.reflect.Field;
@ -22,13 +21,7 @@ public class barricade extends Block {
private IIcon field_149949_b;
public barricade() {
super(Material.wood); // Choose the appropriate material
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
setCreativeTab(LoECreativeTabs.tabBlockLoE);
setHardness(5.0F);
setResistance(15.0F);
setStepSound(Block.soundTypeWood);

@ -3,11 +3,10 @@ package com.zivilon.cinder_loe.blocks;
import com.zivilon.cinder_loe.util.Utilities;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import lotr.common.LOTRCreativeTabs;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import com.zivilon.cinder_loe.LoECreativeTabs;
import java.lang.reflect.Field;
@ -15,13 +14,7 @@ public class plaster extends Block {
public plaster() {
super(Material.rock); // Choose the appropriate material
try {
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
setCreativeTab((CreativeTabs)tab);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
setCreativeTab(LoECreativeTabs.tabBlockLoE);
// Set other properties like hardness, resistance, name, etc.
setHardness(2.0F);
setResistance(5.0F);

@ -2,7 +2,7 @@ package com.zivilon.cinder_loe.items;
import com.zivilon.cinder_loe.entity.projectile.EntityWarDart;
import lotr.common.LOTRCreativeTabs;
import com.zivilon.cinder_loe.LoECreativeTabs;
import lotr.common.dispenser.LOTRDispenseThrowingAxe;
import lotr.common.enchant.LOTREnchantment;
import lotr.common.enchant.LOTREnchantmentHelper;
@ -23,7 +23,7 @@ import net.minecraft.world.World;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.creativetab.CreativeTabs;
import java.util.List;
public class WarDart extends Item {
@ -33,6 +33,7 @@ public class WarDart extends Item {
this.setHasSubtypes(true);
setMaxStackSize(4);
this.setMaxDamage(0);
setCreativeTab(LoECreativeTabs.tabCombatLoE);
}
@Override
@ -146,5 +147,17 @@ public class WarDart extends Item {
double damagePercent = getDamageFromMeta(damageMeta) * (1.0 / 8) * 100.0;
double roundedDamagePercent = 5 * Math.round(damagePercent / 5.0);
list.add(EnumChatFormatting.DARK_GREEN + "Ranged damage: " + roundedDamagePercent + "%");
if (damageMeta > 0) {
double damagePercent = getDamageFromMeta(damageMeta) * (1.0 / 8) * 100.0;
double roundedDamagePercent = 5 * Math.round(damagePercent / 5.0);
list.add(EnumChatFormatting.DARK_GREEN + "Ranged damage: " + roundedDamagePercent + "%");
}
}
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < icons.length; i++) {
list.add(new ItemStack(item, 1, i));
}
}
}

Loading…
Cancel
Save