• 0

    posted a message on Check skeleton type and then add drop?
    So I have this:

    public EntitySkeleton skeleton;
    public static double random;
    
    @ForgeSubscribe
    public void addWitherSkeletonDrop(LivingDropsEvent event)
    {
      if (event.source.getDamageType().equals("player"))
      {
       random = Math.random();
       if (event.entityLiving instanceof EntitySkeleton && skeleton.getSkeletonType() == 1)
       {
        if (random < 1D)
        {
    	 event.entityLiving.dropItem(Item.bone.itemID, 1);
        }
       }
      }
    }


    Makes crashes. :c

    Error:

    2013-07-27 15:14:32 [INFO] [STDERR] net.minecraft.util.ReportedException: Ticking memory connection
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:60)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:677)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:573)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:470)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
    2013-07-27 15:14:32 [INFO] [STDERR] Caused by: java.lang.NullPointerException
    2013-07-27 15:14:32 [INFO] [STDERR]  at teamoverhaul.netheroverhaul.common.EventHandler.addWitherSkeletonDrop(EventHandler.java:22)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraftforge.event.ASMEventHandler_4_EventHandler_addWitherSkeletonDrop_LivingDropsEvent.invoke(.dynamic)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraftforge.event.EventBus.post(EventBus.java:108)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraftforge.common.ForgeHooks.onLivingDrops(ForgeHooks.java:338)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.entity.EntityLiving.onDeath(EntityLiving.java:1372)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.entity.monster.EntitySkeleton.onDeath(EntitySkeleton.java:211)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.entity.EntityLiving.attackEntityFrom(EntityLiving.java:1126)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.entity.monster.EntityMob.attackEntityFrom(EntityMob.java:72)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.entity.player.EntityPlayer.attackTargetEntityWithCurrentItem(EntityPlayer.java:1347)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.network.NetServerHandler.handleUseEntity(NetServerHandler.java:832)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.network.packet.Packet7UseEntity.processPacket(Packet7UseEntity.java:57)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:134)
    2013-07-27 15:14:32 [INFO] [STDERR]  at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:53)
    2013-07-27 15:14:32 [INFO] [STDERR]  ... 6 more
    2013-07-27 15:14:32 [SEVERE] [Minecraft-Server] Encountered an unexpected exception ReportedException
    net.minecraft.util.ReportedException: Ticking memory connection
    at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:60)
    at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:677)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:573)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:470)
    at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
    Caused by: java.lang.NullPointerException
    at teamoverhaul.netheroverhaul.common.EventHandler.addWitherSkeletonDrop(EventHandler.java:22)
    at net.minecraftforge.event.ASMEventHandler_4_EventHandler_addWitherSkeletonDrop_LivingDropsEvent.invoke(.dynamic)
    at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
    at net.minecraftforge.event.EventBus.post(EventBus.java:108)
    at net.minecraftforge.common.ForgeHooks.onLivingDrops(ForgeHooks.java:338)
    at net.minecraft.entity.EntityLiving.onDeath(EntityLiving.java:1372)
    at net.minecraft.entity.monster.EntitySkeleton.onDeath(EntitySkeleton.java:211)
    at net.minecraft.entity.EntityLiving.attackEntityFrom(EntityLiving.java:1126)
    at net.minecraft.entity.monster.EntityMob.attackEntityFrom(EntityMob.java:72)
    at net.minecraft.entity.player.EntityPlayer.attackTargetEntityWithCurrentItem(EntityPlayer.java:1347)
    at net.minecraft.network.NetServerHandler.handleUseEntity(NetServerHandler.java:832)
    at net.minecraft.network.packet.Packet7UseEntity.processPacket(Packet7UseEntity.java:57)
    at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
    at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:134)
    at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:53)
    ... 6 more


    HALP!
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED]Simple world feature gen question
    I would like to generate a single block randomly within the top block of my dimension. What do? :D I would like to do this via a WorldGen*featurename* class and call it in the chunk provider, but anything works. Actually if it's simple enough I could chuck it into the chunk provider as is.

    EDIT: Solved it :D
    Posted in: Modification Development
  • 0

    posted a message on Item that glows and armor that has night vision

    i dont know how to decompile it...


    With JD-Gui and most decompilers... drag and drop.
    Posted in: Modification Development
  • 0

    posted a message on Check block player is standing on?
    Quote from JiffyJay

    That depends on what you need it for. Would you be able to use NBT?


    I could yes. Basically I just need a line of code to be fired (EntityRegistry.addSpawn) when the nether portal is open, and remove it when it's not. I figured checking if the player has been to the dimension, or is in the dimension, would work. But, now that I think about it, checking if the portal block exists would work better. Or it could be fired on the lighting of the portal. The method doesn't have to be removed after it's been fired, it works for me either way. I've been googling and poking around in the src code for a while now. No luck. :P I know I would have to use tick updates so it continually checks to see if the block exists. Or if it were to activate on portal ignition, I wouldn't need to use tick updates.
    Posted in: Modification Development
  • 0

    posted a message on [1.5.2] Troubles with Music Discs
    Quote from Arcturus

    Bump. I could really use some help with this. It's been tormenting my code for ages.


    Our mod is going to use music discs as well. I'll let you know how we did it once it's working. :P
    Posted in: Modification Development
  • 0

    posted a message on Check block player is standing on?
    Quote from SoBiohazardous

    Exactly. Thats what this does.
    int x = (int) Math.floor(living.posX);
    int y = (int) (living.posY - living.getYOffset());
    int z = (int) Math.floor(living.posZ);
    if (living.worldObj.getBlockId(x, y - 1, z) == BLOCKIDTOCHECK && living.worldObj.getBlockId(x, y, z) == 0)
    {
    		 if (living.motionY < 0 && living.boundingBox.minY < y)
    		 {
    living.onGround() = true;
    		 //CODE THAT YOU TO DO
    		 }



    Oh XD I see it now. Sorry :P one more thing, do you know if it's possible to check if a dimension has been visited?
    Posted in: Modification Development
  • 0

    posted a message on [1.7.x][Library][Forge] Developer Capes - HD Cape Support!
    Quote from big_Xplosion

    No i was running in f5 mode and then after a few minutes the cape disapears.


    Same problem here
    Posted in: Minecraft Mods
  • 0

    posted a message on Check block player is standing on?
    Quote from SoBiohazardous

    A method that does what? Just put the code i posted in a ticking handler.


    A simple method that checks the block that the player is standing on? For example:

    if (EntityLiving.getItemStack(whatever that method is) == someItem.itemID)
    {
    EntityLiving.getTheBlockThatTheDudeIsStandingOn.changeLightLevelstuff.some more code
    }
    Posted in: Modification Development
  • 0

    posted a message on Check block player is standing on?
    Quote from SoBiohazardous

    Oh, you mean detecting for just all blocks? You would probably throw that code in your ticking handler.


    Well I know that much :P is there a method that does this?
    Posted in: Modification Development
  • 0

    posted a message on Check block player is standing on?
    Quote from SoBiohazardous

    Oh, well in that case look at BlockRedstoneOre, all you need to know should be in there.


    But how would I get the block instead of calling just one block?
    Posted in: Modification Development
  • 0

    posted a message on Check block player is standing on?
    Quote from SoBiohazardous

    Try this:

    int x = (int) Math.floor(living.posX);
    int y = (int) (living.posY - living.getYOffset());
    int z = (int) Math.floor(living.posZ);
    if (living.worldObj.getBlockId(x, y - 1, z) == BLOCKIDTOCHECK && living.worldObj.getBlockId(x, y, z) == 0)
    {
    	 if (living.motionY < 0 && living.boundingBox.minY < y)
    	 {
    living.onGround() = true;
    	 //CODE THAT YOU TO DO
    	 }


    Living would obviously be your EntityLiving parameter.


    Is there a way to return the block and give it a property? Like change the light level while the player is standing on it? I'm trying to do dynamic lights if you can't tell :D
    Posted in: Modification Development
  • 0

    posted a message on Mob flees from attacker if health below certain level?
    Quote from Crumpetxxix

    Sorry man, it worked for me. But it also caused some serious lag issues if you had a lot of mobs in the area (100+).

    A better solution to what you are looking for is maybe to take the code from the EntityAIAvoid code and make a new entity AI that flees from the target when it's low on hp. It would be a lot more simple and avoid a lot of the issues we are having here

    Edit: it would also solve the lag issues I experienced when using that code with a large group of mobs


    I'll give that a shot. No worries, thanks man :D
    Posted in: Modification Development
  • 0

    posted a message on Check block player is standing on?
    Is there really no methods that anyone knows of that checks this?
    Posted in: Modification Development
  • 0

    posted a message on Mob flees from attacker if health below certain level?
    Quote from Crumpetxxix

    1.6.1, im not using forge so that may be part of the issue

    change the floats to doubles then, just keep the same number in there. and for the obfuscated function just use the
    float currentHP = this.dataWatercher.getWatchableObjectFloat(6); 


    and change the
    if (func_110143_aJ() <= 8.f)
    {
    //... code here
    }

    to
    if (currentHP <= 8.f)
    {
    //... code here
    }



    Yeahhh it just runs away no matter what. I think it's because I'm using 1.5.2, not 1.6
    Posted in: Modification Development
  • To post a comment, please or register a new account.