mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-19 07:11:02 +00:00
gradelized patch
I'm not including this until it can be gradle-ized for sake of public compilation
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ plugins {
|
|||||||
id "de.undercouch.download" version "5.0.1"
|
id "de.undercouch.download" version "5.0.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
version '2.4.2-1.19.3'
|
version '2.4.3-1.19.3'
|
||||||
def nmsVersion = "1.19.3" //[NMS]
|
def nmsVersion = "1.19.3" //[NMS]
|
||||||
def apiVersion = '1.19'
|
def apiVersion = '1.19'
|
||||||
def specialSourceVersion = '1.11.0' //[NMS]
|
def specialSourceVersion = '1.11.0' //[NMS]
|
||||||
|
|||||||
@@ -1,102 +1,102 @@
|
|||||||
package com.volmit.iris.core.link;
|
//package com.volmit.iris.core.link;
|
||||||
|
//
|
||||||
import com.jojodmo.customitems.api.CustomItemsAPI;
|
//import com.jojodmo.customitems.api.CustomItemsAPI;
|
||||||
import com.jojodmo.customitems.item.custom.CustomItem;
|
//import com.jojodmo.customitems.item.custom.CustomItem;
|
||||||
import com.jojodmo.customitems.item.custom.block.CustomMushroomBlock;
|
//import com.jojodmo.customitems.item.custom.block.CustomMushroomBlock;
|
||||||
import com.jojodmo.customitems.version.SafeMaterial;
|
//import com.jojodmo.customitems.version.SafeMaterial;
|
||||||
import com.volmit.iris.util.collection.KList;
|
//import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.reflect.WrappedField;
|
//import com.volmit.iris.util.reflect.WrappedField;
|
||||||
import com.volmit.iris.util.reflect.WrappedReturningMethod;
|
//import com.volmit.iris.util.reflect.WrappedReturningMethod;
|
||||||
import org.bukkit.block.BlockFace;
|
//import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.data.BlockData;
|
//import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.block.data.MultipleFacing;
|
//import org.bukkit.block.data.MultipleFacing;
|
||||||
import org.bukkit.inventory.ItemStack;
|
//import org.bukkit.inventory.ItemStack;
|
||||||
|
//
|
||||||
import java.util.Map;
|
//import java.util.Map;
|
||||||
import java.util.MissingResourceException;
|
//import java.util.MissingResourceException;
|
||||||
|
//
|
||||||
public class CustomItemsDataProvider extends ExternalDataProvider {
|
//public class CustomItemsDataProvider extends ExternalDataProvider {
|
||||||
|
//
|
||||||
private static final String FIELD_FACES = "faces";
|
// private static final String FIELD_FACES = "faces";
|
||||||
private static final String METHOD_GET_MATERIAL = "getMaterial";
|
// private static final String METHOD_GET_MATERIAL = "getMaterial";
|
||||||
|
//
|
||||||
private WrappedField<CustomMushroomBlock, Map<Integer, boolean[]>> mushroomFaces;
|
// private WrappedField<CustomMushroomBlock, Map<Integer, boolean[]>> mushroomFaces;
|
||||||
private WrappedReturningMethod<CustomMushroomBlock, SafeMaterial> mushroomMaterial;
|
// private WrappedReturningMethod<CustomMushroomBlock, SafeMaterial> mushroomMaterial;
|
||||||
|
//
|
||||||
public CustomItemsDataProvider() {
|
// public CustomItemsDataProvider() {
|
||||||
super("CustomItems");
|
// super("CustomItems");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void init() {
|
// public void init() {
|
||||||
this.mushroomFaces = new WrappedField<>(CustomMushroomBlock.class, FIELD_FACES);
|
// this.mushroomFaces = new WrappedField<>(CustomMushroomBlock.class, FIELD_FACES);
|
||||||
this.mushroomMaterial = new WrappedReturningMethod<>(CustomMushroomBlock.class, METHOD_GET_MATERIAL);
|
// this.mushroomMaterial = new WrappedReturningMethod<>(CustomMushroomBlock.class, METHOD_GET_MATERIAL);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public BlockData getBlockData(Identifier blockId) throws MissingResourceException {
|
// public BlockData getBlockData(Identifier blockId) throws MissingResourceException {
|
||||||
CustomItem item = CustomItem.get(blockId.key());
|
// CustomItem item = CustomItem.get(blockId.key());
|
||||||
if(item == null) {
|
// if(item == null) {
|
||||||
throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
// throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
||||||
} else if(item.getBlockTexture().isSpawner()) {
|
// } else if(item.getBlockTexture().isSpawner()) {
|
||||||
throw new MissingResourceException("Iris does not yet support SpawnerBlocks from CustomItems.", blockId.namespace(), blockId.key());
|
// throw new MissingResourceException("Iris does not yet support SpawnerBlocks from CustomItems.", blockId.namespace(), blockId.key());
|
||||||
} else if(item.getBlockTexture() != null && item.getBlockTexture().isValid()) {
|
// } else if(item.getBlockTexture() != null && item.getBlockTexture().isValid()) {
|
||||||
throw new MissingResourceException("Tried to fetch BlockData for a CustomItem that is not placeable!", blockId.namespace(), blockId.key());
|
// throw new MissingResourceException("Tried to fetch BlockData for a CustomItem that is not placeable!", blockId.namespace(), blockId.key());
|
||||||
}
|
// }
|
||||||
return getMushroomData(item);
|
// return getMushroomData(item);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public ItemStack getItemStack(Identifier itemId) throws MissingResourceException {
|
// public ItemStack getItemStack(Identifier itemId) throws MissingResourceException {
|
||||||
ItemStack stack = CustomItemsAPI.getCustomItem(itemId.key());
|
// ItemStack stack = CustomItemsAPI.getCustomItem(itemId.key());
|
||||||
if(stack == null) {
|
// if(stack == null) {
|
||||||
throw new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key());
|
// throw new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key());
|
||||||
}
|
// }
|
||||||
return stack;
|
// return stack;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public Identifier[] getBlockTypes() {
|
// public Identifier[] getBlockTypes() {
|
||||||
KList<Identifier> names = new KList<>();
|
// KList<Identifier> names = new KList<>();
|
||||||
for (String name : CustomItemsAPI.listBlockCustomItemIDs()) {
|
// for (String name : CustomItemsAPI.listBlockCustomItemIDs()) {
|
||||||
try {
|
// try {
|
||||||
Identifier key = new Identifier("cui", name);
|
// Identifier key = new Identifier("cui", name);
|
||||||
if (getItemStack(key) != null)
|
// if (getItemStack(key) != null)
|
||||||
names.add(key);
|
// names.add(key);
|
||||||
} catch (MissingResourceException ignored) { }
|
// } catch (MissingResourceException ignored) { }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return names.toArray(new Identifier[0]);
|
// return names.toArray(new Identifier[0]);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public Identifier[] getItemTypes() {
|
// public Identifier[] getItemTypes() {
|
||||||
KList<Identifier> names = new KList<>();
|
// KList<Identifier> names = new KList<>();
|
||||||
for (String name : CustomItemsAPI.listCustomItemIDs()) {
|
// for (String name : CustomItemsAPI.listCustomItemIDs()) {
|
||||||
try {
|
// try {
|
||||||
Identifier key = new Identifier("cui", name);
|
// Identifier key = new Identifier("cui", name);
|
||||||
if (getItemStack(key) != null)
|
// if (getItemStack(key) != null)
|
||||||
names.add(key);
|
// names.add(key);
|
||||||
} catch (MissingResourceException ignored) { }
|
// } catch (MissingResourceException ignored) { }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return names.toArray(new Identifier[0]);
|
// return names.toArray(new Identifier[0]);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public boolean isValidProvider(Identifier key, boolean isItem) {
|
// public boolean isValidProvider(Identifier key, boolean isItem) {
|
||||||
return key.namespace().equalsIgnoreCase("cui");
|
// return key.namespace().equalsIgnoreCase("cui");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private BlockData getMushroomData(CustomItem item) {
|
// private BlockData getMushroomData(CustomItem item) {
|
||||||
MultipleFacing data = (MultipleFacing)mushroomMaterial.invoke(item.getBlockTexture().getMushroomId()).parseMaterial().createBlockData();
|
// MultipleFacing data = (MultipleFacing)mushroomMaterial.invoke(item.getBlockTexture().getMushroomId()).parseMaterial().createBlockData();
|
||||||
boolean[] values = mushroomFaces.get().get(item.getBlockTexture().getMushroomId());
|
// boolean[] values = mushroomFaces.get().get(item.getBlockTexture().getMushroomId());
|
||||||
data.setFace(BlockFace.DOWN, values[0]);
|
// data.setFace(BlockFace.DOWN, values[0]);
|
||||||
data.setFace(BlockFace.EAST, values[1]);
|
// data.setFace(BlockFace.EAST, values[1]);
|
||||||
data.setFace(BlockFace.NORTH, values[2]);
|
// data.setFace(BlockFace.NORTH, values[2]);
|
||||||
data.setFace(BlockFace.SOUTH, values[3]);
|
// data.setFace(BlockFace.SOUTH, values[3]);
|
||||||
data.setFace(BlockFace.UP, values[4]);
|
// data.setFace(BlockFace.UP, values[4]);
|
||||||
data.setFace(BlockFace.WEST, values[5]);
|
// data.setFace(BlockFace.WEST, values[5]);
|
||||||
return data;
|
// return data;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ public class ExternalDataSVC implements IrisService {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
addProvider(
|
addProvider(
|
||||||
|
// new CustomItemsDataProvider(), //need this to be gradelized before i can add it to the master repo
|
||||||
new OraxenDataProvider(),
|
new OraxenDataProvider(),
|
||||||
new ItemAdderDataProvider(),
|
new ItemAdderDataProvider());
|
||||||
new CustomItemsDataProvider());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user