Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

ashjack

Members
  • Posts

    102
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

ashjack's Achievements

Creeper Killer

Creeper Killer (4/8)

0

Reputation

  1. I am trying to create an itemstack in order to get the localised name of an item, but for some reason creating the itemstack causes the game to crash with "java.lang.ClassCastException: net.minecraft.item.ItemStack cannot be cast to net.minecraft.item.Item" I do not understand why this is happening because I am simply creating a new itemstack and using an item with it. I am using the following code: public static List<Item> itemList = new ArrayList<Item>(); public static void learnItems() { itemList.clear(); Iterator iterator = Item.itemRegistry.iterator(); while (iterator.hasNext()) { Item item = (Item)iterator.next(); if (item != null) { item.getSubItems(item, (CreativeTabs)null, itemList); } itemList.add(item); ModLog.log.info("Added " + new ItemStack(item).getDisplayName()); } } public static Item getItemFromMsg(String msg) { for(int i = 0; i < itemList.size(); i++) { if(itemList.get(i) != null) { ItemStack is = new ItemStack(itemList.get(i)); // I tried new ItemStack(itemList.get(i), 1); with same results if(msg.contains(is.getDisplayName())) { return itemList.get(i); } } else { ModLog.log.info("Item is null"); } } return null; }
  2. I have made an event handling class, and have registered it using the following: public class EventManager { @EventHandler public void load(FMLInitializationEvent event) { FMLCommonHandler.instance().bus().register(new EventManager()); } @SubscribeEvent public void onEntitySpawn(EntityJoinWorldEvent event) { MineAILog.log.info("Entity Has Spawned"); if (event.entity instanceof EntityMob) { MineAILog.log.info("Entity is a mob"); assignAI((EntityMob) event.entity, event); } } private void assignAI(EntityMob e, Event ev) { e.tasks.addTask(4, new EntityAIAttackOnCollide(e, EntityAI.class, 1.0D, false)); e.targetTasks.addTask(4, new EntityAINearestAttackableTarget(e, EntityAI.class, 0, true)); } } And yet the event does not fire at all, and the log functions do not run. I have also tried registering the EventManager class in the main mod class, but this has not worked either. I honestly do not know why it is not firing.
  3. Adding the resource pack is once again working thanks to the functions you told me to use, however, I still can't get the texture. I have triple checked every file name, and they match up perfectly.
  4. Here is the source code: https://github.com/ashjack/Sim-U-Kraft-Reloaded-2
  5. Just one thing, I am reflecting and adding to the list in the preinit function. Should I be doing this in a later function?
  6. I did have some uppercase directory names, however, upon correcting them to lowercase the problem still persisted. I have just tried the method (refreshResources()) and the texture is still not found. I am sure that I have spelt the directory and file names correctly
  7. Thanks for your reply. However, I still get a missing texture. I am returning a skin for an entity: return new ResourceLocation("SUK2", "Races/Elf/female3.png"); The whole path is: assets/SUK2/Races/Elf/female3.png
  8. I have successfully reflected the list that Minecraft uses to store resource packs, and I have added a new one programmatically, which adds some external textures to Minecraft. The problem I have, is that after successfully adding this resource pack, it turns out the resource domain is blank. The resource domain is the first string that is required in making an instance of ResourceLocation (new ResourceLocation("ResourceDomain", "Path")). How can I set the resource domain of this resource pack? If you're wandering, the resource pack is an instance of FileResourcePack.
  9. You are not supposed to put other people's API classes on GitHub, therefore he didn't upload it. His crash doesn't refer to IEnergyReceiver. Do what Abastro said and run 'gradlew build'. Once it has built, navigate to the 'build/libs' folder. Here you will find a jar file with your modid in. This is the file that people put into their mods folder.
  10. How do I reflect a list? I googled it, and all the questions are about reflecting the TYPE of list it is, not the actual list field itself.
  11. Oh, I reflected the wrong field. I reflected Minecraft.class' instance of DefaultResourcePack
  12. Ok, so I have successfully reflected mcDefaultResourcePack and have access to it, but I see no way of adding files to it without overwriting the existing ones.
  13. Spawning the NPC near the player is purely for aesthetic purposes. The player is unlikely to travel a far distance from where the NPC spawned, so when the NPC is called by the block, he/she walks out of the woods instead of teleporting. This problem has been solved now
  14. It doesn't actually go to the player, it goes to a block that the player must have interacted with for the entity to need to go there in the first place. If it is too far away, the entity 'warps' with a particle effect. The only reason it needs to spawn near a player is for aesthetic purposes, so any player will suffice.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.