Tabnine Logo
MapData
Code IndexAdd Tabnine to your IDE (free)

How to use
MapData
in
net.minecraft.world.storage

Best Java code snippets using net.minecraft.world.storage.MapData (Showing top 11 results out of 315)

origin: vadis365/TheErebus

public static ItemStack setupNewMap(World worldIn, double worldX, double worldZ, byte scale, boolean trackingPosition, boolean unlimitedTracking)
{
  ItemStack itemstack = new ItemStack(ModItems.EREBUS_MAP_FILLED, 1, worldIn.getUniqueDataId("map"));
  String s = "map_" + itemstack.getMetadata();
  MapData mapdata = new MapData(s);
  worldIn.setData(s, mapdata);
  mapdata.scale = scale;
  mapdata.calculateMapCenter(worldX, worldZ, mapdata.scale);
  mapdata.dimension = worldIn.provider.getDimension();
  mapdata.trackingPosition = trackingPosition;
  mapdata.unlimitedTracking = unlimitedTracking;
  mapdata.markDirty();
  return itemstack;
}
origin: vadis365/TheErebus

@Nullable
public Packet<?> createMapDataPacket(ItemStack stack, World worldIn, EntityPlayer player)
{
  return this.getMapData(stack, worldIn).getMapPacket(stack, worldIn, player);
}
origin: vadis365/TheErebus

protected static void enableMapTracking(ItemStack p_185064_0_, World p_185064_1_)
{
  MapData mapdata = ((ItemErebusMap) ModItems.EREBUS_MAP_FILLED).getMapData(p_185064_0_, p_185064_1_);
  p_185064_0_.setItemDamage(p_185064_1_.getUniqueDataId("map"));
  MapData mapdata1 = new MapData("map_" + p_185064_0_.getMetadata());
  mapdata1.trackingPosition = true;
  if (mapdata != null)
  {
    mapdata1.xCenter = mapdata.xCenter;
    mapdata1.zCenter = mapdata.zCenter;
    mapdata1.scale = mapdata.scale;
    mapdata1.dimension = mapdata.dimension;
    mapdata1.markDirty();
    p_185064_1_.setData("map_" + p_185064_0_.getMetadata(), mapdata1);
  }
}
origin: Vazkii/Quark

MapData mapdata = new MapData(s);
world.setData(s, mapdata);
mapdata.scale = 1;
mapdata.unlimitedTracking = true;
ItemMap.renderBiomePreviewMap(world, itemstack);
mapdata.addTargetDecoration(itemstack, treasurePos, "x", Type.TARGET_X);
mapdata.markDirty();
origin: Vazkii/Quark

public static ItemStack createMap(World world, BlockPos pos, TradeInfo info) {
  BlockPos biomePos = BiomeLocator.spiralOutwardsLookingForBiome(world, info.biome, pos.getX(), pos.getZ());
  if(biomePos == null)
    return ItemStack.EMPTY;
  
  int id = world.getUniqueDataId("map");
  ItemStack stack = new ItemStack(Items.FILLED_MAP, 1, id);
  stack.setTranslatableName(info.name);
  NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, "display", false);
  cmp.setInteger("MapColor", info.color);
  ItemNBTHelper.setCompound(stack, "display", cmp);
  String s = "map_" + id;
  MapData mapdata = new MapData(s);
  world.setData(s, mapdata);
  mapdata.scale = 2;
  mapdata.xCenter = biomePos.getX() + (int) ((Math.random() - 0.5) * 200);
  mapdata.zCenter = biomePos.getZ() + (int) ((Math.random() - 0.5) * 200);
  mapdata.dimension = 0;
  mapdata.trackingPosition = true;
  mapdata.unlimitedTracking = true;
  ItemMap.renderBiomePreviewMap(world, stack);
  MapData.addTargetDecoration(stack, biomePos, "+", Type.TARGET_X);
  return stack;
}
origin: Vazkii/Quark

public static void addMarker(ItemStack stack, EntityPlayer player) {
  if(stack.getItem() == Items.FILLED_MAP) {
    MapData data = ((ItemMap) Items.FILLED_MAP).getMapData(stack, player.world);
    
    if(data != null)
      data.addTargetDecoration(stack, player.getPosition(), "Pin" + player.getPosition().hashCode(), Type.TARGET_X);
  }
}

origin: vadis365/TheErebus

data.updateMapData(xPixel, zPixel);
origin: TeamLapen/Vampirism

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
  World w = getCommandSenderAsPlayer(sender).getEntityWorld();
  VampirismWorldData worldData = VampirismWorldData.get(w);
  BlockPos dungeonPos = worldData.getRandomVampireDungeon(getCommandSenderAsPlayer(sender).getRNG());
  ItemStack itemstack = ItemMap.setupNewMap(w, (double) dungeonPos.getX(), (double) dungeonPos.getZ(), (byte) 2, true, true);
  ItemMap.renderBiomePreviewMap(w, itemstack);
  MapData.addTargetDecoration(itemstack, dungeonPos, "+", MapDecoration.Type.TARGET_X);
  getCommandSenderAsPlayer(sender).dropItem(itemstack, false);
}
origin: vadis365/TheErebus

protected static void scaleMap(ItemStack p_185063_0_, World p_185063_1_, int p_185063_2_)
{
  MapData mapdata = ((ItemErebusMap) ModItems.EREBUS_MAP_FILLED).getMapData(p_185063_0_, p_185063_1_);
  p_185063_0_.setItemDamage(p_185063_1_.getUniqueDataId("map"));
  MapData mapdata1 = new MapData("map_" + p_185063_0_.getMetadata());
  if (mapdata != null)
  {
    mapdata1.scale = (byte)MathHelper.clamp(mapdata.scale + p_185063_2_, 0, 4);
    mapdata1.trackingPosition = mapdata.trackingPosition;
    mapdata1.calculateMapCenter((double)mapdata.xCenter, (double)mapdata.zCenter, mapdata1.scale);
    mapdata1.dimension = mapdata.dimension;
    mapdata1.markDirty();
    p_185063_1_.setData("map_" + p_185063_0_.getMetadata(), mapdata1);
  }
}
origin: JurassiCraftTeam/JurassiCraft2

public static void init() {
  ResourceLocation location = new ResourceLocation("minecraft", "librarian");
  VillagerRegistry.VillagerProfession profession = ForgeRegistries.VILLAGER_PROFESSIONS.getValue(location);
  if(!profession.getRegistryName().equals(location)) {
    JurassiCraft.getLogger().error("Could not find librarian profession");
  } else {
    VillagerRegistry.VillagerCareer career = profession.getCareer(1);
    if(career.getName().equals("cartographer")) {
      career.addTrade(4, (merchant, recipeList, random) -> {
        if(StructureUtils.getStructureData().isVisitorCenter()) {
          World world = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(0);
          BlockPos blockpos = MapUtils.getVisitorCenterPosition();
          ItemStack itemstack = ItemMap.setupNewMap(world, blockpos.getX(), blockpos.getZ(), (byte)2, true, true);
          ItemMap.renderBiomePreviewMap(world, itemstack);
          MapData.addTargetDecoration(itemstack, blockpos, "+", MapDecoration.Type.MANSION);
          itemstack.setTranslatableName("filled_map.jurassicraft.visitorcenter");
          recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, random.nextInt(12) + 16), new ItemStack(Items.COMPASS), itemstack));
        }
      });
      JurassiCraft.getLogger().info("Successfully registered maps trade");
    } else {
      JurassiCraft.getLogger().error("Could not find cartographer maps career");
    }
  }
}
origin: vadis365/TheErebus

@Nullable
public MapData getMapData(ItemStack stack, World worldIn)
{
  String s = "map_" + stack.getMetadata();
  MapData mapdata = (MapData)worldIn.loadData(MapData.class, s);
  if (mapdata == null && !worldIn.isRemote)
  {
    stack.setItemDamage(worldIn.getUniqueDataId("map"));
    s = "map_" + stack.getMetadata();
    mapdata = new MapData(s);
    mapdata.scale = 3;
    mapdata.calculateMapCenter((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale);
    mapdata.dimension = worldIn.provider.getDimension();
    mapdata.markDirty();
    worldIn.setData(s, mapdata);
  }
  return mapdata;
}
net.minecraft.world.storageMapData

Most used methods

  • addTargetDecoration
  • <init>
  • markDirty
  • calculateMapCenter
  • getMapPacket
  • updateMapData

Popular in Java

  • Parsing JSON documents to java classes using gson
  • runOnUiThread (Activity)
  • getSharedPreferences (Context)
  • startActivity (Activity)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now