
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 (4/8)
0
Reputation
-
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; }
-
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.
-
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.
-
[1.7.10] Problem with Built Mod NoDefClassFoundError
ashjack replied to grand_mind1's topic in Modder Support
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. -
[1.7.10] How do I load an external texture onto an Entity?
ashjack replied to ashjack's topic in Modder Support
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. -
[1.7.10] How do I load an external texture onto an Entity?
ashjack replied to ashjack's topic in Modder Support
Oh, I reflected the wrong field. I reflected Minecraft.class' instance of DefaultResourcePack -
[1.7.10] How do I load an external texture onto an Entity?
ashjack replied to ashjack's topic in Modder Support
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. -
How do I get the EntityPlayer on the Server Side?
ashjack replied to ashjack's topic in Modder Support
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 -
How do I get the EntityPlayer on the Server Side?
ashjack replied to ashjack's topic in Modder Support
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.