org.spongepowered.asm.mixin.Overwrite Java Examples

The following examples show how to use org.spongepowered.asm.mixin.Overwrite. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MixinCrashReport.java    From VanillaFix with MIT License 6 votes vote down vote up
/** @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", "    ");
}
 
Example #2
Source File: MixinNetHandlerPlayClient.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * @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;
    }
}
 
Example #3
Source File: MixinGuiChat.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @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);
}
 
Example #4
Source File: MixinGuiConnecting.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @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);
}
 
Example #5
Source File: MixinRenderPlayer.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * @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_);
}
 
Example #6
Source File: MixinMinecraft.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @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();
        }
    }
}
 
Example #7
Source File: MixinGlStateManager.java    From VanillaFix with MIT License 6 votes vote down vote up
@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();
            }
        }
    }
}
 
Example #8
Source File: MixinBlockLadder.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @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);
        }
    }
}
 
Example #9
Source File: MixinEntityLivingBase.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @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;
}
 
Example #10
Source File: MixinEffectRenderer.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @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) {
    }
}
 
Example #11
Source File: MixinUtil.java    From VanillaFix with MIT License 6 votes vote down vote up
/**
 * @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;
    }
}
 
Example #12
Source File: MixinEntityLivingBase.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @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;
}
 
Example #13
Source File: MixinBlock.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @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);
}
 
Example #14
Source File: MixinC00Handshake.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @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());
}
 
Example #15
Source File: MixinGuiEditSign.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @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);
    }
}
 
Example #16
Source File: MixinBlockModelShapes.java    From VanillaFix with MIT License 5 votes vote down vote up
/**
 * @reason Get the stored location for that state, and get the model from
 * that location from the model manager.
 **/
@Overwrite
public IBakedModel getModelForState(IBlockState state) {
    IBakedModel model = modelManager.getModel(modelLocations.get(state));
    if (model == null) {
        model = modelManager.getMissingModel();
    }
    return model;
}
 
Example #17
Source File: MixinMultiMap.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @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);
        }
    };
}
 
Example #18
Source File: MixinGuiEditSign.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @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);
    }
}
 
Example #19
Source File: MixinItemModelMesherForge.java    From VanillaFix with MIT License 5 votes vote down vote up
/**
 * @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));
}
 
Example #20
Source File: MixinCrashReportCategory.java    From VanillaFix with MIT License 5 votes vote down vote up
/** @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");
    }
}
 
Example #21
Source File: MixinModelPlayer.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @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();
}
 
Example #22
Source File: MixinEntityPlayerSP.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @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);
    }
}
 
Example #23
Source File: MixinNetHandlerPlayClient.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 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;
        }
    }
}
 
Example #24
Source File: MixinItemModelMesherForge.java    From VanillaFix with MIT License 5 votes vote down vote up
/**
 * @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);
}
 
Example #25
Source File: MixinEnchantmentHelper.java    From VanillaFix with MIT License 5 votes vote down vote up
/** @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());
    }
}
 
Example #26
Source File: MixinEnumConnectionState.java    From VanillaFix with MIT License 5 votes vote down vote up
/**
 * @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();
}
 
Example #27
Source File: MixinRendererLivingEntity.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @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;
}
 
Example #28
Source File: MixinGuiScreenResourcePacks.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @reason Change text location
 * @author SiroQ
 */
@Overwrite
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    hyperiumGuiResourcePack.drawScreen(availableResourcePacksList, selectedResourcePacksList, mouseX, mouseY, partialTicks, fontRendererObj, width);
    super.drawScreen(mouseX, mouseY, partialTicks);
    textField.drawTextBox();
}
 
Example #29
Source File: MixinTextureManager.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @author asbyth
 * @reason fix missing textures
 */
@Overwrite
public boolean loadTickableTexture(ResourceLocation resourceLocation, ITickableTextureObject textureObject) {
    if (loadTexture(resourceLocation, textureObject)) {
        listTickables.add(textureObject);
        textures.put(resourceLocation.toString(), textureObject);
        return true;
    } else {
        return false;
    }
}
 
Example #30
Source File: MixinCrashReport.java    From VanillaFix with MIT License 5 votes vote down vote up
/** @reason Improve report formatting, add VanillaFix comment */
@Overwrite
public void getSectionsInStringBuilder(StringBuilder builder) {
    for (CrashReportCategory crashreportcategory : crashReportSections) {
        crashreportcategory.appendToStringBuilder(builder);
        builder.append("\n");
    }

    systemDetailsCategory.appendToStringBuilder(builder);
}