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   View source code 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: DecompiledMinecraft   File: ChunkRenderWorker.java   View source code 7 votes vote down vote up
public void run()
{
    while (true)
    {
        try
        {
            this.processTask(this.chunkRenderDispatcher.getNextChunkUpdate());
        }
        catch (InterruptedException var3)
        {
            LOGGER.debug("Stopping due to interrupt");
            return;
        }
        catch (Throwable throwable)
        {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Batching chunks");
            Minecraft.getMinecraft().crashed(Minecraft.getMinecraft().addGraphicsAndWorldToCrashReport(crashreport));
            return;
        }
    }
}
 
Example 3
Project: rezolve   File: SecurityServerEntity.java   View source code 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 4
Project: Backmemed   File: ShadersTex.java   View source code 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 5
Project: Proyecto-DASI   File: AbsoluteMovementCommandsImplementation.java   View source code 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 6
Project: Proyecto-DASI   File: MalmoModClient.java   View source code 7 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 7
Project: MineCamera   File: EventLoader.java   View source code 7 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 8
Project: Proyecto-DASI   File: ClientStateMachine.java   View source code 7 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 9
Project: BaseClient   File: ShadersTex.java   View source code 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 10
Project: needtobreath   File: NTBOverlayRenderer.java   View source code 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 11
Project: Backmemed   File: TileEntityRendererDispatcher.java   View source code 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 12
Project: Backmemed   File: GuiScreenOptionsSounds.java   View source code 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 13
Project: BaseClient   File: EntityPlayer.java   View source code 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 14
Project: Backmemed   File: RenderUtils.java   View source code 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 15
Project: Machines-and-Stuff   File: RenderAccumulator.java   View source code 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 16
Project: Backmemed   File: PlayerConfigurationParser.java   View source code 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 17
Project: Backmemed   File: ModelAdapterWither.java   View source code 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 18
Project: Adventurers-Toolbox   File: SwordModel.java   View source code 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 19
Project: Proyecto-DASI   File: ClientStateMachine.java   View source code 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 20
Project: betaexpansion   File: NetClientHandler.java   View source code 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 21
Project: Mods   File: TF2EventsClient.java   View source code 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 22
Project: BaseClient   File: GuiResourcePackList.java   View source code 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 23
Project: PurificatiMagicae   File: CPacketSpawnParticle.java   View source code 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 24
Project: Proyecto-DASI   File: CommandForWheeledRobotNavigationImplementation.java   View source code 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 25
Project: Visualize   File: GuiNewOptionsRowList.java   View source code 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 26
Project: TextDisplayer   File: ModernTextBox.java   View source code 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 27
Project: betaexpansion   File: ThreadConnectToServer.java   View source code 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 28
Project: harshencastle   File: HandlerExtraRange.java   View source code 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 29
Project: FirstAid   File: MessageReceiveDamage.java   View source code 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 30
Project: PurificatiMagicae   File: GuiTranslationDeskPanel.java   View source code 6 votes vote down vote up
public void minRate()
{
    if (rate > 0)
    {
        rate -= 2;
    }
    Minecraft.getMinecraft().player.playSound(SoundRegistry.ERROR, 1, 1);
}
 
Example 31
Project: BaseClient   File: AutoPot.java   View source code 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 32
Project: MineCamera   File: EventLoader.java   View source code 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 33
Project: Backmemed   File: ModelAdapterShulkerBullet.java   View source code 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 34
Project: Backmemed   File: ModelAdapterEvoker.java   View source code 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 35
Project: DecompiledMinecraft   File: IntegratedServer.java   View source code 6 votes vote down vote up
public IntegratedServer(Minecraft mcIn, String folderName, String worldName, WorldSettings settings)
{
    super(new File(mcIn.mcDataDir, "saves"), mcIn.getProxy(), new File(mcIn.mcDataDir, USER_CACHE_FILE.getName()));
    this.setServerOwner(mcIn.getSession().getUsername());
    this.setFolderName(folderName);
    this.setWorldName(worldName);
    this.setDemo(mcIn.isDemo());
    this.canCreateBonusChest(settings.isBonusChestEnabled());
    this.setBuildLimit(256);
    this.setConfigManager(new IntegratedPlayerList(this));
    this.mc = mcIn;
    this.theWorldSettings = this.isDemo() ? DemoWorldServer.demoWorldSettings : settings;
}
 
Example 36
Project: Backmemed   File: ModelAdapterSheep.java   View source code 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 37
Project: Proyecto-DASI   File: ScreenHelper.java   View source code 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 38
Project: EMC   File: IWorld.java   View source code 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 39
Project: Torched   File: ProxyClient.java   View source code 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 40
Project: HardcoreRevival   File: ClientProxy.java   View source code 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);
		}
	}
}