• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Redirect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.spongepowered.asm.mixin.injection.Redirect的典型用法代码示例。如果您正苦于以下问题:Java Redirect类的具体用法?Java Redirect怎么用?Java Redirect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Redirect类属于org.spongepowered.asm.mixin.injection包,在下文中一共展示了Redirect类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: rotateRedirect

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(
        method = "applyRotations(Lnet/minecraft/client/entity/AbstractClientPlayer;FFF)V",
        at = @At(
                value = "INVOKE",
                target = "Lnet/minecraft/client/renderer/GlStateManager;rotate(FFFF)V",
                ordinal = 3))
private void rotateRedirect(float f1, float f2, float f3, float f4) {
    boolean isPony = this.playerModel.getModel() instanceof ModelPlayerPony;
    if (isPony) {
        f1 += 90;
    }

    GlStateManager.rotate(f1, f2, f3, f4);
    if (isPony) {
        GlStateManager.translate(0, -1, 0);
    }
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:18,代码来源:MixinRenderPlayer.java


示例2: onBindTexture

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(
        method = "renderSkull",
        at = @At(
                value = "INVOKE",
                target = "Lnet/minecraft/client/renderer/tileentity/TileEntitySkullRenderer;bindTexture(Lnet/minecraft/util/ResourceLocation;)V",
                ordinal = 4))
private void onBindTexture(TileEntitySkullRenderer tesr, ResourceLocation rl, float x, float y, float z, EnumFacing facing, float rotation, int meta,
                           @Nullable GameProfile profile, int p_180543_8_, float ticks) {
    if (profile != null) {
        Optional<ResourceLocation> skin = HDSkinManager.INSTANCE.getSkinLocation(profile, Type.SKIN, true);
        if (skin.isPresent())
            // rebind
            bindTexture(skin.get());
        else
            bindTexture(rl);
    } else
        bindTexture(rl);
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:19,代码来源:MixinSkullRenderer.java


示例3: firePlayerListData

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(method = "playerLoggedOut",
        at = @At(value = "INVOKE", target = "Lnet/minecraft/server/management/ServerConfigurationManager;"
                + "sendPacketToAllPlayers(Lnet/minecraft/network/Packet;)V"))
public void firePlayerListData(ServerConfigurationManager manager, net.minecraft.network.Packet packetIn, EntityPlayerMP playerIn) {
    PlayerListData playerListData = ((Player) playerIn).getPlayerListData(PlayerListAction.REMOVE_PLAYER);
    for (EntityPlayerMP playerMP : manager.playerEntityList) {
        PlayerListHook playerListHook = new PlayerListHook(playerListData.copy(), (Player) playerMP);
        if (!playerListHook.call().isCanceled()) {
            S38PacketPlayerListItem packet = new S38PacketPlayerListItem();
            packet.action = S38PacketPlayerListItem.Action.valueOf(PlayerListAction.REMOVE_PLAYER.name());
            WorldSettings.GameType gameType =
                    WorldSettings.GameType.getByID(playerListHook.getData().getMode().getId());
            IChatComponent iChatComponent = playerListHook.getData().displayNameSet() ?
                    (IChatComponent) playerListHook.getData().getDisplayName() : null;
            packet.players.add(packet.new AddPlayerData(playerListHook.getData()
                    .getProfile(), playerListHook.getData().getPing(), gameType, iChatComponent));
            playerMP.playerNetServerHandler.sendPacket(packet);
        }
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:21,代码来源:MixinServerConfigurationManager.java


示例4: handleStringProperties

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(method = "startServer", at = @At(value = "INVOKE",
        target = "Lnet/minecraft/server/dedicated/PropertyManager;"
                + "getStringProperty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"))
public String handleStringProperties(PropertyManager propertyManager, String key, String defaultValue) {
    if ("server-ip".equals(key)) {
        return Configuration.getServerConfig().getBindIp();
    } else if ("motd".equals(key)) {
        return Configuration.getServerConfig().getMotd();
    } else if ("level-name".equals(key)) {
        return Configuration.getServerConfig().getDefaultWorldName();
    } else if ("level-seed".equals(key)) {
        return Configuration.getWorldConfig(this.getFolderName() + "_NORMAL").getWorldSeed();
    } else if ("level-type".equals(key)) {
        return Configuration.getWorldConfig(this.getFolderName() + "_NORMAL").getWorldType().toString();
    } else if ("generator-type".equals(key)) {
        return Configuration.getWorldConfig(this.getFolderName() + "_NORMAL").getGeneratorSettings();
    } else {
        return propertyManager.getStringProperty(key, defaultValue);
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:21,代码来源:MixinDedicatedServer.java


示例5: doRender

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(method = "doRenderEntity(Lnet/minecraft/entity/Entity;DDDFFZ)V", at = @At(value = "INVOKE", target = "net/minecraft/client/renderer/entity/Render.doRender(Lnet/minecraft/entity/Entity;DDDFF)V"))
@SuppressWarnings("unchecked")
private void doRender(Render render, Entity entity, double x, double y, double z, float entityYaw, float partialTicks) {
    EntityRenderEvent event = new EntityRenderEvent(EventState.PRE, render, entity, x, y, z, entityYaw, partialTicks);
    ClientAPI.EVENT_BUS.post(event);
    if (!event.isCancelled())
        render.doRender(entity, x, y, z, entityYaw, partialTicks);

    ClientAPI.EVENT_BUS.post(new EntityRenderEvent(EventState.POST, render, entity, x, y, x, entityYaw, partialTicks));
}
 
开发者ID:ImpactDevelopment,项目名称:ClientAPI,代码行数:11,代码来源:MixinRenderManager.java


示例6: travel

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(method = "onLivingUpdate", at = @At(value = "INVOKE", target = "net/minecraft/entity/EntityLivingBase.travel(FFF)V"))
private void travel(EntityLivingBase entity, float strafe, float vertical, float forward) {
    EntityTravelEvent event = new EntityTravelEvent(EventState.PRE, entity, strafe, vertical, forward);
    ClientAPI.EVENT_BUS.post(event);
    if (!event.isCancelled())
        entity.travel(event.getStrafe(), event.getVertical(), event.getForward());

    ClientAPI.EVENT_BUS.post(new EntityTravelEvent(EventState.POST, entity, strafe, vertical, forward));
}
 
开发者ID:ImpactDevelopment,项目名称:ClientAPI,代码行数:10,代码来源:MixinEntityLivingBase.java


示例7: move

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(method = "move", at = @At(value = "INVOKE", target = "net/minecraft/client/entity/AbstractClientPlayer.move(Lnet/minecraft/entity/MoverType;DDD)V"))
private void move(AbstractClientPlayer player, MoverType type, double x, double y, double z) {
    MoveEvent event = new MoveEvent(type, x, y, z);
    ClientAPI.EVENT_BUS.post(event);
    if (event.isCancelled())
        return;

    super.move(type, event.getX(), event.getY(), event.getZ());
}
 
开发者ID:ImpactDevelopment,项目名称:ClientAPI,代码行数:10,代码来源:MixinEntityPlayerSP.java


示例8: doRenderLayer

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(method = "renderLayers", at = @At(value = "INVOKE", target = "net/minecraft/client/renderer/entity/layers/LayerRenderer.doRenderLayer(Lnet/minecraft/entity/EntityLivingBase;FFFFFFF)V"))
@SuppressWarnings("unchecked")
private void doRenderLayer(LayerRenderer renderer, EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scaleIn) {
    LayerRenderEvent event = new LayerRenderEvent(entitylivingbaseIn, renderer);
    ClientAPI.EVENT_BUS.post(event);
    if (!event.isCancelled())
        renderer.doRenderLayer(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scaleIn);
}
 
开发者ID:ImpactDevelopment,项目名称:ClientAPI,代码行数:9,代码来源:MixinRenderLivingBase.java


示例9: processPacket

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(method = "channelRead0", at = @At(value = "INVOKE", target = "net/minecraft/network/Packet.processPacket(Lnet/minecraft/network/INetHandler;)V"))
@SuppressWarnings("unchecked")
private void processPacket(Packet<?> packetIn, INetHandler handler) {
    PacketEvent event = new PacketEvent.Receive(packetIn);
    ClientAPI.EVENT_BUS.post(event);
    if (event.isCancelled())
        return;

    ((Packet<INetHandler>) event.getPacket()).processPacket(handler);
}
 
开发者ID:ImpactDevelopment,项目名称:ClientAPI,代码行数:11,代码来源:MixinNetworkManager.java


示例10: sendPacket

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@SuppressWarnings("AmbiguousMixinReference")
@Redirect(method = "sendPacket", at = @At(value = "INVOKE", target = "net/minecraft/network/NetworkManager.dispatchPacket(Lnet/minecraft/network/Packet;[Lio/netty/util/concurrent/GenericFutureListener;)V"))
private void sendPacket(NetworkManager networkManager, Packet<?> packetIn, @Nullable final GenericFutureListener<? extends Future<?super Void>>[] futureListeners) {
    PacketEvent event = new PacketEvent.Send(packetIn);
    ClientAPI.EVENT_BUS.post(event);
    if (event.isCancelled())
        return;

    this.dispatchPacket(event.getPacket(), null);
}
 
开发者ID:ImpactDevelopment,项目名称:ClientAPI,代码行数:11,代码来源:MixinNetworkManager.java


示例11: onDrawStringWithShadow

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I"))
public int onDrawStringWithShadow(FontRenderer fontRenderer, String string, float x, float y, int colour) {
    try {
        string = Serenity.getInstance().getFriendManager().applyProtection(string);
    } catch (Exception ignored) {}
    return fontRenderer.drawStringWithShadow(string, x, y, colour);
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:8,代码来源:MixinGuiPlayerTabOverlay.java


示例12: onGetStringWidth

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;getStringWidth(Ljava/lang/String;)I"))
public int onGetStringWidth(FontRenderer fontRenderer, String string) {
    try {
        string = Serenity.getInstance().getFriendManager().applyProtection(string);
    } catch (Exception ignored) {}
    return fontRenderer.getStringWidth(string);
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:8,代码来源:MixinGuiPlayerTabOverlay.java


示例13: injectCustomTransform

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(method = "renderItemInFirstPerson", at = @At(value = "INVOKE", target = "net.minecraft.client.renderer.ItemRenderer.transformFirstPersonItem(FF)V", ordinal = 2))
public void injectCustomTransform(ItemRenderer itemRenderer, float equipProgress, float swingProgress) {
    try {
        if (Serenity.getInstance().getModuleManager().getModule(BlockHit.class).isEnabled()) {
            transformFirstPersonItem(equipProgress, Minecraft.getMinecraft().thePlayer.getSwingProgress(((MinecraftExtension) Minecraft.getMinecraft()).getTimer().renderPartialTicks));
        } else {
            transformFirstPersonItem(equipProgress, swingProgress);
        }
    } catch (Exception e) {
        transformFirstPersonItem(equipProgress, swingProgress);
    }
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:13,代码来源:MixinItemRenderer.java


示例14: onIsSneaking

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(method = "moveEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;isSneaking()Z"))
public boolean onIsSneaking(Entity entity) {
    if (entity == Minecraft.getMinecraft().thePlayer)
        return EventManager.post(new ShouldSafeWalk(entity.isSneaking())).getShouldSafeWalk();

    return entity.isSneaking();
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:8,代码来源:MixinEntity.java


示例15: onDrawStringWithShadow

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(method = "drawChat(I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I"))
public int onDrawStringWithShadow(FontRenderer fontRenderer, String string, float x, float y, int colour) {
    try {
        string = Serenity.getInstance().getFriendManager().applyProtection(string);
    } catch (Exception ignored) {}
    return fontRenderer.drawStringWithShadow(string, x, y, colour);
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:8,代码来源:MixinGuiNewChat.java


示例16: onRegister

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
/**
 * @author gabizou - February 4th, 2016
 *
 * This redirects the registration of an Aspect so that
 * the AspectRegistryModule will know of them.
 */
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Ljava/util/LinkedHashMap;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"), remap = false)
private Object onRegister(LinkedHashMap<Object, Object> aspects, Object name, Object aspect) {
    AspectRegistryModule.getInstance().registerAspect((Aspect) aspect, name);
    aspects.put(name, aspect);
    return aspect;
}
 
开发者ID:gabizou,项目名称:ThaumicSponge,代码行数:13,代码来源:MixinAspect.java


示例17: redirectLeftArm

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(
        method = "renderLeftArm(Lnet/minecraft/client/entity/AbstractClientPlayer;)V",
        at = @At(
                value = "FIELD",
                target = "Lnet/minecraft/client/model/ModelPlayer;bipedLeftArm:Lnet/minecraft/client/model/ModelRenderer;",
                opcode = Opcodes.GETFIELD),
        require = 2)
private ModelRenderer redirectLeftArm(ModelPlayer mr) {
    return this.playerModel.getModel().steveLeftArm;
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:11,代码来源:MixinRenderPlayer.java


示例18: redirectLeftArmwear

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(
        method = "renderLeftArm(Lnet/minecraft/client/entity/AbstractClientPlayer;)V",
        at = @At(
                value = "FIELD",
                target = "Lnet/minecraft/client/model/ModelPlayer;bipedLeftArmwear:Lnet/minecraft/client/model/ModelRenderer;",
                opcode = Opcodes.GETFIELD),
        require = 2)
private ModelRenderer redirectLeftArmwear(ModelPlayer mr) {
    return this.playerModel.getModel().steveLeftArmwear;
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:11,代码来源:MixinRenderPlayer.java


示例19: redirectRightArm

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(
        method = "renderRightArm(Lnet/minecraft/client/entity/AbstractClientPlayer;)V",
        at = @At(
                value = "FIELD",
                target = "Lnet/minecraft/client/model/ModelPlayer;bipedRightArm:Lnet/minecraft/client/model/ModelRenderer;",
                opcode = Opcodes.GETFIELD),
        require = 2)
private ModelRenderer redirectRightArm(ModelPlayer mr) {
    return this.playerModel.getModel().steveRightArm;
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:11,代码来源:MixinRenderPlayer.java


示例20: redirectRightArmwear

import org.spongepowered.asm.mixin.injection.Redirect; //导入依赖的package包/类
@Redirect(
        method = "renderRightArm(Lnet/minecraft/client/entity/AbstractClientPlayer;)V",
        at = @At(
                value = "FIELD",
                target = "Lnet/minecraft/client/model/ModelPlayer;bipedRightArmwear:Lnet/minecraft/client/model/ModelRenderer;",
                opcode = Opcodes.GETFIELD),
        require = 2)
private ModelRenderer redirectRightArmwear(ModelPlayer mr) {
    return this.playerModel.getModel().steveRightArmwear;
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:11,代码来源:MixinRenderPlayer.java



注:本文中的org.spongepowered.asm.mixin.injection.Redirect类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CharFilter类代码示例发布时间:2022-05-22
下一篇:
Java StackImpl类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap