diff --git a/run/resourcepacks/unity/assets/techreborn/textures/items/nuggets/diamondNugget.png b/run/resourcepacks/unity/assets/techreborn/textures/items/nuggets/diamondNugget.png index cf3c314dc..1250f5366 100644 Binary files a/run/resourcepacks/unity/assets/techreborn/textures/items/nuggets/diamondNugget.png and b/run/resourcepacks/unity/assets/techreborn/textures/items/nuggets/diamondNugget.png differ diff --git a/run/resourcepacks/unity/assets/techreborn/textures/items/tool/energyCrystal.png b/run/resourcepacks/unity/assets/techreborn/textures/items/tool/energyCrystal.png index 592352776..0e4974a26 100644 Binary files a/run/resourcepacks/unity/assets/techreborn/textures/items/tool/energyCrystal.png and b/run/resourcepacks/unity/assets/techreborn/textures/items/tool/energyCrystal.png differ diff --git a/run/resourcepacks/unity/assets/techreborn/textures/items/tool/energyCrystalEmpty.png b/run/resourcepacks/unity/assets/techreborn/textures/items/tool/energyCrystalEmpty.png new file mode 100644 index 000000000..d683c6585 Binary files /dev/null and b/run/resourcepacks/unity/assets/techreborn/textures/items/tool/energyCrystalEmpty.png differ diff --git a/run/resourcepacks/unity/assets/techreborn/textures/items/tool/lapotronCrystal.png b/run/resourcepacks/unity/assets/techreborn/textures/items/tool/lapotronCrystal.png index 4e4f302e1..6d80c3cc2 100644 Binary files a/run/resourcepacks/unity/assets/techreborn/textures/items/tool/lapotronCrystal.png and b/run/resourcepacks/unity/assets/techreborn/textures/items/tool/lapotronCrystal.png differ diff --git a/run/resourcepacks/unity/assets/techreborn/textures/items/tool/lapotronCrystalEmpty.png b/run/resourcepacks/unity/assets/techreborn/textures/items/tool/lapotronCrystalEmpty.png new file mode 100644 index 000000000..8fc0545a9 Binary files /dev/null and b/run/resourcepacks/unity/assets/techreborn/textures/items/tool/lapotronCrystalEmpty.png differ diff --git a/run/resourcepacks/unity/assets/techreborn/textures/models/lapotronpack.png b/run/resourcepacks/unity/assets/techreborn/textures/models/lapotronpack.png new file mode 100644 index 000000000..fe6659629 Binary files /dev/null and b/run/resourcepacks/unity/assets/techreborn/textures/models/lapotronpack.png differ diff --git a/run/resourcepacks/unity/assets/techreborn/textures/models/lithiumbatpack.png b/run/resourcepacks/unity/assets/techreborn/textures/models/lithiumbatpack.png new file mode 100644 index 000000000..47fa5dbd6 Binary files /dev/null and b/run/resourcepacks/unity/assets/techreborn/textures/models/lithiumbatpack.png differ diff --git a/src/main/java/techreborn/client/RegisterItemJsons.java b/src/main/java/techreborn/client/RegisterItemJsons.java index 463c0eaf4..bb6bc0e1c 100644 --- a/src/main/java/techreborn/client/RegisterItemJsons.java +++ b/src/main/java/techreborn/client/RegisterItemJsons.java @@ -1,9 +1,11 @@ package techreborn.client; -import net.minecraft.client.Minecraft; +import net.minecraft.block.Block; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; +import net.minecraftforge.client.model.ModelLoader; import techreborn.init.ModBlocks; +import techreborn.init.ModItems; public class RegisterItemJsons { @@ -15,12 +17,36 @@ public class RegisterItemJsons private static void registerItems() { + register(ModItems.reBattery, "reBattery"); + register(ModItems.lithiumBattery, "lithiumBattery"); + register(ModItems.energyCrystal, "energyCrystal"); + register(ModItems.lapotronCrystal, "lapotronCrystal"); + register(ModItems.nanosaber, "nanosaber"); } private static void registerBlocks() { - Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( - Item.getItemFromBlock(ModBlocks.ironFence), 0, - new ModelResourceLocation("techreborn:ironFence", "inventory")); + register(ModBlocks.ironFence, "ironFence"); + } + + private static void register(Item item, int meta, String name) + { + ModelLoader.setCustomModelResourceLocation(item, meta, + new ModelResourceLocation("techreborn:" + name, "inventory")); + } + + private static void register(Item item, String name) + { + register(item, 0, name); + } + + private static void register(Block block, int meta, String name) + { + register(Item.getItemFromBlock(block), meta, name); + } + + private static void register(Block block, String name) + { + register(Item.getItemFromBlock(block), 0, name); } } diff --git a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java index d42304883..b3c5332cd 100644 --- a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java +++ b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java @@ -111,6 +111,15 @@ import java.util.List; jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidSodiumpersulfate)); jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidTritium)); jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidWolframium)); + jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidSulfur)); + jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidSulfuricAcid)); + jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidCarbon)); + jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidCarbonFiber)); + jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidNitroCarbon)); + jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidSodiumSulfide)); + jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidDiesel)); + jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidNitroDiesel)); + jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidOil)); registry.addRecipeCategories(new AlloySmelterRecipeCategory(guiHelper), new AssemblingMachineRecipeCategory(guiHelper), new BlastFurnaceRecipeCategory(guiHelper), diff --git a/src/main/java/techreborn/config/ConfigTechReborn.java b/src/main/java/techreborn/config/ConfigTechReborn.java index 2c5a3e0fa..fe45961b5 100644 --- a/src/main/java/techreborn/config/ConfigTechReborn.java +++ b/src/main/java/techreborn/config/ConfigTechReborn.java @@ -82,6 +82,7 @@ public class ConfigTechReborn public static boolean FreqTransmitterChat; public static boolean FreqTransmitterTooltip; + public static boolean NanosaberChat; // EU/T public static int CloakingDeviceEUTick; // Crafting @@ -373,6 +374,10 @@ public class ConfigTechReborn .get(CATEGORY_FEATURES, "Frequency Transmitter tooltips", true, "Allow Frequency Transmitter to display tooltip info") .getBoolean(true); + NanosaberChat = config + .get(CATEGORY_FEATURES, "Nanosaber Chat messages", true, "Allow Nanosaber chat messages") + .getBoolean(true); + enableGemArmorAndTools = config.get(CATEGORY_FEATURES, "Gem tools and armor", true, "Should the gem tools and armor be added to the game").getBoolean(true); // Crafting diff --git a/src/main/java/techreborn/init/ModItems.java b/src/main/java/techreborn/init/ModItems.java index cba8404eb..c6d797227 100644 --- a/src/main/java/techreborn/init/ModItems.java +++ b/src/main/java/techreborn/init/ModItems.java @@ -273,7 +273,7 @@ public class ModItems wrench = new ItemWrench(); registerItem(wrench, "wrench"); - nanosaber = new ItemNanosaber(); + nanosaber = PoweredItem.createItem(ItemNanosaber.class); registerItem(nanosaber, "nanosaber"); scrapBox = new ItemScrapBox(); diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 3d681948b..ffcc9a07d 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -423,13 +423,16 @@ public class ModRecipes new GrinderRecipe(new ItemStack(Blocks.IRON_ORE), ItemDusts.getDustByName("iron", 2), ticktime, eutick)); RecipeHandler.addRecipe( new GrinderRecipe(new ItemStack(Blocks.GOLD_ORE), ItemDusts.getDustByName("gold", 2), ticktime, eutick)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Items.COAL), ItemDusts.getDustByName("coal"), ticktime, eutick)); - RecipeHandler - .addRecipe(new GrinderRecipe(new ItemStack(Blocks.COAL_ORE), new ItemStack(Items.COAL, 2), ticktime, eutick)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15), ticktime, eutick)); - RecipeHandler - .addRecipe(new GrinderRecipe(new ItemStack(Blocks.COBBLESTONE), new ItemStack(Blocks.SAND), ticktime, eutick)); - RecipeHandler.addRecipe(new GrinderRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(new ItemStack(Items.COAL), ItemDusts.getDustByName("coal"), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(new ItemStack(Blocks.COAL_ORE), new ItemStack(Items.COAL, 2), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(new ItemStack(Blocks.COBBLESTONE), new ItemStack(Blocks.SAND), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT), ticktime, eutick)); // TechReborn RecipeHandler.addRecipe( @@ -442,6 +445,45 @@ public class ModRecipes new GrinderRecipe(BlockOre.getOreByName("Silver"), ItemDusts.getDustByName("silver", 2), ticktime, eutick)); RecipeHandler .addRecipe(new GrinderRecipe(ItemGems.getGemByName("ruby"), ItemDusts.getDustByName("ruby"), ticktime, eutick)); + + // Ingots to Dust + RecipeHandler.addRecipe( + new GrinderRecipe(new ItemStack(Items.IRON_INGOT), ItemDusts.getDustByName("iron", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(new ItemStack(Items.GOLD_INGOT), ItemDusts.getDustByName("gold", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("aluminum"), ItemDusts.getDustByName("aluminum", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("brass"), ItemDusts.getDustByName("brass", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("bronze"), ItemDusts.getDustByName("bronze", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("chrome"), ItemDusts.getDustByName("chrome", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("copper"), ItemDusts.getDustByName("copper", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("electrum"), ItemDusts.getDustByName("electrum", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("invar"), ItemDusts.getDustByName("invar", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("lead"), ItemDusts.getDustByName("lead", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("nickel"), ItemDusts.getDustByName("nickel", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("platinum"), ItemDusts.getDustByName("platinum", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("silver"), ItemDusts.getDustByName("silver", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("steel"), ItemDusts.getDustByName("steel", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("tin"), ItemDusts.getDustByName("tin", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("titanium"), ItemDusts.getDustByName("titanium", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("tungsten"), ItemDusts.getDustByName("tungsten", 1), ticktime, eutick)); + RecipeHandler.addRecipe( + new GrinderRecipe(ItemIngots.getIngotByName("zinc"), ItemDusts.getDustByName("zinc", 1), ticktime, eutick)); + } // static void addHammerRecipes() diff --git a/src/main/java/techreborn/items/ItemTRNoDestroy.java b/src/main/java/techreborn/items/ItemTRNoDestroy.java new file mode 100644 index 000000000..766098b50 --- /dev/null +++ b/src/main/java/techreborn/items/ItemTRNoDestroy.java @@ -0,0 +1,15 @@ +package techreborn.items; + +import net.minecraft.item.Item; +import techreborn.client.TechRebornCreativeTab; + +public class ItemTRNoDestroy extends Item +{ + + public ItemTRNoDestroy() + { + setNoRepair(); + setCreativeTab(TechRebornCreativeTab.instance); + } + +} diff --git a/src/main/java/techreborn/items/battery/ItemBattery.java b/src/main/java/techreborn/items/battery/ItemBattery.java index f47805596..6f451dbe9 100644 --- a/src/main/java/techreborn/items/battery/ItemBattery.java +++ b/src/main/java/techreborn/items/battery/ItemBattery.java @@ -1,18 +1,22 @@ package techreborn.items.battery; -import java.util.List; - import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import reborncore.api.power.IEnergyItemInfo; import reborncore.common.powerSystem.PoweredItem; -import techreborn.client.TechRebornCreativeTab; -import techreborn.items.ItemTextureBase; +import techreborn.items.ItemTRNoDestroy; -public class ItemBattery extends ItemTextureBase implements IEnergyItemInfo +import javax.annotation.Nullable; +import java.util.List; + +public class ItemBattery extends ItemTRNoDestroy implements IEnergyItemInfo { String name = "null"; @@ -30,7 +34,18 @@ public class ItemBattery extends ItemTextureBase implements IEnergyItemInfo this.maxEnergy=maxEnergy; this.maxTransfer=maxTransfer; this.tier=tier; - setCreativeTab(TechRebornCreativeTab.instance); + this.addPropertyOverride(new ResourceLocation("techreborn:empty"), new IItemPropertyGetter() + { + @SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn, + @Nullable EntityLivingBase entityIn) + { + if (stack != null && PoweredItem.getEnergy(stack) == 0.0) + { + return 1.0F; + } + return 0.0F; + } + }); } @SuppressWarnings({ "rawtypes", "unchecked" }) @@ -88,16 +103,4 @@ public class ItemBattery extends ItemTextureBase implements IEnergyItemInfo { return tier; } - - @Override - public String getTextureName(int damage) - { - return "techreborn:items/tool/"+name; - } - - @Override - public int getMaxMeta() - { - return 1; - } } diff --git a/src/main/java/techreborn/items/battery/ItemReBattery.java b/src/main/java/techreborn/items/battery/ItemReBattery.java index 0030458e2..4c8eef762 100644 --- a/src/main/java/techreborn/items/battery/ItemReBattery.java +++ b/src/main/java/techreborn/items/battery/ItemReBattery.java @@ -1,8 +1,10 @@ package techreborn.items.battery; -public class ItemReBattery extends ItemBattery { +public class ItemReBattery extends ItemBattery +{ - public ItemReBattery() { + public ItemReBattery() + { super("rebattery", 10000, 64, 1); } } diff --git a/src/main/java/techreborn/items/tools/ItemNanosaber.java b/src/main/java/techreborn/items/tools/ItemNanosaber.java index ef77ab79c..c8d96bc0a 100644 --- a/src/main/java/techreborn/items/tools/ItemNanosaber.java +++ b/src/main/java/techreborn/items/tools/ItemNanosaber.java @@ -1,187 +1,209 @@ package techreborn.items.tools; -import java.util.List; - -import me.modmuss50.jsonDestroyer.api.IHandHeld; -import me.modmuss50.jsonDestroyer.api.ITexturedItem; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.translation.I18n; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import reborncore.RebornCore; import reborncore.api.power.IEnergyItemInfo; import reborncore.common.powerSystem.PoweredItem; -import reborncore.common.util.ItemNBTHelper; +import reborncore.common.util.ChatUtils; import techreborn.client.TechRebornCreativeTab; -import techreborn.lib.ModInfo; +import techreborn.config.ConfigTechReborn; +import techreborn.init.ModItems; +import techreborn.lib.MessageIDs; -import net.minecraft.item.Item.ToolMaterial; -public class ItemNanosaber extends ItemSword implements IEnergyItemInfo, ITexturedItem, IHandHeld +import javax.annotation.Nullable; +import java.util.List; + +public class ItemNanosaber extends ItemSword implements IEnergyItemInfo { - - public static int tier = 1; - public int maxCharge = 1; public int cost = 250; - public float unpoweredSpeed = 2.0F; - public double transferLimit = 100; public ItemNanosaber() { super(ToolMaterial.DIAMOND); + setNoRepair(); setCreativeTab(TechRebornCreativeTab.instance); setMaxStackSize(1); - setMaxDamage(240); + setMaxDamage(1); setUnlocalizedName("techreborn.nanosaber"); - RebornCore.jsonDestroyer.registerObject(this); - this.maxCharge = 1000; - this.tier = 2; + this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter() + { + @SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn, + @Nullable EntityLivingBase entityIn) + { + if (stack != null && stack.getTagCompound().getBoolean("isActive")) + { + return 1.0F; + } + return 0.0F; + } + }); } - @Override - public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) + @Override public Multimap getAttributeModifiers(EntityEquipmentSlot slot, + ItemStack stack) + { + Multimap multimap = HashMultimap.create(); + int modifier = 0; + if (stack.getTagCompound().getBoolean("isActive")) + modifier = 9; + + if (slot == EntityEquipmentSlot.MAINHAND) + { + multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), + new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double) modifier, 0)); + multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), + new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0)); + } + return multimap; + } + + @Override public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, + EntityLivingBase entityliving1) + { + if (PoweredItem.canUseEnergy(cost, itemstack)) + { + PoweredItem.useEnergy(cost, itemstack); + return true; + } else + { + return false; + } + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) public void getSubItems(Item item, + CreativeTabs par2CreativeTabs, List itemList) + { + ItemStack inactiveUncharged = new ItemStack(ModItems.nanosaber); + inactiveUncharged.setTagCompound(new NBTTagCompound()); + inactiveUncharged.getTagCompound().setBoolean("isActive", false); + + ItemStack inactiveCharged = new ItemStack(ModItems.nanosaber); + inactiveCharged.setTagCompound(new NBTTagCompound()); + inactiveCharged.getTagCompound().setBoolean("isActive", false); + PoweredItem.setEnergy(getMaxPower(inactiveCharged), inactiveCharged); + + ItemStack activeUncharged = new ItemStack(ModItems.nanosaber); + activeUncharged.setTagCompound(new NBTTagCompound()); + activeUncharged.getTagCompound().setBoolean("isActive", true); + + ItemStack activeCharged = new ItemStack(ModItems.nanosaber); + activeCharged.setTagCompound(new NBTTagCompound()); + activeCharged.getTagCompound().setBoolean("isActive", true); + PoweredItem.setEnergy(getMaxPower(activeCharged), activeCharged); + + itemList.add(inactiveUncharged); + itemList.add(inactiveCharged); + itemList.add(activeUncharged); + itemList.add(activeCharged); + } + + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) + { + if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) + { + list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberInactive")); + } else + { + list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberActive")); + } + } + + @Override public boolean showDurabilityBar(ItemStack stack) { - PoweredItem.useEnergy(cost, itemstack); return true; } - @Override - public ActionResult onItemRightClick(ItemStack stack, World worldIn, EntityPlayer player, EnumHand hand) + @Override public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, + EnumHand hand) { if (player.isSneaking()) { - changeMode(stack); + if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) + { + stack.setTagCompound(new NBTTagCompound()); + stack.getTagCompound().setBoolean("isActive", true); + if (!world.isRemote && ConfigTechReborn.NanosaberChat) + { + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString( + TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " " + + TextFormatting.GOLD + I18n + .translateToLocal("techreborn.message.nanosaberActive"))); + } + } else + { + stack.getTagCompound().setBoolean("isActive", false); + if (!world.isRemote && ConfigTechReborn.NanosaberChat) + { + ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString( + TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " " + + TextFormatting.GOLD + I18n + .translateToLocal("techreborn.message.nanosaberInactive"))); + } + } } - return new ActionResult<>(EnumActionResult.FAIL, stack); + return new ActionResult<>(EnumActionResult.SUCCESS, stack); } - public void changeMode(ItemStack stack) + @Override public double getDurabilityForDisplay(ItemStack stack) { - if (!ItemNBTHelper.verifyExistance(stack, "isActive")) + if (PoweredItem.getEnergy(stack) > getMaxPower(stack)) { - ItemNBTHelper.setBoolean(stack, "isActive", true); - } else if (ItemNBTHelper.verifyExistance(stack, "isActive")) - { - stack.getTagCompound().removeTag("isActive"); + return 0; } - } - - public boolean isItemActive(ItemStack stack) - { - return !ItemNBTHelper.verifyExistance(stack, "isActive"); - } - -// @SideOnly(Side.CLIENT) -// @Override -// public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) -// { -// if (ItemNBTHelper.verifyExistance(stack, "isActive")) -// { -// list.add("Active"); -// } else if (!ItemNBTHelper.verifyExistance(stack, "isActive")) -// { -// list.add("Not Active"); -// } -// super.addInformation(stack, player, list, par4); -// } - - @Override - public boolean isRepairable() - { - return false; - } - - @Override - public double getMaxPower(ItemStack stack) - { - return maxCharge; - } - - @Override - public boolean canAcceptEnergy(ItemStack stack) - { - return true; - } - - @Override - public boolean canProvideEnergy(ItemStack stack) - { - return false; - } - - @Override - public double getMaxTransfer(ItemStack stack) - { - return transferLimit; - } - - @Override - public int getStackTier(ItemStack stack) - { - return tier; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) - { - ItemStack itemStack = new ItemStack(this, 1); - itemList.add(itemStack); - - ItemStack charged = new ItemStack(this, 1); - PoweredItem.setEnergy(getMaxPower(charged), charged); - itemList.add(charged); - } - - @Override - public double getDurabilityForDisplay(ItemStack stack) - { double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack)); return 1 - charge; + } - @Override - public boolean showDurabilityBar(ItemStack stack) + @Override public boolean isRepairable() + { + return false; + } + + @Override public double getMaxPower(ItemStack stack) + { + return 100000; + } + + @Override public boolean canAcceptEnergy(ItemStack stack) { return true; } - @Override - public String getTextureName(int damage) + @Override public boolean canProvideEnergy(ItemStack stack) { - if (damage == 1) - { - return "techreborn:items/tool/nanosaber_on"; - } - return "techreborn:items/tool/nanosaber_off"; + return false; } - @Override - public int getMaxMeta() + @Override public double getMaxTransfer(ItemStack stack) + { + return 512; + } + + @Override public int getStackTier(ItemStack stack) { return 2; } - - @Override - @SideOnly(Side.CLIENT) - public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) - { - return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory"); - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) - { - tooltip.add(TextFormatting.RED + "WIP Coming Soon"); - } } diff --git a/src/main/java/techreborn/lib/MessageIDs.java b/src/main/java/techreborn/lib/MessageIDs.java index 5cce05555..79cb3feff 100644 --- a/src/main/java/techreborn/lib/MessageIDs.java +++ b/src/main/java/techreborn/lib/MessageIDs.java @@ -8,4 +8,5 @@ public class MessageIDs public static int freqTransmitterID = 0; public static int fluidPipeID = 1; public static int playerDetectorID = 2; + public static int nanosaberID = 3; } diff --git a/src/main/java/techreborn/proxies/ClientProxy.java b/src/main/java/techreborn/proxies/ClientProxy.java index 7930f2ba8..eca79dab1 100644 --- a/src/main/java/techreborn/proxies/ClientProxy.java +++ b/src/main/java/techreborn/proxies/ClientProxy.java @@ -79,13 +79,13 @@ public class ClientProxy extends CommonProxy } }); ModelBakery.registerItemVariants(ModItems.dynamicCell, MODEL_DYNAMIC_CELL); + RegisterItemJsons.registerModels(); } @Override public void init(FMLInitializationEvent event) { super.init(event); - RegisterItemJsons.registerModels(); MinecraftForge.EVENT_BUS.register(new IconSupplier()); MinecraftForge.EVENT_BUS.register(new ChargeHud()); //MinecraftForge.EVENT_BUS.register(new VersionCheckerClient()); diff --git a/src/main/resources/assets/techreborn/lang/en_US.lang b/src/main/resources/assets/techreborn/lang/en_US.lang index afc467461..2950c2062 100644 --- a/src/main/resources/assets/techreborn/lang/en_US.lang +++ b/src/main/resources/assets/techreborn/lang/en_US.lang @@ -365,44 +365,7 @@ item.techreborn.dustsmall.andesite.name=Small Pile of Andesite Dust item.techreborn.dustsmall.diorite.name=Small Pile of Diorite Dust item.techreborn.dustsmall.granite.name=Small Pile of Granite Dust -#Cells -item.techreborn.cell.Berylium.name=Beryllium Cell -item.techreborn.cell.biomass.name=Biomass Cell -item.techreborn.cell.calciumCarbonate.name=Calcium Carbonate Cell -item.techreborn.cell.calcium.name=Calcium Cell -item.techreborn.cell.carbon.name=Carbon Cell -item.techreborn.cell.chlorine.name=Chlorine Cell -item.techreborn.cell.deuterium.name=Deuterium Cell -item.techreborn.cell.diesel.name=Diesel Cell -item.techreborn.cell.ethanol.name=Ethanol Cell -item.techreborn.cell.glyceryl.name=Glyceryl Cell -item.techreborn.cell.helium3.name=Helium3 Cell -item.techreborn.cell.helium.name=Helium Cell -item.techreborn.cell.heliumPlasma.name=Helium Plasma Cell -item.techreborn.cell.hydrogen.name=Hydrogen Cell -item.techreborn.cell.ice.name=Ice Cell -item.techreborn.cell.lithium.name=Lithium Cell -item.techreborn.cell.mercury.name=Mercury Cell -item.techreborn.cell.methane.name=Methane Cell -item.techreborn.cell.nitrocarbon.name=Nitrocarbon Cell -item.techreborn.cell.nitroCoalfuel.name=Nitro Coal Fuel Cell -item.techreborn.cell.nitroDiesel.name=Nitro Diesel Cell -item.techreborn.cell.nitrogen.name=Nitrogen Cell -item.techreborn.cell.nitrogenDioxide.name=Nitrogen Dioxide Cell -item.techreborn.cell.oil.name=Oil Cell -item.techreborn.cell.potassium.name=Potassium Cell -item.techreborn.cell.seedOil.name=Seed Oil Cell -item.techreborn.cell.silicon.name=Silicon Cell -item.techreborn.cell.sodium.name=Sodium Cell -item.techreborn.cell.sodiumPersulfate.name=Sodium Persulfate Cell -item.techreborn.cell.sodiumSulfide.name=Sodium Sulfide Cell -item.techreborn.cell.sulfur.name=Sulfur Cell -item.techreborn.cell.sulfuricAcid.name=Sulfuric Acid Cell -item.techreborn.cell.tritium.name=Tritium Cell -item.techreborn.cell.wolframium.name=Wolframium Cell -item.techreborn.cell.empty.name=Empty Cell -item.techreborn.cell.water.name=Water Cell -item.techreborn.cell.lava.name=Lava Cell +item.techreborn.cell.name=Empty Cell item.techreborn.rebattery.name=Battery item.techreborn.lithiumBattery.name=Lithium Battery item.techreborn.energyCrystal.name=Energy Crystal @@ -983,6 +946,8 @@ techreborn.message.detects=Detects techreborn.message.allPlayers=All Players techreborn.message.onlyOtherPlayers=Only Other Players techreborn.message.onlyYou=Only You +techreborn.message.nanosaberActive=Active +techreborn.message.nanosaberInactive=Inactive #Cables Cable.copperCable.name=Copper Cable diff --git a/src/main/resources/assets/techreborn/models/item/energyCrystal.json b/src/main/resources/assets/techreborn/models/item/energyCrystal.json new file mode 100644 index 000000000..87a1dc719 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/energyCrystal.json @@ -0,0 +1,14 @@ +{ + "parent": "techreborn:item/techrebornItem", + "textures": { + "layer0": "techreborn:items/tool/energyCrystal" + }, + "overrides": [ + { + "predicate": { + "techreborn:empty": 1 + }, + "model": "techreborn:item/energyCrystalEmpty" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/energyCrystalEmpty.json b/src/main/resources/assets/techreborn/models/item/energyCrystalEmpty.json new file mode 100644 index 000000000..942cc38cf --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/energyCrystalEmpty.json @@ -0,0 +1,6 @@ +{ + "parent": "techreborn:item/techrebornItem", + "textures": { + "layer0": "techreborn:items/tool/energyCrystalEmpty" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/lapotronCrystal.json b/src/main/resources/assets/techreborn/models/item/lapotronCrystal.json new file mode 100644 index 000000000..2e3ed8952 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/lapotronCrystal.json @@ -0,0 +1,14 @@ +{ + "parent": "techreborn:item/techrebornItem", + "textures": { + "layer0": "techreborn:items/tool/lapotronCrystal" + }, + "overrides": [ + { + "predicate": { + "techreborn:empty": 1 + }, + "model": "techreborn:item/lapotronCrystalEmpty" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/lapotronCrystalEmpty.json b/src/main/resources/assets/techreborn/models/item/lapotronCrystalEmpty.json new file mode 100644 index 000000000..aa286dcc3 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/lapotronCrystalEmpty.json @@ -0,0 +1,6 @@ +{ + "parent": "techreborn:item/techrebornItem", + "textures": { + "layer0": "techreborn:items/tool/lapotronCrystalEmpty" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/lithiumBattery.json b/src/main/resources/assets/techreborn/models/item/lithiumBattery.json new file mode 100644 index 000000000..b446171d8 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/lithiumBattery.json @@ -0,0 +1,14 @@ +{ + "parent": "techreborn:item/techrebornItem", + "textures": { + "layer0": "techreborn:items/tool/lithiumBattery" + }, + "overrides": [ + { + "predicate": { + "techreborn:empty": 1 + }, + "model": "techreborn:item/lithiumBatteryEmpty" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/lithiumBatteryEmpty.json b/src/main/resources/assets/techreborn/models/item/lithiumBatteryEmpty.json new file mode 100644 index 000000000..5573739c3 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/lithiumBatteryEmpty.json @@ -0,0 +1,6 @@ +{ + "parent": "techreborn:item/techrebornItem", + "textures": { + "layer0": "techreborn:items/tool/lithiumBatteryEmpty" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/nanosaber.json b/src/main/resources/assets/techreborn/models/item/nanosaber.json new file mode 100644 index 000000000..eb15f20ef --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/nanosaber.json @@ -0,0 +1,14 @@ +{ + "parent": "techreborn:item/techrebornItem", + "textures": { + "layer0": "techreborn:items/tool/nanosaber_off" + }, + "overrides": [ + { + "predicate": { + "techreborn:active": 1 + }, + "model": "techreborn:item/nanosaberActive" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/nanosaberActive.json b/src/main/resources/assets/techreborn/models/item/nanosaberActive.json new file mode 100644 index 000000000..d2edeb968 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/nanosaberActive.json @@ -0,0 +1,6 @@ +{ + "parent": "techreborn:item/techrebornItem", + "textures": { + "layer0": "techreborn:items/tool/nanosaber_on" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/reBattery.json b/src/main/resources/assets/techreborn/models/item/reBattery.json new file mode 100644 index 000000000..008987e13 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/reBattery.json @@ -0,0 +1,14 @@ +{ + "parent": "techreborn:item/techrebornItem", + "textures": { + "layer0": "techreborn:items/tool/reBattery" + }, + "overrides": [ + { + "predicate": { + "techreborn:empty": 1 + }, + "model": "techreborn:item/reBatteryEmpty" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/reBatteryEmpty.json b/src/main/resources/assets/techreborn/models/item/reBatteryEmpty.json new file mode 100644 index 000000000..a3fe39da4 --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/reBatteryEmpty.json @@ -0,0 +1,6 @@ +{ + "parent": "techreborn:item/techrebornItem", + "textures": { + "layer0": "techreborn:items/tool/reBatteryEmpty" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/models/item/techrebornItem.json b/src/main/resources/assets/techreborn/models/item/techrebornItem.json new file mode 100644 index 000000000..9a5d7fc5e --- /dev/null +++ b/src/main/resources/assets/techreborn/models/item/techrebornItem.json @@ -0,0 +1,3 @@ +{ + "parent": "item/generated" +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/textures/items/dust/andesiteDust.png b/src/main/resources/assets/techreborn/textures/items/dust/andesiteDust.png new file mode 100644 index 000000000..d125c7925 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/items/dust/andesiteDust.png differ diff --git a/src/main/resources/assets/techreborn/textures/items/dust/dioriteDust.png b/src/main/resources/assets/techreborn/textures/items/dust/dioriteDust.png new file mode 100644 index 000000000..4f7a6ac60 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/items/dust/dioriteDust.png differ diff --git a/src/main/resources/assets/techreborn/textures/items/dust/graniteDust.png b/src/main/resources/assets/techreborn/textures/items/dust/graniteDust.png new file mode 100644 index 000000000..ef00f87d7 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/items/dust/graniteDust.png differ diff --git a/src/main/resources/assets/techreborn/textures/items/tool/nanosaber_on.png.mcmeta b/src/main/resources/assets/techreborn/textures/items/tool/nanosaber_on.png.mcmeta index 97596ba81..dfae8cae1 100644 --- a/src/main/resources/assets/techreborn/textures/items/tool/nanosaber_on.png.mcmeta +++ b/src/main/resources/assets/techreborn/textures/items/tool/nanosaber_on.png.mcmeta @@ -1,5 +1,5 @@ { "animation":{ - "frametime":2 + "frametime":1 } } \ No newline at end of file