Получить текстурку предмета

Версия Minecraft
1.7.10
59
0
Здравствуйте,сделал что-то типо яблока(короче не важно к самой проблеме)=
ГлавКласс:
Код:
import cpw.mods.fml.common.*;
import cpw.mods.fml.common.Mod.*;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.registry.*;
import net.minecraft.block.Block;
import net.minecraft.creativetab.*;
import net.minecraft.item.*;
import ru.denik.item.*;
@Mod (modid = "Vanila", name="Vanila", version = "1.0")
public class MainClass {
 
 public static Item appleblue = new AppleBlue(2022, 6, 0.4F, true).setUnlocalizedName("appleblue");
 
 @EventHandler
 public void load(FMLInitializationEvent event) {
 LanguageRegistry.addName(appleblue, "Синие яблоко");
 
 }
 @EventHandler
 public void preLoad(FMLPreInitializationEvent e) {
 }
 
}

КлассЯблока:
Код:
import net.minecraft.item.*;

public class AppleBlue extends ItemFood{

 public AppleBlue(int par1,int par2, float par3, boolean par4) {
 super(par1, par2, par4);
 maxStackSize = 64;
 }

}
И мне нужно получить текстурку но как?
И да подскажите API майна или форджа)
 
Решение
Denik написал(а):
Garik1303 написал(а):
Denik написал(а):
И мне нужно получить текстурку но как?
Какую именно текстуру?

https://prnt.sc/ggwe0e

В класс яблока

Код:
this.setTextureName("HelmetWithFlashlight");



В @EventHandler
public void preLoad(FMLPreInitializationEvent event)

Код:
.setTextureName("minecraft:apple_blue");
1,200
37
237
Denik написал(а):
Код:
public static ToolMaterial leadsword = EnumHelper.addToolMaterial("leadsword", 4, 1264, 7, 3, 18);
Думаю вас устраивает такой вариант.А проблема не решена.
Зачем в названии материала 'меч'? У тебя же стол (например) сделан из дерева, а не деревостола.
Код:
И да подскажите API майна или форджа)

Вот, качай src для нужной версии (так как 1.7.10, то качай latest). Установку и разбирательство можешь найти тут, в учебнике сайта, просто в гуголе.

Чтобы можно было есть, не страдай и унаследуй свой предмет нет от Item, а от ItemFood.
 
59
0
MJaroslav написал(а):
Denik написал(а):
Код:
public static ToolMaterial leadsword = EnumHelper.addToolMaterial("leadsword", 4, 1264, 7, 3, 18);
Думаю вас устраивает такой вариант.А проблема не решена.
Зачем в названии материала 'меч'? У тебя же стол (например) сделан из дерева, а не деревостола.
Код:
И да подскажите API майна или форджа)

Вот, качай src для нужной версии (так как 1.7.10, то качай latest). Установку и разбирательство можешь найти тут, в учебнике сайта, просто в гуголе.

Чтобы можно было есть, не страдай и унаследуй свой предмет нет от Item, а от ItemFood.
1.Мне главное чтоб работало)
2.Я не про то имел ввиду ниже я написал что было бы как у Bukkit API делали сайты, а там все методы и т.д
3.Я тогда просто забыл вырубить креатив


timaxa007 написал(а):
Denik, пожалуйста.
В preInit'е регистрируешь?

Я понял ты про это
Код:
public void preLoad(FMLPreInitializationEvent e) {
Да тут
 

timaxa007

Модератор
5,831
409
672
Denik написал(а):
Я понял ты про это
Код:
public void preLoad(FMLPreInitializationEvent e) {
Да тут
Да, я про это. Трудно предположить из-за чего, если не видно самой проблемы.
 
59
0
timaxa007 написал(а):
Denik написал(а):
Я понял ты про это
Код:
public void preLoad(FMLPreInitializationEvent e) {
Да тут
Да, я про это. Трудно предположить из-за чего, если не видно самой проблемы.

Так как мне зарегистрировать ?
 

timaxa007

Модератор
5,831
409
672
В главном классе или где надо, создаёшь переменную или константу блока или предмета и даёшь ему нужно значение. И регистрируешь в preInit'е.
 
3,005
192
592
Скинь код, как ты регистрируешь и где ошибка.
(Вот это и нужно предоставлять, если у тебя ошибка в чем-либо!)
 
59
0
Agravaine написал(а):
Ты головой думаешь или тупо копируешь все бездумно? Материал регать не нужно, а ты его пытаешься зарегать как предмет.
Нет копировать смысла нет, при тупом копирование я просто это запомню на день, а потом всё опять искать,просить.
Спасибо.Хоть тут люди нормальные!
 
59
0
В чём ошибка?Сделал броньку все норм,как сделал крафт пошло всё не так:
Код:
GameRegistry.addRecipe(new ItemStack(MainClass.leadhelmet),
 new Object[]{ "AAA", "A A", "  ",
                ('A'), new ItemStack(MainClass.leadingot)});
 GameRegistry.addRecipe(new ItemStack(MainClass.leadchestplate),
 new Object[]{ "A A", "AAA", "AAA",
 ('A'), new ItemStack(MainClass.leadingot)});
 GameRegistry.addRecipe(new ItemStack(MainClass.leadleggings),
 new Object[]{ "AAA", "A A", "A A",
 ('A'), new ItemStack(MainClass.leadingot)});
 GameRegistry.addRecipe(new ItemStack(MainClass.leadboots),
 new Object[]{ "  ", "A A", "A A",
 ('A'), new ItemStack(MainClass.leadingot)});
 
59
0
Thunder написал(а):
Что за ошибка? Могу предположить только что из-за "  ", потому что там 2 пробела, вместо трех...
Да нет везде 3 пробела
На всякий случай:
Класс:
Код:
import cpw.mods.fml.common.*;
import cpw.mods.fml.common.Mod.*;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.registry.*;
import net.minecraft.block.Block;
import net.minecraft.creativetab.*;
import net.minecraft.init.*;
import net.minecraft.item.*;
import net.minecraft.item.Item.*;
import net.minecraftforge.common.util.*;
import ru.denik.block.*;
import ru.denik.item.*;
import ru.denik.world.*;
@Mod (modid = "Vanila", name="Vanila", version = "1.0")
public class MainClass {
 
 public static CreativeTabs tabPlugin = new TabPlugin(CreativeTabs.getNextID(),"CreativeTab");
 
 public static Item appleblue = new AppleBlue(2530, 6, 0.5F, true).setUnlocalizedName("appleblue");
 public static Item leadingot = new LeadIngot(2531).setUnlocalizedName("leadingot");
 public static Item leadsword = new LeadSword();
 public static Item leadaxe = new LeadAxe();
 public static Item leadpickaxe = new LeadPickaxe();
 public static Item leadhoe = new LeadHoe();
 public static Item leadshovel = new LeadShovel();
 
 public static Item leadhelmet = new LeadArmor(0, 0).setUnlocalizedName("leadhelmet");
 public static Item leadchestplate = new LeadArmor(0, 1).setUnlocalizedName("leadchestplate");
 public static Item leadleggings = new LeadArmor(0, 2).setUnlocalizedName("leadleggings");
 public static Item leadboots = new LeadArmor(0, 3).setUnlocalizedName("leadboots");
 
 public static Block leadore = new LeadOre(2630);
 
 @EventHandler
 public void preLoad(FMLPreInitializationEvent e) { 
 appleblue.setTextureName("vanila:apple_blue");
 
 leadore.setBlockTextureName("vanila:lead_ore");
 leadingot.setTextureName("vanila:lead_ingot");
 leadsword.setTextureName("vanila:lead_sword");
 leadaxe.setTextureName("vanila:lead_axe");
 leadpickaxe.setTextureName("vanila:lead_pickaxe");
 leadhoe.setTextureName("vanila:lead_hoe");
 leadshovel.setTextureName("vanila:lead_shovel");
 
 leadhelmet.setTextureName("vanila:lead_helmet");
 leadchestplate.setTextureName("vanila:lead_chestplate");
 leadleggings.setTextureName("vanila:lead_leggings");
 leadboots.setTextureName("vanila:lead_boots");
 
 GameRegistry.registerItem(appleblue, "Синие яблоко");
 
 GameRegistry.registerItem(leadingot, "Свинцовый слиток");
 GameRegistry.registerItem(leadsword, "Свинцовый меч");
 GameRegistry.registerItem(leadaxe, "Свинцовый топор");
 GameRegistry.registerItem(leadpickaxe, "Свинцовая кирка");
 GameRegistry.registerItem(leadhoe, "Свинцовая мотыга");
 GameRegistry.registerItem(leadshovel, "Свинцовая лопата");
 
 GameRegistry.registerItem(leadhelmet, "leadhelmet");
 GameRegistry.registerItem(leadchestplate, "leadchestplate");
 GameRegistry.registerItem(leadleggings, "leadleggings");
 GameRegistry.registerItem(leadboots, "leadboots");
 
 GameRegistry.registerBlock(leadore, "Свинцовая руда"); 
 }
 @EventHandler
 public void load(FMLInitializationEvent event) {
 LanguageRegistry.addName(appleblue, "Синие яблоко");
 
 LanguageRegistry.addName(leadore, "Свинцовая руда");
 
 LanguageRegistry.addName(leadingot, "Свинцовый слиток");
 LanguageRegistry.addName(leadsword, "Свинцовый Меч");
 LanguageRegistry.addName(leadaxe, "Свинцовый топор");
 LanguageRegistry.addName(leadpickaxe, "Свинцовая кирка");
 LanguageRegistry.addName(leadhoe, "Свинцовая мотыга");
 LanguageRegistry.addName(leadshovel, "Свинцовая лопата");
 
 LanguageRegistry.addName(leadhelmet, "Свинцовый шлем");
 LanguageRegistry.addName(leadchestplate, "Свинцовый нагрудник");
 LanguageRegistry.addName(leadleggings, "Свинцовые поножи");
 LanguageRegistry.addName(leadboots, "Свинцовые ботинки");
 
 GameRegistry.addRecipe(new ItemStack(MainClass.appleblue, 2),
 new Object[]{ "AAA", "ABA", "AAA", 
 ('A'), new ItemStack(Items.dye, 1, 4), ('B'), Items.apple});
 
 GameRegistry.addRecipe(new ItemStack(MainClass.leadsword),
 new Object[]{ " A ", " A ", " B ",
 ('A'), new ItemStack(MainClass.leadingot), ('B'), Items.stick}); 
 GameRegistry.addRecipe(new ItemStack(MainClass.leadaxe),
 new Object[]{ "AA ", "AB ", " B ",
 ('A'), new ItemStack(MainClass.leadingot), ('B'), Items.stick});
 GameRegistry.addRecipe(new ItemStack(MainClass.leadpickaxe),
 new Object[]{ "AAA", " B ", " B ",
 ('A'), new ItemStack(MainClass.leadingot), ('B'), Items.stick});
 GameRegistry.addRecipe(new ItemStack(MainClass.leadhoe),
 new Object[]{ "AA ", " B ", " B ",
 ('A'), new ItemStack(MainClass.leadingot), ('B'), Items.stick}); 
 GameRegistry.addRecipe(new ItemStack(MainClass.leadshovel),
 new Object[]{ " A ", " B ", " B ",
 ('A'), new ItemStack(MainClass.leadingot), ('B'), Items.stick});
 
 GameRegistry.addRecipe(new ItemStack(MainClass.leadhelmet),
 new Object[]{ "AAA", "A A", "  ",
                ('A'), new ItemStack(MainClass.leadingot)});
 GameRegistry.addRecipe(new ItemStack(MainClass.leadchestplate),
 new Object[]{ "A A", "AAA", "AAA",
 ('A'), new ItemStack(MainClass.leadingot)});
 GameRegistry.addRecipe(new ItemStack(MainClass.leadleggings),
 new Object[]{ "AAA", "A A", "A A",
 ('A'), new ItemStack(MainClass.leadingot)});
 GameRegistry.addRecipe(new ItemStack(MainClass.leadboots),
 new Object[]{ "  ", "A A", "A A",
 ('A'), new ItemStack(MainClass.leadingot)});
 
 GameRegistry.addSmelting(leadore, new ItemStack(MainClass.leadingot, 2), 2.0F);
 }
 
}
Броня:
Код:
import net.minecraft.entity.*;
import net.minecraft.item.*;
import net.minecraftforge.common.util.*;
import ru.denik.mod.*;

public class LeadArmor extends ItemArmor{
 
  private String texturePath = "vanila:textures/model/armor/";
  
  static ArmorMaterial mat = EnumHelper.addArmorMaterial("lead", 20, new int[] {3, 6, 4, 3}, 18);

 public LeadArmor(int id, int armorType) {
 super(mat, armorType, armorType);
 setCreativeTab(MainClass.tabPlugin);
 setMaxStackSize(1);
 this.setTextureName();
 }
 public void setTextureName() {
 if (armorType == 0||armorType == 1||armorType == 3) {
 this.texturePath += "lead_layer_" + 1 + ".png";
 }
 else {
 this.texturePath += "lead_layer_" + 2 + ".png";
 }
 }
 @Override
    public String getArmorTexture(ItemStack itemstack, Entity entity, int slot, String type){
            return this.texturePath;
    }

}
 
59
0
Код:
---- Minecraft Crash Report ----
// Don't be sad. I'll do better next time, I promise!

Time: 07.09.17 18:58
Description: Initializing game

java.lang.StringIndexOutOfBoundsException: String index out of range: 8
 at java.lang.String.charAt(Unknown Source)
 at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:232)
 at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:250)
 at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:245)
 at ru.denik.mod.MainClass.load(MainClass.java:116)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
 at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
 at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
 at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
 at com.google.common.eventbus.EventBus.post(EventBus.java:275)
 at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
 at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
 at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
 at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
 at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
 at com.google.common.eventbus.EventBus.post(EventBus.java:275)
 at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
 at cpw.mods.fml.common.Loader.initializeMods(Loader.java:737)
 at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:311)
 at net.minecraft.client.Minecraft.startGame(Minecraft.java:597)
 at net.minecraft.client.Minecraft.run(Minecraft.java:942)
 at net.minecraft.client.main.Main.main(Main.java:164)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
 at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
 at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
 at GradleStart.main(Unknown Source)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
 at java.lang.String.charAt(Unknown Source)
 at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:232)
 at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:250)
 at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:245)
 at ru.denik.mod.MainClass.load(MainClass.java:116)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
 at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
 at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
 at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
 at com.google.common.eventbus.EventBus.post(EventBus.java:275)
 at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
 at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
 at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
 at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
 at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
 at com.google.common.eventbus.EventBus.post(EventBus.java:275)
 at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
 at cpw.mods.fml.common.Loader.initializeMods(Loader.java:737)
 at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:311)
 at net.minecraft.client.Minecraft.startGame(Minecraft.java:597)

-- Initialization --
Details:
Stacktrace:
 at net.minecraft.client.Minecraft.run(Minecraft.java:942)
 at net.minecraft.client.main.Main.main(Main.java:164)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
 at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
 at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
 at GradleStart.main(Unknown Source)

-- System Details --
Details:
 Minecraft Version: 1.7.10
 Operating System: Windows 10 (amd64) version 10.0
 Java Version: 1.8.0_144, Oracle Corporation
 Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
 Memory: 640399488 bytes (610 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
 JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
 AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
 IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
 FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 4 mods loaded, 4 mods active
 States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
 UCHI mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
 UCHI FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
 UCHI Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
 UCHE Vanila{1.0} [Vanila] (bin) 
 GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 376.53' Renderer: 'GeForce GTX 770/PCIe/SSE2'
 Launched Version: 1.7.10
 LWJGL: 2.9.1
 OpenGL: GeForce GTX 770/PCIe/SSE2 GL version 4.5.0 NVIDIA 376.53, NVIDIA Corporation
 GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

 Is Modded: Definitely; Client brand changed to 'fml,forge'
 Type: Client (map_client.txt)
 Resource Packs: []
 Current Language: Русский (Россия)
 Profiler Position: N/A (disabled)
 Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
 Anisotropic Filtering: Off (1)
 
Сверху