Jump to content

jredfox

Members
  • Posts

    660
  • Joined

  • Last visited

Everything posted by jredfox

  1. Solved Use LivingAttackEvent instead of hurt: @SubscribeEvent(priority = EventPriority.LOW) public void hurt(LivingAttackEvent e) { if(!(e.getEntity() instanceof EntityPlayerMP) || e.getSource() == DamageSource.OUT_OF_WORLD) return; EntityPlayerMP player = (EntityPlayerMP) e.getEntity(); CapAbility cap = (CapAbility) CapabilityReg.getCapabilityConatainer(player).getCapability(new ResourceLocation(Reference.MODID + ":" + "ability")); if(cap.godEnabled) { player.capabilities.disableDamage = true; player.sendPlayerAbilities(); e.setCanceled(true); } }
  2. @SubscribeEvent(priority = EventPriority.LOW) public void hurt(LivingHurtEvent e) { if(!(e.getEntity() instanceof EntityPlayerMP)) return; EntityPlayerMP player = (EntityPlayerMP) e.getEntity(); CapAbility cap = (CapAbility) CapabilityReg.getCapabilityConatainer(player).getCapability(new ResourceLocation(Reference.MODID + ":" + "ability")); if(cap.godEnabled) { System.out.println("here"); player.capabilities.disableDamage = true; player.sendPlayerAbilities(); e.setResult(Result.DENY); e.setAmount(0.0F); e.setCanceled(true); } } As you can see above the code prints here and sets it canceled but, the hurt sound still plays. Yes I tried always canceling it regardless of what entity it is and that still played the hurt sound. Issue: hurt sound and animation still plays even though damage isn't even suppose to be dealt once canceled to the player Test 2 still plays sound: @SubscribeEvent(priority = EventPriority.LOW) public void hurt(LivingHurtEvent e) { if(!(e.getEntity() instanceof EntityPlayer)) return; e.setCancled(true); } Test 3 still plays sound: @SubscribeEvent(priority = EventPriority.LOW) public void hurt(LivingHurtEvent e) { e.setCancled(true); }
  3. yes they are pretty advanced if you take a look at the links it's part of the github respiratory feel free to use Evil Notch Lib in your own mods via dependency. If you take a look at FeildAcess.java it shows you how to use MCPMappings Api which you give a class and deob field name then it will produce the right string based on the dev environment It appears it's the client that's the issue client is like here is old coords server says new coords don't match packet try and freak out. Even draconic evolution has this issue as well as vanilla. The proper fix would be to disable the checks on server side for good on both the vehicles the horses and the players. Of course leaving old checks like flying though. As for now I am leaving EvilNotch Lib ASM free right now but, if you want to get in on this and help me that would be great just msg me
  4. you think of it wrongly the world loaded chunks is what I am worried about not necessarily the chunk provider might have an if else statement for modded worlds or just plain not using it always for chunk provider. If you looked at another method checking for chunk generated at checks both the world and chunk provider Anyways this thread is solved
  5. it won't always work with modded worlds and that's the issue.
  6. well I got the crash report as stated above when the object of the world was created as a new instance rarely but, it did happen as well as it occurring when I was trying to access player methods because I didn't set it accessible every time just once in pre init.
  7. If I don't the world throws an Illegal Security exception I tried just setting it accessible only once on startup it sometimes fails if the world becomes a new instance. And it is needed outside the world class for modded terrain generation if they are optimized that is
  8. not sure if this is proper but, I got it working would prefer no reflection this is something that should always be visable: /** * uses reflection since the world method is protected */ public static boolean isChunkLoaded(World w,int x,int z,boolean allowEmpty) { try { Method m = FieldAcess.chunkLoaded; m.setAccessible(true); return (Boolean) m.invoke(w, x,z,allowEmpty); } catch(Throwable t) { t.printStackTrace(); } return false; }
  9. WorldServer is protected why? I feel this should always be public especially with checking stuff like chunks are loaded protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) { return this.getChunkProvider().chunkExists(x, z); }
  10. maybe I could do both? Either way it seems to be protected weird return world.isChunkLoaded() && world.chunkProivder.chunkExists(); ChunkProvider.chunkExists()doesn't seem to be a method for the interface I could check for chunk provider loaded chunk method I think I should always use the world's implementation instead of chunk providers since that should always work but, the method is protected I don't want to use reflection why is it protected?
  11. it says chunkExists I believe it returns whether or not it's been generated not if it's currently loaded into memory helpful but, wrong boolean
  12. calling world get chunk will provide the chunk if not loaded and will always return true I believe. In 1.7.10 there was a world.chunkExists(chunkX,chunkZ) where it sounded like it checked only loaded?
  13. I tried System.out.println("First Check:" + e.world.isChunkGeneratedAt(chunkX,chunkZ)); but, it said true when I was checking a chunk 100 blocks away. It returned true since the chunk generated that far away was already stored on the disk how should I test for actual loaded chunks?
  14. seems like it's a packet issue with the client the fix for this is asm if anything since there are no work arounds the check just needs to be remvoed
  15. so basically I am asking how to stop it from trying to revert me and the horses position when teleporting the horse????
  16. I get this with my command /tpdim. I was trying to teleport the entity horse to another dimension the issue is the cheat system for the server thinks the horse should be at the orignal location after manually teleporting the horse and the player to the new location. Steps to reproduce: ride a horse /tpdim @e[type=horse] ~ ~ ~100 0 have the console spit out vehicle moved too quickly or horse moved too quickly and sometimes the teleport doesn't even work Code: Command class EntityUtil.teleportEntity: how should I fix it where is the vehicle of the player captured coords or whatever so I can say this is the new coords to the player vehicle. Attempt fix one failed due to packet sending in previous coords. If you look at the network class of the player on process vechile move it checks current and packet coords the client is sending previous coords and screwing everything up. it can be reproduced on regular teleport command /** * work around for the shitty cheat detection system in vanilla */ public static void captureCoords(EntityPlayerMP player) { try { NetHandlerPlayServer connection = player.connection; FieldAcess.capture.invoke(connection); Entity lowest = player.getLowestRidingEntity(); ReflectionUtil.setObject(connection, null, NetHandlerPlayServer.class, "lowestRiddenEnt"); if(lowest == null) lowest = player; ReflectionUtil.setObject(connection, lowest.posX, NetHandlerPlayServer.class, FieldAcess.lowestRiddenX); ReflectionUtil.setObject(connection, lowest.posY, NetHandlerPlayServer.class, FieldAcess.lowestRiddenY); ReflectionUtil.setObject(connection, lowest.posZ, NetHandlerPlayServer.class, FieldAcess.lowestRiddenZ); ReflectionUtil.setObject(connection, lowest.posX, NetHandlerPlayServer.class, FieldAcess.lowestRiddenX1); ReflectionUtil.setObject(connection, lowest.posY, NetHandlerPlayServer.class, FieldAcess.lowestRiddenY1); ReflectionUtil.setObject(connection, lowest.posZ, NetHandlerPlayServer.class, FieldAcess.lowestRiddenZ1); } catch(Throwable t) { t.printStackTrace(); } }
  17. Should be stored as HashMap<ResourceLocation,ICapability> if your looking to replace the system for forge and should be a forge pull(ICapability in my opinion should only have read/write to nbt. However if your working with the system forge already gives you it needs to be synced with serialization during read/write to nbt Example for players replacing a system(similar to what bukkit does): https://github.com/jredfox/evilnotchlib/tree/master/src/main/java/com/EvilNotch/lib/minecraft/content/pcapabilites
  18. so your saying it's proper to do division then ? why is there an x there then as if that failed?
  19. ok so >>4 or use math helper then?
  20. Edit: use >> 4 >> 4 or /16 for getting chunk? I have read that >>4 is more optimized yet it fails on negative numbers I am confused since vanilla uses >>4 when it's negative???? I need it for teleporting entities now because of a vanilla bug with the entities not being added to chunks when teleporting if the chunk isn't loaded(never) or not being added to next tick /** *supports teleporting entities from location to location in the same dimension doesn't support actual cross dimensional teleport */ public static void doTeleport(Entity e, double x, double y, double z,float yaw, float pitch) { int chunkOldX = (int)e.posX >> 4; int chunkOldZ = (int)e.posZ >> 4; int chunkX = (int)x >> 4; int chunkZ = (int)z >> 4; //remove from old chunk if(chunkOldX != chunkX || chunkOldZ != chunkZ) { Chunk chunkOld = e.world.getChunkFromChunkCoords(chunkOldX,chunkOldZ); chunkOld.removeEntity(e); } if (e instanceof EntityPlayerMP) { Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class); e.dismountRidingEntity(); e.setLocationAndAngles(x, y, z, e.rotationYaw, e.rotationPitch); ((EntityPlayerMP)e).connection.setPlayerLocation(x, y, z, yaw, pitch, set); } else { float f2 = (float)MathHelper.wrapDegrees(yaw); float f3 = (float)MathHelper.wrapDegrees(pitch); f3 = MathHelper.clamp(f3, -90.0F, 90.0F); e.setLocationAndAngles(x, y, z, f2, f3); } if (!(e instanceof EntityLivingBase) || !((EntityLivingBase)e).isElytraFlying()) { e.motionY = 0.0D; e.onGround = true; } //vanilla hotfix add entity to the new chunk if not already added Chunk chunk = e.world.getChunkFromChunkCoords(chunkX,chunkZ); if(!containsEntity(chunk.getEntityLists(),e)) chunk.addEntity(e); } public static boolean containsEntity(ClassInheritanceMultiMap<Entity>[] list,Entity e) { for(int i=0;i<list.length;i++) { ClassInheritanceMultiMap map = list[i]; Iterator<Entity> it = map.iterator(); while(it.hasNext()) { Entity e2 = it.next(); if(e == e2) return true; } } return false; }
  21. all I am asking is where is the client info for thinking it's dead so I can debug and where does it render the dead model since it's clearly wrong
  22. just returns p.getHeldItem(hand); I know it doesn't work always because I changed the toolclasses of diamond ore to axe and set the material to wood then next thing I know the speed is default for pickaxe when it should be 1.0F. It's due to vanilla hard coding a list of blocks rather then comparing block material mods shouldn't have this issue. I mean I could just always get the main hand but, since break speed can only be done with main hand stupid but, for other events I would like to know this.
  23. vanilla bugfix if not right toolclass have 1.0F which is what it's suppose to be. I need an itemstack for that
  24. Edit: for break event the hand will always be your main hand and the itemstack you can get off of that don't know why they just didn't throw the enum hand in there in case a mod wants to change something up I must be noob but, there is no hand argument in break speed event and get active hand randomly returns null and crashes the game @SubscribeEvent public void breakFix(PlayerEvent.BreakSpeed e) { EntityPlayer p = e.getEntityPlayer(); String blockclazz = e.getState().getBlock().getHarvestTool(e.getState()); String itemclazz = ItemUtil.getToolClass(EntityUtil.getActiveItemStack(p,p.getActiveHand() ) );//error on this line null point exception if(!blockclazz.equals(itemclazz) ) e.setNewSpeed(1.0F); System.out.println(e.getNewSpeed()); } older version you literally just called player.getActiveItemStack() and it never returned null during events unless the player had no item in that slot here it randomly returns air when it's always pickaxe help.
×
×
  • Create New...

Important Information

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