mirror of
https://github.com/zDevelopers/ImageOnMap.git
synced 2024-11-29 05:26:18 +01:00
fixed a bug where map can't be removed
This commit is contained in:
parent
eacd8122e1
commit
0359740890
@ -99,10 +99,19 @@ public class PosterOnASurface {
|
||||
* */
|
||||
static public ItemFrame[] getMatchingMapFrames(PosterMap map, FlatLocation location, int mapId, BlockFace bf) {
|
||||
int mapIndex = map.getIndex(mapId);
|
||||
int x = map.getColumnAt(mapIndex), y = map.getRowAt(mapIndex);
|
||||
|
||||
PluginLogger.info("x = "+x+" y = "+y);
|
||||
return getMatchingMapFrames(map, location.clone().addH(x, y,bf),bf);
|
||||
//int x = map.getColumnAt(mapIndex), y = map.getRowAt(mapIndex);
|
||||
int x=0,y=0;
|
||||
switch(bf){
|
||||
case EAST:
|
||||
case WEST:
|
||||
y=map.getColumnCount()-1;
|
||||
break;
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
y=map.getRowCount()-1;
|
||||
break;
|
||||
}
|
||||
return getMatchingMapFrames(map, location.clone().addH(x, y,bf),bf).clone();
|
||||
}
|
||||
|
||||
static public ItemFrame[] getMatchingMapFrames(PosterMap map, FlatLocation location, BlockFace bf) {
|
||||
@ -116,7 +125,7 @@ public class PosterOnASurface {
|
||||
switch (bf){
|
||||
case EAST:
|
||||
case WEST:
|
||||
/* X=map.getRowCount();
|
||||
/*X=map.getRowCount();
|
||||
Y=map.getColumnCount();
|
||||
break;*/
|
||||
case NORTH:
|
||||
@ -127,13 +136,14 @@ public class PosterOnASurface {
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
PluginLogger.info("max: X: "+X+" Y:"+Y);
|
||||
for (int y = 0; y < Y; ++y) {
|
||||
for (int x = 0; x < X; ++x) {
|
||||
PluginLogger.info("x: "+x+" y:"+y);
|
||||
int mapIndex = map.getIndexAt(x, y);
|
||||
PluginLogger.info("map index "+mapIndex);
|
||||
//PluginLogger.info("loc= "+loc);
|
||||
|
||||
ItemFrame frame = getMapFrameAt(loc, map);
|
||||
PluginLogger.info("frame= "+frame.getLocation());
|
||||
if (frame != null)
|
||||
@ -141,7 +151,7 @@ public class PosterOnASurface {
|
||||
switch (bf){
|
||||
case EAST:
|
||||
case WEST:
|
||||
loc.addH( 0,1,bf);
|
||||
loc.addH( 0,-1,bf);
|
||||
break;
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
@ -155,8 +165,8 @@ public class PosterOnASurface {
|
||||
switch (bf){
|
||||
case EAST:
|
||||
case WEST:
|
||||
loc.addH( -1,-map.getRowCount(),bf);//test
|
||||
//loc.addH( -map.getRowCount(),-1,bf);
|
||||
loc.addH( 1,map.getColumnCount(),bf);//test
|
||||
|
||||
break;
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
|
@ -139,11 +139,9 @@ abstract public class SplatterMapManager {
|
||||
final NBTCompound nbt = NBT.fromItemStack(itemStack);
|
||||
if (!nbt.containsKey("Enchantments"))
|
||||
return false;
|
||||
|
||||
final Object enchantments = nbt.get("Enchantments");
|
||||
if (!(enchantments instanceof NBTList))
|
||||
return false;
|
||||
|
||||
return !((NBTList) enchantments).isEmpty();
|
||||
} catch (NMSException e) {
|
||||
PluginLogger.error("Unable to get Splatter Map attribute on item", e);
|
||||
@ -159,6 +157,7 @@ abstract public class SplatterMapManager {
|
||||
* @return True if is a splatter map
|
||||
*/
|
||||
static public boolean isSplatterMap(ItemStack itemStack) {
|
||||
if(itemStack==null) return false;
|
||||
return hasSplatterAttributes(itemStack) && MapManager.managesMap(itemStack);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user