net.minecraft.util.ChatStyle#org.spongepowered.asm.mixin.injection.callback.CallbackInfo源码实例Demo

下面列出了net.minecraft.util.ChatStyle#org.spongepowered.asm.mixin.injection.callback.CallbackInfo 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Wurst7   文件: MultiplayerScreenMixin.java
@Inject(at = {@At("TAIL")}, method = {"init()V"})
private void onInit(CallbackInfo ci)
{
	if(!WurstClient.INSTANCE.isEnabled())
		return;
	
	lastServerButton = addButton(new ButtonWidget(width / 2 - 154, 10, 100,
		20, new LiteralText("Last Server"), b -> LastServerRememberer
			.joinLastServer((MultiplayerScreen)(Object)this)));
	
	addButton(new ButtonWidget(width / 2 + 154 + 4, height - 52, 100, 20,
		new LiteralText("Server Finder"), b -> client.openScreen(
			new ServerFinderScreen((MultiplayerScreen)(Object)this))));
	
	addButton(new ButtonWidget(width / 2 + 154 + 4, height - 28, 100, 20,
		new LiteralText("Clean Up"), b -> client.openScreen(
			new CleanUpScreen((MultiplayerScreen)(Object)this))));
}
 
@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);

        }
    }
}
 
源代码3 项目: Wurst7   文件: DisconnectedScreenMixin.java
@Inject(at = {@At("TAIL")}, method = {"init()V"})
private void onInit(CallbackInfo ci)
{
	if(!WurstClient.INSTANCE.isEnabled())
		return;
	
	int backButtonX = width / 2 - 100;
	int backButtonY =
		Math.min(height / 2 + reasonHeight / 2 + 9, height - 30);
	
	addButton(new ButtonWidget(backButtonX, backButtonY + 24, 200, 20,
		new LiteralText("Reconnect"),
		b -> LastServerRememberer.reconnect(parent)));
	
	autoReconnectButton =
		addButton(new ButtonWidget(backButtonX, backButtonY + 48, 200, 20,
			new LiteralText("AutoReconnect"), b -> pressAutoReconnect()));
	
	if(WurstClient.INSTANCE.getHax().autoReconnectHack.isEnabled())
		autoReconnectTimer = 100;
}
 
源代码4 项目: Wurst7   文件: ClientPlayerEntityMixin.java
@Inject(at = @At("HEAD"),
	method = "sendChatMessage(Ljava/lang/String;)V",
	cancellable = true)
private void onSendChatMessage(String message, CallbackInfo ci)
{
	ChatOutputEvent event = new ChatOutputEvent(message);
	WurstClient.INSTANCE.getEventManager().fire(event);
	
	if(event.isCancelled())
	{
		ci.cancel();
		return;
	}
	
	if(!event.isModified())
		return;
	
	ChatMessageC2SPacket packet =
		new ChatMessageC2SPacket(event.getMessage());
	networkHandler.sendPacket(packet);
	ci.cancel();
}
 
源代码5 项目: LiquidBounce   文件: MixinGuiMultiplayer.java
@Inject(method = "actionPerformed", at = @At("HEAD"))
private void actionPerformed(GuiButton button, CallbackInfo callbackInfo) {
    switch(button.id) {
        case 997:
            mc.displayGuiScreen(new GuiAntiForge((GuiScreen) (Object) this));
            break;
        case 998:
            BungeeCordSpoof.enabled = !BungeeCordSpoof.enabled;
            bungeeCordSpoofButton.displayString = "BungeeCord Spoof: " + (BungeeCordSpoof.enabled ? "On" : "Off");
            LiquidBounce.fileManager.saveConfig(LiquidBounce.fileManager.valuesConfig);
            break;
        case 999:
            mc.displayGuiScreen(new GuiTools((GuiScreen) (Object) this));
            break;
    }
}
 
源代码6 项目: bleachhack-1.14   文件: MixinClientConnection.java
@Inject(method = "channelRead0", at = @At("HEAD"), cancellable = true)
public void channelRead0(ChannelHandlerContext channelHandlerContext_1, Packet<?> packet_1, CallbackInfo callback) {
    if (this.channel.isOpen() && packet_1 != null) {
    	try {
            EventReadPacket event = new EventReadPacket(packet_1);
            BleachHack.eventBus.post(event);
            if (event.isCancelled()) callback.cancel();
        } catch (Exception exception) {}
    }
}
 
源代码7 项目: fabric-carpet   文件: ExplosionMixin.java
@Inject(method = "<init>(Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;DDDFZLnet/minecraft/world/explosion/Explosion$DestructionType;)V",
        at = @At(value = "RETURN"))
private void onExplosionCreated(World world, Entity entity, double x, double y, double z, float power, boolean createFire, Explosion.DestructionType blockDestructionType, CallbackInfo ci)
{
    if (LoggerRegistry.__explosions && ! world.isClient)
    {
        eLogger = new ExplosionLogHelper(entity, x, y, z, power, createFire, blockDestructionType);
    }
}
 
源代码8 项目: patchwork-api   文件: MixinLivingEntity.java
@Inject(method = "onDeath", at = @At("HEAD"), cancellable = true)
private void hookDeath(DamageSource source, CallbackInfo callback) {
	LivingEntity entity = (LivingEntity) (Object) this;

	if (EntityEvents.onLivingDeath(entity, source)) {
		callback.cancel();
	}
}
 
源代码9 项目: fabric-carpet   文件: ServerWorld_tickMixin.java
@Inject(method = "tick", at = @At(
        value = "CONSTANT",
        args = "stringValue=world border"
))
private void stopWeatherStartChunkSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
    if (currentSection != null)
    {
        CarpetProfiler.end_current_section(currentSection);
        // we go deeper here
    }
}
 
源代码10 项目: LiquidBounce   文件: MixinEntityPlayerSP.java
@Inject(method = "swingItem", at = @At("HEAD"), cancellable = true)
private void swingItem(CallbackInfo callbackInfo) {
    final NoSwing noSwing = (NoSwing) LiquidBounce.moduleManager.getModule(NoSwing.class);

    if (noSwing.getState()) {
        callbackInfo.cancel();

        if (!noSwing.getServerSideValue().get())
            this.sendQueue.addToSendQueue(new C0APacketAnimation());
    }
}
 
@Inject(method = "onPlayerAction", at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/server/network/ServerPlayerEntity;dropSelectedItem(Z)Z",
        ordinal = 0,
        shift = At.Shift.BEFORE
))
private void onQItem(PlayerActionC2SPacket playerActionC2SPacket_1, CallbackInfo ci)
{
    PLAYER_DROPS_ITEM.onPlayerEvent(player);
}
 
源代码12 项目: LiquidBounce   文件: MixinGuiConnecting.java
@Inject(method = "connect", at = @At(value = "NEW", target = "net/minecraft/network/login/client/C00PacketLoginStart"), cancellable = true)
private void mcLeaks(CallbackInfo callbackInfo) {
    if(MCLeaks.isAltActive()) {
        networkManager.sendPacket(new C00PacketLoginStart(new GameProfile(null, MCLeaks.getSession().getUsername())));
        callbackInfo.cancel();
    }
}
 
源代码13 项目: the-hallow   文件: LivingEntityMixin.java
@Inject(method = "applyDamage(Lnet/minecraft/entity/damage/DamageSource;F)V", at = @At("RETURN"))
public void applyDamage(DamageSource damageSource, float damage, CallbackInfo info) {
	LivingEntity attacked = (LivingEntity) (Object) this;
	if (damageSource.getSource() instanceof LivingEntity && attacked.getHealth() < damage) {
		LivingEntity attacker = (LivingEntity) damageSource.getSource();
		if (!attacked.isInvulnerableTo(damageSource)) {
			float health = LifestealEnchantment.getLifeWithSteal(damageSource, damage, attacked);
			if (health != 0) {
				attacker.setHealth(health);
			}
		}
	}
}
 
源代码14 项目: multiconnect   文件: MixinLivingEntity.java
@Inject(method = "travel",
        slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;LEVITATION:Lnet/minecraft/entity/effect/StatusEffect;", ordinal = 0)),
        at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;fallDistance:F", ordinal = 0, shift = At.Shift.AFTER))
private void dontResetLevitationFallDistance(Vec3d travelVec, CallbackInfo ci) {
    if (ConnectionInfo.protocolVersion <= Protocols.V1_12_2) {
        fallDistance = oldFallDistance;
    }
}
 
源代码15 项目: fabric-carpet   文件: ServerWorld_tickMixin.java
@Inject(method = "tick", at = @At(
        value = "CONSTANT",
        args = "stringValue=world border"
))
private void startWeatherSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
{
    currentSection = CarpetProfiler.start_section((World)(Object)this, "Environment", CarpetProfiler.TYPE.GENERAL);
}
 
源代码16 项目: patchwork-api   文件: MixinPlayerEntity.java
@Inject(method = "attack(Lnet/minecraft/entity/Entity;)V", at = @At("HEAD"), cancellable = true)
private void onAttackEntity(Entity target, CallbackInfo callback) {
	PlayerEntity player = (PlayerEntity) (Object) this;

	if (!EntityEvents.attackEntity(player, target)) {
		callback.cancel();
	}
}
 
@Inject(method = "onPlayerInteractEntity", at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/server/network/ServerPlayerEntity;interact(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;"
))
private void onEntityInteract(PlayerInteractEntityC2SPacket playerInteractEntityC2SPacket_1, CallbackInfo ci)
{
    PLAYER_INTERACTS_WITH_ENTITY.onEntityAction(player, playerInteractEntityC2SPacket_1.getEntity(player.getServerWorld()), playerInteractEntityC2SPacket_1.getHand());
}
 
源代码18 项目: Wurst7   文件: ChunkOcclusionGraphBuilderMixin.java
@Inject(at = {@At("HEAD")},
	method = {"markClosed(Lnet/minecraft/util/math/BlockPos;)V"},
	cancellable = true)
private void onMarkClosed(BlockPos pos, CallbackInfo ci)
{
	SetOpaqueCubeEvent event = new SetOpaqueCubeEvent();
	WurstClient.INSTANCE.getEventManager().fire(event);
	
	if(event.isCancelled())
		ci.cancel();
}
 
源代码19 项目: bleachhack-1.14   文件: MixinClientConnection.java
@Inject(method = "exceptionCaught(Lio/netty/channel/ChannelHandlerContext;Ljava/lang/Throwable;)V", at = @At("HEAD"), cancellable = true)
public void exceptionCaught(ChannelHandlerContext channelHandlerContext_1, Throwable throwable_1, CallbackInfo callback) {
	if (!ModuleManager.getModule(AntiChunkBan.class).isToggled()) return;
	
	if (!(throwable_1 instanceof PacketEncoderException)) {
		BleachLogger.warningMessage("Canceled Defect Packet: " + throwable_1);
    	callback.cancel();
	}
}
 
源代码20 项目: LiquidBounce   文件: MixinMinecraft.java
@Inject(method = "startGame", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;displayGuiScreen(Lnet/minecraft/client/gui/GuiScreen;)V", shift = At.Shift.AFTER))
private void afterMainScreen(CallbackInfo callbackInfo) {
    if (LiquidBounce.fileManager.firstStart)
        Minecraft.getMinecraft().displayGuiScreen(new GuiWelcome());
    else if (LiquidBounce.INSTANCE.getLatestVersion() > LiquidBounce.CLIENT_VERSION - (LiquidBounce.IN_DEV ? 1 : 0))
        Minecraft.getMinecraft().displayGuiScreen(new GuiUpdate());
}
 
源代码21 项目: bleachhack-1.14   文件: MixinClientConnection.java
@Inject(method = "send(Lnet/minecraft/network/Packet;Lio/netty/util/concurrent/GenericFutureListener;)V", at = @At("HEAD"), cancellable = true)
  public void send(Packet<?> packet_1, GenericFutureListener<? extends Future<? super Void>> genericFutureListener_1, CallbackInfo callback) {
  	if (packet_1 instanceof ChatMessageC2SPacket) {
	ChatMessageC2SPacket pack = (ChatMessageC2SPacket) packet_1;
	if (pack.getChatMessage().startsWith(CommandManager.prefix)) {
   		CommandManager.callCommand(pack.getChatMessage().substring(CommandManager.prefix.length()));
   		callback.cancel();
	}
}
  	
  	EventSendPacket event = new EventSendPacket(packet_1);
      BleachHack.eventBus.post(event);

      if (event.isCancelled()) callback.cancel();
  }
 
@Inject(method = "onPlayerMove", at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/server/network/ServerPlayerEntity;jump()V"
))
private void onJump(PlayerMoveC2SPacket playerMoveC2SPacket_1, CallbackInfo ci)
{
    PLAYER_JUMPS.onPlayerEvent(player);
}
 
源代码23 项目: LiquidBounce   文件: MixinRenderEntityItem.java
@Inject(method = "doRender", at = @At("HEAD"))
private void injectChamsPre(CallbackInfo callbackInfo) {
    final Chams chams = (Chams) LiquidBounce.moduleManager.getModule(Chams.class);

    if (chams.getState() && chams.getItemsValue().get()) {
        GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
        GL11.glPolygonOffset(1.0F, -1000000F);
    }
}
 
@Inject(method = "onPlayerAction", at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/server/network/ServerPlayerInteractionManager;processBlockBreakingAction(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/network/packet/c2s/play/PlayerActionC2SPacket$Action;Lnet/minecraft/util/math/Direction;I)V",
        shift = At.Shift.BEFORE
))
private void onClicked(PlayerActionC2SPacket packet, CallbackInfo ci)
{
    if (packet.getAction() == PlayerActionC2SPacket.Action.START_DESTROY_BLOCK)
        PLAYER_CLICKS_BLOCK.onBlockAction(player, packet.getPos(), packet.getDirection());
}
 
源代码25 项目: Wurst7   文件: ClientPlayerEntityMixin.java
@Inject(at = @At(value = "INVOKE",
	target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;tick()V",
	ordinal = 0), method = "tick()V")
private void onTick(CallbackInfo ci)
{
	WurstClient.INSTANCE.getEventManager().fire(UpdateEvent.INSTANCE);
}
 
源代码26 项目: OptiFabric   文件: MixinTitleScreen.java
@Inject(method = "render", at = @At("RETURN"))
private void render(int int_1, int int_2, float float_1, CallbackInfo info) {
	if (!OptifabricError.hasError()) {
		float fadeTime = this.doBackgroundFade ? (float) (Util.getMeasuringTimeMs() - this.backgroundFadeStart) / 1000.0F : 1.0F;
		float fadeColor = this.doBackgroundFade ? MathHelper.clamp(fadeTime - 1.0F, 0.0F, 1.0F) : 1.0F;

		int int_6 = MathHelper.ceil(fadeColor * 255.0F) << 24;
		if ((int_6 & -67108864) != 0) {
			this.drawString(this.font, OptifineVersion.version, 2, this.height - 20, 16777215 | int_6);
		}
	}
}
 
源代码27 项目: patchwork-api   文件: MixinLivingEntity.java
@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);
}
 
源代码28 项目: patchwork-api   文件: ItemStackMixin.java
@Inject(method = "<init>(Lnet/minecraft/nbt/CompoundTag;)V", at = @At("RETURN"))
private void deserializeCapabilities(CompoundTag tag, CallbackInfo callbackInfo) {
	// TODO: See above TODO
	gatherCapabilities(null);

	if (tag.contains("ForgeCaps")) {
		deserializeCaps(tag.getCompound("ForgeCaps"));
	}
}
 
@Inject(method = "renderMob", cancellable = true, at = @At("HEAD"))
private static void injectPaintingSpawnerFix(MobSpawnerBaseLogic mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks, CallbackInfo ci) {
    Entity entity = mobSpawnerLogic.func_180612_a(mobSpawnerLogic.getSpawnerWorld());

    if (entity == null || entity instanceof EntityPainting)
        ci.cancel();
}
 
源代码30 项目: LiquidBounce   文件: MixinRendererLivingEntity.java
@Inject(method = "doRender", at = @At("RETURN"))
private <T extends EntityLivingBase> void injectChamsPost(T entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo callbackInfo) {
    final Chams chams = (Chams) LiquidBounce.moduleManager.getModule(Chams.class);

    if (chams.getState() && chams.getTargetsValue().get() && EntityUtils.isSelected(entity, false)) {
        GL11.glPolygonOffset(1.0F, 1000000F);
        GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
    }
}