本文整理汇总了Java中org.spongepowered.asm.mixin.injection.callback.CallbackInfo类的典型用法代码示例。如果您正苦于以下问题:Java CallbackInfo类的具体用法?Java CallbackInfo怎么用?Java CallbackInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CallbackInfo类属于org.spongepowered.asm.mixin.injection.callback包,在下文中一共展示了CallbackInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDrawScreen
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "drawScreen", at = @At("HEAD"), cancellable = true)
public void onDrawScreen(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) {
Minecraft mc = Minecraft.getMinecraft();
GuiScreen thisScreen = (GuiScreen) (Object) this;
RenderGuiScreen renderGuiScreen = new RenderGuiScreen(thisScreen);
EventManager.post(renderGuiScreen);
if (renderGuiScreen.isCancelled()) {
if (mc.currentScreen != null && mc.currentScreen != thisScreen) {
mc.currentScreen.drawScreen(mouseX, mouseY, partialTicks);
}
ci.cancel();
}
}
示例2: preUpdateWalkingPlayer
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "onUpdateWalkingPlayer()V", at = @At("HEAD"), cancellable = true)
public void preUpdateWalkingPlayer(CallbackInfo callbackInfo) {
PlayerWalkingUpdate event = EventManager.post(new PlayerWalkingUpdate(this.rotationYaw, this.rotationPitch));
_yaw = this.rotationYaw;
_pitch = this.rotationPitch;
if (event.isCancelled()) {
callbackInfo.cancel();
} else {
if (event.getYaw() != _yaw || event.getPitch() != _pitch) {
this.rotationYaw = wrapAngleTo180(event.getYaw());
this.rotationPitch = wrapAngleTo180(event.getPitch());
}
}
}
示例3: onInitPotions
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "initPotions", at = @At("HEAD"), remap = false)
private static void onInitPotions(CallbackInfo callbackInfo) {
try {
RegistryHelper.setFinalStatic(ThaumicPotionEffectTypes.class, "FLUX", PotionFluxTaint.instance);
RegistryHelper.setFinalStatic(ThaumicPotionEffectTypes.class, "VIS_EXHAUST", PotionVisExhaust.instance);
RegistryHelper.setFinalStatic(ThaumicPotionEffectTypes.class, "INFECTIOUS_VIS_EXHAUST", PotionInfectiousVisExhaust.instance);
RegistryHelper.setFinalStatic(ThaumicPotionEffectTypes.class, "UNNATURAL_HUNGER", PotionUnnaturalHunger.instance);
RegistryHelper.setFinalStatic(ThaumicPotionEffectTypes.class, "WARP_WARD", PotionWarpWard.instance);
RegistryHelper.setFinalStatic(ThaumicPotionEffectTypes.class, "DEATH_GAZE", PotionDeathGaze.instance);
RegistryHelper.setFinalStatic(ThaumicPotionEffectTypes.class, "BLURRED_VISION", PotionBlurredVision.instance);
RegistryHelper.setFinalStatic(ThaumicPotionEffectTypes.class, "SUN_SCORNED", PotionSunScorned.instance);
RegistryHelper.setFinalStatic(ThaumicPotionEffectTypes.class, "THAUMARHIA", PotionThaumarhia.instance);
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: init
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(
method = "<init>(Lnet/minecraft/client/renderer/entity/RenderManager;Z)V",
at = @At("RETURN"))
private void init(RenderManager renderManager, boolean useSmallArms, CallbackInfo ci) {
this.playerModel = smallArms ? PMAPI.ponySmall : PMAPI.pony;
this.mainModel = this.playerModel.getModel();
this.layerRenderers.clear();
this.addLayer(new LayerPonyArmor(this));
this.addLayer(new LayerHeldPonyItem(this));
this.addLayer(new LayerArrow(this));
this.addLayer(new LayerPonyCape(this));
this.addLayer(new LayerPonyCustomHead(this));
this.addLayer(new LayerPonyElytra(this));
this.addLayer(new LayerEntityOnPonyShoulder(renderManager, this));
}
示例5: setWeathers
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "registerDefaults", at = @At("RETURN"), remap = false)
private void setWeathers(CallbackInfo ci) {
// The weathers
this.weathers = Maps.newHashMap();
// Sponge has only a lookup by the name of the weather,
// we will also add the by identifier
for (Weather weather : this.weatherMappings.values()) {
this.weathers.put(weather.getId().toLowerCase(), (WeatherType) weather);
this.weathers.put(weather.getName().toLowerCase(), (WeatherType) weather);
}
// Add some default aliases and command messages
((IMixinWeather) Weathers.THUNDER_STORM).setAliases(Lists.newArrayList("storm", "thunder"));
((IMixinWeather) Weathers.THUNDER_STORM).setCommandMessage("commands.weather.thunder");
((IMixinWeather) Weathers.THUNDER_STORM).setRainStrength(1f);
((IMixinWeather) Weathers.THUNDER_STORM).setDarkness(1f);
// The rate is the chance for every chunk, every tick
((IMixinWeather) Weathers.THUNDER_STORM).setLightningRate(0.00001f);
((IMixinWeather) Weathers.THUNDER_STORM).setThunderRate(1f);
((IMixinWeather) Weathers.CLEAR).setAliases(Lists.newArrayList("sunny"));
((IMixinWeather) Weathers.CLEAR).setCommandMessage("commands.weather.clear");
((IMixinWeather) Weathers.RAIN).setAliases(Lists.newArrayList("rainy"));
((IMixinWeather) Weathers.RAIN).setCommandMessage("commands.weather.rain");
((IMixinWeather) Weathers.RAIN).setRainStrength(1f);
this.addAliases(Weathers.THUNDER_STORM);
this.addAliases(Weathers.CLEAR);
}
示例6: onUpdate
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "update", at = @At("RETURN"))
private void onUpdate(CallbackInfo callbackInfo) {
if (!this.world.isRemote) {
if (this.isBurning()) {
ItemStack itemStack = this.furnaceItemStacks[0];
if (itemStack != null) {
if (itemStack.getItem() instanceof ItemBlock) {
Block block = ((ItemBlock) itemStack.getItem()).block;
if (block.getMaterial(block.getStateFromMeta(itemStack.getMetadata())) == Material.TNT) {
this.doExplosion();
}
} else if (itemStack.getItem() == Items.GUNPOWDER) {
this.doExplosion();
} else if (itemStack.getItem() instanceof ItemFirework || itemStack.getItem()
instanceof ItemFireworkCharge) {
this.doExplosion();
}
}
}
}
}
示例7: onProcessHandshake
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "processHandshake", at = @At(value = "HEAD"), cancellable = true)
private void onProcessHandshake(C00Handshake packetIn, CallbackInfo ci) {
if (packetIn.getRequestedState().equals(EnumConnectionState.LOGIN)) {
final String[] split = packetIn.ip.split("\00");
if (split.length >= 3) {
packetIn.ip = split[0];
((IMixinNetworkManager_Bungee) this.networkManager).setRemoteAddress(new InetSocketAddress(split[1],
((InetSocketAddress) this.networkManager.getRemoteAddress()).getPort()));
((IMixinNetworkManager_Bungee) this.networkManager).setSpoofedUUID(UUIDTypeAdapter.fromString(split[2]));
if (split.length == 4) {
((IMixinNetworkManager_Bungee) this.networkManager).setSpoofedProfile(GSON.fromJson(split[3], Property[].class));
}
} else {
final ChatComponentText chatcomponenttext =
new ChatComponentText("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext));
this.networkManager.closeChannel(chatcomponenttext);
}
}
}
示例8: onPopulateEnvironment
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "populateEnvironment", at = @At("RETURN"))
private void onPopulateEnvironment(CallbackInfo ci) {
if (Canary.pluginManager() != null) {
this.theReportCategory.addCrashSectionCallable("Canary Plugins", () -> {
final StringBuilder result = new StringBuilder(64);
for (final Plugin plugin : Canary.pluginManager().getPlugins()) {
result.append("\n\t\t")
.append(plugin.getName())
.append(" v ")
.append(plugin.getVersion())
.append(" (")
.append(plugin.getPath())
.append(")");
}
return result.toString();
});
}
}
示例9: onSetKeyBindState
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method="setKeyBindState", [email protected]("HEAD"), cancellable=true)
private static void onSetKeyBindState(int p_74510_0_, boolean p_74510_1_, CallbackInfo ci) {
//methodhead
// mod_controlpack
// called on every mouse AND keyboard event (mouse button - 100 to avoid colliding numbers)
if (ControlPackMain.instance.handleInputEvent(p_74510_0_, p_74510_1_)) {
ci.cancel();
}
// mod_controlpack
// ensure the correct keys are in the down state
if (ControlPackMain.instance != null) {
ControlPackMain.instance.resetPlayerKeyState();
}
}
示例10: onInitialization
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "<init>*", at = @At("RETURN"))
private void onInitialization(CallbackInfo ci) {
this.chatGui = tc.getChatGui();
this.sentHistoryCursor = chatGui.getSentMessages().size();
this.chat = chatGui.getChatManager();
this.textBox = chat.getChatBox().getChatInput().getTextField();
Channel chan = chat.getActiveChannel();
if (this.defaultInputFieldText.isEmpty()
&& !chan.isPrefixHidden()
&& !chan.getPrefix().isEmpty()) {
defaultInputFieldText = chan.getPrefix() + " ";
}
this.componentList.add(chat.getChatBox());
}
示例11: initSplashText
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "initGui()V", at = @At("RETURN"), locals = LocalCapture.CAPTURE_FAILSOFT)
private void initSplashText(CallbackInfo callbackInfo, Calendar calendar) {
if (calendar.get(Calendar.MONTH) == Calendar.JUNE && calendar.get(Calendar.DAY_OF_MONTH) == 21)
this.splashText = "Happy Birthday Gogume1er!";
}
示例12: loadCurrentPosition
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "renderItemInFirstPerson",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/item/ItemStack;getItemUseAction()Lnet/minecraft/item/EnumAction;"),
locals = LocalCapture.CAPTURE_FAILEXCEPTION)
private void loadCurrentPosition(float partialTicks, CallbackInfo callbackInfo, float f,
AbstractClientPlayer abstractClientPlayer, float f1) {
this.currentPosition = PastOption.OLD_BLOCKHIT.getValue() ? f1 : 0.0f;
}
示例13: loadPastResourcePack
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "refreshResources",
at = @At(value = "INVOKE",
target = "Ljava/util/List;addAll(Ljava/util/Collection;)Z",
ordinal = 0,
remap = false),
locals = LocalCapture.CAPTURE_FAILEXCEPTION)
private void loadPastResourcePack(CallbackInfo callbackInfo, List<IResourcePack> list) {
list.add(Past.getInstance().getResourcePack());
}
示例14: multiplyCriticalParticle
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "onCriticalHit",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/particle/EffectRenderer;emitParticleAtEntity(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/EnumParticleTypes;)V"))
private void multiplyCriticalParticle(Entity entityHit, CallbackInfo callbackInfo) {
for (int i = 0; i < PastOption.PARTICLE_MULTIPLIER.getValue().intValue() - 1; ++i)
this.mc.effectRenderer.emitParticleAtEntity(entityHit, EnumParticleTypes.CRIT);
}
示例15: multiplyEnchantmentParticle
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; //导入依赖的package包/类
@Inject(method = "onEnchantmentCritical",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/particle/EffectRenderer;emitParticleAtEntity(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/EnumParticleTypes;)V"))
private void multiplyEnchantmentParticle(Entity entityHit, CallbackInfo callbackInfo) {
for (int i = 0; i < PastOption.PARTICLE_MULTIPLIER.getValue().intValue() - 1; ++i)
this.mc.effectRenderer.emitParticleAtEntity(entityHit, EnumParticleTypes.CRIT_MAGIC);
}