当前位置: 首页>>代码示例>>Java>>正文


Java CallbackInfoReturnable类代码示例

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


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

示例1: getSkinType

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(
        method = "getSkinType",
        cancellable = true,
        at = @At("RETURN"))
private void getSkinType(CallbackInfoReturnable<String> ci) {
    MinecraftProfileTexture skin = HDSkinManager.INSTANCE.getProfileData(getGameProfile()).get(Type.SKIN);
    if (skin != null) {
        String type = skin.getMetadata("model");
        if (type == null)
            type = "default";
        String type1 = type;
        Optional<ResourceLocation> texture = HDSkinManager.INSTANCE.getSkinLocation(getGameProfile(), Type.SKIN, false);

        texture.ifPresent((res) -> ci.setReturnValue(type1));
    }
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:17,代码来源:MixinPlayerInfo.java

示例2: onShouldSideBeRendered

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(method="shouldSideBeRendered(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)Z", [email protected]("HEAD"), cancellable=true)
private void onShouldSideBeRendered(IBlockAccess blockAccess, BlockPos pos, EnumFacing facing, CallbackInfoReturnable<Boolean> ci) {
    if (UyjuliansXrayModMain.xrayEnabled()) {
        ci.setReturnValue((!UyjuliansXrayModMain.checkBlockList(this.getBlock())) && UyjuliansXrayModMain.checkBlockList(blockAccess.getBlockState(pos.offset(facing)).getBlock()));
    }
    else if (UyjuliansXrayModMain.caveFinderEnabled()) {
        ci.setReturnValue((!UyjuliansXrayModMain.checkBlockList(this.getBlock())) && blockAccess.isAirBlock(pos.offset(facing)));
    }
    else if (UyjuliansXrayModMain.specialMode1Enabled()) {
        if (!UyjuliansXrayModMain.checkBlockList(this.getBlock())) {
            boolean shouldRender = true;
            for (EnumFacing facing1 : new EnumFacing[]{EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST}) {
                if (blockAccess.isAirBlock(pos.offset(facing1))) {
                    shouldRender = true;
                }
                else {
                    shouldRender = false;
                    break;
                }
            }
            ci.setReturnValue(shouldRender);
        } else {
            ci.setReturnValue(false);
        }
    }
}
 
开发者ID:uyjulian,项目名称:MinecraftX-RAY,代码行数:27,代码来源:MixinStateImplementation.java

示例3: loadFovModifierInCache

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(method = "getFovModifier",
        at = {
                @At(value = "INVOKE",
                        target = "Lnet/minecraft/client/entity/AbstractClientPlayer;getEntityAttribute(Lnet/minecraft/entity/ai/attributes/IAttribute;)Lnet/minecraft/entity/ai/attributes/IAttributeInstance;",
                        shift = Shift.AFTER),
                @At(value = "INVOKE",
                        target = "Lnet/minecraft/client/entity/AbstractClientPlayer;getItemInUseDuration()I",
                        shift = Shift.AFTER)
        },
        locals = LocalCapture.CAPTURE_FAILEXCEPTION)
private void loadFovModifierInCache(CallbackInfoReturnable<Float> callbackInfo, float f) {
    this.cache = f;
}
 
开发者ID:Gogume1er,项目名称:Past-Client,代码行数:14,代码来源:MixinAbstractClientPlayer.java

示例4: getTeamColor

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(method = "getTeamColor", at = @At("HEAD"), cancellable = true)
private void getTeamColor(Entity entityIn, CallbackInfoReturnable<Integer> ci) {
    TeamColorEvent event = new TeamColorEvent(entityIn);
    ClientAPI.EVENT_BUS.post(event);
    if (event.isCancelled())
        ci.setReturnValue(event.getColor());
}
 
开发者ID:ImpactDevelopment,项目名称:ClientAPI,代码行数:8,代码来源:MixinRender.java

示例5: canCollideCheck

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(method = "canCollideCheck", at = @At("HEAD"), cancellable = true)
private void canCollideCheck(IBlockState state, boolean hitIfLiquid, CallbackInfoReturnable<Boolean> ci) {
    BlockCollisionEvent event = new BlockCollisionEvent((Block) (Object) this);
    ClientAPI.EVENT_BUS.post(event);
    if (event.isCancelled())
        ci.setReturnValue(false);
}
 
开发者ID:ImpactDevelopment,项目名称:ClientAPI,代码行数:8,代码来源:MixinBlock.java

示例6: update

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(
        method = "parseUserSkin(Ljava/awt/image/BufferedImage;)Ljava/awt/image/BufferedImage;",
        at = @At("RETURN"),
cancellable = true)
private void update(BufferedImage image, CallbackInfoReturnable<BufferedImage> ci) {
    // convert skins from mojang server
    BufferedImage image2 = ci.getReturnValue();
    boolean isLegacy = image.getHeight() == 32;
    if (isLegacy) {
        Graphics graphics = image2.getGraphics();
        HDSkinManager.INSTANCE.convertSkin(image2, graphics);
        graphics.dispose();
    }
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:15,代码来源:MixinImageBufferDownload.java

示例7: getLocationSkin

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(
        method = "getLocationSkin",
        cancellable = true,
        at = @At("RETURN"))
private void getLocationSkin(CallbackInfoReturnable<ResourceLocation> ci) {
    getTextureLocation(ci, Type.SKIN);
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:8,代码来源:MixinPlayerInfo.java

示例8: getLocationCape

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(
        method = "getLocationCape",
        cancellable = true,
        at = @At("RETURN"))
private void getLocationCape(CallbackInfoReturnable<ResourceLocation> ci) {
    getTextureLocation(ci, Type.CAPE);
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:8,代码来源:MixinPlayerInfo.java

示例9: getLocationElytra

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(
        method = "getLocationElytra",
        cancellable = true,
        at = @At("RETURN"))
private void getLocationElytra(CallbackInfoReturnable<ResourceLocation> ci) {
    getTextureLocation(ci, Type.ELYTRA);
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:8,代码来源:MixinPlayerInfo.java

示例10: onDeserialize

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(method = "deserialize", at = @At("RETURN"))
private void onDeserialize(JsonElement element, Type type, JsonDeserializationContext ctx, CallbackInfoReturnable<ServerStatusResponse> cir) {
    JsonObject json = element.getAsJsonObject();
    ServerStatusResponse response = cir.getReturnValue();

    ServerType serverType = null;
    ServerCompatibility serverCompat = null;

    if (json.has("spongeInfo")) {
        JsonObject spongeInfo = json.getAsJsonObject("spongeInfo");
        serverType = spongeInfo.has("serverType") ? ServerType.valueOf(spongeInfo.get("serverType").getAsString().toUpperCase()) : null;
        // Mainly means the server compatibility against the vanilla client
        serverCompat = spongeInfo.has("serverCompat") ? ServerCompatibility.valueOf(
                spongeInfo.get("serverCompat").getAsString().toUpperCase()) : null;
    }

    // System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(json.getAsJsonObject("modinfo")));

    if (serverType == null || serverCompat == null) {
        JsonObject modInfo = json.has("modinfo") ? json.getAsJsonObject("modinfo") : null;
        if (modInfo != null && modInfo.has("modList")) {
            List<String> mods = StreamSupport.stream(modInfo.getAsJsonArray("modList").spliterator(), false)
                    .map(e -> e.getAsJsonObject().get("modid").getAsString())
                    .collect(Collectors.toList());
            if (serverType == null) {
                if (mods.contains("sponge")) {
                    serverType = ServerType.SPONGE_FORGE;
                } else {
                    serverType = ServerType.FORGE;
                }
            }
        } else {
            if (serverCompat == null) {
                serverCompat = ServerCompatibility.UNKNOWN;
            }
        }
    }
    ((IMixinServerStatusResponse) response).setSpongeInfo(new SpongeStatusInfo(
            serverType == null ? ServerType.VANILLA : serverType, serverCompat == null ? ServerCompatibility.UNKNOWN : serverCompat));
}
 
开发者ID:Cybermaxke,项目名称:LiteSpongeClient,代码行数:41,代码来源:MixinServerStatusResponseSerializer.java

示例11: onIsThundering

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(method = "isThundering()Z", at = @At("HEAD"), cancellable = true)
private void onIsThundering(CallbackInfoReturnable<Boolean> ci) {
    if (!this.isRemote) {
        final IMixinWorldInfo info = (IMixinWorldInfo) this.worldInfo;
        ci.setReturnValue(info.getWeather().getThunderRate() > 0f && this.isWeatherOptimal());
    }
}
 
开发者ID:Cybermaxke,项目名称:Weathers,代码行数:8,代码来源:MixinWorld.java

示例12: onCalculateSkylightSubtracted

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
/**
 * Make sure that it won't go under zero, this can happen if the darkness < 0
 */
@Inject(method = "calculateSkylightSubtracted(F)I", at = @At("RETURN"), cancellable = true)
private void onCalculateSkylightSubtracted(float delta, CallbackInfoReturnable<Integer> ci) {
    int value = ci.getReturnValueI();
    if (value < 0) {
        ci.setReturnValue(0);
    }
}
 
开发者ID:Cybermaxke,项目名称:Weathers,代码行数:11,代码来源:MixinWorld.java

示例13: onTrySleep

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(method = "trySleep", at = @At(value = "INVOKE"))
public void onTrySleep(BlockPos bedLocation, CallbackInfoReturnable<EntityPlayer.EnumStatus> callbackInfo) {
    if (this instanceof Player) {
        BedEnterHook bedEnterHook = (BedEnterHook)
                new BedEnterHook((Player) this, this.getWorld().getBlockAt(bedLocation.getX(),
                        bedLocation.getY(), bedLocation.getZ())).call();
        if (bedEnterHook.isCanceled()) {
            callbackInfo.setReturnValue(EntityPlayer.EnumStatus.OTHER_PROBLEM);
        }
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:12,代码来源:MixinEntityPlayer.java

示例14: onStartServer

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(method = "startServer", at = @At(value = "INVOKE",
        target = "Lnet/minecraft/server/dedicated/DedicatedServer;loadAllWorlds(Ljava/lang/String;"
                + "Ljava/lang/String;JLnet/minecraft/world/WorldType;Ljava/lang/String;)V"))
public void onStartServer(CallbackInfoReturnable<Boolean> ci) throws IOException {
    Canary.enableEarlyPlugins();
    ((Neptune) Canary.instance()).lateInitialisation();
    Canary.enableLatePlugins();
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:9,代码来源:MixinDedicatedServer.java

示例15: onIsPressed

import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入依赖的package包/类
@Inject(method="isPressed", [email protected]("HEAD"))
private void onIsPressed(CallbackInfoReturnable<Boolean> ci) {
	KeyBinding currentkb = ((KeyBinding)(Object)this);
	// mod_controlpack
	if (ControlPackMain.instance != null) {
		if (currentkb == ControlPackMain.mc.gameSettings.keyBindInventory) {
			ControlPackMain.instance.runAutoTool(false);
		}
	}
}
 
开发者ID:uyjulian,项目名称:ControlPack,代码行数:11,代码来源:MixinKeyBinding.java


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