Jump to content

Ms_Raven

Members
  • Posts

    106
  • Joined

  • Last visited

Everything posted by Ms_Raven

  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); } } } }
  14. I made an enchantment that's supposed to increase the player's speed every level. But walking with the max-level enchanted boots equipped is still the default speed doesn't even happen and instead the world keeps unloading and loading. My event handler registered and working perfectly fine with other events so I can't figure out what I'm doing wrong. @SubscribeEvent public void updateEnchantments(LivingUpdateEvent event) { if (event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.entity; ItemStack item; for (int i = 0; i < 4; i++) { item = player.getCurrentArmor(i); if (item != null) { int j = EnchantmentHelper.getEnchantmentLevel(Worlds.hyperspeed.effectId, item); if (j > 0) { player.capabilities.setPlayerWalkSpeed(player.capabilities.getWalkSpeed() + 1 * j); Worlds.log.entry("Speed - " + player.capabilities.getWalkSpeed()); } } } } }
  15. I need custom log blocks but it won't render the texture. The whole thing is just purple & black. There are no errors so it has to be recognising the files (and yes, the file locations are 100% correct), I just can't figure what's going wrong after it does. This is my log class: public class NewLog extends NewBlock { @SideOnly(Side.CLIENT) protected IIcon top; @SideOnly(Side.CLIENT) protected IIcon side; public NewLog(String name, Material material) { super(name, material); this.setBlockTextureName(Worlds.MODID + ":" + name); this.setHardness(2.0F); this.setHarvestLevel("axe", 0); this.setStepSound(soundTypeWood); this.setCreativeTab(Tabs.blocks); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister i) { top = i.registerIcon(this.getTextureName() + "_top"); side = i.registerIcon(this.getTextureName()); } public int quantityDropped(Random r) { return 1; } public Item getItemDropped(int i, Random r, int m) { return Item.getItemFromBlock(this); } public void breakBlock(World world, int x, int y, int z, Block b, int meta) { byte b0 = 4; int i1 = b0 + 1; if (world.checkChunksExist(x - i1, y - i1, z - i1, x + i1, y + i1, z + i1)) { for (int j1 = -b0; j1 <= b0; ++j1) { for (int k1 = -b0; k1 <= b0; ++k1) { for (int l1 = -b0; l1 <= b0; ++l1) { Block block = world.getBlock(x + j1, y + k1, z + l1); if (block.isLeaves(world, x + j1, y + k1, z + l1)) { block.beginLeavesDecay(world, x + j1, y + k1, z + l1); } } } } } } public int onBlockPlaced(World w, int x, int y, int z, int s, float fx, float fy, float fz, int m) { int j1 = m & 3; byte b0 = 0; switch (s) { case 0: case 1: b0 = 0; break; case 2: case 3: b0 = 8; break; case 4: case 5: b0 = 4; } return j1 | b0; } public int getRenderType() { return 31; } @SideOnly(Side.CLIENT) protected IIcon getSideIcon(int i) { return side; } @SideOnly(Side.CLIENT) protected IIcon getTopIcon(int i) { return top; } @Override public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) { return true; } @Override public boolean isWood(IBlockAccess world, int x, int y, int z) { return true; } public int func_150162_k(int p_150162_1_) { return p_150162_1_ & 3; } protected ItemStack createStackedBlock(int p_149644_1_) { return new ItemStack(Item.getItemFromBlock(this), 1, this.func_150162_k(p_149644_1_)); } }
  16. The way I write my item/block registry is in an array so I can cycle through and register them without using triple the amount of code. It works perfectly fine in 1.7.10 but in 1.8 it crashes at this line: public void registerItemRenderer() { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, // <----- This line new ModelResourceLocation(CC.MODID + ":" + item.getUnlocalizedName())); } with a NullPointerException. This is my registry method: public static void register() { CC.logger.entry("Registering items..."); for (int i = 0; i < items.length; i++) { GameRegistry.registerItem(items[i], items[i].getUnlocalizedName()); registerItemRenderer(items[i]); CC.logger.info("-----> Registered " + items[i].getUnlocalizedName()); if (items[i].getCreativeTab() == null) { CC.logger.error("No creative tab is set for " + items[i].getUnlocalizedName() + ". Fix it."); } } CC.logger.entry("Registering blocks..."); for (int i = 0; i < blocks.length; i++) { GameRegistry.registerBlock(blocks[i], blocks[i].getUnlocalizedName()); registerBlockRenderer(blocks[i]); CC.logger.info("-----> Registered " + blocks[i].getUnlocalizedName()); if (blocks[i].getCreativeTabToDisplayOn() == null) { CC.logger.error("No creative tab is set for " + blocks[i].getUnlocalizedName() + ". Fix it."); } } } All my jsons are correct and in the right places and the items/blocks are absolutely registered. So why does it successfully register everything to the GameRegistry but give a NullPointerException on the renderers?
  17. Uh, if it wasn't being registered then nothing would happen. As I've said several times, nothing renders, not mine or the vanilla. So the pre-event is clearly being called. The post-event that's supposed to render mine is being called, for some reason it's not doing anything.
  18. Unfortunately that still doesn't work. Nothing renders. @SubscribeEvent public void clear(RenderGameOverlayEvent.Pre event) { if (event.type == ElementType.HOTBAR) { event.setCanceled(true); return; } if (event.type == ElementType.FOOD) { event.setCanceled(true); return; } if (event.type == ElementType.EXPERIENCE) { event.setCanceled(true); return; } if (event.type == ElementType.HEALTH) { event.setCanceled(true); return; } if (event.type == ElementType.JUMPBAR) { event.setCanceled(true); return; } if (event.type == ElementType.AIR) { event.setCanceled(true); return; } if (event.type == ElementType.ARMOR) { event.setCanceled(true); return; } if (event.type != ElementType.FOOD) { return; } } @SubscribeEvent public void render(RenderGameOverlayEvent.Post event) { EntityPlayer player = mc.thePlayer; FontRenderer fontrenderer = this.mc.fontRenderer; InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory; this.mc.getTextureManager().bindTexture(texturepath); int xPos = (mc.displayWidth / 2) - 90; int yPos = mc.displayHeight - 60; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_ALPHA_TEST); // HOTBAR - ICONS this.mc.mcProfiler.startSection("actionBar"); GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); for (int i = 0; i < 9; ++i) { this.renderInventorySlot(i, xPos + i * 20, yPos + 37, 1); } RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); this.mc.mcProfiler.endSection(); GL11.glDisable(GL11.GL_BLEND); // HOTBAR - SELECTOR this.drawTexturedModalRect(xPos + 6 + inventoryplayer.currentItem * 20, yPos - 34, 8, 57, 8, 7); if (!mc.thePlayer.capabilities.isCreativeMode) { // HUD BACKGROUND this.drawTexturedModalRect(xPos, yPos, 0, 0, 180, 54); // FOOD BAR int hunger = player.getFoodStats().getFoodLevel(); int hungerWidth = (hunger / 20) * 71; this.drawTexturedModalRect(xPos + 105, yPos + 21, 9, 185, hungerWidth, 9); if (hunger <= 1) { this.drawTexturedModalRect(xPos + 110, yPos + 13, 0, 57, 4, 10); } String hDisplay = hunger + "/" + 20; int w2 = fontrenderer.getStringWidth(hDisplay) / 2; fontrenderer.drawStringWithShadow(hDisplay, xPos + 56, yPos + 13, 0x000000); // EXPERIENCE BAR int xp = (int) player.experience; int toNextLevel = player.xpBarCap(); int level = player.experienceLevel; String s = "" + level; int w3 = fontrenderer.getStringWidth(s) / 2; fontrenderer.drawStringWithShadow(s, xPos + 90, yPos + 20, 0x000000); if (level > 0) { this.drawTexturedModalRect(xPos + 20, yPos + 4, 20, 57, (xp / toNextLevel) * 140, 4); } // HEALTH BAR int health = (int) (player.getHealth() * 2); int maxHealth = (int) (player.getMaxHealth() * 2); int healthWidth = (health / maxHealth) * 71; this.drawTexturedModalRect(xPos + 4, yPos + 21, 0, 185, healthWidth, 9); if (health <= 1) { this.drawTexturedModalRect(xPos + 66, yPos + 13, 4, 57, 4, 10); } String hp = health + "/" + maxHealth; int w1 = fontrenderer.getStringWidth(hp) / 2; fontrenderer.drawStringWithShadow(hp, xPos + 122, yPos + 13, 0x000000); // HORSE BAR if (this.mc.thePlayer.isRidingHorse()) { this.mc.mcProfiler.startSection("jumpBar"); float jump = this.mc.thePlayer.getHorseJumpPower(); int jumpMax = 148; this.drawTexturedModalRect(xPos + 16, yPos - 19, 0, 90, (int) ((jump / jumpMax) * jumpMax), 19); if (jump > 0) { this.drawTexturedModalRect(xPos + 20, yPos + 8, 0, 109, 140, 4); } this.mc.mcProfiler.endSection(); } // OXYGEN // ARMOUR } }
  19. Okay that was dumb. But now after fixing that my HUD still won't render. @SubscribeEvent public void renderHUD(RenderGameOverlayEvent.Pre event) { if (event.isCancelable()) { if (event.type == ElementType.HEALTH || event.type == ElementType.FOOD || event.type == ElementType.AIR || event.type == ElementType.HOTBAR || event.type == ElementType.EXPERIENCE || event.type == ElementType.JUMPBAR) { render(); event.setCanceled(true); } } } If the event is cancelled after it renders or if I don't cancel it at all, it just shows a really glitchy-looking black-and-white version of the vanilla HUD. If the event is cancelled before it renders, the vanilla HUD doesn't render but mine still doesn't either.
  20. I want to replace the health/hunger/oxygen/armour/xp/jump bars with my own. But I can't figure out how to cancel only those specific render types. I try to check if it's rendering those types, load mine then cancel the event but nothing renders. Not mine, not the ones I want cancelled, not even the crosshair, inventory or pause menu. How do I do this right? public class HeadsUpDisplay extends Gui { private Minecraft mc; private static final ResourceLocation texturepath = new ResourceLocation(This.MODID, "hud.png"); protected static final RenderItem itemRenderer = new RenderItem(); public HeadsUpDisplay() { super(); this.mc = Minecraft.getMinecraft(); } @SubscribeEvent public void renderHUD(RenderGameOverlayEvent.Pre event) { if (event.isCancelable() || event.type == ElementType.HEALTH || event.type == ElementType.FOOD || event.type == ElementType.AIR || event.type == ElementType.HOTBAR || event.type == ElementType.EXPERIENCE || event.type == ElementType.JUMPBAR) { render(); event.setCanceled(true); } } private void render() { EntityPlayer player = mc.thePlayer; FontRenderer fontrenderer = this.mc.fontRenderer; InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory; int xPos = (mc.displayWidth / 2) - 90; int yPos = mc.displayHeight - 60; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); this.mc.getTextureManager().bindTexture(texturepath); // Render main HUD background this.drawTexturedModalRect(xPos, yPos, 0, 0, 180, 54); // Render health int health = (int) (player.getHealth() * 2); int maxHealth = (int) (player.getMaxHealth() * 2); int healthWidth = (health / maxHealth) * 71; this.drawTexturedModalRect(xPos + 4, yPos + 21, 0, 185, healthWidth, 9); if (health <= 1) { this.drawTexturedModalRect(xPos + 66, yPos + 13, 4, 57, 4, 10); } String hp = health + "/" + maxHealth; int w1 = fontrenderer.getStringWidth(hp) / 2; fontrenderer.drawStringWithShadow(hp, xPos + 122, yPos + 13, 0x000000); // Render hunger int hunger = player.getFoodStats().getFoodLevel(); int hungerWidth = (hunger / 20) * 71; this.drawTexturedModalRect(xPos + 105, yPos + 21, 9, 185, hungerWidth, 9); if (hunger <= 1) { this.drawTexturedModalRect(xPos + 110, yPos + 13, 0, 57, 4, 10); } String hDisplay = hunger + "/" + 20; int w2 = fontrenderer.getStringWidth(hDisplay) / 2; fontrenderer.drawStringWithShadow(hDisplay, xPos + 56, yPos + 13, 0x000000); // Render hotbar item selector this.drawTexturedModalRect(xPos + 6 + inventoryplayer.currentItem * 20, yPos - 34, 8, 57, 8, 7); // Render hotbar icons this.mc.mcProfiler.startSection("actionBar"); GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); for (int i = 0; i < 9; ++i) { this.renderInventorySlot(i, xPos + i * 20, yPos + 37, 1); } RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); this.mc.mcProfiler.endSection(); GL11.glDisable(GL11.GL_BLEND); // Render horse jump bar if (this.mc.thePlayer.isRidingHorse()) { this.mc.mcProfiler.startSection("jumpBar"); float jump = this.mc.thePlayer.getHorseJumpPower(); int jumpMax = 148; this.drawTexturedModalRect(xPos + 16, yPos - 19, 0, 90, (int) ((jump / jumpMax) * jumpMax), 19); if (jump > 0) { this.drawTexturedModalRect(xPos + 20, yPos + 8, 0, 109, 140, 4); } this.mc.mcProfiler.endSection(); } // Render xp bar int xp = (int) player.experience; int toNextLevel = player.xpBarCap(); int level = player.experienceLevel; String s = "" + level; int w3 = fontrenderer.getStringWidth(s) / 2; fontrenderer.drawStringWithShadow(s, xPos + 90, yPos + 20, 0x000000); if (level > 0) { this.drawTexturedModalRect(xPos + 20, yPos + 4, 20, 57, (xp / toNextLevel) * 140, 4); } // Render armour // Render oxygen } protected void renderInventorySlot(int slot, int x, int y, float tick) { ItemStack itemstack = this.mc.thePlayer.inventory.mainInventory[slot]; if (itemstack != null) { float f1 = (float) itemstack.animationsToGo - tick; if (f1 > 0.0F) { GL11.glPushMatrix(); float f2 = 1.0F + f1 / 5.0F; GL11.glTranslatef((float) (x + , (float) (y + 12), 0.0F); GL11.glScalef(1.0F / f2, (f2 + 1.0F) / 2.0F, 1.0F); GL11.glTranslatef((float) (-(x + ), (float) (-(y + 12)), 0.0F); } itemRenderer.renderItemAndEffectIntoGUI(this.mc.fontRenderer, this.mc.getTextureManager(), itemstack, x, y); if (f1 > 0.0F) { GL11.glPopMatrix(); } itemRenderer.renderItemOverlayIntoGUI(this.mc.fontRenderer, this.mc.getTextureManager(), itemstack, x, y); } } }
  21. I have a command that's supposed to give item info to the player. I want it to return both its literal name (e.g: iron_ingot) and its final name (e.g: Iron Ingot), among several other things, in a list that's printed in an external window. But there's only a getUnlocalizedName() method that returns the final name from the language file. How do I get the literal name, too?
  22. No, when I said it runs alongside my mod I meant it's created from within the mod. The window is created in the mod's preInit(). I didn't know how else I would get it to interact with it directly.
  23. I made an app that runs alongside my mod that displays various information on the features and content of the mod based on commands the user enters into it. (Like entering 'lookup entity bombskit' would show a list of the mob's stats, entering 'lookup recipe backpack' would should a recipe grid for a backpack, etc) All that should be fine. But I want to disable command input in the app until Minecraft is completely loaded to avoid any bugs or crashes from referencing things that haven't loaded yet. I thought about adding it to the EntityJoinWorldEvent but I'm not sure if that's the best place to do it, or if there's a better way altogether.
×
×
  • Create New...

Important Information

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