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
I would like to generate a single block randomly within the top block of my dimension. What do? 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.
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. 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.
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 one more thing, do you know if it's possible to check if a dimension has been visited?
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
}
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
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
0
Makes crashes. :c
Error:
HALP!
0
0
EDIT: Solved it
0
With JD-Gui and most decompilers... drag and drop.
0
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. 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.
0
Our mod is going to use music discs as well. I'll let you know how we did it once it's working.
0
Oh XD I see it now. Sorry one more thing, do you know if it's possible to check if a dimension has been visited?
0
Same problem here
0
A simple method that checks the block that the player is standing on? For example:
0
Well I know that much is there a method that does this?
0
But how would I get the block instead of calling just one block?
0
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
0
I'll give that a shot. No worries, thanks man
0
0
Yeahhh it just runs away no matter what. I think it's because I'm using 1.5.2, not 1.6