Java Code Examples for net.minecraft.init.Items.FILLED_MAP

The following are Jave code examples for showing how to use FILLED_MAP of the net.minecraft.init.Items class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Backmemed   File: RecipesMapExtending.java   View Source Code Vote up 6 votes
/**
 * Returns an Item that is the result of this recipe
 */
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    ItemStack itemstack = ItemStack.field_190927_a;

    for (int i = 0; i < inv.getSizeInventory() && itemstack.func_190926_b(); ++i)
    {
        ItemStack itemstack1 = inv.getStackInSlot(i);

        if (itemstack1.getItem() == Items.FILLED_MAP)
        {
            itemstack = itemstack1;
        }
    }

    itemstack = itemstack.copy();
    itemstack.func_190920_e(1);

    if (itemstack.getTagCompound() == null)
    {
        itemstack.setTagCompound(new NBTTagCompound());
    }

    itemstack.getTagCompound().setInteger("map_scale_direction", 1);
    return itemstack;
}
 
Example 2
Project: VillagerTrades   File: TradeHandlers.java   View Source Code Vote up 5 votes
@Override
		public ItemStack getSellingStack(ITradeList t)
		{
//			TreasureMapForEmeralds trade = (TreasureMapForEmeralds)t;
			ItemStack stack = new ItemStack(Items.FILLED_MAP, 1);
			return stack;
		}
 
Example 3
Project: Backmemed   File: EntityItemFrame.java   View Source Code Vote up 5 votes
/**
 * Removes the dot representing this frame's position from the map when the item frame is broken.
 */
private void removeFrameFromMap(ItemStack stack)
{
    if (!stack.func_190926_b())
    {
        if (stack.getItem() == Items.FILLED_MAP)
        {
            MapData mapdata = ((ItemMap)stack.getItem()).getMapData(stack, this.world);
            mapdata.mapDecorations.remove("frame-" + this.getEntityId());
        }

        stack.setItemFrame((EntityItemFrame)null);
    }
}
 
Example 4
Project: Backmemed   File: ItemMap.java   View Source Code Vote up 5 votes
public static ItemStack func_190906_a(World p_190906_0_, double p_190906_1_, double p_190906_3_, byte p_190906_5_, boolean p_190906_6_, boolean p_190906_7_)
{
    ItemStack itemstack = new ItemStack(Items.FILLED_MAP, 1, p_190906_0_.getUniqueDataId("map"));
    String s = "map_" + itemstack.getMetadata();
    MapData mapdata = new MapData(s);
    p_190906_0_.setItemData(s, mapdata);
    mapdata.scale = p_190906_5_;
    mapdata.calculateMapCenter(p_190906_1_, p_190906_3_, mapdata.scale);
    mapdata.dimension = (byte)p_190906_0_.provider.getDimensionType().getId();
    mapdata.trackingPosition = p_190906_6_;
    mapdata.field_191096_f = p_190906_7_;
    mapdata.markDirty();
    return itemstack;
}
 
Example 5
Project: Backmemed   File: RecipesMapExtending.java   View Source Code Vote up 5 votes
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    if (!super.matches(inv, worldIn))
    {
        return false;
    }
    else
    {
        ItemStack itemstack = ItemStack.field_190927_a;

        for (int i = 0; i < inv.getSizeInventory() && itemstack.func_190926_b(); ++i)
        {
            ItemStack itemstack1 = inv.getStackInSlot(i);

            if (itemstack1.getItem() == Items.FILLED_MAP)
            {
                itemstack = itemstack1;
            }
        }

        if (itemstack.func_190926_b())
        {
            return false;
        }
        else
        {
            MapData mapdata = Items.FILLED_MAP.getMapData(itemstack, worldIn);
            return mapdata == null ? false : (this.func_190934_a(mapdata) ? false : mapdata.scale < 4);
        }
    }
}
 
Example 6
Project: Backmemed   File: RecipesMapCloning.java   View Source Code Vote up 5 votes
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    int i = 0;
    ItemStack itemstack = ItemStack.field_190927_a;

    for (int j = 0; j < inv.getSizeInventory(); ++j)
    {
        ItemStack itemstack1 = inv.getStackInSlot(j);

        if (!itemstack1.func_190926_b())
        {
            if (itemstack1.getItem() == Items.FILLED_MAP)
            {
                if (!itemstack.func_190926_b())
                {
                    return false;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.MAP)
                {
                    return false;
                }

                ++i;
            }
        }
    }

    return !itemstack.func_190926_b() && i > 0;
}
 
Example 7
Project: CustomWorldGen   File: RecipesMapExtending.java   View Source Code Vote up 5 votes
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    if (!super.matches(inv, worldIn))
    {
        return false;
    }
    else
    {
        ItemStack itemstack = null;

        for (int i = 0; i < inv.getSizeInventory() && itemstack == null; ++i)
        {
            ItemStack itemstack1 = inv.getStackInSlot(i);

            if (itemstack1 != null && itemstack1.getItem() == Items.FILLED_MAP)
            {
                itemstack = itemstack1;
            }
        }

        if (itemstack == null)
        {
            return false;
        }
        else
        {
            MapData mapdata = Items.FILLED_MAP.getMapData(itemstack, worldIn);
            return mapdata == null ? false : mapdata.scale < 4;
        }
    }
}
 
Example 8
Project: CustomWorldGen   File: RecipesMapExtending.java   View Source Code Vote up 5 votes
/**
 * Returns an Item that is the result of this recipe
 */
@Nullable
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    ItemStack itemstack = null;

    for (int i = 0; i < inv.getSizeInventory() && itemstack == null; ++i)
    {
        ItemStack itemstack1 = inv.getStackInSlot(i);

        if (itemstack1 != null && itemstack1.getItem() == Items.FILLED_MAP)
        {
            itemstack = itemstack1;
        }
    }

    itemstack = itemstack.copy();
    itemstack.stackSize = 1;

    if (itemstack.getTagCompound() == null)
    {
        itemstack.setTagCompound(new NBTTagCompound());
    }

    itemstack.getTagCompound().setInteger("map_scale_direction", 1);
    return itemstack;
}
 
Example 9
Project: CustomWorldGen   File: RecipesMapCloning.java   View Source Code Vote up 5 votes
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    int i = 0;
    ItemStack itemstack = null;

    for (int j = 0; j < inv.getSizeInventory(); ++j)
    {
        ItemStack itemstack1 = inv.getStackInSlot(j);

        if (itemstack1 != null)
        {
            if (itemstack1.getItem() == Items.FILLED_MAP)
            {
                if (itemstack != null)
                {
                    return false;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.MAP)
                {
                    return false;
                }

                ++i;
            }
        }
    }

    return itemstack != null && i > 0;
}
 
Example 10
Project: CustomWorldGen   File: ItemEmptyMap.java   View Source Code Vote up 5 votes
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    ItemStack itemstack = new ItemStack(Items.FILLED_MAP, 1, worldIn.getUniqueDataId("map"));
    String s = "map_" + itemstack.getMetadata();
    MapData mapdata = new MapData(s);
    worldIn.setItemData(s, mapdata);
    mapdata.scale = 0;
    mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale);
    mapdata.dimension = worldIn.provider.getDimension();
    mapdata.trackingPosition = true;
    mapdata.markDirty();
    --itemStackIn.stackSize;

    if (itemStackIn.stackSize <= 0)
    {
        return new ActionResult(EnumActionResult.SUCCESS, itemstack);
    }
    else
    {
        if (!playerIn.inventory.addItemStackToInventory(itemstack.copy()))
        {
            playerIn.dropItem(itemstack, false);
        }

        playerIn.addStat(StatList.getObjectUseStats(this));
        return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
    }
}
 
Example 11
Project: Backmemed   File: RecipesMapExtending.java   View Source Code Vote up 4 votes
public RecipesMapExtending()
{
    super(3, 3, new ItemStack[] {new ItemStack(Items.PAPER), new ItemStack(Items.PAPER), new ItemStack(Items.PAPER), new ItemStack(Items.PAPER), new ItemStack(Items.FILLED_MAP, 1, 32767), new ItemStack(Items.PAPER), new ItemStack(Items.PAPER), new ItemStack(Items.PAPER), new ItemStack(Items.PAPER)}, new ItemStack(Items.MAP));
}
 
Example 12
Project: Backmemed   File: RecipesMapCloning.java   View Source Code Vote up 4 votes
/**
 * Returns an Item that is the result of this recipe
 */
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    int i = 0;
    ItemStack itemstack = ItemStack.field_190927_a;

    for (int j = 0; j < inv.getSizeInventory(); ++j)
    {
        ItemStack itemstack1 = inv.getStackInSlot(j);

        if (!itemstack1.func_190926_b())
        {
            if (itemstack1.getItem() == Items.FILLED_MAP)
            {
                if (!itemstack.func_190926_b())
                {
                    return ItemStack.field_190927_a;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.MAP)
                {
                    return ItemStack.field_190927_a;
                }

                ++i;
            }
        }
    }

    if (!itemstack.func_190926_b() && i >= 1)
    {
        ItemStack itemstack2 = new ItemStack(Items.FILLED_MAP, i + 1, itemstack.getMetadata());

        if (itemstack.hasDisplayName())
        {
            itemstack2.setStackDisplayName(itemstack.getDisplayName());
        }

        if (itemstack.hasTagCompound())
        {
            itemstack2.setTagCompound(itemstack.getTagCompound());
        }

        return itemstack2;
    }
    else
    {
        return ItemStack.field_190927_a;
    }
}
 
Example 13
Project: Backmemed   File: RenderItemFrame.java   View Source Code Vote up 4 votes
/**
 * Renders the desired {@code T} type Entity.
 */
public void doRender(EntityItemFrame entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.pushMatrix();
    BlockPos blockpos = entity.getHangingPosition();
    double d0 = (double)blockpos.getX() - entity.posX + x;
    double d1 = (double)blockpos.getY() - entity.posY + y;
    double d2 = (double)blockpos.getZ() - entity.posZ + z;
    GlStateManager.translate(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D);
    GlStateManager.rotate(180.0F - entity.rotationYaw, 0.0F, 1.0F, 0.0F);
    this.renderManager.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher();
    ModelManager modelmanager = blockrendererdispatcher.getBlockModelShapes().getModelManager();
    IBakedModel ibakedmodel;

    if (!entity.getDisplayedItem().func_190926_b() && entity.getDisplayedItem().getItem() == Items.FILLED_MAP)
    {
        ibakedmodel = modelmanager.getModel(this.mapModel);
    }
    else
    {
        ibakedmodel = modelmanager.getModel(this.itemFrameModel);
    }

    GlStateManager.pushMatrix();
    GlStateManager.translate(-0.5F, -0.5F, -0.5F);

    if (this.renderOutlines)
    {
        GlStateManager.enableColorMaterial();
        GlStateManager.enableOutlineMode(this.getTeamColor(entity));
    }

    blockrendererdispatcher.getBlockModelRenderer().renderModelBrightnessColor(ibakedmodel, 1.0F, 1.0F, 1.0F, 1.0F);

    if (this.renderOutlines)
    {
        GlStateManager.disableOutlineMode();
        GlStateManager.disableColorMaterial();
    }

    GlStateManager.popMatrix();
    GlStateManager.translate(0.0F, 0.0F, 0.4375F);
    this.renderItem(entity);
    GlStateManager.popMatrix();
    this.renderName(entity, x + (double)((float)entity.facingDirection.getFrontOffsetX() * 0.3F), y - 0.25D, z + (double)((float)entity.facingDirection.getFrontOffsetZ() * 0.3F));
}
 
Example 14
Project: CustomWorldGen   File: RecipesMapExtending.java   View Source Code Vote up 4 votes
public RecipesMapExtending()
{
    super(3, 3, new ItemStack[] {new ItemStack(Items.PAPER), new ItemStack(Items.PAPER), new ItemStack(Items.PAPER), new ItemStack(Items.PAPER), new ItemStack(Items.FILLED_MAP, 0, 32767), new ItemStack(Items.PAPER), new ItemStack(Items.PAPER), new ItemStack(Items.PAPER), new ItemStack(Items.PAPER)}, new ItemStack(Items.MAP, 0, 0));
}
 
Example 15
Project: CustomWorldGen   File: RecipesMapCloning.java   View Source Code Vote up 4 votes
/**
 * Returns an Item that is the result of this recipe
 */
@Nullable
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    int i = 0;
    ItemStack itemstack = null;

    for (int j = 0; j < inv.getSizeInventory(); ++j)
    {
        ItemStack itemstack1 = inv.getStackInSlot(j);

        if (itemstack1 != null)
        {
            if (itemstack1.getItem() == Items.FILLED_MAP)
            {
                if (itemstack != null)
                {
                    return null;
                }

                itemstack = itemstack1;
            }
            else
            {
                if (itemstack1.getItem() != Items.MAP)
                {
                    return null;
                }

                ++i;
            }
        }
    }

    if (itemstack != null && i >= 1)
    {
        ItemStack itemstack2 = new ItemStack(Items.FILLED_MAP, i + 1, itemstack.getMetadata());

        if (itemstack.hasDisplayName())
        {
            itemstack2.setStackDisplayName(itemstack.getDisplayName());
        }

        return itemstack2;
    }
    else
    {
        return null;
    }
}
 
Example 16
Project: CustomWorldGen   File: RenderItemFrame.java   View Source Code Vote up 4 votes
/**
 * Renders the desired {@code T} type Entity.
 */
public void doRender(EntityItemFrame entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.pushMatrix();
    BlockPos blockpos = entity.getHangingPosition();
    double d0 = (double)blockpos.getX() - entity.posX + x;
    double d1 = (double)blockpos.getY() - entity.posY + y;
    double d2 = (double)blockpos.getZ() - entity.posZ + z;
    GlStateManager.translate(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D);
    GlStateManager.rotate(180.0F - entity.rotationYaw, 0.0F, 1.0F, 0.0F);
    this.renderManager.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher();
    ModelManager modelmanager = blockrendererdispatcher.getBlockModelShapes().getModelManager();
    IBakedModel ibakedmodel;

    if (entity.getDisplayedItem() != null && entity.getDisplayedItem().getItem() == Items.FILLED_MAP)
    {
        ibakedmodel = modelmanager.getModel(this.mapModel);
    }
    else
    {
        ibakedmodel = modelmanager.getModel(this.itemFrameModel);
    }

    GlStateManager.pushMatrix();
    GlStateManager.translate(-0.5F, -0.5F, -0.5F);

    if (this.renderOutlines)
    {
        GlStateManager.enableColorMaterial();
        GlStateManager.enableOutlineMode(this.getTeamColor(entity));
    }

    blockrendererdispatcher.getBlockModelRenderer().renderModelBrightnessColor(ibakedmodel, 1.0F, 1.0F, 1.0F, 1.0F);

    if (this.renderOutlines)
    {
        GlStateManager.disableOutlineMode();
        GlStateManager.disableColorMaterial();
    }

    GlStateManager.popMatrix();
    GlStateManager.translate(0.0F, 0.0F, 0.4375F);
    this.renderItem(entity);
    GlStateManager.popMatrix();
    this.renderName(entity, x + (double)((float)entity.facingDirection.getFrontOffsetX() * 0.3F), y - 0.25D, z + (double)((float)entity.facingDirection.getFrontOffsetZ() * 0.3F));
}