org.spongepowered.asm.mixin.injection.callback.LocalCapture Java Examples
The following examples show how to use
org.spongepowered.asm.mixin.injection.callback.LocalCapture.
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: ClientPlayNetworkHandler_smoothClientAnimationsMixin.java From fabric-carpet with MIT License | 7 votes |
@Inject( method = "onChunkData", locals = LocalCapture.CAPTURE_FAILHARD, require = 0, at = @At( value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;getBlockEntity(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/entity/BlockEntity;", shift = At.Shift.AFTER )) private void recreateMovingPistons(ChunkDataS2CPacket packet, CallbackInfo ci, Iterator var5, CompoundTag tag, BlockPos blockPos) { if (CarpetSettings.smoothClientAnimations) { BlockEntity blockEntity = world.getBlockEntity(blockPos); if (blockEntity == null && "minecraft:piston".equals(tag.getString("id"))) { BlockState blockState = world.getBlockState(blockPos); if (blockState.getBlock() == Blocks.MOVING_PISTON) { tag.putFloat("progress", Math.min(tag.getFloat("progress") + 0.5F, 1.0F)); blockEntity = new PistonBlockEntity(); blockEntity.fromTag(tag); world.setBlockEntity(blockPos, blockEntity); blockEntity.resetBlock(); } } } }
Example #2
Source File: PistonBlockEntityRenderer_movableTEMixin.java From fabric-carpet with MIT License | 6 votes |
@Inject(method = "render", at = @At("RETURN"), locals = LocalCapture.NO_CAPTURE) private void endMethod3576(PistonBlockEntity pistonBlockEntity_1, float partialTicks, MatrixStack matrixStack_1, VertexConsumerProvider layeredVertexConsumerStorage_1, int int_1, int init_2, CallbackInfo ci) { if (((PistonBlockEntityInterface) pistonBlockEntity_1).getRenderCarriedBlockEntity()) { BlockEntity carriedBlockEntity = ((PistonBlockEntityInterface) pistonBlockEntity_1).getCarriedBlockEntity(); if (carriedBlockEntity != null) { carriedBlockEntity.setPos(pistonBlockEntity_1.getPos()); //((BlockEntityRenderDispatcherInterface) BlockEntityRenderDispatcher.INSTANCE).renderBlockEntityOffset(carriedBlockEntity, float_1, int_1, BlockRenderLayer.field_20799, bufferBuilder_1, pistonBlockEntity_1.getRenderOffsetX(float_1), pistonBlockEntity_1.getRenderOffsetY(float_1), pistonBlockEntity_1.getRenderOffsetZ(float_1)); matrixStack_1.translate( pistonBlockEntity_1.getRenderOffsetX(partialTicks), pistonBlockEntity_1.getRenderOffsetY(partialTicks), pistonBlockEntity_1.getRenderOffsetZ(partialTicks) ); BlockEntityRenderDispatcher.INSTANCE.render(carriedBlockEntity, partialTicks, matrixStack_1, layeredVertexConsumerStorage_1); } } }
Example #3
Source File: MixinPlayerChat_SayCommand.java From Galaxy with GNU Affero General Public License v3.0 | 6 votes |
@SuppressWarnings("UnresolvedMixinReference") @Inject( method = "method_13563", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcastChatMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/MessageType;Ljava/util/UUID;)V", ordinal = 0 ), locals = LocalCapture.CAPTURE_FAILSOFT ) private static void onCommand(CommandContext<ServerCommandSource> context, CallbackInfoReturnable<Integer> cir, Text text, TranslatableText translatableText, Entity entity) { if (!(entity instanceof ServerPlayerEntity)) return; Main main = Main.Companion.getMain(); ServerPlayerEntity player = (ServerPlayerEntity) entity; if (main == null || !main.getEventManager().emit(new PlayerChatEvent(player, translatableText)).getCancel()) { player.server.getPlayerManager().broadcastChatMessage(translatableText, MessageType.CHAT, entity.getUuid()); } else { cir.setReturnValue(0); cir.cancel(); player.server.sendSystemMessage(translatableText.append(" (Canceled)"), entity.getUuid()); } }
Example #4
Source File: MixinPlayerChat_MeCommand.java From Galaxy with GNU Affero General Public License v3.0 | 6 votes |
@SuppressWarnings("UnresolvedMixinReference") @Inject( method = "method_13238", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcastChatMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/MessageType;Ljava/util/UUID;)V", ordinal = 0 ), locals = LocalCapture.CAPTURE_FAILSOFT ) private static void onCommand(CommandContext<ServerCommandSource> context, CallbackInfoReturnable<Integer> cir, TranslatableText translatableText, Entity entity) { if (!(entity instanceof ServerPlayerEntity)) return; Main main = Main.Companion.getMain(); ServerPlayerEntity player = (ServerPlayerEntity) entity; if (main == null || !main.getEventManager().emit(new PlayerChatEvent(player, translatableText)).getCancel()) { player.server.getPlayerManager().broadcastChatMessage(translatableText, MessageType.CHAT, entity.getUuid()); } else { cir.setReturnValue(0); cir.cancel(); player.server.sendSystemMessage(translatableText.append(" (Canceled)"), entity.getUuid()); } }
Example #5
Source File: MixinMouse.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
@Inject(method = "method_1605", at = @At("HEAD"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) private void preMouseReleased(boolean[] handled, double mouseX, double mouseY, int button, CallbackInfo info) { if (MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.MouseReleasedEvent.Pre(client.currentScreen, mouseX, mouseY, button))) { handled[0] = true; info.cancel(); } }
Example #6
Source File: MixinMouse.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
@Inject(method = "method_1611", at = @At("RETURN"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) private void postMouseClicked(boolean[] handled, double mouseX, double mouseY, int button, CallbackInfo info) { if (handled[0]) { return; } if (MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.MouseClickedEvent.Post(client.currentScreen, mouseX, mouseY, button))) { handled[0] = true; info.cancel(); } }
Example #7
Source File: MixinMouse.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
@Inject(method = "method_1605", at = @At("RETURN"), locals = LocalCapture.CAPTURE_FAILHARD) private void postMouseReleased(boolean[] handled, double mouseX, double mouseY, int button, CallbackInfo info) { if (handled[0]) { return; } if (MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.MouseReleasedEvent.Post(client.currentScreen, mouseX, mouseY, button))) { handled[0] = true; info.cancel(); } }
Example #8
Source File: MixinMouse.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
@Inject(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseScrolled(DDD)Z", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) private void preMouseScrolled(long window, double xOffset, double yOffset, CallbackInfo info, double amount, double mouseX, double mouseY) { if (MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.MouseScrollEvent.Pre(client.currentScreen, mouseX, mouseY, amount))) { info.cancel(); } }
Example #9
Source File: ClientPlayerEntityMixin.java From spark with GNU General Public License v3.0 | 5 votes |
@Inject(method = "sendChatMessage(Ljava/lang/String;)V", at = @At("HEAD"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) public void onSendChatMessage(String message, CallbackInfo ci) { if (FabricSparkGameHooks.INSTANCE.tryProcessChat(message)) { ci.cancel(); } }
Example #10
Source File: PistonHandler_movableTEMixin.java From fabric-carpet with MIT License | 5 votes |
@Inject(method = "tryMove", at = @At(value = "INVOKE", target = "Ljava/util/List;get(I)Ljava/lang/Object;", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) /** * Handles blocks besides the slimeblock that are sticky. Currently only supports blocks that are sticky on one side. * @author 2No2Name */ private void stickToStickySide(BlockPos blockPos_1, Direction direction_1, CallbackInfoReturnable<Boolean> cir, BlockState blockState_1, Block block_1, int int_1, int int_2, int int_4, BlockPos blockPos_3, int int_5, int int_6){ if(!stickToStickySide(blockPos_3)){ cir.setReturnValue(false); cir.cancel(); } }
Example #11
Source File: PistonHandler_movableTEMixin.java From fabric-carpet with MIT License | 5 votes |
@Inject(method = "calculatePush", at = @At(value = "INVOKE", target = "Ljava/util/List;get(I)Ljava/lang/Object;", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) /** * Handles blocks besides the slimeblock that are sticky. Currently only supports blocks that are sticky on one side. * @author 2No2Name */ private void stickToStickySide(CallbackInfoReturnable<Boolean> cir, int int_1){ BlockPos pos = this.movedBlocks.get(int_1); if(!stickToStickySide(pos)){ cir.setReturnValue(false); cir.cancel(); } }
Example #12
Source File: ServerPlayerInteractionManager_scarpetEventsMixin.java From fabric-carpet with MIT License | 5 votes |
@Inject(method = "tryBreakBlock", locals = LocalCapture.CAPTURE_FAILEXCEPTION, at = @At( value = "INVOKE", target = "Lnet/minecraft/block/Block;onBroken(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V", shift = At.Shift.BEFORE )) private void onBlockBroken(BlockPos blockPos_1, CallbackInfoReturnable<Boolean> cir, BlockState blockState_1, BlockEntity be, Block b, boolean boolean_1) { PLAYER_BREAK_BLOCK.onBlockBroken(player, blockPos_1, blockState_1); }
Example #13
Source File: ServerWorld_scarpetEventMixin.java From fabric-carpet with MIT License | 5 votes |
@Inject(method = "tickChunk", locals = LocalCapture.CAPTURE_FAILHARD, at = @At( value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;addLightning(Lnet/minecraft/entity/LightningEntity;)V" )) private void onNaturalLightinig(WorldChunk chunk, int randomTickSpeed, CallbackInfo ci, ChunkPos chunkPos, boolean bl, int i, int j, Profiler profiler, BlockPos blockPos, boolean bl2) { if (LIGHTNING.isNeeded()) LIGHTNING.onWorldEventFlag((ServerWorld) (Object)this, blockPos, bl2?1:0); }
Example #14
Source File: CauldronBlock_stackableSBoxesMixin.java From fabric-carpet with MIT License | 5 votes |
@Inject(method = "onUse", locals = LocalCapture.CAPTURE_FAILHARD, at = @At( value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;hasTag()Z", shift = At.Shift.BEFORE )) private void setSboxCount(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult arg5, CallbackInfoReturnable<Boolean> cir, ItemStack itemStack, int i, Item item, Block block, ItemStack itemStack5) { if (CarpetSettings.stackableShulkerBoxes) itemStack5.setCount(itemStack.getCount()); }
Example #15
Source File: PlayerManager_fakePlayersMixin.java From fabric-carpet with MIT License | 5 votes |
@Inject(method = "createPlayer", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, target = "Ljava/util/Iterator;hasNext()Z"), locals = LocalCapture.CAPTURE_FAILHARD) private void newWhileLoop(GameProfile gameProfile_1, CallbackInfoReturnable<ServerPlayerEntity> cir, UUID uUID_1, List list_1, Iterator var5) { while (var5.hasNext()) { ServerPlayerEntity serverPlayerEntity_3 = (ServerPlayerEntity) var5.next(); if(serverPlayerEntity_3 instanceof EntityPlayerMPFake) { serverPlayerEntity_3.kill(); continue; } serverPlayerEntity_3.networkHandler.disconnect(new TranslatableText("multiplayer.disconnect.duplicate_login")); } }
Example #16
Source File: World_tickMixin.java From fabric-carpet with MIT License | 5 votes |
@Inject(method = "tickBlockEntities", locals = LocalCapture.CAPTURE_FAILHARD, at = @At( value = "INVOKE", target = "Lnet/minecraft/block/entity/BlockEntity;isRemoved()Z", shift = At.Shift.BEFORE, ordinal = 0 )) private void startTileEntitySection(CallbackInfo ci, Profiler profiler_1, Iterator i, BlockEntity blockEntity_2) { entitySection = CarpetProfiler.start_entity_section((World)(Object)this, blockEntity_2, CarpetProfiler.TYPE.TILEENTITY); }
Example #17
Source File: PistonBlock_movableTEMixin.java From fabric-carpet with MIT License | 5 votes |
@Inject(method = "move", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, target = "Ljava/util/List;size()I", ordinal = 4),locals = LocalCapture.CAPTURE_FAILHARD) private void onMove(World world_1, BlockPos blockPos_1, Direction direction_1, boolean boolean_1, CallbackInfoReturnable<Boolean> cir, BlockPos blockPos_2, PistonHandler pistonHandler_1, Map map_1, List<BlockPos> list_1, List<BlockState> list_2, List list_3, int int_2, BlockState[] blockStates_1, Direction direction_2) { //Get the blockEntities and remove them from the world before any magic starts to happen if (CarpetSettings.movableBlockEntities) { list1_BlockEntities.set(Lists.newArrayList()); for (int i = 0; i < list_1.size(); ++i) { BlockPos blockpos = list_1.get(i); BlockEntity blockEntity = (list_2.get(i).getBlock().hasBlockEntity()) ? world_1.getBlockEntity(blockpos) : null; list1_BlockEntities.get().add(blockEntity); if (blockEntity != null) { //hopefully this call won't have any side effects in the future, such as dropping all the BlockEntity's items //we want to place this same(!) BlockEntity object into the world later when the movement stops again world_1.removeBlockEntity(blockpos); blockEntity.markDirty(); } } } }
Example #18
Source File: PistonBlock_movableTEMixin.java From fabric-carpet with MIT License | 5 votes |
@Inject(method = "move", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, target = "Lnet/minecraft/world/World;setBlockEntity(Lnet/minecraft/util/math/BlockPos;" + "Lnet/minecraft/block/entity/BlockEntity;)V", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) private void setBlockEntityWithCarried(World world_1, BlockPos blockPos_1, Direction direction_1, boolean boolean_1, CallbackInfoReturnable<Boolean> cir, BlockPos blockPos_2, PistonHandler pistonHandler_1, Map map_1, List list_1, List list_2, List list_3, int int_2, BlockState[] blockStates_1, Direction direction_2, int int_3, BlockPos blockPos_4, BlockState blockState_1) { BlockEntity blockEntityPiston = PistonExtensionBlock.createBlockEntityPiston((BlockState) list_2.get(int_3), direction_1, boolean_1, false); if (CarpetSettings.movableBlockEntities) ((PistonBlockEntityInterface) blockEntityPiston).setCarriedBlockEntity(list1_BlockEntities.get().get(int_3)); world_1.setBlockEntity(blockPos_4, blockEntityPiston); }
Example #19
Source File: MixinMouse.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
@Inject(method = "method_1611", at = @At("HEAD"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) public void preMouseClicked(boolean[] handled, double mouseX, double mouseY, int button, CallbackInfo info) { if (MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.MouseClickedEvent.Pre(client.currentScreen, mouseX, mouseY, button))) { handled[0] = true; info.cancel(); } }
Example #20
Source File: MixinMouse.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
@Inject(method = "onMouseScroll", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSpectator()Z", shift = Shift.BEFORE), cancellable = true) private void onMouseScroll(long window, double d, double e, CallbackInfo info, double f, float i) { final Event event = new InputEvent.MouseScrollEvent(f, wasLeftButtonClicked(), middleButtonClicked, wasRightButtonClicked(), getX(), getY()); if (MinecraftForge.EVENT_BUS.post(event)) { info.cancel(); } }
Example #21
Source File: MixinEntityType.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
@Inject(method = SPAWN, at = @At(value = "INVOKE", target = "net/minecraft/world/World.spawnEntity(Lnet/minecraft/entity/Entity;)Z"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) private void hookMobSpawns(World world, @Nullable CompoundTag itemTag, @Nullable Text name, @Nullable PlayerEntity player, BlockPos pos, SpawnType type, boolean alignPosition, boolean bl, CallbackInfoReturnable<Entity> callback, Entity entity) { if (!(entity instanceof MobEntity)) { return; } MobEntity mob = (MobEntity) entity; if (EntityEvents.doSpecialSpawn(mob, world, pos.getX(), pos.getY(), pos.getZ(), null, type)) { callback.setReturnValue(null); } }
Example #22
Source File: MixinLivingEntity.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
@Inject(method = "drop", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;playerHitTimer : I"), locals = LocalCapture.CAPTURE_FAILHARD) private void hookDropForCapturePre(DamageSource src, CallbackInfo info, int lootingLevel) { IForgeEntity forgeEntity = (IForgeEntity) this; forgeEntity.captureDrops(new ArrayList<>()); dropLootingLevel.set(lootingLevel); }
Example #23
Source File: MixinPlayerUpdateSign_NetworkHandler.java From Galaxy with GNU Affero General Public License v3.0 | 5 votes |
@Inject(method = "onSignUpdate", at = @At( value = "INVOKE", target = "Lnet/minecraft/block/entity/SignBlockEntity;isEditable()Z" ), cancellable = true, locals = LocalCapture.CAPTURE_FAILSOFT) private void onSignUpdate(UpdateSignC2SPacket packet, CallbackInfo ci, ServerWorld serverWorld, BlockPos blockPos, BlockState blockState, BlockEntity blockEntity, SignBlockEntity signBlockEntity) { Main main = Main.Companion.getMain(); if (main == null) return; if (main.getEventManager().emit(new PlayerUpdateSignEvent(packet, player, signBlockEntity)).getCancel()) { ci.cancel(); signBlockEntity.markDirty(); serverWorld.updateListeners(blockPos, blockState, blockState, 3); } }
Example #24
Source File: ChunkSerializerMixin.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
@Inject(method = "serialize", slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;saveToTag(Lnet/minecraft/nbt/CompoundTag;)Z"), to = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/ProtoChunk;getEntities()Ljava/util/List;")), at = @At(value = "JUMP", opcode = Opcodes.GOTO, ordinal = 2), locals = LocalCapture.CAPTURE_FAILHARD) private static void serializeCapabilities(ServerWorld serverWorld, Chunk chunk, CallbackInfoReturnable<CompoundTag> callbackInfoReturnable, ChunkPos chunkPos, CompoundTag compoundTag, CompoundTag level) { CompoundTag tag = ((CapabilityProviderHolder) chunk).serializeCaps(); if (tag != null) { level.put("ForgeCaps", tag); } }
Example #25
Source File: FallingBlockEntityMixin.java From carpet-extra with GNU Lesser General Public License v3.0 | 5 votes |
@Inject( method = "tick", at = @At(value = "INVOKE", shift = At.Shift.AFTER, ordinal = 1, target = "Lnet/minecraft/entity/FallingBlockEntity;setVelocity(Lnet/minecraft/util/math/Vec3d;)V"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true ) private void onTick(CallbackInfo ci, Block block_1, BlockPos blockPos_2, boolean b1, boolean bl2, BlockState blockState_1) { if (block_1.matches(BlockTags.ANVIL)) { if (CarpetExtraSettings.renewablePackedIce && this.world.getBlockState(new BlockPos(this.getX(), this.getY() - 0.059999999776482582D, this.getZ())).getBlock() == Blocks.ICE) { if (iceCount < 2) { world.breakBlock(blockPos_2.down(), false, null); this.onGround = false; iceCount++; ci.cancel(); } else { world.setBlockState(blockPos_2.down(), Blocks.PACKED_ICE.getDefaultState(), 3); world.playLevelEvent(2001, blockPos_2.down(), Block.getRawIdFromState(Blocks.PACKED_ICE.getDefaultState())); } } else if (CarpetExtraSettings.renewableSand && this.world.getBlockState(new BlockPos(this.getX(), this.getY() - 0.06, this.getZ())).getBlock() == Blocks.COBBLESTONE) { world.breakBlock(blockPos_2.down(1), false); world.setBlockState(blockPos_2.down(1), Blocks.SAND.getDefaultState(), 3); } } }
Example #26
Source File: HopperMinecartEntity_cooldownFixMixin.java From carpet-extra with GNU Lesser General Public License v3.0 | 5 votes |
@Inject(method = "canOperate", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/HopperBlockEntity;extract(Lnet/minecraft/inventory/Inventory;Lnet/minecraft/entity/ItemEntity;)Z", shift = At.Shift.BEFORE),cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) private void extractAndReturnSuccess(CallbackInfoReturnable<Boolean> cir, List list_1) { if (CarpetExtraSettings.hopperMinecart8gtCooldown) { boolean result = HopperBlockEntity.extract(this, (ItemEntity) list_1.get(0)); cir.setReturnValue(result); cir.cancel(); } }
Example #27
Source File: HopperMinecartEntity_cooldownFixMixin.java From carpet-extra with GNU Lesser General Public License v3.0 | 5 votes |
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/vehicle/HopperMinecartEntity;setTransferCooldown(I)V",ordinal = 0),locals = LocalCapture.CAPTURE_FAILHARD) private void rememberBlockPos(CallbackInfo ci){ if(CarpetExtraSettings.hopperMinecart8gtCooldown) this.currentBlockPos = this.getBlockPos(); else this.currentBlockPos = BlockPos.ORIGIN; }
Example #28
Source File: CallbackInjectionInfo.java From Mixin with MIT License | 5 votes |
@Override protected Injector parseInjector(AnnotationNode injectAnnotation) { boolean cancellable = Annotations.<Boolean>getValue(injectAnnotation, "cancellable", Boolean.FALSE); LocalCapture locals = Annotations.<LocalCapture>getValue(injectAnnotation, "locals", LocalCapture.class, LocalCapture.NO_CAPTURE); String identifier = Annotations.<String>getValue(injectAnnotation, "id", ""); return new CallbackInjector(this, cancellable, locals, identifier); }
Example #29
Source File: MixinEnchantmentHelper.java From Sandbox with GNU Lesser General Public License v3.0 | 4 votes |
/** * @author B0undarybreaker */ @Inject(method = "getHighestApplicableEnchantmentsAtPower", at = @At(value = "INVOKE", target = "Lnet/minecraft/enchantment/Enchantment;isTreasure()Z"), locals = LocalCapture.CAPTURE_FAILEXCEPTION) private static void localEnchantment(int power, ItemStack stack, boolean allowTreasure, CallbackInfoReturnable info, List<InfoEnchantment> ret, Item item, boolean isBook, Iterator<Enchantment> itr, Enchantment enchantment) { ench.set(enchantment); }
Example #30
Source File: MixinCrashReportCategory.java From VanillaFix with MIT License | 4 votes |
/** @reason Deobfuscate stacktrace for crash report categories. */ @Inject(method = "getPrunedStackTrace", at = @At(value = "INVOKE", target = "Ljava/lang/Thread;getStackTrace()[Ljava/lang/StackTraceElement;", shift = At.Shift.BY, by = 2, ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD) private void afterGetStacktrace(int size, CallbackInfoReturnable<Integer> cir, StackTraceElement[] stackTrace) { StacktraceDeobfuscator.deobfuscateStacktrace(stackTrace); }