Esempio n. 1
0
 @Override
 public void renderTick(EntityPlayerCustom playerCustom) {
   if (playerCustom.isRolling
       || (Util.isCube(
               Minecraft.getMinecraft()
                   .theWorld
                   .getBlock(
                       MathHelper.floor_double(Minecraft.getMinecraft().thePlayer.posX),
                       MathHelper.floor_double(Minecraft.getMinecraft().thePlayer.posY),
                       MathHelper.floor_double(Minecraft.getMinecraft().thePlayer.posZ)))
           && playerCustom.wasRolling)) {
     int x1 = MathHelper.floor_double(Minecraft.getMinecraft().thePlayer.posX);
     int y1 = MathHelper.floor_double(Minecraft.getMinecraft().thePlayer.posY);
     int z1 = MathHelper.floor_double(Minecraft.getMinecraft().thePlayer.posZ);
     ExtendedBlockStorage ebs =
         ((ExtendedBlockStorage[])
                 ObfuscationReflectionHelper.getPrivateValue(
                     Chunk.class,
                     Minecraft.getMinecraft().thePlayer.worldObj.getChunkFromBlockCoords(x1, z1),
                     2))
             [y1 >> 4];
     if (ebs.getExtSkylightValue((x1 & 15), y1 & 15, (z1 & 15)) == 0) {
       ebs.setExtSkylightValue((x1 & 15), y1 & 15, (z1 & 15), playerCustom.lastLightValue);
     }
     playerCustom.lastLightValue = (byte) ebs.getExtSkylightValue((x1 & 15), y1 & 15, (z1 & 15));
     KeyBinding.setKeyBindState(
         Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), true);
     if (renderer == null) {
       renderer = new EntityRendererCustom(Minecraft.getMinecraft());
     }
     if (Minecraft.getMinecraft().entityRenderer != renderer) {
       // be sure to store the previous renderer
       prevRenderer = Minecraft.getMinecraft().entityRenderer;
       Minecraft.getMinecraft().entityRenderer = renderer;
     }
   } else if (prevRenderer != null
       && Minecraft.getMinecraft().entityRenderer != prevRenderer
       && playerCustom.wasRolling) {
     // reset the renderer
     KeyBinding.setKeyBindState(
         Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), false);
     Minecraft.getMinecraft().entityRenderer = prevRenderer;
     playerCustom.wasRolling = false;
   }
   if (!playerCustom.wasRolling) {
     playerCustom.wasRolling = playerCustom.isRolling;
   }
 }