cache: add provider interfaces for items, models, sprites, and textures
This commit is contained in:
@@ -34,6 +34,7 @@ import java.util.Map;
|
|||||||
import net.runelite.cache.definitions.ItemDefinition;
|
import net.runelite.cache.definitions.ItemDefinition;
|
||||||
import net.runelite.cache.definitions.exporters.ItemExporter;
|
import net.runelite.cache.definitions.exporters.ItemExporter;
|
||||||
import net.runelite.cache.definitions.loaders.ItemLoader;
|
import net.runelite.cache.definitions.loaders.ItemLoader;
|
||||||
|
import net.runelite.cache.definitions.providers.ItemProvider;
|
||||||
import net.runelite.cache.fs.Archive;
|
import net.runelite.cache.fs.Archive;
|
||||||
import net.runelite.cache.fs.ArchiveFiles;
|
import net.runelite.cache.fs.ArchiveFiles;
|
||||||
import net.runelite.cache.fs.FSFile;
|
import net.runelite.cache.fs.FSFile;
|
||||||
@@ -42,7 +43,7 @@ import net.runelite.cache.fs.Storage;
|
|||||||
import net.runelite.cache.fs.Store;
|
import net.runelite.cache.fs.Store;
|
||||||
import net.runelite.cache.util.Namer;
|
import net.runelite.cache.util.Namer;
|
||||||
|
|
||||||
public class ItemManager
|
public class ItemManager implements ItemProvider
|
||||||
{
|
{
|
||||||
private final Store store;
|
private final Store store;
|
||||||
private final Map<Integer, ItemDefinition> items = new HashMap<>();
|
private final Map<Integer, ItemDefinition> items = new HashMap<>();
|
||||||
@@ -124,4 +125,10 @@ public class ItemManager
|
|||||||
fw.println("}");
|
fw.println("}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemDefinition provide(int itemId)
|
||||||
|
{
|
||||||
|
return getItem(itemId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.cache;
|
package net.runelite.cache;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.LinkedListMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -34,15 +34,16 @@ import java.util.Collections;
|
|||||||
import net.runelite.cache.definitions.SpriteDefinition;
|
import net.runelite.cache.definitions.SpriteDefinition;
|
||||||
import net.runelite.cache.definitions.exporters.SpriteExporter;
|
import net.runelite.cache.definitions.exporters.SpriteExporter;
|
||||||
import net.runelite.cache.definitions.loaders.SpriteLoader;
|
import net.runelite.cache.definitions.loaders.SpriteLoader;
|
||||||
|
import net.runelite.cache.definitions.providers.SpriteProvider;
|
||||||
import net.runelite.cache.fs.Archive;
|
import net.runelite.cache.fs.Archive;
|
||||||
import net.runelite.cache.fs.Index;
|
import net.runelite.cache.fs.Index;
|
||||||
import net.runelite.cache.fs.Storage;
|
import net.runelite.cache.fs.Storage;
|
||||||
import net.runelite.cache.fs.Store;
|
import net.runelite.cache.fs.Store;
|
||||||
|
|
||||||
public class SpriteManager
|
public class SpriteManager implements SpriteProvider
|
||||||
{
|
{
|
||||||
private final Store store;
|
private final Store store;
|
||||||
private final Multimap<Integer, SpriteDefinition> sprites = HashMultimap.create();
|
private final Multimap<Integer, SpriteDefinition> sprites = LinkedListMultimap.create();
|
||||||
|
|
||||||
public SpriteManager(Store store)
|
public SpriteManager(Store store)
|
||||||
{
|
{
|
||||||
@@ -108,4 +109,10 @@ public class SpriteManager
|
|||||||
exporter.exportTo(png);
|
exporter.exportTo(png);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SpriteDefinition provide(int spriteId, int frameId)
|
||||||
|
{
|
||||||
|
return findSprite(spriteId, frameId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.runelite.cache.definitions.TextureDefinition;
|
import net.runelite.cache.definitions.TextureDefinition;
|
||||||
import net.runelite.cache.definitions.loaders.TextureLoader;
|
import net.runelite.cache.definitions.loaders.TextureLoader;
|
||||||
|
import net.runelite.cache.definitions.providers.TextureProvider;
|
||||||
import net.runelite.cache.fs.Archive;
|
import net.runelite.cache.fs.Archive;
|
||||||
import net.runelite.cache.fs.ArchiveFiles;
|
import net.runelite.cache.fs.ArchiveFiles;
|
||||||
import net.runelite.cache.fs.FSFile;
|
import net.runelite.cache.fs.FSFile;
|
||||||
@@ -36,7 +37,7 @@ import net.runelite.cache.fs.Index;
|
|||||||
import net.runelite.cache.fs.Storage;
|
import net.runelite.cache.fs.Storage;
|
||||||
import net.runelite.cache.fs.Store;
|
import net.runelite.cache.fs.Store;
|
||||||
|
|
||||||
public class TextureManager
|
public class TextureManager implements TextureProvider
|
||||||
{
|
{
|
||||||
private final Store store;
|
private final Store store;
|
||||||
private final List<TextureDefinition> textures = new ArrayList<>();
|
private final List<TextureDefinition> textures = new ArrayList<>();
|
||||||
@@ -80,4 +81,10 @@ public class TextureManager
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureDefinition[] provide()
|
||||||
|
{
|
||||||
|
return textures.toArray(new TextureDefinition[textures.size()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
32
cache/src/main/java/net/runelite/cache/definitions/providers/ItemProvider.java
vendored
Normal file
32
cache/src/main/java/net/runelite/cache/definitions/providers/ItemProvider.java
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.cache.definitions.providers;
|
||||||
|
|
||||||
|
import net.runelite.cache.definitions.ItemDefinition;
|
||||||
|
|
||||||
|
public interface ItemProvider
|
||||||
|
{
|
||||||
|
ItemDefinition provide(int itemId);
|
||||||
|
}
|
||||||
33
cache/src/main/java/net/runelite/cache/definitions/providers/ModelProvider.java
vendored
Normal file
33
cache/src/main/java/net/runelite/cache/definitions/providers/ModelProvider.java
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.cache.definitions.providers;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import net.runelite.cache.definitions.ModelDefinition;
|
||||||
|
|
||||||
|
public interface ModelProvider
|
||||||
|
{
|
||||||
|
ModelDefinition provide(int modelId) throws IOException;
|
||||||
|
}
|
||||||
32
cache/src/main/java/net/runelite/cache/definitions/providers/SpriteProvider.java
vendored
Normal file
32
cache/src/main/java/net/runelite/cache/definitions/providers/SpriteProvider.java
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.cache.definitions.providers;
|
||||||
|
|
||||||
|
import net.runelite.cache.definitions.SpriteDefinition;
|
||||||
|
|
||||||
|
public interface SpriteProvider
|
||||||
|
{
|
||||||
|
SpriteDefinition provide(int spriteId, int frameId);
|
||||||
|
}
|
||||||
32
cache/src/main/java/net/runelite/cache/definitions/providers/TextureProvider.java
vendored
Normal file
32
cache/src/main/java/net/runelite/cache/definitions/providers/TextureProvider.java
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.cache.definitions.providers;
|
||||||
|
|
||||||
|
import net.runelite.cache.definitions.TextureDefinition;
|
||||||
|
|
||||||
|
public interface TextureProvider
|
||||||
|
{
|
||||||
|
TextureDefinition[] provide();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user