com.google.common.collect.UnmodifiableListIterator#org.spongepowered.asm.mixin.Overwrite源码实例Demo

下面列出了com.google.common.collect.UnmodifiableListIterator#org.spongepowered.asm.mixin.Overwrite 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: LiquidBounce   文件: MixinGuiChat.java
/**
 * @author CCBlueX
 */
@Overwrite
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    Gui.drawRect(2, this.height - (int) fade, this.width - 2, this.height, Integer.MIN_VALUE);
    this.inputField.drawTextBox();

    if (LiquidBounce.commandManager.getLatestAutoComplete().length > 0 && !inputField.getText().isEmpty() && inputField.getText().startsWith(String.valueOf(LiquidBounce.commandManager.getPrefix()))) {
        String[] latestAutoComplete = LiquidBounce.commandManager.getLatestAutoComplete();
        String[] textArray = inputField.getText().split(" ");
        String trimmedString = latestAutoComplete[0].replaceFirst("(?i)" + textArray[textArray.length - 1], "");

        mc.fontRendererObj.drawStringWithShadow(trimmedString, inputField.xPosition + mc.fontRendererObj.getStringWidth(inputField.getText()), inputField.yPosition, new Color(165, 165, 165).getRGB());
    }

    IChatComponent ichatcomponent =
            this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY());

    if (ichatcomponent != null)
        this.handleComponentHover(ichatcomponent, mouseX, mouseY);
}
 
源代码2 项目: VanillaFix   文件: MixinCrashReport.java
/** @reason Improve report formatting */
@Overwrite
public String getCompleteReport() {
    StringBuilder builder = new StringBuilder();

    builder.append("---- Minecraft Crash Report ----\n")
           .append("// ").append(getVanillaFixComment())
           .append("\n\n")
           .append("Time: ").append(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z").format(new Date())).append("\n")
           .append("Description: ").append(description)
           .append("\n\n")
           .append(stacktraceToString(cause).replace("\t", "    ")) // Vanilla's getCauseStackTraceOrString doesn't print causes and suppressed exceptions
           .append("\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n");

    for (int i = 0; i < 87; i++) {
        builder.append("-");
    }

    builder.append("\n\n");
    getSectionsInStringBuilder(builder);
    return builder.toString().replace("\t", "    ");
}
 
源代码3 项目: LiquidBounce   文件: MixinEntityLivingBase.java
/**
 * @author CCBlueX
 */
@Overwrite
protected void jump() {
    final JumpEvent jumpEvent = new JumpEvent(this.getJumpUpwardsMotion());
    LiquidBounce.eventManager.callEvent(jumpEvent);
    if(jumpEvent.isCancelled())
        return;

    this.motionY = jumpEvent.getMotion();

    if(this.isPotionActive(Potion.jump))
        this.motionY += (double) ((float) (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F);

    if(this.isSprinting()) {
        float f = this.rotationYaw * 0.017453292F;
        this.motionX -= (double) (MathHelper.sin(f) * 0.2F);
        this.motionZ += (double) (MathHelper.cos(f) * 0.2F);
    }

    this.isAirBorne = true;
}
 
源代码4 项目: VanillaFix   文件: MixinUtil.java
/**
 * @reason Warn the player (configurable to crash or log too) instead of only logging a
 * message a scheduled task throws an exception. The default vanilla behaviour is dangerous
 * as things will fail silently, making future bugs much harder to solve. In fact, it may
 * actually be a vanilla bug that the client doesn't crash, since they are using the "fatal"
 * log level, which is otherwise used only for problems which crash the game.
 */
@Overwrite
@Nullable
// TODO: Utils shouldn't depend on minecraft, redirect individual calls to runTask instead
public static <V> V runTask(FutureTask<V> task, Logger logger) {
    task.run();
    try {
        return task.get();
    } catch (InterruptedException | ExecutionException e) {
        ModConfig.ProblemAction action = ModConfig.crashes.scheduledTaskAction;

        if (action == ModConfig.ProblemAction.CRASH) {
            CrashUtils.crash(new CrashReport("Error executing task", e));
        } else if (action == ModConfig.ProblemAction.WARNING_SCREEN) {
            CrashUtils.warn(new CrashReport("Error executing task", e));
        } else if (action == ModConfig.ProblemAction.NOTIFICATION) {
            CrashUtils.notify(new CrashReport("Error executing task", e));
        } else if (action == ModConfig.ProblemAction.LOG) {
            logger.fatal("Error executing task", e);
        }
        return null;
    }
}
 
源代码5 项目: LiquidBounce   文件: MixinEffectRenderer.java
/**
 * @author Mojang
 * @author Marco
 */
@Overwrite
public void updateEffects() {
    try {
        for(int i = 0; i < 4; ++i)
            this.updateEffectLayer(i);

        for(final Iterator<EntityParticleEmitter> it = this.particleEmitters.iterator(); it.hasNext(); ) {
            final EntityParticleEmitter entityParticleEmitter = it.next();

            entityParticleEmitter.onUpdate();

            if(entityParticleEmitter.isDead)
                it.remove();
        }
    }catch(final ConcurrentModificationException ignored) {
    }
}
 
源代码6 项目: LiquidBounce   文件: MixinBlockLadder.java
/**
 * @author CCBlueX
 */
@Overwrite
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) {
    final IBlockState iblockstate = worldIn.getBlockState(pos);

    if(iblockstate.getBlock() instanceof BlockLadder) {
        final FastClimb fastClimb = (FastClimb) LiquidBounce.moduleManager.getModule(FastClimb.class);
        final float f = fastClimb.getState() && fastClimb.getModeValue().get().equalsIgnoreCase("AAC3.0.0") ? 0.99f : 0.125f;

        switch(iblockstate.getValue(FACING)) {
            case NORTH:
                this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
                break;
            case SOUTH:
                this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
                break;
            case WEST:
                this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
                break;
            case EAST:
            default:
                this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
        }
    }
}
 
源代码7 项目: VanillaFix   文件: MixinGlStateManager.java
@Overwrite // overwrite for efficiency
public static void bindTexture(int texture) {
    if (texture != textureState[activeTextureUnit].textureName) {
        textureState[activeTextureUnit].textureName = texture;
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);

        if (activeTextureUnit == 0) {
            if (texture == TextureScaleInfo.textureId) {
                bound = true;
                scaleTextures();
            } else if (bound) {
                bound = false;
                unscaleTextures();
            }
        }
    }
}
 
源代码8 项目: LiquidBounce   文件: MixinEntityLivingBase.java
/**
 * @author CCBlueX
 */
@Overwrite
protected void jump() {
    final JumpEvent jumpEvent = new JumpEvent(this.getJumpUpwardsMotion());
    LiquidBounce.eventManager.callEvent(jumpEvent);
    if(jumpEvent.isCancelled())
        return;

    this.motionY = jumpEvent.getMotion();

    if(this.isPotionActive(Potion.jump))
        this.motionY += (double) ((float) (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F);

    if(this.isSprinting()) {
        float f = this.rotationYaw * 0.017453292F;
        this.motionX -= (double) (MathHelper.sin(f) * 0.2F);
        this.motionZ += (double) (MathHelper.cos(f) * 0.2F);
    }

    this.isAirBorne = true;
}
 
源代码9 项目: LiquidBounce   文件: MixinMinecraft.java
/**
 * @author CCBlueX
 */
@Overwrite
private void sendClickBlockToController(boolean leftClick) {
    if(!leftClick)
        this.leftClickCounter = 0;

    if (this.leftClickCounter <= 0 && (!this.thePlayer.isUsingItem() || LiquidBounce.moduleManager.getModule(MultiActions.class).getState())) {
        if(leftClick && this.objectMouseOver != null && this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
            BlockPos blockPos = this.objectMouseOver.getBlockPos();

            if(this.leftClickCounter == 0)
                LiquidBounce.eventManager.callEvent(new ClickBlockEvent(blockPos, this.objectMouseOver.sideHit));


            if(this.theWorld.getBlockState(blockPos).getBlock().getMaterial() != Material.air && this.playerController.onPlayerDamageBlock(blockPos, this.objectMouseOver.sideHit)) {
                this.effectRenderer.addBlockHitEffects(blockPos, this.objectMouseOver.sideHit);
                this.thePlayer.swingItem();
            }
        } else if (!LiquidBounce.moduleManager.getModule(AbortBreaking.class).getState()) {
            this.playerController.resetBlockRemoving();
        }
    }
}
 
源代码10 项目: LiquidBounce   文件: MixinGuiConnecting.java
/**
 * @author CCBlueX
 */
@Overwrite
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());

    this.drawDefaultBackground();

    RenderUtils.drawLoadingCircle(scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 4 + 70);

    String ip = "Unknown";

    final ServerData serverData = mc.getCurrentServerData();
    if(serverData != null)
        ip = serverData.serverIP;

    Fonts.font40.drawCenteredString("Connecting to", scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 4 + 110, 0xFFFFFF, true);
    Fonts.font35.drawCenteredString(ip, scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 4 + 120, 0x5281FB, true);

    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
源代码11 项目: Hyperium   文件: MixinNetHandlerPlayClient.java
/**
 * @author boomboompower
 * @reason TimeChanger - changes the way time packets are handled
 */
@Overwrite
public void handleTimeUpdate(S03PacketTimeUpdate packet) {
    if (timeChanger == null) timeChanger = Hyperium.INSTANCE.getModIntegration().getTimeChanger();

    if (timeChanger.getTimeType() == null) {
        handleActualPacket(packet);
        return;
    }

    switch (timeChanger.getTimeType()) {
        case DAY:
            handleActualPacket(new S03PacketTimeUpdate(packet.getWorldTime(), -6000L, true));
            break;
        case SUNSET:
            handleActualPacket(new S03PacketTimeUpdate(packet.getWorldTime(), -22880L, true));
            break;
        case NIGHT:
            handleActualPacket(new S03PacketTimeUpdate(packet.getWorldTime(), -18000L, true));
            break;
        case VANILLA:
            handleActualPacket(packet);
            break;
    }
}
 
源代码12 项目: Hyperium   文件: MixinRenderPlayer.java
/**
 * @author Sk1er
 * @reason Cancel nametag render event when score is renderer
 */
@Overwrite
protected void renderOffsetLivingLabel(AbstractClientPlayer entityIn, double x, double y, double z, String str, float p_177069_9_, double p_177069_10_) {
    if (p_177069_10_ < 100.0D) {
        Scoreboard scoreboard = entityIn.getWorldScoreboard();
        ScoreObjective scoreobjective = scoreboard.getObjectiveInDisplaySlot(2);

        if (scoreobjective != null) {
            Score score = scoreboard.getValueFromObjective(entityIn.getName(), scoreobjective);
            RenderNameTagEvent.CANCEL = true;
            if (entityIn != Minecraft.getMinecraft().thePlayer) {
                renderLivingLabel(entityIn, score.getScorePoints() + " " + scoreobjective.getDisplayName(), x, y, z, 64);
                y += (float) getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * p_177069_9_;
            }

            RenderNameTagEvent.CANCEL = false;
        }
    }

    super.renderOffsetLivingLabel(entityIn, x, y, z, str, p_177069_9_, p_177069_10_);
}
 
源代码13 项目: Hyperium   文件: MixinModelBiped.java
/**
 * @author 9Y0, Mojang
 * @reason body parts
 */
@Overwrite
public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) {
    setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
    GlStateManager.pushMatrix();
    if (isChild) {
        float f = 2.0F;
        GlStateManager.scale(1.5F / f, 1.5F / f, 1.5F / f);
        GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
        bipedHead.render(scale);
        GlStateManager.popMatrix();
        GlStateManager.pushMatrix();
        GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f);
        GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
    } else {
        if (entityIn.isSneaking()) GlStateManager.translate(0.0F, 0.2F, 0.0F);
        bipedHead.render(scale);
    }

    // Adding our parts
    bipedBody.render(scale);
    bipedRightArm.render(scale);
    bipedLeftArm.render(scale);
    bipedRightLeg.render(scale);
    bipedLeftLeg.render(scale);
    bipedHeadwear.render(scale);
    if (getClass().equals(ModelBiped.class)) renderBiped(scale);
    GlStateManager.popMatrix();
}
 
源代码14 项目: Hyperium   文件: MixinMultiMap.java
/**
 * @author FalseHonesty
 * @reason ChatTriggers
 */
@Overwrite
public <S> Iterable<S> getByClass(final Class<S> clazz) {
    return () -> {
        List<T> list = map.get(initializeClassLookup(clazz));

        if (list == null) {
            return (UnmodifiableListIterator<S>) Utils.EMPTY_ITERATOR;
        } else {
            Iterator<T> iterator = list.iterator();
            return Iterators.filter(iterator, clazz);
        }
    };
}
 
源代码15 项目: LiquidBounce   文件: MixinC00Handshake.java
/**
 * @author CCBlueX
 */
@Overwrite
public void writePacketData(PacketBuffer buf) {
    buf.writeVarIntToBuffer(this.protocolVersion);
    buf.writeString(this.ip + (AntiForge.enabled && AntiForge.blockFML && !Minecraft.getMinecraft().isIntegratedServerRunning() ? "" : "\0FML\0"));
    buf.writeShort(this.port);
    buf.writeVarIntToBuffer(this.requestedState.getId());
}
 
源代码16 项目: Hyperium   文件: MixinGuiScreen.java
/**
 * @author SiroQ
 * @reason Fix input bug (MC-2781)
 **/
@Overwrite
public void handleKeyboardInput() throws IOException {
    char character = Keyboard.getEventCharacter();

    if (Keyboard.getEventKey() == 0 && character >= 32 || Keyboard.getEventKeyState()) {
        keyTyped(character, Keyboard.getEventKey());
    }

    mc.dispatchKeypresses();
}
 
源代码17 项目: LiquidBounce   文件: MixinGuiEditSign.java
/**
 * @author CCBlueX
 */
@Overwrite
protected void keyTyped(char typedChar, int keyCode) throws IOException {
    this.signCommand1.textboxKeyTyped(typedChar, keyCode);
    this.signCommand2.textboxKeyTyped(typedChar, keyCode);
    this.signCommand3.textboxKeyTyped(typedChar, keyCode);
    this.signCommand4.textboxKeyTyped(typedChar, keyCode);

    if(signCommand1.isFocused() || signCommand2.isFocused() || signCommand3.isFocused() || signCommand4.isFocused())
        return;

    if(keyCode == 200) {
        this.editLine = this.editLine - 1 & 3;
    }

    if(keyCode == 208 || keyCode == 28 || keyCode == 156) {
        this.editLine = this.editLine + 1 & 3;
    }

    String s = this.tileSign.signText[this.editLine].getUnformattedText();
    if(keyCode == 14 && s.length() > 0) {
        s = s.substring(0, s.length() - 1);
    }

    if((ChatAllowedCharacters.isAllowedCharacter(typedChar) || (enabled && typedChar == '§')) && this.fontRendererObj.getStringWidth(s + typedChar) <= 90) {
        s = s + typedChar;
    }

    this.tileSign.signText[this.editLine] = new ChatComponentText(s);
    if(keyCode == 1) {
        this.actionPerformed(this.doneBtn);
    }
}
 
源代码18 项目: VanillaFix   文件: MixinEnchantmentHelper.java
/** @reason Fix memory leak. See mixin class comment. */
@Overwrite
public static float getModifierForCreature(ItemStack stack, EnumCreatureAttribute creatureAttribute) {
    EnchantmentHelper.ModifierLiving enchantmentModifierLiving = new EnchantmentHelper.ModifierLiving();
    enchantmentModifierLiving.livingModifier = 0.0F;
    enchantmentModifierLiving.entityLiving = creatureAttribute;
    applyEnchantmentModifier(enchantmentModifierLiving, stack);
    return enchantmentModifierLiving.livingModifier;
}
 
源代码19 项目: LiquidBounce   文件: MixinBlock.java
/**
 * @author CCBlueX
 */
@Overwrite
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) {
    AxisAlignedBB axisalignedbb = this.getCollisionBoundingBox(worldIn, pos, state);
    BlockBBEvent blockBBEvent = new BlockBBEvent(pos, blockState.getBlock(), axisalignedbb);
    LiquidBounce.eventManager.callEvent(blockBBEvent);
    axisalignedbb = blockBBEvent.getBoundingBox();
    if(axisalignedbb != null && mask.intersectsWith(axisalignedbb))
        list.add(axisalignedbb);
}
 
源代码20 项目: LiquidBounce   文件: MixinC00Handshake.java
/**
 * @author CCBlueX
 */
@Overwrite
public void writePacketData(PacketBuffer buf) {
    buf.writeVarIntToBuffer(this.protocolVersion);
    buf.writeString(this.ip + (AntiForge.enabled && AntiForge.blockFML && !Minecraft.getMinecraft().isIntegratedServerRunning() ? "" : "\0FML\0"));
    buf.writeShort(this.port);
    buf.writeVarIntToBuffer(this.requestedState.getId());
}
 
源代码21 项目: LiquidBounce   文件: MixinGuiEditSign.java
/**
 * @author CCBlueX
 */
@Overwrite
protected void keyTyped(char typedChar, int keyCode) throws IOException {
    this.signCommand1.textboxKeyTyped(typedChar, keyCode);
    this.signCommand2.textboxKeyTyped(typedChar, keyCode);
    this.signCommand3.textboxKeyTyped(typedChar, keyCode);
    this.signCommand4.textboxKeyTyped(typedChar, keyCode);

    if(signCommand1.isFocused() || signCommand2.isFocused() || signCommand3.isFocused() || signCommand4.isFocused())
        return;

    if(keyCode == 200) {
        this.editLine = this.editLine - 1 & 3;
    }

    if(keyCode == 208 || keyCode == 28 || keyCode == 156) {
        this.editLine = this.editLine + 1 & 3;
    }

    String s = this.tileSign.signText[this.editLine].getUnformattedText();
    if(keyCode == 14 && s.length() > 0) {
        s = s.substring(0, s.length() - 1);
    }

    if((ChatAllowedCharacters.isAllowedCharacter(typedChar) || (enabled && typedChar == '§')) && this.fontRendererObj.getStringWidth(s + typedChar) <= 90) {
        s = s + typedChar;
    }

    this.tileSign.signText[this.editLine] = new ChatComponentText(s);
    if(keyCode == 1) {
        this.actionPerformed(this.doneBtn);
    }
}
 
源代码22 项目: VanillaFix   文件: MixinItemModelMesherForge.java
/**
 * @reason Get the stored location for that item and meta, and get the model
 * from that location from the model manager.
 **/
@Overwrite
@Override
protected IBakedModel getItemModel(Item item, int meta) {
    TIntObjectHashMap<ModelResourceLocation> map = locations.get(item.delegate);
    return map == null ? null : getModelManager().getModel(map.get(meta));
}
 
源代码23 项目: VanillaFix   文件: MixinCrashReportCategory.java
/** @reason Improve crash report formatting **/
@Overwrite
public void appendToStringBuilder(StringBuilder builder) {
    builder.append("-- ").append(name).append(" --\n");
    for (CrashReportCategory.Entry entry : children) {
        String sectionIndent = "  ";

        builder.append(sectionIndent)
               .append(entry.getKey())
               .append(": ");

        StringBuilder indent = new StringBuilder(sectionIndent + "  ");
        for (char ignored : entry.getKey().toCharArray()) {
            indent.append(" ");
        }

        boolean first = true;
        for (String line : entry.getValue().trim().split("\n")) {
            if (!first) builder.append("\n").append(indent);
            first = false;
            if (line.startsWith("\t")) line = line.substring(1);
            builder.append(line.replace("\t", ""));
        }

        builder.append("\n");
    }
}
 
源代码24 项目: Hyperium   文件: MixinModelPlayer.java
/**
 * @author 9Y0, Mojang
 * @reason body parts
 */
@Overwrite
public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) {
    super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale);
    GlStateManager.pushMatrix();

    if (isChild) {
        float f = 2.0F;
        GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f);
        GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
    } else {
        if (entityIn.isSneaking()) GlStateManager.translate(0.0F, 0.2F, 0.0F);
    }

    bipedLeftLegwear.render(scale);
    bipedRightLegwear.render(scale);
    bipedLeftArmwear.render(scale);
    bipedRightArmwear.render(scale);
    bipedBodyWear.render(scale);
    bipedLeftForeArmwear.render(scale);
    bipedLeftForeArm.render(scale);
    bipedRightForeArmwear.render(scale);
    bipedRightForeArm.render(scale);
    bipedLeftLowerLeg.render(scale);
    bipedLeftLowerLegwear.render(scale);
    bipedRightLowerLeg.render(scale);
    bipedRightLowerLegwear.render(scale);
    butt.render(scale);

    GlStateManager.popMatrix();
}
 
源代码25 项目: Hyperium   文件: MixinEntityPlayerSP.java
/**
 * @author FalseHonesty
 * @reason Post SendChatMessageEvent
 */
@Overwrite
public void sendChatMessage(String message) {
    SendChatMessageEvent event = new SendChatMessageEvent(message);
    EventBus.INSTANCE.post(event);

    if (!event.isCancelled()) {
        ChatUtil.sendMessage(message);
    }
}
 
源代码26 项目: Hyperium   文件: MixinNetHandlerPlayClient.java
/**
 * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt
 * or receiving a critical hit by normal or magical means
 *
 * @author boomboompower
 * @reason Fixes internal NPE
 */
@Overwrite
public void handleAnimation(S0BPacketAnimation packetIn) {
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, (NetHandlerPlayClient) (Object) this, gameController);

    // Stops the code if the world is null, usually due to a weird packet from the server
    if (clientWorldController == null) return;
    Entity entity = clientWorldController.getEntityByID(packetIn.getEntityID());

    if (entity != null) {
        switch (packetIn.getAnimationType()) {
            case 0:
                EntityLivingBase entitylivingbase = (EntityLivingBase) entity;
                entitylivingbase.swingItem();
                break;

            case 1:
                entity.performHurtAnimation();
                break;

            case 2:
                EntityPlayer entityplayer = (EntityPlayer) entity;
                entityplayer.wakeUpPlayer(false, false, false);
                break;

            case 4:
                gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT);
                break;

            case 5:
                gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT_MAGIC);
                break;
        }
    }
}
 
源代码27 项目: VanillaFix   文件: MixinItemModelMesherForge.java
/**
 * @reason Don't get all models during init (with dynamic loading, that would
 * generate them all). Just store location instead.
 **/
@Overwrite
@Override
public void register(Item item, int meta, ModelResourceLocation location) {
    IRegistryDelegate<Item> key = item.delegate;
    TIntObjectHashMap<ModelResourceLocation> locs = locations.get(key);
    if (locs == null) {
        locs = new TIntObjectHashMap<>();
        locations.put(key, locs);
    }
    locs.put(meta, location);
}
 
源代码28 项目: VanillaFix   文件: MixinEnchantmentHelper.java
/** @reason Fix memory leak. See mixin class comment. */
@Overwrite
public static void applyArthropodEnchantments(EntityLivingBase user, Entity target) {
    EnchantmentHelper.DamageIterator enchantmentIteratorDamage = new EnchantmentHelper.DamageIterator();
    enchantmentIteratorDamage.user = user;
    enchantmentIteratorDamage.target = target;

    if (user != null) {
        applyEnchantmentModifierArray(enchantmentIteratorDamage, user.getEquipmentAndArmor());
    }

    if (user instanceof EntityPlayer) {
        applyEnchantmentModifier(enchantmentIteratorDamage, user.getHeldItemMainhand());
    }
}
 
源代码29 项目: VanillaFix   文件: MixinEnumConnectionState.java
/**
 * @reason Makes packet construction faster
 */
@Nullable
@Overwrite
public Packet<?> getPacket(EnumPacketDirection direction, int packetId) {
    Supplier<? extends Packet<?>> packet = (direction == EnumPacketDirection.SERVERBOUND ? serverbound : clientbound).get(packetId);
    return packet == null ? null : packet.get();
}
 
源代码30 项目: Hyperium   文件: MixinRendererLivingEntity.java
/**
 * @author Sk1er
 * @reason Fix Levelhead not rendering on self
 */
@Overwrite
protected boolean canRenderName(T entity) {
    if (Settings.BETTERF1 && Minecraft.getMinecraft().gameSettings.hideGUI) return false;
    EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;

    if (entity instanceof EntityPlayer) {
        Team team = entity.getTeam();
        Team team1 = entityplayersp.getTeam();

        if (team != null) {
            Team.EnumVisible team$enumvisible = team.getNameTagVisibility();

            switch (team$enumvisible) {
                case NEVER:
                    return false;
                case HIDE_FOR_OTHER_TEAMS:
                    return team1 == null || team.isSameTeam(team1);
                case HIDE_FOR_OWN_TEAM:
                    return team1 == null || !team.isSameTeam(team1);
                case ALWAYS:
                default:
                    return true;
            }
        }
    }

    return Minecraft.isGuiEnabled() && entity != renderManager.livingPlayer && !entity.isInvisibleToPlayer(entityplayersp) && entity.riddenByEntity == null;
}