Jump to content

Ms_Raven

Members
  • Posts

    106
  • Joined

  • Last visited

Converted

  • Gender
    Female

Recent Profile Visitors

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

Ms_Raven's Achievements

Creeper Killer

Creeper Killer (4/8)

2

Reputation

  1. I'm trying to make a new WorldType that generates my custom biomes only, with alternative ores instead of the Vanilla ones. But for some reason it's only generating one biome and the Vanilla Rivers. And on top of that the Wasteland is generating too many trees and NOT generating the alternative ores. Anyone know what's causing this? [spoiler=Biome registry]public class Biomes { public static BiomeGenBase wasteland, harsh_desert, stone_jungle, oasis; public static void init() //Called in main class' preInit() { wasteland = new BiomeWasteland(Config.getBiomeIdWasteland()); harsh_desert = new BiomeWasteland(Config.getBiomeIdHarshDesert()); stone_jungle = new BiomeWasteland(Config.getBiomeIdStoneJungle()); oasis = new BiomeWasteland(Config.getBiomeIdOasis()); } public static void register() //Called in main class' postInit() { BiomeDictionary.registerBiomeType(wasteland, BiomeDictionary.Type.DEAD, Type.WASTELAND, Type.DRY); BiomeManager.addSpawnBiome(wasteland); BiomeDictionary.registerBiomeType(harsh_desert, BiomeDictionary.Type.DEAD, Type.WASTELAND, Type.DRY, Type.HOT); BiomeManager.addSpawnBiome(harsh_desert); BiomeDictionary.registerBiomeType(stone_jungle, BiomeDictionary.Type.DEAD, Type.WASTELAND, Type.MOUNTAIN); BiomeManager.addSpawnBiome(stone_jungle); BiomeDictionary.registerBiomeType(oasis, BiomeDictionary.Type.LUSH, Type.MAGICAL, Type.RIVER, Type.WET); BiomeManager.addSpawnBiome(oasis); } } [spoiler=WorldTypeApocalypse]public class WorldTypeApocalypse extends WorldType { public WorldTypeApocalypse(String name) { super(name); } @Override public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer) { GenLayer ret = new GenLayerApocalypse(3L); ret = GenLayerZoom.magnify(100L, ret, 2); ret = new GenLayerBiomeEdge(100L, ret); return ret; } } [spoiler=GenLayerApocalypse]public class GenLayerApocalypse extends GenLayer { public GenLayerApocalypse(long seed) { super(seed); } protected BiomeGenBase[] allowedBiomes = { Biomes.harsh_desert, Biomes.stone_jungle, Biomes.wasteland }; protected BiomeGenBase[] rareBiomes = { Biomes.oasis }; public int[] getInts(int x, int z, int width, int depth) { int[] dest = IntCache.getIntCache(width * depth); int rarity = nextInt(100); for (int dz = 0; dz < depth; dz++) { for (int dx = 0; dx < width; dx++) { initChunkSeed(dx + x, dz + z); if (rarity < Config.getRareBiomeRarity()) { dest[(dx + dz * width)] = this.rareBiomes[nextInt(this.rareBiomes.length)].biomeID; } else { dest[(dx + dz * width)] = this.allowedBiomes[nextInt(this.allowedBiomes.length)].biomeID; } } } return dest; } } [spoiler=BiomeWasteland (the only one of my biomes that generates)]public class BiomeWasteland extends BiomeGenBase { public BiomeWasteland(int id) { super(id); this.setBiomeName("Wasteland"); this.setColor(new Color(150, 100, 0).getRGB()); this.setTemperatureRainfall(2.5f, 0.1f); this.theBiomeDecorator.treesPerChunk = 1; this.theBiomeDecorator.flowersPerChunk = 0; this.theBiomeDecorator.grassPerChunk = 2; this.theBiomeDecorator.cactiPerChunk = 1; this.theBiomeDecorator.clayPerChunk = 5; this.theBiomeDecorator.deadBushPerChunk = 3; this.theBiomeDecorator.mushroomsPerChunk = 0; this.topBlock = Blocks.dirt; this.theBiomeDecorator.ironGen = new WorldGenMinable(Content.tin_ore, ; this.theBiomeDecorator.goldGen = new WorldGenMinable(Content.silver_ore, ; this.theBiomeDecorator.redstoneGen = new WorldGenMinable(Content.halite_ore, 7); this.theBiomeDecorator.diamondGen = new WorldGenMinable(Content.titanium_ore, 7); this.theBiomeDecorator.lapisGen = new WorldGenMinable(Content.ignium_ore, 6); } @SideOnly(Side.CLIENT) public int getSkyColorByTemp(float f) { return Color.GRAY.getRGB(); } public boolean canSpawnLightningBolt() { return true; } public float getSpawningChance() { return 0.05F; } public int getWaterColorMultiplier() { return new Color(100, 200, 50).getRGB(); } public int getModdedBiomeFoliageColor(int original) { return new Color(150, 100, 0).getRGB(); } }
  2. I'm trying to make a new WorldType that generates my custom biomes only, with alternative ores instead of the Vanilla ones. But for some reason it's only generating one biome and the Vanilla Rivers. And on top of that the Wasteland is generating too many trees and NOT generating the alternative ores. Anyone know what's causing this? [spoiler=Biome registry]public class Biomes { public static BiomeGenBase wasteland, harsh_desert, stone_jungle, oasis; public static void init() //Called in main class' preInit() { wasteland = new BiomeWasteland(Config.getBiomeIdWasteland()); harsh_desert = new BiomeWasteland(Config.getBiomeIdHarshDesert()); stone_jungle = new BiomeWasteland(Config.getBiomeIdStoneJungle()); oasis = new BiomeWasteland(Config.getBiomeIdOasis()); } public static void register() //Called in main class' postInit() { BiomeDictionary.registerBiomeType(wasteland, BiomeDictionary.Type.DEAD, Type.WASTELAND, Type.DRY); BiomeManager.addSpawnBiome(wasteland); BiomeDictionary.registerBiomeType(harsh_desert, BiomeDictionary.Type.DEAD, Type.WASTELAND, Type.DRY, Type.HOT); BiomeManager.addSpawnBiome(harsh_desert); BiomeDictionary.registerBiomeType(stone_jungle, BiomeDictionary.Type.DEAD, Type.WASTELAND, Type.MOUNTAIN); BiomeManager.addSpawnBiome(stone_jungle); BiomeDictionary.registerBiomeType(oasis, BiomeDictionary.Type.LUSH, Type.MAGICAL, Type.RIVER, Type.WET); BiomeManager.addSpawnBiome(oasis); } } [spoiler=WorldTypeApocalypse]public class WorldTypeApocalypse extends WorldType { public WorldTypeApocalypse(String name) { super(name); } @Override public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer) { GenLayer ret = new GenLayerApocalypse(3L); ret = GenLayerZoom.magnify(100L, ret, 2); ret = new GenLayerBiomeEdge(100L, ret); return ret; } } [spoiler=GenLayerApocalypse]public class GenLayerApocalypse extends GenLayer { public GenLayerApocalypse(long seed) { super(seed); } protected BiomeGenBase[] allowedBiomes = { Biomes.harsh_desert, Biomes.stone_jungle, Biomes.wasteland }; protected BiomeGenBase[] rareBiomes = { Biomes.oasis }; public int[] getInts(int x, int z, int width, int depth) { int[] dest = IntCache.getIntCache(width * depth); int rarity = nextInt(100); for (int dz = 0; dz < depth; dz++) { for (int dx = 0; dx < width; dx++) { initChunkSeed(dx + x, dz + z); if (rarity < Config.getRareBiomeRarity()) { dest[(dx + dz * width)] = this.rareBiomes[nextInt(this.rareBiomes.length)].biomeID; } else { dest[(dx + dz * width)] = this.allowedBiomes[nextInt(this.allowedBiomes.length)].biomeID; } } } return dest; } } [spoiler=BiomeWasteland (the only one of my biomes that generates)]public class BiomeWasteland extends BiomeGenBase { public BiomeWasteland(int id) { super(id); this.setBiomeName("Wasteland"); this.setColor(new Color(150, 100, 0).getRGB()); this.setTemperatureRainfall(2.5f, 0.1f); this.theBiomeDecorator.treesPerChunk = 1; this.theBiomeDecorator.flowersPerChunk = 0; this.theBiomeDecorator.grassPerChunk = 2; this.theBiomeDecorator.cactiPerChunk = 1; this.theBiomeDecorator.clayPerChunk = 5; this.theBiomeDecorator.deadBushPerChunk = 3; this.theBiomeDecorator.mushroomsPerChunk = 0; this.topBlock = Blocks.dirt; this.theBiomeDecorator.ironGen = new WorldGenMinable(Content.tin_ore, ; this.theBiomeDecorator.goldGen = new WorldGenMinable(Content.silver_ore, ; this.theBiomeDecorator.redstoneGen = new WorldGenMinable(Content.halite_ore, 7); this.theBiomeDecorator.diamondGen = new WorldGenMinable(Content.titanium_ore, 7); this.theBiomeDecorator.lapisGen = new WorldGenMinable(Content.ignium_ore, 6); } @SideOnly(Side.CLIENT) public int getSkyColorByTemp(float f) { return Color.GRAY.getRGB(); } public boolean canSpawnLightningBolt() { return true; } public float getSpawningChance() { return 0.05F; } public int getWaterColorMultiplier() { return new Color(100, 200, 50).getRGB(); } public int getModdedBiomeFoliageColor(int original) { return new Color(150, 100, 0).getRGB(); } }
  3. I want to use symbols in some items' tooltips to represent the elements and special effects of weapons I'm adding but they appear significantly smaller than they do in out-of-Minecraft text. All extra symbols (stars, hearts, music notes, etc) appear in a significantly smaller font size and are slightly superscript in tooltips. Even when running Minecraft on a large TV I have trouble seeing what the symbols are. For example, I want the enchantability of items to be displayed with a star next to them (like "☆10" on a Diamond Sword). However, what shows up is more like "☆10". This is what I'm using (in the ItemTooltipEvent so I can add to Vanilla items): event.toolTip.add(EnumChatFormatting.BLUE + "☆ " + item.getItemEnchantability()); Is there any way to fix this?
  4. Here's the full code: http://pastebin.com/zetGiejq
  5. Okay, so how would I save it in that? I tried setting NBTTagCompound entityData = player.getEntityData(); to NBTTagCompound entityData = player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); And it just gives the player items on every single login now. I have no idea how to actually use that.
  6. I'm trying to give the player items the first time they join the world. So I check a boolean in the player nbt, if it's false I check if their username contains one of several specific words and if it does it gives them some special items and enables some other aesthetic features, then set it to true. And at first glance it works perfectly. I log in to a new world, get the items, log out and when I log back it it recognises that I already got them. Unfortunately, if I log out after I die it's undone and it gives me new items the next time I log back in. I assume this is because the player gets a new nbt on respawn? I'm specifically trying to do this WITHOUT using IExtendedEntityProperties because I cannot get that to work no matter which tutorial I try, for what ever reason. How can I get it to stay through death without using IEEP? @SubscribeEvent public void login(PlayerLoggedInEvent event) { EntityPlayer player = event.player; NBTTagCompound entityData = player.getEntityData(); if (event.player.dimension == 0) { if (entityData.getBoolean(Infinity.MODID + "." + "RecievedItems") == false) { if (Tools.hasRelatedName(player)) { player.inventory.addItemStackToInventory(new ItemStack(Content.dream_sword)); player.addChatMessage( new ChatComponentText(EnumChatFormatting.GOLD + "You got a Keychain and the Dream Sword!")); player.inventory.addItemStackToInventory(new ItemStack(Content.keychain)); entityData.setBoolean(Infinity.MODID + "." + "RecievedItems", true); } else { player.addChatMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "[" + Infinity.NAME + "]" + EnumChatFormatting.RESET + "There's nothing special for you today.")); } } } }
  7. Description: Initializing game java.lang.NullPointerException: Initializing game at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:236) at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:250) at ss.khi.Recipes.add(Recipes.java:129) at ss.khi.Recipes.init(Recipes.java:72) at ss.khi.Infinity.preInit(Infinity.java:36) 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.preinitializeMods(Loader.java:556) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) 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 net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:236) at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:250) at ss.khi.Recipes.add(Recipes.java:129) at ss.khi.Recipes.init(Recipes.java:72) at ss.khi.Infinity.preInit(Infinity.java:36) 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.preinitializeMods(Loader.java:556) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) -- 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_66, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 814372896 bytes (776 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 UCH mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) UCH FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) UCH Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) UCE khi{1.0} [Kingdom Hearts Infinity] (bin) GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13397 Compatibility Profile Context 15.200.1055.0' Renderer: 'AMD Radeon HD 8400 / R3 Series' Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: AMD Radeon HD 8400 / R3 Series GL version 4.5.13397 Compatibility Profile Context 15.200.1055.0, ATI Technologies Inc. GL Caps: Using GL 1.3 multitexturing.
  8. I'm trying to do it that way because it's shorter and I don't have to edit the shaped recipe object every single time. And the recipes are being registered AFTER all the content is. All the content shows up in-game, so none of it is null.
  9. I'm trying to use pre-built Object arrays that take items as parameters so I don't have to copy/paste/edit every single shaped recipe since they're all the same shape, just with a different main material. But for some reason I'm getting a NullPointerException crash in when loading the mod. I can't figure out what I'm doing wrong. How I'm trying to register them: public static void init() { add(Content.kingdom_key, keyRecipe(Content.heart)); } add() method: public static void add(Item output, Object[] recipe) { GameRegistry.addShapedRecipe(new ItemStack(output), recipe); } keyRecipe() method: public static Object[] keyRecipe(Object synth) { return new Object[] { "AAA", "ABA", "AAA", 'A', synth, 'B', Content.wooden_key }; }
  10. That's my point, I can't figure out how to do that...
  11. I have no idea why, but I can't get any of the many projectile tutorials I've tried to work. It would always either only ever go in one direction or spawn but not move at all until hit. So I gave up and de-obfuscated a mod to try to figure out just what I'm doing so wrongly compared to a finished mod that I've tried and that works, and finally found some code that's successful...at first. Unfortunately, after about 2 seconds of travelling, the projectile starts slowing down exponentially for another second until it stops in mid-air... I assume it's something to do with the math, but I've always been horrible at that so I really don't know what's going on there. What exactly is going on here and how can I get it to just fly straight? Vec3 vec1 = player.getLook(1); EntityLargeFireball fireball = new EntityLargeFireball(player.worldObj); fireball.setLocationAndAngles(player.posX + vec1.xCoord, player.posY + player.getEyeHeight() * 0.85, player.posZ + vec1.zCoord, player.rotationYaw, player.rotationPitch); fireball.motionX = (-MathHelper.sin(fireball.rotationYaw / 180.0F * 3.141593F) * MathHelper.cos(fireball.rotationPitch / 180.0F * 3.141593F)); fireball.motionZ = (MathHelper.cos(fireball.rotationYaw / 180.0F * 3.141593F) * MathHelper.cos(fireball.rotationPitch / 180.0F * 3.141593F)); fireball.motionY = (-MathHelper.sin(fireball.rotationPitch / 180.0F * 3.141593F)); fireball.motionX *= 2.0D; fireball.motionY *= 2.0D; fireball.motionZ *= 2.0D;
  12. I have an item that's supposed to basically search the player's hotbar for a specific weapon type, check if it's damaged and repair it if it is. But in the searching-inventory stage it gives me this crash: Time: 11/01/16 21:47 Description: Ticking player java.lang.ArrayIndexOutOfBoundsException: 4 at net.minecraft.entity.player.InventoryPlayer.getStackInSlot(InventoryPlayer.java:646) at ss.khi.content.items.Ether.onEaten(Ether.java:44) at net.minecraft.item.ItemStack.onFoodEaten(ItemStack.java:169) at net.minecraft.entity.player.EntityPlayer.onItemUseFinish(EntityPlayer.java:470) at net.minecraft.entity.player.EntityPlayerMP.onItemUseFinish(EntityPlayerMP.java:970) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:281) at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:330) at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:111) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.entity.player.InventoryPlayer.getStackInSlot(InventoryPlayer.java:646) at ss.khi.content.items.Ether.onEaten(Ether.java:44) at net.minecraft.item.ItemStack.onFoodEaten(ItemStack.java:169) at net.minecraft.entity.player.EntityPlayer.onItemUseFinish(EntityPlayer.java:470) at net.minecraft.entity.player.EntityPlayerMP.onItemUseFinish(EntityPlayerMP.java:970) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:281) -- Player being ticked -- Details: Entity Type: null (net.minecraft.entity.player.EntityPlayerMP) Entity ID: 392 Entity Name: Player571 Entity's Exact location: 156.07, 68.00, 265.40 Entity's Block location: World: (156,68,265), Chunk: (at 12,4,9 in 9,16; contains blocks 144,0,256 to 159,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Entity's Momentum: 0.00, -0.08, 0.00 Stacktrace: at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:330) at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:111) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) -- Ticking connection -- Details: Connection: net.minecraft.network.NetworkManager@6b8d3ab5 Stacktrace: at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) The line the crash points to is the 9th line in my item's onEaten() method: public ItemStack onEaten(ItemStack s, World w, EntityPlayer p) { if (!w.isRemote) { ItemStack stack = null; boolean hasRods = false; for (int i = 36; i < 45; i++) // These are the hotbar slots: 36-44, right? { stack = p.inventory.getStackInSlot(i); // ← Crash log points to this line if (stack != null) { if (stack.getItem() instanceof Rod) { hasRods = true; if (stack.getItemDamage() > 0) { stack.setItemDamage(0); p.addChatMessage(new ChatComponentText(stack.getDisplayName() + " was fully charged!")); if (!p.capabilities.isCreativeMode) { --s.stackSize; } return s; } } } } if (hasRods) { p.addChatMessage( new ChatComponentText("All hotbar magic weapons are fully charged. There's no need to use this.")); } else { p.addChatMessage(new ChatComponentText("You need an uncharged magic weapon in your hotbar to use this.")); } } return s; } What did I do wrong?
  13. If the player is holding a magic rod when a key is pressed it should cast a fireball and damage the rod. But I'm not sure how to go about doing that. I'm assuming the code I have won't work (I haven't made the projectile or packets yet so I haven't tested it) since it's getting the equipped item of the client player? If not, how do I get the regular EntityPlayer from that in a packet? Would simply passing the client player through the packet parameters and casting it to EntityPlayer be enough? @SubscribeEvent public void onKeyPress(KeyInputEvent event) { if (Keybinds.fire.isPressed()) { ItemStack stack = Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem(); if (stack.getItem() instanceof Rod) { if (stack.getItemDamage() < stack.getMaxDamage() - 1) { // TODO packet stack.damageItem(1, Minecraft.getMinecraft().thePlayer); } } } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.