@Override protected void process(EntityPlayer player, Side side) { AtlasData atlasData = AntiqueAtlasMod.atlasData.getAtlasData(atlasID, player.world); DimensionData dimData = atlasData.getDimensionData(dimension); for (TileGroup t : tileGroups) { dimData.putTileGroup(t); } } }
/** Returns the Tile previously set at given coordinates. */ private Tile removeTile(int dimension, int x, int y) { DimensionData dimData = getDimensionData(dimension); return dimData.removeTile(x, y); }
/** Puts a given tile into given map at specified coordinates and, * if tileStitcher is present, sets appropriate sectors on adjacent tiles. */ public void setTile(int dimension, int x, int y, Tile tile) { DimensionData dimData = getDimensionData(dimension); dimData.setTile(x, y, tile); }
public void loadSavedBrowsingPosition() { // Apply zoom first, because browsing position depends on it: setMapScale(biomeData.getBrowsingZoom()); mapOffsetX = biomeData.getBrowsingX(); mapOffsetY = biomeData.getBrowsingY(); isDragging = false; }
@Override protected void process(EntityPlayer player, Side side) { AtlasData data = AntiqueAtlasMod.atlasData.getAtlasData(atlasID, player.world); for (int i = 0; i < tileCount; i++) { data.getDimensionData(dimension).setTile(tileData.readShort(), tileData.readShort(), new Tile(tileData.readShort())); } } }
@Override public void setTile(int x, int y, Tile tile) { ShortVec2 groupPos = getKey().set((int)Math.floor(x / (float) TileGroup.CHUNK_STEP), (int)Math.floor(y / (float) TileGroup.CHUNK_STEP)); TileGroup tg = tileGroups.get(groupPos); if (tg == null) { tg = new TileGroup(groupPos.x * TileGroup.CHUNK_STEP, groupPos.y * TileGroup.CHUNK_STEP); tileGroups.put(groupPos, tg); } tg.setTile(x, y, tile); scope.extendTo(x, y); parent.markDirty(); }
public void readFromNBT(NBTTagList me){ if (me == null){ return; } for (int d = 0; d < me.tagCount(); d++) { NBTTagCompound tgTag = me.getCompoundTagAt(d); TileGroup tg = new TileGroup(0, 0); tg.readFromNBT(tgTag); putTileGroup(tg); } }
public Map<ShortVec2, Tile> getSeenChunksInDimension(int dimension) { return getDimensionData(dimension).getSeenChunks(); }
public void addData(DimensionData other){ for (Entry<ShortVec2, TileGroup> e:other.tileGroups.entrySet()){ TileGroup group = e.getValue(); Rect s = group.getScope(); for (int x = s.minX; x <= s.maxX; x++){ for (int y = s.minY; y <= s.maxY; y++){ Tile tile = group.getTile(x, y); if (tile != null) setTile(x, y, tile); } } } }
public AtlasData(String key) { super(key); biomeDetectorOverworld.setScanPonds(SettingsConfig.performance.doScanPonds); biomeDetectorOverworld.setScanRavines(SettingsConfig.performance.doScanRavines); setBiomeDetectorForDimension(0, biomeDetectorOverworld); setBiomeDetectorForDimension(-1, biomeDetectorNether); setBiomeDetectorForDimension(1, biomeDetectorEnd); }
@Override public boolean hasTileAt(int x, int y) { return getTile(x, y) != null; }
@Override public Tile removeTile(int x, int y) { //TODO // since scope is not modified, I assume this was never really used // Tile oldTile = tileGroups.remove(getKey().set(x, y)); // if (oldTile != null) parent.markDirty(); // return oldTile; return getTile(x,y); }
public Tile(int biomeID) { this(biomeID, (byte)0); randomizeTexture(); } private Tile(int biomeID, byte variationNumber) {
@Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { return writeToNBT(compound, true); }
@Override public boolean equals(Object obj) { if (!(obj instanceof DimensionData)) return false; DimensionData other = (DimensionData)obj; if (other.tileGroups.size() != tileGroups.size()) return false; for (ShortVec2 entry : tileGroups.keySet()) { if (!this.tileGroups.get(entry).equals(other.tileGroups.get(entry))) return false; } return true; } }
/** Loads data for the given atlas ID or creates a new one. */ public AtlasData getAtlasData(ItemStack stack, World world) { if (stack.getItem() == RegistrarAntiqueAtlas.ATLAS) { return getAtlasData(stack.getItemDamage(), world); } else { return null; } }
@Override public boolean hasTileAt(int x, int y) { return getTile(x,y)!=null; }