fix a bunch of Builder processing bugs
This commit is contained in:
parent
609c752790
commit
bf25fdfbf6
3 changed files with 27 additions and 11 deletions
|
@ -277,7 +277,11 @@ public class MappingRegistry {
|
||||||
for (int i = 0; i < blocksMapping.tagCount(); ++i) {
|
for (int i = 0; i < blocksMapping.tagCount(); ++i) {
|
||||||
NBTTagCompound sub = blocksMapping.getCompoundTagAt(i);
|
NBTTagCompound sub = blocksMapping.getCompoundTagAt(i);
|
||||||
String name = sub.getString("name");
|
String name = sub.getString("name");
|
||||||
Block b = (Block) Block.blockRegistry.getObject(name);
|
Block b = null;
|
||||||
|
|
||||||
|
if (Block.blockRegistry.containsKey(name)) {
|
||||||
|
b = (Block) Block.blockRegistry.getObject(name);
|
||||||
|
}
|
||||||
|
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
registerBlock(b);
|
registerBlock(b);
|
||||||
|
@ -294,7 +298,11 @@ public class MappingRegistry {
|
||||||
for (int i = 0; i < itemsMapping.tagCount(); ++i) {
|
for (int i = 0; i < itemsMapping.tagCount(); ++i) {
|
||||||
NBTTagCompound sub = itemsMapping.getCompoundTagAt(i);
|
NBTTagCompound sub = itemsMapping.getCompoundTagAt(i);
|
||||||
String name = sub.getString("name");
|
String name = sub.getString("name");
|
||||||
Item item = (Item) Item.itemRegistry.getObject(name);
|
Item item = null;
|
||||||
|
|
||||||
|
if (Item.itemRegistry.containsKey(name)) {
|
||||||
|
item = (Item) Item.itemRegistry.getObject(name);
|
||||||
|
}
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
registerItem(item);
|
registerItem(item);
|
||||||
|
|
|
@ -33,6 +33,8 @@ public class SchematicBlock extends SchematicBlockBase {
|
||||||
*/
|
*/
|
||||||
public ItemStack [] storedRequirements = new ItemStack [0];
|
public ItemStack [] storedRequirements = new ItemStack [0];
|
||||||
|
|
||||||
|
private boolean doNotUse = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getRequirementsForPlacement(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
public void getRequirementsForPlacement(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
|
@ -86,7 +88,9 @@ public class SchematicBlock extends SchematicBlockBase {
|
||||||
super.readSchematicFromNBT(nbt, registry);
|
super.readSchematicFromNBT(nbt, registry);
|
||||||
|
|
||||||
readBlockFromNBT(nbt, registry);
|
readBlockFromNBT(nbt, registry);
|
||||||
readRequirementsFromNBT(nbt, registry);
|
if (!doNotUse()) {
|
||||||
|
readRequirementsFromNBT(nbt, registry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -114,12 +118,16 @@ public class SchematicBlock extends SchematicBlockBase {
|
||||||
context.world().setBlockMetadataWithNotify(x, y, z, meta, 3);
|
context.world().setBlockMetadataWithNotify(x, y, z, meta, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean doNotUse() {
|
||||||
|
return doNotUse;
|
||||||
|
}
|
||||||
|
|
||||||
protected void readBlockFromNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
protected void readBlockFromNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
||||||
try {
|
try {
|
||||||
block = registry.getBlockForId(nbt.getInteger("blockId"));
|
block = registry.getBlockForId(nbt.getInteger("blockId"));
|
||||||
meta = nbt.getInteger("blockMeta");
|
meta = nbt.getInteger("blockMeta");
|
||||||
} catch (MappingNotFoundException e) {
|
} catch (MappingNotFoundException e) {
|
||||||
defaultPermission = BuildingPermission.CREATIVE_ONLY;
|
doNotUse = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,11 +136,11 @@ public class SchematicBlock extends SchematicBlockBase {
|
||||||
NBTTagList rq = nbt.getTagList("rq", Constants.NBT.TAG_COMPOUND);
|
NBTTagList rq = nbt.getTagList("rq", Constants.NBT.TAG_COMPOUND);
|
||||||
|
|
||||||
ArrayList<ItemStack> rqs = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> rqs = new ArrayList<ItemStack>();
|
||||||
|
int idTEST = 0;
|
||||||
for (int i = 0; i < rq.tagCount(); ++i) {
|
for (int i = 0; i < rq.tagCount(); ++i) {
|
||||||
try {
|
try {
|
||||||
NBTTagCompound sub = rq.getCompoundTagAt(i);
|
NBTTagCompound sub = rq.getCompoundTagAt(i);
|
||||||
|
idTEST = sub.getInteger("id");
|
||||||
if (sub.getInteger("id") >= 0) {
|
if (sub.getInteger("id") >= 0) {
|
||||||
registry.stackToWorld(sub);
|
registry.stackToWorld(sub);
|
||||||
rqs.add(ItemStack.loadItemStackFromNBT(sub));
|
rqs.add(ItemStack.loadItemStackFromNBT(sub));
|
||||||
|
|
|
@ -226,9 +226,9 @@ public class Blueprint extends BlueprintBase {
|
||||||
case ALL:
|
case ALL:
|
||||||
break;
|
break;
|
||||||
case CREATIVE_ONLY:
|
case CREATIVE_ONLY:
|
||||||
System.out.println("FOUND CREATIVE BUILDING PERMISSION");
|
//System.out.println("FOUND CREATIVE BUILDING PERMISSION");
|
||||||
System.out.println("- block: " + Block.blockRegistry.getNameForObject(block));
|
//System.out.println("- block: " + Block.blockRegistry.getNameForObject(block));
|
||||||
System.out.println("- meta: " + meta);
|
//System.out.println("- meta: " + meta);
|
||||||
if (buildingPermission == BuildingPermission.ALL) {
|
if (buildingPermission == BuildingPermission.ALL) {
|
||||||
buildingPermission = BuildingPermission.CREATIVE_ONLY;
|
buildingPermission = BuildingPermission.CREATIVE_ONLY;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue