本文整理汇总了Java中net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent方法的典型用法代码示例。如果您正苦于以下问题:Java TickEvent.RenderTickEvent方法的具体用法?Java TickEvent.RenderTickEvent怎么用?Java TickEvent.RenderTickEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.fml.common.gameevent.TickEvent
的用法示例。
在下文中一共展示了TickEvent.RenderTickEvent方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRenderTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent event)
{
Minecraft mc = Minecraft.getMinecraft();
if(mc.world != null)
{
if(event.phase == TickEvent.Phase.START)
{
ItemStack currentInv = ItemHandler.getUsableDualHandedItem(mc.player);
boolean was = currentItemIsTorchGun;
currentItemIsTorchGun = (currentInv.getItem() instanceof ItemTorchGun || currentInv.getItem() instanceof ItemTorchLauncher);
if(was && !currentItemIsTorchGun)
{
Torched.channel.sendToServer(new PacketKeyEvent(false));
}
if(prevCurItem != mc.player.inventory.currentItem)
{
if(mc.player.inventory.currentItem >= 0 && mc.player.inventory.currentItem <= 9 && mc.entityRenderer.itemRenderer.equippedProgressMainHand >= 1.0F)
{
prevCurItem = mc.player.inventory.currentItem;
}
currentItemIsTorchGun = false;
}
}
}
}
示例2: onRenderTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent ev)
{
purgeExpiredFragments(null);
if (Minecraft.getMinecraft().currentScreen != null && !(Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu))
return;
int displayWidth = Minecraft.getMinecraft().displayWidth;
int displayHeight = Minecraft.getMinecraft().displayHeight;
ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft(), displayWidth, displayHeight);
int width = res.getScaledWidth();
int height = res.getScaledHeight();
float rx = (float) width / 1000f;
float ry = (float) height / 1000f;
synchronized(this.fragments)
{
for (TextCategory cat : TextCategory.values())
{
TextCategoryAttributes atts = this.attributes.get(cat);
if (atts != null && (!atts.flashing || ((System.currentTimeMillis() / 500) % 3 != 0)) && shouldDisplay(atts.displayLevel))
{
int x = Math.round(rx * (float) atts.xOrg);
int y = Math.round(ry * (float) atts.yOrg);
ArrayList<TextFragment> frags = this.fragments.get(cat);
if (frags != null && !frags.isEmpty())
{
for (TextFragment frag : frags)
{
drawText(frag.text, x, y, atts.colour);
y += 10;
}
}
}
}
}
}
示例3: onRenderTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
/** Called for each screen redraw - approximately three times as often as the other tick events,
* under normal conditions.<br>
* This is where we want to update our yaw/pitch, in order to get smooth panning etc
* (which is how Minecraft itself does it).
* The speed of the render ticks is not guaranteed, and can vary from machine to machine, so
* we try to account for this in the calculations.
* @param ev the RenderTickEvent object for this tick
*/
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent ev)
{
if (ev.phase == Phase.START)
{
if (this.isOverriding())
{
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
if (player != null)
{
updateYawAndPitch();
player.rotationPitch = this.mCameraPitch;
player.rotationYaw = this.mYaw;
}
}
}
}
示例4: onTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void onTick(TickEvent.RenderTickEvent event) {
if (TextDisplayerMod.getInstance().getWebsiteUtils().isDisabled()) return;
boolean isClickedLeft = Mouse.isButtonDown(0);
if (isClickedLeft != this.lastLeft) {
this.lastLeft = isClickedLeft;
if (isClickedLeft) {
this.leftClicks.add(System.currentTimeMillis());
}
}
boolean isClickedRight = Mouse.isButtonDown(1);
if (isClickedRight != this.lastRight) {
this.lastRight = isClickedRight;
if (isClickedRight) {
this.rightClicks.add(System.currentTimeMillis());
}
}
}
示例5: renderTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void renderTick(TickEvent.RenderTickEvent event) {
tickTime = event.renderTickTime;
Minecraft minecraft = Minecraft.getMinecraft();
if (event.phase == Phase.END)
if (minecraft.player != null && minecraft.player.getHeldItemMainhand() != null)
if (minecraft.player.getHeldItemMainhand().getItem() instanceof ItemUsable) {
Mouse.poll();
minecraft.player.rotationYawHead = minecraft.player.rotationYaw;
moveEntities = true;
keyPressUpdate(Mouse.isButtonDown(minecraft.gameSettings.keyBindAttack.getKeyCode() + 100),
Mouse.isButtonDown(minecraft.gameSettings.keyBindUseItem.getKeyCode() + 100));
moveEntities = false;
}
}
示例6: tickEnd
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void tickEnd(TickEvent.RenderTickEvent event) {
if (event.phase == TickEvent.Phase.END && FMLClientHandler.instance().getClient().inGameHasFocus && PneumaticCraftRepressurized.proxy.getPlayer().world != null && (ModuleRegulatorTube.inverted || !ModuleRegulatorTube.inLine)) {
Minecraft mc = FMLClientHandler.instance().getClient();
ScaledResolution sr = new ScaledResolution(mc);
FontRenderer fontRenderer = FMLClientHandler.instance().getClient().fontRenderer;
String warning = TextFormatting.RED + I18n.format("gui.regulatorTube.hudMessage." + (ModuleRegulatorTube.inverted ? "inverted" : "notInLine"));
fontRenderer.drawStringWithShadow(warning, sr.getScaledWidth() / 2 - fontRenderer.getStringWidth(warning) / 2, sr.getScaledHeight() / 2 + 30, 0xFFFFFFFF);
}
}
示例7: renderTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void renderTick(TickEvent.RenderTickEvent event) {
if (event.phase == TickEvent.Phase.END) {
Minecraft mc = FMLClientHandler.instance().getClient();
if (mc != null && mc.player != null) {
render2D(event.renderTickTime);
}
}
}
示例8: onRenderTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent event)
{
if(event.phase == TickEvent.Phase.START)
{
drawnChannels.clear();
}
}
示例9: guiRendered
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void guiRendered(TickEvent.RenderTickEvent evt)
{
if (CreeperHost.instance.toastText != null)
{
long curTime = System.currentTimeMillis();
if (CreeperHost.instance.fadeTime > curTime)
{
long fadeDiff = CreeperHost.instance.fadeTime - CreeperHost.instance.endTime;
long curFade = Math.min(CreeperHost.instance.fadeTime - curTime, fadeDiff);
float alpha = (float) curFade / (float) fadeDiff;
RenderHelper.disableStandardItemLighting();
GlStateManager.color(1.0F, 1.0F, 1.0F, alpha);
mc.renderEngine.bindTexture(getToastResourceLocation());
ScaledResolution res = new ScaledResolution(mc);
drawTexturedModalRect(res.getScaledWidth() - 160, 0, u, v, 160, 32);
GlStateManager.enableBlend();
int textColour = (0xFFFFFF << 32) | ((int) (alpha * 255) << 24);
mc.fontRendererObj.drawSplitString(CreeperHost.instance.toastText, res.getScaledWidth() - 160 + 5, 6, 160, textColour);
}
else
{
CreeperHost.instance.toastText = null;
}
}
}
示例10: onRenderTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent ev)
{
// Pass the event on to the active episode, if there is one:
this.stateEpisodeLock.readLock().lock();
if (this.stateEpisode != null && this.stateEpisode.isLive())
{
this.stateEpisode.onRenderTick(ev);
}
this.stateEpisodeLock.readLock().unlock();
}
示例11: onClientTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onClientTick(TickEvent.RenderTickEvent event) {
if (event.phase != TickEvent.Phase.START) return;
EntityPlayerSP player = Minecraft.getMinecraft().player;
if (player==null) return; //We're not in-game
if (event.phase == TickEvent.Phase.START) {
FX.update(Minecraft.getMinecraft().world);
if (player.isPotionActive(Thermionics.POTION_TIPSY)) {
swayTheta += swaySpeed * event.renderTickTime;
int magnitude = player.getActivePotionEffect(Thermionics.POTION_TIPSY).getAmplifier();
if (magnitude>10) {
//TODO: Extra-magnitude effects. My idea of inducing nausea was vetoed by people clearly unfamiliar with the effects of ten forties of vodka.
}
if (player.movementInput.forwardKeyDown) {
//Modulate the player direction
float swayBase = MathHelper.cos(swayTheta);
float sway = swayAmplitudePerTipsy * player.getActivePotionEffect(Thermionics.POTION_TIPSY).getAmplifier() * swayBase;
player.rotationYaw += sway;
//player.cameraYaw += sway;
}
}
}
}
示例12: onGameTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void onGameTick(TickEvent.RenderTickEvent event) {
if (TextDisplayerMod.getInstance().getWebsiteUtils().isDisabled()) return;
if (mc.currentScreen != null) {
if (this.mc.currentScreen instanceof MainGui) {
try {
this.mc.currentScreen.handleInput();
} catch (IOException ignored) {
}
}
} else if (this.mc.inGameHasFocus && !this.mc.gameSettings.showDebugInfo && mc.thePlayer != null) {
TextDisplayerMod.getInstance().getLoader().renderAll(false);
}
}
示例13: onRenderTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@Override
public void onRenderTick(TickEvent.RenderTickEvent ev)
{
// We wait until we start to get render ticks, at which point we assume Minecraft has finished starting up.
episodeHasCompleted(ClientState.DORMANT);
}
示例14: guiRender
import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void guiRender(TickEvent.RenderTickEvent t){
Minecraft mc = Minecraft.getMinecraft();
if(mc.inGameHasFocus && !mc.gameSettings.showDebugInfo) {
ScaledResolution res = new ScaledResolution(mc);
int width = res.getScaledWidth();
int height = res.getScaledHeight();
int xPos = 0;
int yPos = 0;
switch(ConfigValues.XALIGNMENT){
case LEFT:
xPos = ConfigValues.COMPASSX;
break;
case RIGHT:
xPos = width-ConfigValues.COMPASSX;
break;
case CENTER:
xPos = width/2+ ConfigValues.COMPASSX;
}
switch(ConfigValues.YALIGNMENT){
case TOP:
yPos = ConfigValues.COMPASSY;
break;
case BOTTOM:
yPos = height-ConfigValues.COMPASSY;
break;
case CENTER:
yPos = height/2+ConfigValues.COMPASSY;
}
glEnable(32826);
GlStateManager.pushMatrix();
RenderHelper.enableGUIStandardItemLighting();
glDisable(GL12.GL_RESCALE_NORMAL);
mc.getRenderItem().renderItemIntoGUI(new ItemStack(UHCCompass.uhccompass), xPos, yPos);
RenderHelper.disableStandardItemLighting();
glEnable(32826);
GlStateManager.popMatrix();
}
}