本文整理汇总了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));
}
}
示例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);
}
}
}
示例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;
}
示例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());
}
示例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);
}
示例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();
}
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
}
示例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();
}
示例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);
}
}
}