Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

somarani

Members
  • Posts

    55
  • 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.

somarani's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. I've never worked with packets before. Do you know of any good tutorials or could you briefly explain it? Thank you
  2. Hi, I created a custom level up system based on kills. To monitor player kills and level, I added 2 NBT values.On a keypress, I want the chat to print out the player stats (kill and level NBT values). To use those nbt values, I need an entity player. Usually when using the NBT values with other events, I use event.player or event.getSource, etc. But i can't seem to find anything like that using the KeyInputEvent. Does anyone know of a good way I can do this? Here is my key handler class public class SoulMenu { private final Minecraft mc; public static final int loc = 0; private static final String[] desc = {"menu.desc"}; private static final int[] keyValues = {Keyboard.KEY_L}; public static final KeyBinding[] keys = new KeyBinding[desc.length]; public SoulMenu() { mc = Minecraft.getMinecraft(); for(int i = 0; i < desc.length; ++i) { keys[i] = new KeyBinding(desc[i], keyValues[i], StatCollector.translateToLocal("soulcraft.label")); ClientRegistry.registerKeyBinding(keys[i]); Minecraft.getMinecraft().gameSettings.loadOptions(); } } @SubscribeEvent(priority = EventPriority.NORMAL) public void onKeyInput(KeyInputEvent event) { if(mc.inGameHasFocus) { if(keys[loc].isPressed()) { NBTSoulLevel.showLevel(/*i need a player*/); } } } } And this is the NBT class @SubscribeEvent public void Event(PlayerLoggedInEvent event) { NBTTagCompound tag = event.player.getEntityData(); NBTBase modeTag = tag.getTag("level"); } public static void incrementTag(EntityPlayer player) { if(player != null){ NBTTagCompound tag = player.getEntityData(); NBTBase modeTag = tag.getTag("level"); tag.setInteger("level", tag.getInteger("level") + 1);} } public static void setTag(int num, EntityPlayer player) { if(player != null){ NBTTagCompound tag = player.getEntityData(); NBTBase modeTag = tag.getTag("level"); tag.setInteger("level", num);} } public static int getTag(EntityPlayer player) { if(player != null){ NBTTagCompound tag = player.getEntityData(); NBTBase modeTag = tag.getTag("level"); return tag.getInteger("level"); } return 0; } public static void showLevel(EntityPlayer player){ GuiNewChat chat = Minecraft.getMinecraft().ingameGUI .getChatGUI(); chat.printChatMessage(new ChatComponentText( "Kills \u00a7b" + NBTKillCreate.getTag(player))); chat.printChatMessage(new ChatComponentText( "Level \u00a7b" + getTag(player))); chat.printChatMessage(new ChatComponentText( "Kills to next level \u00a7b" + NBTKillCreate.getTag(player))); } }
  3. It's the same code I have above. The only condition I have to kill it is if the difficulty is peaceful. The mob works fine if spawned through its spawn egg, but dissapears if I spawn it in any other way.
  4. Ok here is the whole output from when he first spawned Spawning entity on client Entity spawned on client X: -388.0,Y:6.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:6.0,Z:-494.0, client side? =false, isDead =false X: -388.0,Y:6.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:5.9231925,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:5.772594574068951,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:5.551128321694432,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:5.261600127278932,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.906705242455058,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.489032186941148,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.011066975123075,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false X: -388.0,Y:4.0,Z:-494.0, client side? =true, isDead =false setDead() called
  5. Ok, this is what I get from that X: -393.0,Y:6.0,Z:-482.0, client side? =true, isDead =false X: -393.0,Y:6.0,Z:-482.0, client side? =false, isDead =false X: -393.0,Y:6.0,Z:-482.0, client side? =true, isDead =false X: -393.0,Y:5.9231925,Z:-482.0, client side? =true, isDead =false X: -393.0,Y:5.772594574068951,Z:-482.0, client side? =true, isDead =false X: -393.0,Y:5.551128321694432,Z:-482.0, client side? =true, isDead =false X: -393.0,Y:5.261600127278932,Z:-482.0, client side? =true, isDead =false X: -393.0,Y:4.906705242455058,Z:-482.0, client side? =true, isDead =false Those are the first couple lines. After the 3rd time it stays the same. I'm not sure why client side is true since im only spawning when world is not remote. Also why is it true at first, turns false then goes back to true.
  6. I did the print line and the boss does spawn, then he just disappears (the coordinates print out about 5 times then he dies. Here is his code http://pastebin.com/kf36ddZQ OR package somarani.soulcraft.mobboss; import org.omg.CORBA.PUBLIC_MEMBER; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import scala.annotation.varargs; import scala.reflect.internal.Trees.This; import somarani.soulcraft.common.SoulCraft; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiNewChat; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IRangedAttackMob; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIArrowAttack; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIFleeSun; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIRestrictSun; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.boss.BossStatus; import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntitySpider; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagInt; import net.minecraft.util.ChatComponentText; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants.NBT; public class EntitySoulBossMob extends EntityMob implements IRangedAttackMob, IBossDisplayData { public static int count = 1000; public static int lightning = 0; public EntitySoulBossMob(World par1World) { super(par1World); this.stepHeight = 3f; } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth) .setBaseValue(200d); } public void onLivingUpdate() { System.out.println("X: " + this.posX + ",Y:" + this.posY + ",Z:" + this.posZ ); BossStatus.setBossStatus(this, true); EntityPlayer entityplayer = this.worldObj .getClosestVulnerablePlayerToEntity(this, 16.0D); if (entityplayer != null) { int x = (int) entityplayer.posX; int y = (int) entityplayer.posY; int z = (int) entityplayer.posZ; EntityCreeper creeper = new EntityCreeper(worldObj); EntitySkeleton skeleton = new EntitySkeleton(worldObj); EntitySpider spider = new EntitySpider(worldObj); EntityZombie zombie = new EntityZombie(worldObj); creeper.setPosition(x + 10, y + 10, z); skeleton.setPosition(this.posX, this.posY, this.posZ); spider.setPosition(x + 5, y, z + 5); zombie.setPosition(this.posX, this.posY, this.posZ); if (count > 169) { if (!worldObj.isRemote) { worldObj.spawnEntityInWorld(creeper); worldObj.spawnEntityInWorld(creeper); worldObj.spawnEntityInWorld(skeleton); worldObj.spawnEntityInWorld(skeleton); worldObj.spawnEntityInWorld(skeleton); worldObj.spawnEntityInWorld(spider); worldObj.spawnEntityInWorld(zombie); worldObj.spawnEntityInWorld(zombie); count = 0; } } else count++; } if (this.getHealth() == 0) { if (!worldObj.isRemote) { this.worldObj.spawnEntityInWorld(new EntityLightningBolt( this.worldObj, this.posX, this.posY, this.posZ)); this.worldObj.spawnEntityInWorld(new EntityLightningBolt( this.worldObj, this.posX, this.posY, this.posZ)); this.worldObj.spawnEntityInWorld(new EntityLightningBolt( this.worldObj, this.posX, this.posY, this.posZ)); } } if (worldObj.difficultySetting == EnumDifficulty.PEACEFUL) { this.kill(); } if (lightning >= 150) { if (entityplayer != null) { int x = (int) entityplayer.posX; int y = (int) entityplayer.posY; int z = (int) entityplayer.posZ; if (!worldObj.isRemote) { this.worldObj.spawnEntityInWorld(new EntityLightningBolt( this.worldObj, x + 3, y, z + 2)); lightning = 0; } } } else { lightning++; } super.onLivingUpdate(); } public void onDeath(DamageSource par1DamageSource) { World world = worldObj; if (!world.isRemote) { int j = this.rand.nextInt(2) + 1; this.dropItem(SoulCraft.smallSoulFragment, j); } super.onDeath(par1DamageSource); } @Override public void attackEntityWithRangedAttack(EntityLivingBase var1, float var2) { // TODO Auto-generated method stub } }
  7. Ok this is the new code. Now it happens like you said it would. The boss spawns for a few seconds then disappears, although the diamond block and lightning work just fine. public void onEntityCollidedWithBlock(World world1, int x, int y, int z, Entity entity) { if (!(entity instanceof EntityPlayer)) { entity.setDead(); } System.out.println(entity); if (entity instanceof EntityItem) { if (entity.toString().contains("spideressence")) { spider = true; } if (entity.toString().contains("bonehelmet")) { skull = true; } if (entity.toString().contains("creeperessence")) { creeper = true; } if (entity.toString().contains("zombieeessence")) { zombie = true; } if(spider && skull && creeper && zombie){ World world = entity.worldObj; if(!world.isRemote){ shouldSpawn = true; EntitySoulBossMob boss = new EntitySoulBossMob(world); boss.posX = x + 2; boss.posY= y + 2; boss.posZ = z +2 ; world.spawnEntityInWorld(new EntityLightningBolt(world, x, y, z)); world.setBlockToAir(x, y, z); world.setBlock(x, y, z, Blocks.diamond_block); // for testing purposes. world.spawnEntityInWorld(boss); } } } }
  8. Hi, I created a boss and want a way to spawn him. I have a block in my mod that allows players (and items) to walk through. So to spawn the boss, you throw 4 items into the block, the items and the block disappear and the boss spawns. For some reason this wont work. The lightning strikes but I get no sound or fire and I get the boss bar but I dont see him. To further test this, I made it place a diamond block when you throw the items. The block does appear but when you right click it, it goes back to the old block. Does anyone know why this is happening? code - http://pastebin.com/19aBpwCi OR package somarani.soulcraft.block; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Facing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import somarani.soulcraft.common.SoulCraft; import somarani.soulcraft.mobboss.EntitySoulBossMob; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockSoulGlass extends Block { public static boolean skull = false; public static boolean spider = false; public static boolean creeper = false; public static boolean zombie = false; public static boolean shouldSpawn = false; public BlockSoulGlass(Material p_i45394_1_) { super(p_i45394_1_); setHardness(2f); setResistance(5f); setBlockName("soulglass"); setCreativeTab(SoulCraft.tabSoul); setLightLevel(0f); setBlockTextureName("soulcraft:soulglass"); GameRegistry.registerBlock(this, "soulglass"); } @SideOnly(Side.CLIENT) public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, java.util.List par3List, boolean par4) { par3List.add("Allows ONLY players to walk right through"); } @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_); if (this == SoulCraft.soulGlass) { if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_])) { return true; } if (block == this) { return false; } } return true; } @SideOnly(Side.CLIENT) public int getRenderBlockPass() { return 0; } @SideOnly(Side.CLIENT) public boolean isOpaqueCube() { return false; } public void onEntityCollidedWithBlock(World p_149670_1_, int x, int y, int z, Entity entity) { if (!(entity instanceof EntityPlayer)) { entity.setDead(); } System.out.println(entity); if (entity instanceof EntityItem) { if (entity.toString().contains("spideressence")) { spider = true; } if (entity.toString().contains("bonehelmet")) { skull = true; } if (entity.toString().contains("creeperessence")) { creeper = true; } if (entity.toString().contains("zombieeessence")) { zombie = true; } if(spider && skull && creeper && zombie){ shouldSpawn = true; EntitySoulBossMob mob = new EntitySoulBossMob(Minecraft.getMinecraft().theWorld); mob.posX = x + 2; mob.posY = y; mob.posZ = z + 2; Minecraft.getMinecraft().theWorld.spawnEntityInWorld(new EntityLightningBolt(Minecraft.getMinecraft().theWorld, x, y, z)); Minecraft.getMinecraft().theWorld.spawnEntityInWorld(mob); Minecraft.getMinecraft().theWorld.setBlockToAir(x, y, z); Minecraft.getMinecraft().theWorld.setBlock(x, y, z, Blocks.diamond_block); // for testing purposes. } } } public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { return null; } public boolean renderAsNormalBlock() { return false; } }
  9. I'm trying to make a block when right clicked takes on the texture of the block you clicked it with. With the code I have, it does change the texture but it requires me to place a block somewhere to update and it changes it for all instances of the block. Is there a way to do it so only the block you click on changes, and to make it happen instantly? Thankyou package somarani.soulcraft.block; import java.util.List; import com.sun.org.apache.bcel.internal.generic.RETURN; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Facing; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import scala.reflect.internal.Trees.Return; import somarani.soulcraft.common.SoulCraft; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockClearSoulGlass extends Block { @SideOnly(Side.CLIENT) private IIcon icon; public BlockClearSoulGlass(Material p_i45394_1_) { super(p_i45394_1_); setHardness(2f); setResistance(5f); setBlockName("clearsoulglass"); setCreativeTab(SoulCraft.tabSoul); setLightLevel(0f); setBlockTextureName("soulcraft:isg"); GameRegistry.registerBlock(this, "clearsoulglass"); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { icon = this.blockIcon; icon = p_149651_1_.registerIcon("soulcraft:clearsoulglass"); } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ){ if(entityPlayer.getCurrentEquippedItem() != null){ ItemStack stack = entityPlayer.getCurrentEquippedItem(); icon = stack.getIconIndex(); } return true; } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess p_149673_1_, int p_149673_2_, int p_149673_3_, int p_149673_4_, int p_149673_5_){ return icon; } @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { return true; } @SideOnly(Side.CLIENT) public int getRenderBlockPass() { return 0; } @SideOnly(Side.CLIENT) public boolean isOpaqueCube() { return false; } public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity entity) { if(!(entity instanceof EntityPlayer)){ entity.setDead(); } } public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { return null; } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; } }
  10. I've never worked with NBT before. Do you mind explaining how I create them, or link me to a tutorial that explains it well?
  11. I'm trying to make a block that teleports you to another (of the same) block on the Y axis. This is the code I have so far, and it works great, except that if I have more than 2 of the block on the Y axis it will teleport you up more than once, probably because it's still registering the keypress as down. If you tap really quickly, it will teleport you only once. Is there a way to make it so it delays it, or you have to repress the key for it to register it? Thank you package somarani.soulcraft.block; import java.awt.event.KeyEvent; import somarani.soulcraft.common.SoulCraft; import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; import cpw.mods.fml.common.registry.GameRegistry; import net.java.games.input.Keyboard; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; public class BlockEnder extends Block { public BlockEnder(Material p_i45394_1_) { super(p_i45394_1_); setHardness(4f); setResistance(4f); setBlockName("enderblock"); setCreativeTab(SoulCraft.tabSoul); setLightLevel(1.0f); setBlockTextureName("soulcraft:enderblock1"); GameRegistry.registerBlock(this, "enderblock"); } @Override public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity) { if (entity instanceof EntityPlayer){ EntityPlayer player = (EntityPlayer)entity; KeyEvent event = null; if(org.lwjgl.input.Keyboard.isKeyDown(org.lwjgl.input.Keyboard.KEY_LSHIFT)){ int Y= y - 100; for(int i = y - 2; i > Y; i-- ){ if (world.blockExists(x, i, z)){ if (world.getBlock(x, i, z) == SoulCraft.enderBlock){ player.setPositionAndUpdate(x + 0.5d, i + 1, z + 0.5d); world.playSoundAtEntity(player, "mob.endermen.portal", 1.0f, 1.0f); break; } } } } else if (org.lwjgl.input.Keyboard.isKeyDown(org.lwjgl.input.Keyboard.KEY_SPACE)){ int Y= y + 100; for(int i = y + 2; i < Y; i++ ){ if (world.blockExists(x, i, z)){ if (world.getBlock(x, i, z) == SoulCraft.enderBlock){ player.setPositionAndUpdate(x + 0.5d, i + 1, z + 0.5d); world.playSoundAtEntity(player, "mob.endermen.portal", 1.0f, 1.0f); player.motionY = 0; break; } } } } } } @Override public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z) { return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 0.9D, (double) z + 1.0D); } }
  12. This is the new code, but it still doesn't work , the messages never show up. And to make sure my subscribe event works, I did a dummy PlayerTickEvent and it worked. Does anyone know why I cant get this to work? package somarani.soulcraft.event; import somarani.soulcraft.common.SoulCraft; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.DamageSource; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent; public class EntityHurtHandler { @SubscribeEvent public void Event(LivingAttackEvent event) { System.out.println("test 1"); if (event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.entity; System.out.println("test 2"); if(event.source.isExplosion() && player.inventory.getStackInSlot(player.inventory.currentItem).getItem() == SoulCraft.creeperBow){ event.setCanceled(true); } } } }
  13. I did this but it wont work, what did I do wrong? public class EntityHurtHandler { @SubscribeEvent public void Event(LivingAttackEvent event) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; if(event.entity instanceof EntityPlayer && event.source.isExplosion() && player.inventory.getStackInSlot(player.inventory.currentItem).getItem() == SoulCraft.creeperBow){ event.setCanceled(true); } } }
  14. Hi, is there a way to make a player immune to explosive damage when they have a certain item in hand?
×
×
  • Create New...

Important Information

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