本文整理汇总了Java中org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable.setReturnValue方法的典型用法代码示例。如果您正苦于以下问题:Java CallbackInfoReturnable.setReturnValue方法的具体用法?Java CallbackInfoReturnable.setReturnValue怎么用?Java CallbackInfoReturnable.setReturnValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
的用法示例。
在下文中一共展示了CallbackInfoReturnable.setReturnValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: 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());
}
示例3: 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);
}
示例4: 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());
}
}
示例5: 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);
}
}
示例6: 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);
}
}
}
示例7: getFOVModifier
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入方法依赖的package包/类
@Inject(method = "getFOVModifier", at = @At("HEAD"), cancellable = true)
private void getFOVModifier(float partialTicks, boolean useFOVSetting, CallbackInfoReturnable<Float> ci) {
if (Camera.isCapturing())
ci.setReturnValue(90.0F);
}
示例8: onGetBlockReachDistance
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入方法依赖的package包/类
@Inject(method = "getBlockReachDistance()F", at = @At("RETURN"), cancellable = true)
public void onGetBlockReachDistance(CallbackInfoReturnable<Float> callbackInfo) {
callbackInfo.setReturnValue(EventManager.post(new PlayerReach(currentGameType.isCreative() ? 5.0F : 4.5F)).getReach());
}
示例9: onGetCollisionBorderSize
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入方法依赖的package包/类
@Inject(method = "getCollisionBorderSize", at = @At("RETURN"), cancellable = true)
public void onGetCollisionBorderSize(CallbackInfoReturnable<Float> callbackInfo) {
callbackInfo.setReturnValue(EventManager.post(new HitboxSize(callbackInfo.getReturnValue())).getSize());
}
示例10: onPushOutOfBlocks
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入方法依赖的package包/类
@Inject(method = "pushOutOfBlocks(DDD)Z", at = @At("HEAD"), cancellable = true)
public void onPushOutOfBlocks(double x, double y, double z, CallbackInfoReturnable<Boolean> callbackInfo) {
if (EventManager.post(new PushOutOfBlocks()).isCancelled())
callbackInfo.setReturnValue(false);
}
示例11: onShouldSideBeRendered
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入方法依赖的package包/类
@Inject(method = "shouldSideBeRendered", at = @At("RETURN"), cancellable = true)
public void onShouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side, CallbackInfoReturnable<Boolean> callbackInfo) {
callbackInfo.setReturnValue(EventManager.post(new BlockShouldSideBeRendered((Block) (Object) this, side, callbackInfo.getReturnValue())).getShouldSideBeRendered());
}
示例12: onIsUseableByPlayer
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入方法依赖的package包/类
@Inject(method = "isUseableByPlayer", at = @At("HEAD"), cancellable = true)
public void onIsUseableByPlayer(EntityPlayer viewingPlayer, CallbackInfoReturnable<Boolean> cir) {
if (!viewingPlayer.getUniqueID().equals(player.getUniqueID())) {
cir.setReturnValue(true);
}
}
示例13: onIsRaining
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入方法依赖的package包/类
@Inject(method = "isRaining()Z", at = @At("HEAD"), cancellable = true)
private void onIsRaining(CallbackInfoReturnable<Boolean> ci) {
if (!this.isRemote) {
ci.setReturnValue(this.getRainStrength() > 0.2f);
}
}
示例14: onGetThunderStrength
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入方法依赖的package包/类
@Inject(method = "getThunderStrength(F)F", at = @At("HEAD"), cancellable = true)
private void onGetThunderStrength(float delta, CallbackInfoReturnable<Float> ci) {
if (!this.isRemote) {
ci.setReturnValue(this.getDarkness());
}
}
示例15: onGetRainStrength
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; //导入方法依赖的package包/类
@Inject(method = "getRainStrength(F)F", at = @At("HEAD"), cancellable = true)
private void onGetRainStrength(float delta, CallbackInfoReturnable<Float> ci) {
if (!this.isRemote) {
ci.setReturnValue(this.getRainStrength());
}
}