Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static final Method setSize = ReflectionHelper.findMethod(Entity.class, "setSize", "func_70105_a", float.class, float.class);
- @SubscribeEvent
- public static void playerUpdate(TickEvent.PlayerTickEvent event)
- {
- EntityPlayer player = event.player;
- EntityEquipmentSlot head = EntityEquipmentSlot.HEAD;
- EntityEquipmentSlot chest = EntityEquipmentSlot.CHEST;
- EntityEquipmentSlot legs = EntityEquipmentSlot.LEGS;
- EntityEquipmentSlot feet = EntityEquipmentSlot.FEET;
- Item helmet = ModItems.SPACE_SUIT_HELMET;
- Item body = ModItems.SPACE_SUIT_CHEST;
- Item leggings = ModItems.SPACE_SUIT_LEGS;
- Item boots = ModItems.SPACE_SUIT_BOOTS;
- if(player.getItemStackFromSlot(head).getItem() == helmet &&
- player.getItemStackFromSlot(chest).getItem() == body &&
- player.getItemStackFromSlot(legs).getItem() == leggings &&
- player.getItemStackFromSlot(feet).getItem() == boots)
- {
- AxisAlignedBB aabb = player.getEntityBoundingBox();
- float height = 1.8F;
- float width = 0.6F;
- player.eyeHeight = height * 0.9F;
- player.stepHeight = height / 3F;
- player.setEntityBoundingBox(new AxisAlignedBB(aabb.minX, aabb.minY, aabb.minZ, aabb.minX + width,
- aabb.minY + height, aabb.minZ + width));
- if(!player.world.collidesWithAnyBlock(aabb))
- {
- player.setEntityBoundingBox(new AxisAlignedBB(aabb.minX, aabb.minY, aabb.minZ, aabb.minX + width,
- aabb.minY + height, aabb.minZ + width));
- try
- {
- setSize.invoke(player, width, height);
- }
- catch (IllegalAccessException e)
- {
- e.printStackTrace();
- }
- catch (IllegalArgumentException e)
- {
- e.printStackTrace();
- }
- catch (InvocationTargetException e)
- {
- e.printStackTrace();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment