Jump to content

FLUFFY2

Forge Modder
  • Posts

    424
  • Joined

  • Last visited

Everything posted by FLUFFY2

  1. Its a simple code. If he wants to learn he will check how its working. But you are actually right. No more copy/paste from me.
  2. Whay don't you just try to make an item that places your block down? It should be simpler other than messing around with OpenGL.
  3. Diesieben means: public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(Mainclass.yourblock); }
  4. I have a code that detect if the mob is in the player field of view and can be seen. public void onUpdate() { super.onUpdate(); EntityPlayer ep = Minecraft.getMinecraft().thePlayer; if(isInFieldOfVision(this, ep) && canEntityBeSeen(ep)){ //The problem this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "fluffy:grunt.Enabled", 2.0F, 1.0F); } } protected boolean isInFieldOfVision(EntityLiving e1, EntityLiving e2){ //save Entity 2's original rotation variables float rotationYawPrime = e2.rotationYaw; float rotationPitchPrime = e2.rotationPitch; //make Entity 2 directly face Entity 1 e2.faceEntity(e1, 360F, 360F); //switch values of prime rotation variables with current rotation variables float f = e2.rotationYaw; float f1 = e2.rotationPitch; e2.rotationYaw = rotationYawPrime; e2.rotationPitch = rotationPitchPrime; rotationYawPrime = f; rotationPitchPrime = f1; //assuming field of vision consists of everything within X degrees from rotationYaw and Y degrees from rotationPitch, check if entity 2's current rotationYaw and rotationPitch within this X and Y range float X = 60F; float Y = 60F; float yawFOVMin = e2.rotationYaw - X; float yawFOVMax = e2.rotationYaw + X; float pitchFOVMin = e2.rotationPitch - Y; float pitchFOVMax = e2.rotationPitch + Y; boolean flag1 = (yawFOVMin < 0F && (rotationYawPrime >= yawFOVMin + 360F || rotationYawPrime <= yawFOVMax)) || (yawFOVMax >= 360F && (rotationYawPrime <= yawFOVMax - 360F || rotationYawPrime >= yawFOVMin)) || (yawFOVMax < 360F && yawFOVMin >= 0F && rotationYawPrime <= yawFOVMax && rotationYawPrime >= yawFOVMin); boolean flag2 = (pitchFOVMin <= -180F && (rotationPitchPrime >= pitchFOVMin + 360F || rotationPitchPrime <= pitchFOVMax)) || (pitchFOVMax > 180F && (rotationPitchPrime <= pitchFOVMax - 360F || rotationPitchPrime >= pitchFOVMin)) || (pitchFOVMax < 180F && pitchFOVMin >= -180F && rotationPitchPrime <= pitchFOVMax && rotationPitchPrime >= pitchFOVMin); if(flag1 && flag2 && e2.canEntityBeSeen(e1)) return true; else return false; } The problem is only EntityLiving has .faceEntity method and i can't cast EntityPlayer to EntityLiving coz they are from EntityLivingBase. It gives me an error if i use EntityPlayer rather than EntityLiving. Thanks for helping me out!
  5. Oh now i get it finally. Thanks for everyone who is helped me!
  6. If you want to make your helmet break after a given time, than: Give the armor around 6000 damage or more. public void onArmorTick(World par2World, EntityPlayer player, ItemStack par1ItemStack) { par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1); } That will damage your helmet every tick so you might want to bump up the max damage. I might be wrong and you need +1 instead of -1. Hope it helps.
  7. Thank you guys for helping! brandon:Its the same as mine just in a different way. But apprechiate you help! diesieben:Now its clear to me, thanks to you. BUT, how am i supposed to make it working than? My logic is failed.
  8. Okey i give up! Nothing has worked so far. I made a new code: List<Entity> entities = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.thePlayer, mc.thePlayer.boundingBox.expand(19.0D, 19.0D, 19.0D), EntityGrunt.mobSelector); Entity entity; while(entities.iterator().hasNext()){ entity = (Entity)entities.iterator().next(); if(entity instanceof EntityGrunt){ mc.thePlayer.addChatComponentMessage(new ChatComponentText("ON")); } else if(!(entity instanceof EntityGrunt)){ mc.thePlayer.addChatComponentMessage(new ChatComponentText("OFF")); } break; } if(entities.isEmpty()) { mc.thePlayer.addChatComponentMessage(new ChatComponentText("OFF")); } The problem is when another mob is closer than the mob i want to detect its simply turns off! So iterator not gona for me this i why i need list.contains. Thanks for helping!
  9. Thank you guys, but what i was looking is too simple and figured out by my own. I use now: (its the same but with a mobselector at the end.) List<Entity> entities = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.thePlayer, mc.thePlayer.boundingBox.expand(19.0D, 19.0D, 19.0D), EntityGrunt.mobSelector); if(entities.isEmpty){ } else{ } Its that simple! Thanks anyway for helping me out!
  10. Sorry but i have another problem with this. If the entity instanceof EntityGrunt then: Turn ON If the list is empty then: Turn OFF How can i make NOT instanceof? If i use else then its sometimes turns off coz its checking for the closest entity and its can be an item or xp or anything. I need notinstanceof somehow but i cant do that.
  11. Okey i did what you said and come up with this: while(entities.iterator().hasNext()){ if(entities.contains(EntityGrunt.class){ //NOT WORK mc.thePlayer.addChatMessage(new ChatComponentText("ON")); }else{ mc.thePlayer.addChatMessage(new ChatComponentText("OFF")); } break; } But i can't get the entity from the list. Only OFF text showing that means i screw up the "contains" code.
  12. I have a monster and i want to detect if its in a specified range to player. There is any way to do it? I tryed that, but its only see the closest entity and all what in the list: List<Entity> entities = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.thePlayer, mc.thePlayer.boundingBox.expand(19.0D, 19.0D, 19.0D)); Entity entity; if(entities.iterator().hasNext()){ entity = (Entity)entities.iterator().next(); if(entity instanceof EntityGrunt){ if(numTicks % 20L == 0L && sanity != 0) sanity -= 1; if(terrorcounter != 0){ terrorcounter--; } else if(terrorcounter == 0){ mc.theWorld.playSound(X, Y, Z, "fluffy:Terror", 999.0F, 1.0F, false); terrorcounter = 80; } if(chase == false){ try{ if(fear == false){ Minecraft.getMinecraft().entityRenderer.theShaderGroup = new ShaderGroup(Minecraft.getMinecraft().getResourceManager(), Minecraft.getMinecraft().getFramebuffer(), new ResourceLocation("shaders/post/deconverge.json")); Minecraft.getMinecraft().entityRenderer.theShaderGroup.createBindFramebuffers(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); } mc.theWorld.playSound(X, Y, Z, "fluffy:music.AttackGrunt", 999.0F, 1.0F, false); this.chase = true; } catch(IOException ioexception) {} } }else{ if(chase){ mc.entityRenderer.theShaderGroup = null; this.chase = false; terrorcounter = 0; mc.gameSettings.setSoundLevel(SoundCategory.RECORDS, 0.0F); mc.gameSettings.setSoundLevel(SoundCategory.RECORDS, sound); } } }else{ if(chase){ mc.entityRenderer.theShaderGroup = null; this.chase = false; terrorcounter = 0; mc.gameSettings.setSoundLevel(SoundCategory.RECORDS, 0.0F); mc.gameSettings.setSoundLevel(SoundCategory.RECORDS, sound); } } I can't get an entity out of the list coz entities.contain() not work. Thanks for helping!
  13. So you guys have no idea where the light engine is written.
  14. Mainly i want to make a circular light. Than want to make it a bit more orangeis.
  15. I know how to add light value to a block. I want to modify the existing light in the game(shape, colour, ect...). The info is good GreyGhost, but its not what i need. I want to know where should i look around in the minecraft source. If its created with OpenGL where is the OpenGl class that creates the actual light? Thanks!
  16. Hello everyone, I want to modify or create a new light source in the game, but i cant figure out where is minecraft lighting system written. I mean where can i find the .class for it? I figured out light is not a block in this game its something else. Thank you for helping!
  17. Thank you guys! The problem seems to be i can't use EntityLivingBase and i missed the break; line.
  18. Thank you but it causes hanging to my game. The game is still running i can see it on the console, but the screen is freezed. I discovered that the "while" causes it.
  19. In a TickHander i was checking for entities around the player. List<Entity> entities = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.thePlayer, mc.thePlayer.boundingBox.expand(19.8D, 19.8D, 19.8D)); My problem is i want to get only a specific entity out that list. If its there that do something. I tryed: entities.contains(EntityGrunt.class) entities == new EntityGrunt(mc.theWorld) entities instanceof EntityGrunt Nothing worked. The code is working i can print out the list and its shows that there is EntityGrunt in the range. Thanks!
  20. Thank you i got the answer right there! Code: try{ Minecraft.getMinecraft().entityRenderer.theShaderGroup = new ShaderGroup(Minecraft.getMinecraft().getResourceManager(), Minecraft.getMinecraft().getFramebuffer(), new ResourceLocation("shaders/post/phosphor.json")); Minecraft.getMinecraft().entityRenderer.theShaderGroup.createBindFramebuffers(Minecraft.getMinecraft(). displayWidth, Minecraft.getMinecraft().displayHeight); } catch(IOException ioexception) {}
  21. Is there any way to turn on a specific shader when something happens? And not just a random shader. Like Shanders.enableShader(Shanders.phospor); Thanks!
×
×
  • Create New...

Important Information

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