Java Code Examples for net.minecraft.client.Minecraft

The following are top voted examples for showing how to use net.minecraft.client.Minecraft. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: BetterBeginningsReborn   File: GuiDoubleWorkbench.java   Source Code and License 7 votes vote down vote up
private void drawItemTooltip(int x, int y, ItemStack stack, boolean warn)
{
	if (stack == null)
	{
		return;
	}

	List<String> lines = new ArrayList<>();

	boolean adv = Minecraft.getMinecraft().gameSettings.advancedItemTooltips;
	int id = Item.getIdFromItem(stack.getItem());
	lines.addAll(stack.getTooltip(container.getOpeningPlayer(), adv ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL));
	lines.set(0, lines.get(0) + " " + id);

	if (warn)
	{
		lines.add(ChatUtil.RED + I18n.format("container.craftingdouble.warning"));
	}

	drawHoveringText(lines, x, y); //Draw tooltip
}
 
Example 2
Project: rezolve   File: SecurityServerEntity.java   Source Code and License 7 votes vote down vote up
public boolean editRule(String id, String name, int mode) {
	Rule rule = this.getRuleByIdInternal(id);
	
	if (rule == null)
		return false;
	
	if (this.getWorld().isRemote) {
		RezolvePacketHandler.INSTANCE.sendToServer(new RuleModificationMessage(
			Minecraft.getMinecraft().thePlayer, 
			this, id, name, mode
		));
			
		return true;
	}

	if (!"<players>".equals(rule.getName()) && !"<machines>".equals(rule.getName())) {
		rule.name = name;
	}
	
	rule.mode = mode;
	this.notifyUpdate();
	
	return true;
}
 
Example 3
Project: Backmemed   File: ShadersTex.java   Source Code and License 7 votes vote down vote up
static void updateTextureMinMagFilter()
{
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    ITextureObject itextureobject = texturemanager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

    if (itextureobject != null)
    {
        MultiTexID multitexid = itextureobject.getMultiTexID();
        GlStateManager.bindTexture(multitexid.base);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilB]);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilB]);
        GlStateManager.bindTexture(multitexid.norm);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilN]);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilN]);
        GlStateManager.bindTexture(multitexid.spec);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilS]);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilS]);
        GlStateManager.bindTexture(0);
    }
}
 
Example 4
Project: Proyecto-DASI   File: AbsoluteMovementCommandsImplementation.java   Source Code and License 7 votes vote down vote up
private void sendChanges()
{
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    if (player == null)
        return;

    // Send any changes requested over the wire to the server:
    double x = this.setX ? this.x : 0;
    double y = this.setY ? this.y : 0;
    double z = this.setZ ? this.z : 0;
    float yaw = this.setYaw ? this.rotationYaw : 0;
    float pitch = this.setPitch ? this.rotationPitch : 0;

    if (this.setX || this.setY || this.setZ || this.setYaw || this.setPitch)
    {
        MalmoMod.network.sendToServer(new TeleportMessage(x, y, z, yaw, pitch, this.setX, this.setY, this.setZ, this.setYaw, this.setPitch));
        if (this.setYaw || this.setPitch)
        {
            // Send a message that the ContinuousMovementCommands can pick up on:
            Event event = new CommandForWheeledRobotNavigationImplementation.ResetPitchAndYawEvent(this.setYaw, this.rotationYaw, this.setPitch, this.rotationPitch);
            MinecraftForge.EVENT_BUS.post(event);
        }
        this.setX = this.setY = this.setZ = this.setYaw = this.setPitch = false;
    }
}
 
Example 5
Project: BaseClient   File: ShadersTex.java   Source Code and License 7 votes vote down vote up
static void updateTextureMinMagFilter()
{
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    ITextureObject itextureobject = texturemanager.getTexture(TextureMap.locationBlocksTexture);

    if (itextureobject != null)
    {
        MultiTexID multitexid = itextureobject.getMultiTexID();
        GlStateManager.bindTexture(multitexid.base);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilB]);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilB]);
        GlStateManager.bindTexture(multitexid.norm);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilN]);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilN]);
        GlStateManager.bindTexture(multitexid.spec);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilS]);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilS]);
        GlStateManager.bindTexture(0);
    }
}
 
Example 6
Project: needtobreath   File: NTBOverlayRenderer.java   Source Code and License 7 votes vote down vote up
public static void onRenderWorld(RenderWorldLastEvent event) {
//        EntityPlayerSP player = Minecraft.getMinecraft().player;
//        if (player.getHeldItem(EnumHand.MAIN_HAND).isEmpty()) {
//            return;
//        }

//        if (player.getHeldItem(EnumHand.MAIN_HAND).getItem() != ModItems.radiationMonitorItem) {
//            return;
//        }


        if (cleanAir != null) {
            EntityPlayerSP p = Minecraft.getMinecraft().player;
            if (hasGlasses()) {
                int cnt = cleanAir.size();
                if (cnt != prevCnt) {
                    System.out.println("cleanAir = " + cnt);
                    prevCnt = cnt;
                }
                renderHighlightedBlocks(event, p, cleanAir);
            }
        }
    }
 
Example 7
Project: Backmemed   File: TileEntityRendererDispatcher.java   Source Code and License 7 votes vote down vote up
public void drawBatch(int p_drawBatch_1_)
{
    this.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.blendFunc(770, 771);
    GlStateManager.enableBlend();
    GlStateManager.disableCull();

    if (Minecraft.isAmbientOcclusionEnabled())
    {
        GlStateManager.shadeModel(7425);
    }
    else
    {
        GlStateManager.shadeModel(7424);
    }

    if (p_drawBatch_1_ > 0)
    {
        this.batchBuffer.getBuffer().sortVertexData((float)staticPlayerX, (float)staticPlayerY, (float)staticPlayerZ);
    }

    this.batchBuffer.draw();
    RenderHelper.enableStandardItemLighting();
    this.drawingBatch = false;
}
 
Example 8
Project: Backmemed   File: GuiScreenOptionsSounds.java   Source Code and License 7 votes vote down vote up
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY)
{
    if (super.mousePressed(mc, mouseX, mouseY))
    {
        this.volume = (float)(mouseX - (this.xPosition + 4)) / (float)(this.width - 8);
        this.volume = MathHelper.clamp(this.volume, 0.0F, 1.0F);
        mc.gameSettings.setSoundLevel(this.category, this.volume);
        mc.gameSettings.saveOptions();
        this.displayString = this.categoryName + ": " + GuiScreenOptionsSounds.this.getDisplayString(this.category);
        this.pressed = true;
        return true;
    }
    else
    {
        return false;
    }
}
 
Example 9
Project: BaseClient   File: EntityPlayer.java   Source Code and License 7 votes vote down vote up
/**
 * Causes this entity to do an upwards motion (jumping).
 */
public void jump()
{
	if (this == Minecraft.getMinecraft().thePlayer)
	{
	    JumpEvent event = new JumpEvent();
	    event.call();

	    if (event.isCancelled()) return;
	}

    super.jump();
    this.triggerAchievement(StatList.jumpStat);

    if (this.isSprinting())
    {
        this.addExhaustion(0.8F);
    }
    else
    {
        this.addExhaustion(0.2F);
    }
}
 
Example 10
Project: Backmemed   File: RenderUtils.java   Source Code and License 7 votes vote down vote up
public static void searchBox(BlockPos blockPos) {
	double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
	double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
	double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
	GL11.glBlendFunc(770, 771);
	GL11.glEnable(GL_BLEND);
	GL11.glLineWidth(1.0F);
	float sinus = 1F - MathHelper
			.abs(MathHelper.sin(Minecraft.getSystemTime() % 10000L / 10000.0F * (float) Math.PI * 4.0F) * 1F);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL_DEPTH_TEST);
	GL11.glDepthMask(false);
	GL11.glColor4f(1F - sinus, sinus, 0F, 0.15F);
	drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), 1F - sinus, sinus, 0F, 0.15F);
	GL11.glColor4d(0, 0, 0, 0.5);
	drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL_DEPTH_TEST);
	GL11.glDepthMask(true);
	GL11.glDisable(GL_BLEND);
}
 
Example 11
Project: Machines-and-Stuff   File: RenderAccumulator.java   Source Code and License 7 votes vote down vote up
public static void renderBlockModel(World world, BlockPos pos, IBlockState state) {
    VertexBuffer wr = Tessellator.getInstance().getBuffer();
    wr.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
    wr.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ());
    BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
    BlockModelShapes modelShapes = blockrendererdispatcher.getBlockModelShapes();
    IBakedModel ibakedmodel = modelShapes.getModelForState(state);
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    
    for(BlockRenderLayer layer : BlockRenderLayer.values()) {
        if(state.getBlock().canRenderInLayer(state, layer)) {
            ForgeHooksClient.setRenderLayer(layer);
            blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, state, pos, wr, true);
        }
    }
    ForgeHooksClient.setRenderLayer(null);
    wr.setTranslation(0, 0, 0);
    Tessellator.getInstance().draw();
}
 
Example 12
Project: Backmemed   File: PlayerConfigurationParser.java   Source Code and License 7 votes vote down vote up
private BufferedImage downloadTextureImage(String p_downloadTextureImage_1_)
{
    String s = "http://s.optifine.net/" + p_downloadTextureImage_1_;

    try
    {
        byte[] abyte = HttpPipeline.get(s, Minecraft.getMinecraft().getProxy());
        BufferedImage bufferedimage = ImageIO.read((InputStream)(new ByteArrayInputStream(abyte)));
        return bufferedimage;
    }
    catch (IOException ioexception)
    {
        Config.warn("Error loading item texture " + p_downloadTextureImage_1_ + ": " + ioexception.getClass().getName() + ": " + ioexception.getMessage());
        return null;
    }
}
 
Example 13
Project: Backmemed   File: ModelAdapterWither.java   Source Code and License 6 votes vote down vote up
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize)
{
    RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
    RenderWither renderwither = new RenderWither(rendermanager);
    renderwither.mainModel = modelBase;
    renderwither.shadowSize = shadowSize;
    return renderwither;
}
 
Example 14
Project: Adventurers-Toolbox   File: SwordModel.java   Source Code and License 6 votes vote down vote up
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
		@Nullable World world, @Nullable EntityLivingBase entity) {

	if (stack.getItem() != ModItems.sword) {
		return originalModel;
	}

	BakedSwordModel model = (BakedSwordModel) originalModel;

	String key = IBladeTool.getBladeMat(stack).getName() + "|"
			+ ICrossguardTool.getCrossguardMat(stack).getName() + "|"
			+ IHandleTool.getHandleMat(stack).getName() + "|"
			+ IAdornedTool.getAdornmentMat(stack).getName();

	if (!model.cache.containsKey(key)) {
		ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
		builder.put("blade", IBladeTool.getBladeMat(stack).getName());
		builder.put("crossguard", ICrossguardTool.getCrossguardMat(stack).getName());
		builder.put("handle", IHandleTool.getHandleMat(stack).getName());
		if (IAdornedTool.getAdornmentMat(stack) != ModMaterials.ADORNMENT_NULL) {
			builder.put("adornment", IAdornedTool.getAdornmentMat(stack).getName());
		}
		IModel parent = model.parent.retexture(builder.build());
		Function<ResourceLocation, TextureAtlasSprite> textureGetter;
		textureGetter = new Function<ResourceLocation, TextureAtlasSprite>() {
			public TextureAtlasSprite apply(ResourceLocation location) {
				return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
			}
		};
		IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format,
				textureGetter);
		model.cache.put(key, bakedModel);
		return bakedModel;
	}

	return model.cache.get(key);
}
 
Example 15
Project: Proyecto-DASI   File: ClientStateMachine.java   Source Code and License 6 votes vote down vote up
@Override
protected void execute() throws Exception
{
    ClientStateMachine.this.initialiseComms();

    // This is necessary in order to allow user to exit the Minecraft window without halting the experiment:
    GameSettings settings = Minecraft.getMinecraft().gameSettings;
    settings.pauseOnLostFocus = false;
}
 
Example 16
Project: betaexpansion   File: NetClientHandler.java   Source Code and License 6 votes vote down vote up
public NetClientHandler(Minecraft minecraft, String s, int i)
    throws UnknownHostException, IOException
{
    disconnected = false;
    field_1210_g = false;
    field_28118_b = new MapStorage(null);
    rand = new Random();
    mc = minecraft;
    Socket socket = new Socket(InetAddress.getByName(s), i);
    netManager = new NetworkManager(socket, "Client", this);
}
 
Example 17
Project: Mods   File: TF2EventsClient.java   Source Code and License 6 votes vote down vote up
public int getActionType(boolean attackKeyDown, boolean altAttackKeyDown) {
	int value = 0;
	ItemStack stack = Minecraft.getMinecraft().player.getHeldItemMainhand();
	
	if (attackKeyDown) {
		value++;
	}
	if (altAttackKeyDown) {
		value += 2;
	}
	if (ClientProxy.reload.isKeyDown()) {
		value += 4;
	}
	return ((ItemUsable)stack.getItem()).getStateOverride(stack, Minecraft.getMinecraft().player, value);
}
 
Example 18
Project: BaseClient   File: GuiResourcePackList.java   Source Code and License 6 votes vote down vote up
public GuiResourcePackList(Minecraft mcIn, int p_i45055_2_, int p_i45055_3_, List<ResourcePackListEntry> p_i45055_4_)
{
    super(mcIn, p_i45055_2_, p_i45055_3_, 32, p_i45055_3_ - 55 + 4, 36);
    this.mc = mcIn;
    this.field_148204_l = p_i45055_4_;
    this.field_148163_i = false;
    this.setHasListHeader(true, (int)((float)mcIn.fontRendererObj.FONT_HEIGHT * 1.5F));
}
 
Example 19
Project: PurificatiMagicae   File: CPacketSpawnParticle.java   Source Code and License 6 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(CPacketSpawnParticle message, MessageContext ctx)
{
    Minecraft.getMinecraft().addScheduledTask(() ->
            Minecraft.getMinecraft().world.spawnParticle(message.type,
                    message.pos.getX(), message.pos.getY(), message.pos.getZ(),
                    message.motion.getX(), message.motion.getY(), message.motion.getZ()));
    return null;
}
 
Example 20
Project: Proyecto-DASI   File: CommandForWheeledRobotNavigationImplementation.java   Source Code and License 6 votes vote down vote up
@Override
public void deinstall(MissionInit missionInit)
{
    // Restore the player's normal movement control:
    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    if (player != null)
    {
        player.movementInput = this.originalMovement;
    }
    
    FMLCommonHandler.instance().bus().unregister(this);
    MinecraftForge.EVENT_BUS.unregister(this);
}
 
Example 21
Project: Visualize   File: GuiNewOptionsRowList.java   Source Code and License 6 votes vote down vote up
private GuiButton createButton(Minecraft mcIn, int p_148182_2_, int p_148182_3_, GameSettings.Options options) {
    if(options == null) {
        return null;
    } else {
        int i = options.returnEnumOrdinal();
        return options.getEnumFloat() ? new GuiOptionSlider(i, p_148182_2_, p_148182_3_, options) : new GuiOptionButton(i, p_148182_2_, p_148182_3_, options, mcIn.gameSettings.getKeyBinding(options));
    }
}
 
Example 22
Project: TextDisplayer   File: ModernTextBox.java   Source Code and License 6 votes vote down vote up
public ModernTextBox(int componentId, int x, int y, int par5Width, int par6Height) {
    this.id = componentId;
    this.fontRendererInstance = Minecraft.getMinecraft().fontRendererObj;
    this.xPosition = x;
    this.yPosition = y;
    this.width = par5Width;
    this.height = par6Height;
}
 
Example 23
Project: betaexpansion   File: ThreadConnectToServer.java   Source Code and License 6 votes vote down vote up
ThreadConnectToServer(GuiConnecting guiconnecting, Minecraft minecraft, String s, int i)
    {
//        super();
        connectingGui = guiconnecting;
        mc = minecraft;
        hostName = s;
        port = i;
    }
 
Example 24
Project: harshencastle   File: HandlerExtraRange.java   Source Code and License 6 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onClick(MouseInputEvent event)
{
	if(Minecraft.getMinecraft().gameSettings.keyBindAttack.isPressed())
	{
		KeyBinding.onTick(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode());
		RayTraceResult ray = HarshenClientUtils.getMouseOver(Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() instanceof BaseHarshenScythe ?
				((BaseHarshenScythe)Minecraft.getMinecraft().player.getHeldItemMainhand().getItem()).getReach() : AccessoryConfig.reachPendantLength);
		if(Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() instanceof BaseHarshenScythe && HarshenUtils.containsItem(Minecraft.getMinecraft().player, HarshenItems.REACH_PENDANT))
			ray = HarshenClientUtils.getMouseOver(((BaseHarshenScythe)Minecraft.getMinecraft().player.getHeldItemMainhand().getItem()).getReach() + AccessoryConfig.reachPendantLength);
		if(ray != null && (Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() instanceof BaseHarshenScythe || HarshenUtils.containsItem(Minecraft.getMinecraft().player, HarshenItems.REACH_PENDANT)))
			HarshenNetwork.sendToServer(new MessagePacketHitWithRange(ray.entityHit.getEntityId()));
	}
}
 
Example 25
Project: FirstAid   File: MessageReceiveDamage.java   Source Code and License 6 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(MessageReceiveDamage message, MessageContext ctx) {
    Minecraft.getMinecraft().addScheduledTask(() -> {
       AbstractPlayerDamageModel damageModel = PlayerDataManager.getDamageModel(Minecraft.getMinecraft().player);
        Objects.requireNonNull(damageModel);
        AbstractDamageablePart part = damageModel.getFromEnum(message.part);
        part.damage(message.damageAmount, null, false, message.minHealth);
    });
    return null;
}
 
Example 26
Project: PurificatiMagicae   File: GuiTranslationDeskPanel.java   Source Code and License 6 votes vote down vote up
public void minRate()
{
    if (rate > 0)
    {
        rate -= 2;
    }
    Minecraft.getMinecraft().player.playSound(SoundRegistry.ERROR, 1, 1);
}
 
Example 27
Project: Proyecto-DASI   File: MalmoModClient.java   Source Code and License 6 votes vote down vote up
public void init(FMLInitializationEvent event)
{
       // Register for various events:
       FMLCommonHandler.instance().bus().register(this);
       MinecraftForge.EVENT_BUS.register(this);

       GameSettings settings = Minecraft.getMinecraft().gameSettings;
       setUpExtraKeys(settings);

       this.stateMachine = new ClientStateMachine(ClientState.WAITING_FOR_MOD_READY, this);
       
       this.originalMouseHelper = Minecraft.getMinecraft().mouseHelper;
       this.mouseHook = new MouseHook();
       this.mouseHook.isOverriding = true;
       Minecraft.getMinecraft().mouseHelper = this.mouseHook;
       setInputType(InputType.AI);
   }
 
Example 28
Project: BaseClient   File: AutoPot.java   Source Code and License 6 votes vote down vote up
public static void resetItems() {
    if (expectedPackets > 0) {
        --expectedPackets;
        Minecraft mc = Minecraft.getMinecraft();
        mc.thePlayer.inventoryContainer.putStackInSlot(potSlot, null);
        mc.thePlayer.inventoryContainer.putStackInSlot(36 + currentItem, originalStack);
    }
}
 
Example 29
Project: MineCamera   File: EventLoader.java   Source Code and License 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void rightClickEmpty(RightClickEmpty event) {
	// System.out.println("RightClickEmpty,HandType="+event.getHand());
	if (event.getEntityPlayer().getEntityData().hasKey("renderViewCamera") && event.getSide().isClient()
			&& event.getHand().equals(EnumHand.MAIN_HAND)) {
		System.out.println("delay=" + ((EntityTripod) Minecraft.getMinecraft().theWorld
				.getEntityByID(Minecraft.getMinecraft().thePlayer.getEntityData().getInteger("renderViewCamera")))
						.getDelay());
		System.out.println("RightClickEmpty,HandType=" + event.getHand());
		ActiveTripod(Minecraft.getMinecraft().thePlayer.getName(),
				((EntityTripod) event.getWorld()
						.getEntityByID(event.getEntityPlayer().getEntityData().getInteger("renderViewCamera")))
								.getDelay());
	}
}
 
Example 30
Project: MineCamera   File: EventLoader.java   Source Code and License 6 votes vote down vote up
@SubscribeEvent
public void entityInteract(EntityInteract event) {
	if (event.getEntityPlayer().getEntityData().hasKey("renderViewCamera")) {
		event.setCanceled(true);
		if (event.getSide().isClient() && event.getHand().equals(EnumHand.MAIN_HAND)
				&& event.getItemStack() == null) {
			System.out.println("EntityInteract,HandType=" + event.getHand());
			ActiveTripod(Minecraft.getMinecraft().thePlayer.getName(),
					((EntityTripod) event.getWorld()
							.getEntityByID(event.getEntityPlayer().getEntityData().getInteger("renderViewCamera")))
									.getDelay());
		}
		return;
	}
	if (event.getTarget() instanceof EntityTripod) {
		Entity target = ((PlayerInteractEvent.EntityInteract) event).getTarget();
		EntityPlayer player = event.getEntityPlayer();
		if (!player.isSneaking()) {
			if (player.inventory.armorInventory[3] != null
					&& player.inventory.armorInventory[3].getItem() instanceof ItemGlassesHelmet) {
				if (player.getEntityWorld().isRemote) {
					// System.out.println("123");
					Minecraft.getMinecraft().setRenderViewEntity(target);
					Minecraft.getMinecraft().ingameGUI.setRecordPlaying(new TextComponentTranslation("chat.tripod.info"), false);
				}
				player.getEntityData().setInteger("renderViewCamera", target.getEntityId());
			}else if(!event.getWorld().isRemote&&event.getHand().equals(EnumHand.MAIN_HAND)){
				player.addChatComponentMessage(new TextComponentTranslation("chat.tripod.mustuseglass"));
			}
		} else {
			player.getEntityData().setInteger("usingGui", target.getEntityId());
			player.openGui(MineCamera.instance, GuiElementLoader.GUI_TRIPOD_CAMERA, target.getEntityWorld(),
					(int) target.posX, (int) target.posY, (int) target.posZ);
		}
	}
}
 
Example 31
Project: Backmemed   File: ModelAdapterShulkerBullet.java   Source Code and License 6 votes vote down vote up
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize)
{
    RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
    RenderShulkerBullet rendershulkerbullet = new RenderShulkerBullet(rendermanager);

    if (!Reflector.RenderShulkerBullet_model.exists())
    {
        Config.warn("Field not found: RenderShulkerBullet.model");
        return null;
    }
    else
    {
        Reflector.setFieldValue(rendershulkerbullet, Reflector.RenderShulkerBullet_model, modelBase);
        rendershulkerbullet.shadowSize = shadowSize;
        return rendershulkerbullet;
    }
}
 
Example 32
Project: Backmemed   File: ModelAdapterEvoker.java   Source Code and License 6 votes vote down vote up
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize)
{
    RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
    RenderEvoker renderevoker = new RenderEvoker(rendermanager);
    renderevoker.mainModel = modelBase;
    renderevoker.shadowSize = shadowSize;
    return renderevoker;
}
 
Example 33
Project: Proyecto-DASI   File: ClientStateMachine.java   Source Code and License 6 votes vote down vote up
@Override
public void onMessage(MalmoMessageType messageType, Map<String, String> data)
{
    if (messageType == MalmoMessageType.SERVER_TEXT)
    {
        String chat = data.get("chat");
        if (chat != null)
            Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(chat), 1);
        else
        {
            String text = data.get("text");
            ScreenHelper.TextCategory category = ScreenHelper.TextCategory.valueOf(data.get("category"));
            String strtime = data.get("displayTime");
            Integer time = (strtime != null) ? Integer.valueOf(strtime) : null;
            this.getScreenHelper().addFragment(text, category, time);
        }
    }
}
 
Example 34
Project: Backmemed   File: ModelAdapterSheep.java   Source Code and License 6 votes vote down vote up
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize)
{
    RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
    RenderSheep rendersheep = new RenderSheep(rendermanager);
    rendersheep.mainModel = modelBase;
    rendersheep.shadowSize = shadowSize;
    return rendersheep;
}
 
Example 35
Project: Proyecto-DASI   File: ScreenHelper.java   Source Code and License 6 votes vote down vote up
@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;
                    }
                }
            }
        }
    }
}
 
Example 36
Project: EMC   File: IWorld.java   Source Code and License 6 votes vote down vote up
public static IEntity getEntityFromName(String username) {
	for (Entity entity : Minecraft.getMinecraft().world.loadedEntityList) {
		if (entity instanceof EntityOtherPlayerMP) {
			EntityOtherPlayerMP player = (EntityOtherPlayerMP) entity;
			if (player.getName().toLowerCase().equals(username.toLowerCase())) {
				return new IEntity(player);
			}
		}
	}
	return null;
}
 
Example 37
Project: Torched   File: ProxyClient.java   Source Code and License 6 votes vote down vote up
@Override
public void preInitMod()
{
    super.preInitMod();

    iChunUtil.proxy.registerMinecraftKeyBind(Minecraft.getMinecraft().gameSettings.keyBindUseItem);

    Torched.eventHandlerClient = new EventHandlerClient();
    MinecraftForge.EVENT_BUS.register(Torched.eventHandlerClient);

    RenderingRegistry.registerEntityRenderingHandler(EntityTorch.class, new RenderTorch.RenderFactory());
    RenderingRegistry.registerEntityRenderingHandler(EntityTorchFirework.class, new RenderTorchFirework.RenderFactory());
}
 
Example 38
Project: HardcoreRevival   File: ClientProxy.java   Source Code and License 5 votes vote down vote up
@SubscribeEvent
public void onOpenGui(GuiOpenEvent event) {
	Minecraft mc = Minecraft.getMinecraft();
	if (mc.player != null) {
		if (event.getGui() instanceof GuiGameOver && isKnockedOut && !acceptedDeath) { // Minor hack: isKnockedOut is always set AFTER the game over screen pops up, so we can abuse that here
			event.setGui(null);
		} else if (isKnockedOut && event.getGui() instanceof GuiInventory) {
			event.setGui(null);
		}
	}
}
 
Example 39
Project: pnc-repressurized   File: RenderSearchItemBlock.java   Source Code and License 5 votes vote down vote up
public static void renderSearch(double x, double y, double z, int itemCount, int totalCount) {
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    GL11.glColor4d(0, 1, 0, 0.5D);
    GL11.glRotatef(180.0F - Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(180.0F - Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
    // GL11.glLineWidth(1.0F);
    double ratio = (double) itemCount / totalCount;
    double diff = (1 - ratio) / 1.5D;
    double size = 1 - diff;
    /*
    for(double i = size; i > 0; i -= 0.06D) {
        GL11.glPushMatrix();
        GL11.glScaled(i, i, i);
        renderCircle();
        GL11.glPopMatrix();
    }
    */
    BufferBuilder wr = Tessellator.getInstance().getBuffer();
    wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    wr.pos(-size, size, 0).tex(0, 1).endVertex();
    wr.pos(-size, -size, 0).tex(0, 0).endVertex();
    wr.pos(size, -size, 0).tex(1, 0).endVertex();
    wr.pos(size, size, 0).tex(1, 1).endVertex();

    Tessellator.getInstance().draw();

    GL11.glPopMatrix();
}
 
Example 40
Project: CustomWorldGen   File: GuiConnecting.java   Source Code and License 5 votes vote down vote up
public GuiConnecting(GuiScreen parent, Minecraft mcIn, String hostName, int port)
{
    this.mc = mcIn;
    this.previousGuiScreen = parent;
    mcIn.loadWorld((WorldClient)null);
    this.connect(hostName, port);
}
 
Example 41
Project: FoodCraft-Reloaded   File: LiqueurLoader.java   Source Code and License 5 votes vote down vote up
@Load(side = Side.CLIENT, value = LoaderState.POSTINITIALIZATION)
@SideOnly(Side.CLIENT)
public void loadColors() {
    try {
        Field field = ItemColors.class.getDeclaredField("itemColorMap");
        field.setAccessible(true);
        Map<IRegistryDelegate<Item>, IItemColor> itemColorMap = (Map<IRegistryDelegate<Item>, IItemColor>) field.get(Minecraft.getMinecraft().getItemColors());
        cachedLiqueurs.forEach(liqueur -> itemColorMap.entrySet().stream().filter(entry -> entry.getKey().get().equals(liqueur)).forEach(entry -> Minecraft.getMinecraft().getItemColors().registerItemColorHandler(entry.getValue(), entry.getKey().get())));
    } catch (Exception e) {
        FoodCraftReloaded.getLogger().error("Cannot get custom mesh definitions", e);
    }
}
 
Example 42
Project: Minecoprocessors   File: MessageProcessorUpdate.java   Source Code and License 5 votes vote down vote up
@Override
public IMessage onMessage(final MessageProcessorUpdate message, MessageContext ctx) {

  if (message.processorData == null || message.processorData == null) {
    return null;
  }

  IThreadListener mainThread = Minecraft.getMinecraft();

  mainThread.addScheduledTask(new Runnable() {
    @Override
    public void run() {
      if (GuiMinecoprocessor.INSTANCE == null) {
        return;
      }

      if (!GuiMinecoprocessor.INSTANCE.getPos().equals(message.pos)) {
        Minecoprocessors.NETWORK.sendToServer(new MessageEnableGuiUpdates(message.pos, false));
        return;
      }

      GuiMinecoprocessor.INSTANCE.updateData(message.processorData, message.name);
    }
  });

  return null;
}
 
Example 43
Project: OpenFlexiTrack   File: OFTRegistryClient.java   Source Code and License 5 votes vote down vote up
/**
 * Called during Forge's main initialisation stage to register item models.
 */
public static void init(){
	ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
	mesher.register(OFTRegistry.ties, 0, new ModelResourceLocation(OFT.MODID + ":" + "ties", "inventory"));
	mesher.register(OFTRegistry.rails, 0, new ModelResourceLocation(OFT.MODID + ":" + "rails", "inventory"));
	mesher.register(OFTRegistry.track, 0, new ModelResourceLocation(OFT.MODID + ":" + "track", "inventory"));
	mesher.register(Item.getItemFromBlock(OFTRegistry.surveyFlag), 0, new ModelResourceLocation(OFT.MODID + ":" + "surveyflag", "inventory"));
}
 
Example 44
Project: AuthlibLoginHelper   File: AuthlibLoginHelperGui.java   Source Code and License 5 votes vote down vote up
public AuthlibLoginHelperGui(GuiConnecting parent, Minecraft minecraft, String username)
{
    this.mc = minecraft;
    this.parent = parent;
    this.previousUsername = username;
    this.futureUsernamePassword = SettableFuture.create();
}
 
Example 45
Project: Backmemed   File: BannerTextures.java   Source Code and License 5 votes vote down vote up
@Nullable
public ResourceLocation getResourceLocation(String id, List<BannerPattern> patternList, List<EnumDyeColor> colorList)
{
    if (id.isEmpty())
    {
        return null;
    }
    else
    {
        id = this.cacheId + id;
        BannerTextures.CacheEntry bannertextures$cacheentry = (BannerTextures.CacheEntry)this.cacheMap.get(id);

        if (bannertextures$cacheentry == null)
        {
            if (this.cacheMap.size() >= 256 && !this.freeCacheSlot())
            {
                return BannerTextures.BANNER_BASE_TEXTURE;
            }

            List<String> list = Lists.<String>newArrayList();

            for (BannerPattern bannerpattern : patternList)
            {
                list.add(this.cacheResourceBase + bannerpattern.func_190997_a() + ".png");
            }

            bannertextures$cacheentry = new BannerTextures.CacheEntry();
            bannertextures$cacheentry.textureLocation = new ResourceLocation(id);
            Minecraft.getMinecraft().getTextureManager().loadTexture(bannertextures$cacheentry.textureLocation, new LayeredColorMaskTexture(this.cacheResourceLocation, list, colorList));
            this.cacheMap.put(id, bannertextures$cacheentry);
        }

        bannertextures$cacheentry.lastUseMillis = System.currentTimeMillis();
        return bannertextures$cacheentry.textureLocation;
    }
}
 
Example 46
Project: Backmemed   File: GuiHopper.java   Source Code and License 5 votes vote down vote up
public GuiHopper(InventoryPlayer playerInv, IInventory hopperInv)
{
    super(new ContainerHopper(playerInv, hopperInv, Minecraft.getMinecraft().player));
    this.playerInventory = playerInv;
    this.hopperInventory = hopperInv;
    this.allowUserInput = false;
    this.ySize = 133;
}
 
Example 47
Project: BaseClient   File: GuiInventory.java   Source Code and License 5 votes vote down vote up
/**
 * Draws the entity to the screen. Args: xPos, yPos, scale, mouseX, mouseY, entityLiving
 */
public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent)
{
    GlStateManager.enableColorMaterial();
    GlStateManager.pushMatrix();
    GlStateManager.translate((float)posX, (float)posY, 50.0F);
    GlStateManager.scale((float)(-scale), (float)scale, (float)scale);
    GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
    float f = ent.renderYawOffset;
    float f1 = ent.rotationYaw;
    float f2 = ent.rotationPitch;
    float f3 = ent.prevRotationYawHead;
    float f4 = ent.rotationYawHead;
    GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F);
    RenderHelper.enableStandardItemLighting();
    GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
    ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F;
    ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F;
    ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F;
    ent.rotationYawHead = ent.rotationYaw;
    ent.prevRotationYawHead = ent.rotationYaw;
    GlStateManager.translate(0.0F, 0.0F, 0.0F);
    RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
    rendermanager.setPlayerViewY(180.0F);
    rendermanager.setRenderShadow(false);
    rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
    rendermanager.setRenderShadow(true);
    ent.renderYawOffset = f;
    ent.rotationYaw = f1;
    ent.rotationPitch = f2;
    ent.prevRotationYawHead = f3;
    ent.rotationYawHead = f4;
    GlStateManager.popMatrix();
    RenderHelper.disableStandardItemLighting();
    GlStateManager.disableRescaleNormal();
    GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    GlStateManager.disableTexture2D();
    GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
}
 
Example 48
Project: Backmemed   File: ThreadDownloadImageData.java   Source Code and License 5 votes vote down vote up
private boolean shouldPipeline()
{
    if (!this.pipeline)
    {
        return false;
    }
    else
    {
        Proxy proxy = Minecraft.getMinecraft().getProxy();
        return proxy.type() != Type.DIRECT && proxy.type() != Type.SOCKS ? false : this.imageUrl.startsWith("http://");
    }
}
 
Example 49
Project: UHC-Compass   File: KeyHandler.java   Source Code and License 5 votes vote down vote up
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event){
    if(keys[MOVECOMPASS].isPressed()){
        Minecraft.getMinecraft().displayGuiScreen(new GuiCompassMoving());
    }
    if(keys[QUICKCOORDS].isPressed()){
        Minecraft.getMinecraft().displayGuiScreen(new GuiCoords());
    }
}
 
Example 50
Project: CustomWorldGen   File: NetworkPlayerInfo.java   Source Code and License 5 votes vote down vote up
protected void loadPlayerTextures()
{
    synchronized (this)
    {
        if (!this.playerTexturesLoaded)
        {
            this.playerTexturesLoaded = true;
            Minecraft.getMinecraft().getSkinManager().loadProfileTextures(this.gameProfile, new SkinManager.SkinAvailableCallback()
            {
                public void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture)
                {
                    switch (typeIn)
                    {
                        case SKIN:
                            NetworkPlayerInfo.this.playerTextures.put(Type.SKIN, location);
                            NetworkPlayerInfo.this.skinType = profileTexture.getMetadata("model");

                            if (NetworkPlayerInfo.this.skinType == null)
                            {
                                NetworkPlayerInfo.this.skinType = "default";
                            }

                            break;
                        case CAPE:
                            NetworkPlayerInfo.this.playerTextures.put(Type.CAPE, location);
                            break;
                        case ELYTRA:
                            NetworkPlayerInfo.this.playerTextures.put(Type.ELYTRA, location);
                    }
                }
            }, true);
        }
    }
}
 
Example 51
Project: Bewitchment   File: TileRenderCauldron.java   Source Code and License 5 votes vote down vote up
private void renderWater(ResourceLocation loc) {
	final TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(loc.toString());
	final Tessellator tessellator = Tessellator.getInstance();
	tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
	tessellator.getBuffer().pos(0, 16, 0).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
	tessellator.getBuffer().pos(16, 16, 0).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
	tessellator.getBuffer().pos(16, 0, 0).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
	tessellator.getBuffer().pos(0, 0, 0).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
	tessellator.draw();
}
 
Example 52
Project: Backmemed   File: RenderItemFrame.java   Source Code and License 5 votes vote down vote up
protected void renderName(EntityItemFrame entity, double x, double y, double z)
{
    if (Minecraft.isGuiEnabled() && !entity.getDisplayedItem().func_190926_b() && entity.getDisplayedItem().hasDisplayName() && this.renderManager.pointedEntity == entity)
    {
        double d0 = entity.getDistanceSqToEntity(this.renderManager.renderViewEntity);
        float f = entity.isSneaking() ? 32.0F : 64.0F;

        if (d0 < (double)(f * f))
        {
            String s = entity.getDisplayedItem().getDisplayName();
            this.renderLivingLabel(entity, s, x, y, z, 64);
        }
    }
}
 
Example 53
Project: RunicArcana   File: GuiChalk.java   Source Code and License 4 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    int xStart = (width-guiWidth)/30;
    int yStart = (int)((height-guiHeight)*0.95);
    drawTexturedModalRect(xStart,yStart,0,0,guiWidth,guiHeight);

    super.drawScreen(mouseX, mouseY, partialTicks);
    for(GuiButton but: buttonList)
    {
        if(mouseX>but.xPosition&&mouseX<but.xPosition+but.width&&mouseY>but.yPosition&&mouseY<but.yPosition+but.height)
        {
            List<String> text = new ArrayList<String>();

            if(but.id<0)
            {
                text.add((String)ModDust.CategoryNames.get(-(but.id+1)));
            }
            else {
                for (LinkedList<IDustSymbol> category : ModDust.dustRegistry) {
                    for (IDustSymbol dust : category) {
                        if (dust.getDustID() == but.id) {
                            text.add(dust.getDisplayName().getUnformattedText());
                            if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
                                //TODO: symbol descriptions
                            }
                        }
                    }
                }
            }


            drawHoveringText(text,mouseX,mouseY);
        }
    }





}
 
Example 54
Project: Polearms   File: EventHandler.java   Source Code and License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(MouseEvent event)
{
    if (event.getButton() == 0 && event.isButtonstate())
    {
        Minecraft mc = Minecraft.getMinecraft();
        EntityPlayer thePlayer = mc.thePlayer;
        if (thePlayer != null)
        {
            ItemStack itemstack = thePlayer.getHeldItemMainhand();
            IExtendedReach ieri;
            if (itemstack != null)
            {
                if (itemstack.getItem() instanceof IExtendedReach)
                {
                    ieri = (IExtendedReach) itemstack.getItem();
                } else
                {
                    ieri = null;
                }

                if (ieri != null)
                {
                    float reach = ieri.getReach();
                    RayTraceResult mov = getMouseOverExtended(reach);

                    if (mov != null)
                    {
                        if (mov.entityHit != null && mov.entityHit.hurtResistantTime == 0)
                        {
                            if (mov.entityHit != thePlayer )
                            {
                                Polearms.network.sendToServer(new MessageExtendedReachAttack(
                                        mov.entityHit.getEntityId()));
                            }
                        }
                    }
                }
            }
        }
    }
}
 
Example 55
Project: Metalworks   File: ItemDust.java   Source Code and License 4 votes vote down vote up
@Override
public void registerColorHandler(ItemColors itemColors) {
    Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> this.color, this);
}
 
Example 56
Project: ArcaneMagic   File: RenderEntityItemFancy.java   Source Code and License 4 votes vote down vote up
public RenderEntityItemFancy(RenderManager renderManager)
{
	super(renderManager, Minecraft.getMinecraft().getRenderItem());

}
 
Example 57
Project: GeneralLaymansAestheticSpyingScreen   File: EventHandlerClient.java   Source Code and License 4 votes vote down vote up
public TerminalPlacement getTerminalPlacement(String channel) //this is called in render, only from active bases.
{
    if(!terminalPlacementCreationTimeout.containsKey(channel))
    {
        if(terminalPlacements.containsKey(channel))
        {
            return terminalPlacements.get(channel);
        }
        if(terminalLocations.containsKey(channel))
        {
            Minecraft mc = Minecraft.getMinecraft();
            TileEntity te = mc.world.getTileEntity(terminalLocations.get(channel));
            if(te instanceof TileEntityGlassTerminal)
            {
                TileEntityGlassTerminal terminal = (TileEntityGlassTerminal)te;

                //we have the terminal. now find the projector
                TileEntityGlassMaster master = null;
                HashSet<TileEntityGlassBase> activeGlasses = activeGLASS.get(channel);
                for(TileEntityGlassBase base : activeGlasses)
                {
                    if(base.active && base.distance == 1 && base.channel.equalsIgnoreCase(channel) && base instanceof TileEntityGlassMaster)
                    {
                        master = (TileEntityGlassMaster)base;
                        break;
                    }
                }

                if(master != null) //we have the projector. Now generate the terminal placement
                {
                    TerminalPlacement placement = new TerminalPlacement(mc.world, master, terminal, getActiveGlass(channel));
                    terminalPlacements.put(channel, placement);
                    return placement;
                }
            }
            else
            {
                terminalLocations.remove(channel);
            }
        }

        terminalPlacementCreationTimeout.put(channel, 13); //13 tick wait before trying again.
    }
    return null;
}
 
Example 58
Project: BaseClient   File: Realms.java   Source Code and License 4 votes vote down vote up
public static Proxy getProxy()
{
    return Minecraft.getMinecraft().getProxy();
}
 
Example 59
Project: EMC   File: IEntityPlayer.java   Source Code and License 4 votes vote down vote up
public static float getFallDistance() {
	if (isNull()) {
		return 0;
	}
	return Minecraft.getMinecraft().player.fallDistance;
}
 
Example 60
Project: flex-fov   File: RenderMethod.java   Source Code and License 4 votes vote down vote up
/**
 * Render the world.
 * Called between {@link net.minecraft.client.renderer.EntityRenderer#renderWorld(float, long) renderWorld}
 * and {@link net.minecraft.client.renderer.EntityRenderer#renderWorldPass(int, float, long) renderWorldPass}
 */
public void renderWorld(EntityRenderer er, Minecraft mc, Framebuffer framebuffer, Shader shader,
		int[] framebufferTextures, float partialTicks, long finishTimeNano, int width, int height, float sizeIncrease) {
	//save the players state
	player = mc.getRenderViewEntity();
	yaw = player.rotationYaw;
	pitch = player.rotationPitch;
	prevYaw = player.prevRotationYaw;
	prevPitch = player.prevRotationPitch;

	//clear the primary framebuffer
	mc.getFramebuffer().framebufferClear();
	//clear the secondary framebuffer
	framebuffer.framebufferClear();
	//bind the secondary framebuffer
	framebuffer.bindFramebuffer(false);

	//displayWidth and displayHeight are called during world rendering
	//set them to the secondary framebuffer dimensions
	mc.displayWidth = (int)(height*sizeIncrease);
	mc.displayHeight = (int)(height*sizeIncrease); //Must be square

	RenderUtil.partialWidth = mc.displayWidth; //TODO is this even needed?
	RenderUtil.partialHeight = mc.displayHeight; //TODO remove

	RenderUtil.render360 = true;

	Globe globe = globes[globeIndex];
	for (int i=0; i<globe.getCount(); i++) {
		// set camera/player rotation state (read by hooks at the correct moment)
		coordFrame = globe.getCoordFrame(i);
		playerFov = globe.getFov(i);

		// the forward vector is the opposite direction of the z-axis
		float x = -coordFrame.get(2);
		float y = -coordFrame.get(6);
		float z = -coordFrame.get(10);

		// calculate the delta yaw/pitch to point the player
		float lon = (float)Math.atan2(x, -z);
		float lat = (float)Math.atan2(y, Math.sqrt(x*x+z*z));
		playerDeltaYaw = lon;
		playerDeltaPitch = lat;

		// render to texture
		OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, framebufferTextures[i], 0);
		GlStateManager.bindTexture(0);
		er.renderWorldPass(2, partialTicks, finishTimeNano);

		// reset player view
		player.rotationYaw = yaw;
		player.rotationPitch = pitch;
		player.prevRotationYaw = prevYaw;
		player.prevRotationPitch = prevPitch;
	}

	//reset displayWidth and displayHeight to the primary framebuffer dimensions
	mc.displayWidth = width;
	mc.displayHeight = height;

	//reset viewport to full screen
	GlStateManager.viewport(0, 0, width, height);
	//bind primary framebuffer
	mc.getFramebuffer().bindFramebuffer(false);

	if (!getResizeGui() || mc.gameSettings.hideGUI) {
		GL20.glUseProgram(shader.getShaderProgram());
		int cursorUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "drawCursor");
		GL20.glUniform1i(cursorUniform, 0);
		runShader(mc, shader, framebufferTextures);
	}
}