Remove block ID usage (#234)
Also updates AutoExtendClaimTask with new API, will need to ensure users are using a recent build of CB
This commit is contained in:
parent
5f6b541af8
commit
8040a17e5d
2
pom.xml
2
pom.xml
|
|
@ -58,7 +58,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.12-R0.1-SNAPSHOT</version>
|
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--Worldguard dependency-->
|
<!--Worldguard dependency-->
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChunkSnapshot;
|
import org.bukkit.ChunkSnapshot;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
|
|
@ -41,7 +42,7 @@ class AutoExtendClaimTask implements Runnable
|
||||||
for(ChunkSnapshot chunk : this.chunks)
|
for(ChunkSnapshot chunk : this.chunks)
|
||||||
{
|
{
|
||||||
Biome biome = chunk.getBiome(0, 0);
|
Biome biome = chunk.getBiome(0, 0);
|
||||||
ArrayList<Integer> playerBlockIDs = RestoreNatureProcessingTask.getPlayerBlocks(this.worldType, biome);
|
ArrayList<Material> playerBlockIDs = RestoreNatureProcessingTask.getPlayerBlocks(this.worldType, biome);
|
||||||
|
|
||||||
boolean ychanged = true;
|
boolean ychanged = true;
|
||||||
while(!this.yTooSmall(y) && ychanged)
|
while(!this.yTooSmall(y) && ychanged)
|
||||||
|
|
@ -51,11 +52,11 @@ class AutoExtendClaimTask implements Runnable
|
||||||
{
|
{
|
||||||
for(int z = 0; z < 16; z++)
|
for(int z = 0; z < 16; z++)
|
||||||
{
|
{
|
||||||
int blockType = chunk.getBlockTypeId(x, y, z);
|
Material blockType = chunk.getBlockType(x, y, z);
|
||||||
while(!this.yTooSmall(y) && playerBlockIDs.contains(blockType))
|
while(!this.yTooSmall(y) && playerBlockIDs.contains(blockType))
|
||||||
{
|
{
|
||||||
ychanged = true;
|
ychanged = true;
|
||||||
blockType = chunk.getBlockTypeId(x, --y, z);
|
blockType = chunk.getBlockType(x, --y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.yTooSmall(y)) return y;
|
if(this.yTooSmall(y)) return y;
|
||||||
|
|
|
||||||
|
|
@ -19,16 +19,17 @@
|
||||||
package me.ryanhamshire.GriefPrevention;
|
package me.ryanhamshire.GriefPrevention;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
//basically, just a few data points from a block conveniently encapsulated in a class
|
//basically, just a few data points from a block conveniently encapsulated in a class
|
||||||
//this is used only by the RestoreNature code
|
//this is used only by the RestoreNature code
|
||||||
public class BlockSnapshot
|
public class BlockSnapshot
|
||||||
{
|
{
|
||||||
public Location location;
|
public Location location;
|
||||||
public int typeId;
|
public Material typeId;
|
||||||
public byte data;
|
public byte data;
|
||||||
|
|
||||||
public BlockSnapshot(Location location, int typeId, byte data)
|
public BlockSnapshot(Location location, Material typeId, byte data)
|
||||||
{
|
{
|
||||||
this.location = location;
|
this.location = location;
|
||||||
this.typeId = typeId;
|
this.typeId = typeId;
|
||||||
|
|
|
||||||
|
|
@ -876,7 +876,7 @@ public class Claim
|
||||||
{
|
{
|
||||||
//decide which blocks will be considered player placed
|
//decide which blocks will be considered player placed
|
||||||
Location lesserBoundaryCorner = this.getLesserBoundaryCorner();
|
Location lesserBoundaryCorner = this.getLesserBoundaryCorner();
|
||||||
ArrayList<Integer> playerBlocks = RestoreNatureProcessingTask.getPlayerBlocks(lesserBoundaryCorner.getWorld().getEnvironment(), lesserBoundaryCorner.getBlock().getBiome());
|
ArrayList<Material> playerBlocks = RestoreNatureProcessingTask.getPlayerBlocks(lesserBoundaryCorner.getWorld().getEnvironment(), lesserBoundaryCorner.getBlock().getBiome());
|
||||||
|
|
||||||
//scan the claim for player placed blocks
|
//scan the claim for player placed blocks
|
||||||
double score = 0;
|
double score = 0;
|
||||||
|
|
@ -891,7 +891,7 @@ public class Claim
|
||||||
for(; y < GriefPrevention.instance.getSeaLevel(this.lesserBoundaryCorner.getWorld()) - 5; y++)
|
for(; y < GriefPrevention.instance.getSeaLevel(this.lesserBoundaryCorner.getWorld()) - 5; y++)
|
||||||
{
|
{
|
||||||
Block block = this.lesserBoundaryCorner.getWorld().getBlockAt(x, y, z);
|
Block block = this.lesserBoundaryCorner.getWorld().getBlockAt(x, y, z);
|
||||||
if(playerBlocks.contains(block.getTypeId()))
|
if(playerBlocks.contains(block.getType()))
|
||||||
{
|
{
|
||||||
if(block.getType() == Material.CHEST && !creativeMode)
|
if(block.getType() == Material.CHEST && !creativeMode)
|
||||||
{
|
{
|
||||||
|
|
@ -907,7 +907,7 @@ public class Claim
|
||||||
for(; y < this.lesserBoundaryCorner.getWorld().getMaxHeight(); y++)
|
for(; y < this.lesserBoundaryCorner.getWorld().getMaxHeight(); y++)
|
||||||
{
|
{
|
||||||
Block block = this.lesserBoundaryCorner.getWorld().getBlockAt(x, y, z);
|
Block block = this.lesserBoundaryCorner.getWorld().getBlockAt(x, y, z);
|
||||||
if(playerBlocks.contains(block.getTypeId()))
|
if(playerBlocks.contains(block.getType()))
|
||||||
{
|
{
|
||||||
if(block.getType() == Material.CHEST && !creativeMode)
|
if(block.getType() == Material.CHEST && !creativeMode)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ public class EntityEventHandler implements Listener
|
||||||
for(int i = 0; i < blocks.size(); i++)
|
for(int i = 0; i < blocks.size(); i++)
|
||||||
{
|
{
|
||||||
Block block = blocks.get(i);
|
Block block = blocks.get(i);
|
||||||
if(GriefPrevention.instance.config_mods_explodableIds.Contains(new MaterialInfo(block.getTypeId(), block.getData(), null))) continue;
|
if(GriefPrevention.instance.config_mods_explodableIds.Contains(new MaterialInfo(block.getType(), block.getData(), null))) continue;
|
||||||
|
|
||||||
blocks.remove(i--);
|
blocks.remove(i--);
|
||||||
}
|
}
|
||||||
|
|
@ -312,7 +312,7 @@ public class EntityEventHandler implements Listener
|
||||||
if(block.getType() == Material.AIR) continue;
|
if(block.getType() == Material.AIR) continue;
|
||||||
|
|
||||||
//always allow certain block types to explode
|
//always allow certain block types to explode
|
||||||
if(GriefPrevention.instance.config_mods_explodableIds.Contains(new MaterialInfo(block.getTypeId(), block.getData(), null)))
|
if(GriefPrevention.instance.config_mods_explodableIds.Contains(new MaterialInfo(block.getType(), block.getData(), null)))
|
||||||
{
|
{
|
||||||
explodedBlocks.add(block);
|
explodedBlocks.add(block);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -635,7 +635,7 @@ public class GriefPrevention extends JavaPlugin
|
||||||
//default values for container trust mod blocks
|
//default values for container trust mod blocks
|
||||||
if(containerTrustStrings == null || containerTrustStrings.size() == 0)
|
if(containerTrustStrings == null || containerTrustStrings.size() == 0)
|
||||||
{
|
{
|
||||||
containerTrustStrings.add(new MaterialInfo(99999, "Example - ID 99999, all data values.").toString());
|
// containerTrustStrings.add(new MaterialInfo(99999, "Example - ID 99999, all data values.").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
//parse the strings from the config file
|
//parse the strings from the config file
|
||||||
|
|
@ -2640,10 +2640,10 @@ public class GriefPrevention extends JavaPlugin
|
||||||
else if(cmd.getName().equalsIgnoreCase("gpblockinfo") && player != null)
|
else if(cmd.getName().equalsIgnoreCase("gpblockinfo") && player != null)
|
||||||
{
|
{
|
||||||
ItemStack inHand = player.getItemInHand();
|
ItemStack inHand = player.getItemInHand();
|
||||||
player.sendMessage("In Hand: " + String.format("%s(%d:%d)", inHand.getType().name(), inHand.getTypeId(), inHand.getData().getData()));
|
player.sendMessage("In Hand: " + String.format("%s(%d:%s)", inHand.getType().name(), inHand.getType(), inHand.getData().getData()));
|
||||||
|
|
||||||
Block inWorld = GriefPrevention.getTargetNonAirBlock(player, 300);
|
Block inWorld = GriefPrevention.getTargetNonAirBlock(player, 300);
|
||||||
player.sendMessage("In World: " + String.format("%s(%d:%d)", inWorld.getType().name(), inWorld.getTypeId(), inWorld.getData()));
|
player.sendMessage("In World: " + String.format("%s(%d:%s)", inWorld.getType().name(), inWorld.getType(), inWorld.getData()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -3487,7 +3487,7 @@ public class GriefPrevention extends JavaPlugin
|
||||||
for(int y = 0; y < snapshots[0].length; y++)
|
for(int y = 0; y < snapshots[0].length; y++)
|
||||||
{
|
{
|
||||||
Block block = chunk.getWorld().getBlockAt(startLocation.getBlockX() + x, startLocation.getBlockY() + y, startLocation.getBlockZ() + z);
|
Block block = chunk.getWorld().getBlockAt(startLocation.getBlockX() + x, startLocation.getBlockY() + y, startLocation.getBlockZ() + z);
|
||||||
snapshots[x][y][z] = new BlockSnapshot(block.getLocation(), block.getTypeId(), block.getData());
|
snapshots[x][y][z] = new BlockSnapshot(block.getLocation(), block.getType(), block.getData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,48 +18,28 @@
|
||||||
|
|
||||||
package me.ryanhamshire.GriefPrevention;
|
package me.ryanhamshire.GriefPrevention;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
//ordered list of material info objects, for fast searching
|
//ordered list of material info objects, for fast searching
|
||||||
public class MaterialCollection
|
public class MaterialCollection
|
||||||
{
|
{
|
||||||
ArrayList<MaterialInfo> materials = new ArrayList<MaterialInfo>();
|
Set<MaterialInfo> materials = new HashSet<MaterialInfo>();
|
||||||
|
|
||||||
void Add(MaterialInfo material)
|
void Add(MaterialInfo material)
|
||||||
{
|
{
|
||||||
int i;
|
this.materials.add(material);
|
||||||
for(i = 0; i < this.materials.size() && this.materials.get(i).typeID <= material.typeID; i++);
|
|
||||||
this.materials.add(i, material);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean Contains(MaterialInfo material)
|
boolean Contains(MaterialInfo material)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < this.materials.size() ; i++)
|
return this.materials.contains(material);
|
||||||
{
|
|
||||||
MaterialInfo thisMaterial = this.materials.get(i);
|
|
||||||
if(material.typeID == thisMaterial.typeID && (thisMaterial.allDataValues || material.data == thisMaterial.data))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if(thisMaterial.typeID > material.typeID)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
return materials.toString();
|
||||||
for(int i = 0; i < this.materials.size(); i++)
|
|
||||||
{
|
|
||||||
stringBuilder.append(this.materials.get(i).toString() + " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
return stringBuilder.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int size()
|
public int size()
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,17 @@
|
||||||
package me.ryanhamshire.GriefPrevention;
|
package me.ryanhamshire.GriefPrevention;
|
||||||
|
|
||||||
//represents a material or collection of materials
|
//represents a material or collection of materials
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public class MaterialInfo
|
public class MaterialInfo
|
||||||
{
|
{
|
||||||
int typeID;
|
Material typeID;
|
||||||
byte data;
|
byte data;
|
||||||
boolean allDataValues;
|
boolean allDataValues;
|
||||||
String description;
|
String description;
|
||||||
|
|
||||||
public MaterialInfo(int typeID, byte data, String description)
|
public MaterialInfo(Material typeID, byte data, String description)
|
||||||
{
|
{
|
||||||
this.typeID = typeID;
|
this.typeID = typeID;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
|
@ -34,7 +37,7 @@ public class MaterialInfo
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MaterialInfo(int typeID, String description)
|
public MaterialInfo(Material typeID, String description)
|
||||||
{
|
{
|
||||||
this.typeID = typeID;
|
this.typeID = typeID;
|
||||||
this.data = 0;
|
this.data = 0;
|
||||||
|
|
@ -42,7 +45,7 @@ public class MaterialInfo
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MaterialInfo(int typeID, byte data, boolean allDataValues, String description)
|
private MaterialInfo(Material typeID, byte data, boolean allDataValues, String description)
|
||||||
{
|
{
|
||||||
this.typeID = typeID;
|
this.typeID = typeID;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
|
@ -68,7 +71,7 @@ public class MaterialInfo
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int typeID = Integer.parseInt(parts[0]);
|
Material typeID = Material.matchMaterial(parts[0]);
|
||||||
|
|
||||||
byte data;
|
byte data;
|
||||||
boolean allDataValues;
|
boolean allDataValues;
|
||||||
|
|
|
||||||
|
|
@ -1581,7 +1581,7 @@ class PlayerEventHandler implements Listener
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
instance.sendMessage(player, TextMode.Err, noBuildReason);
|
instance.sendMessage(player, TextMode.Err, noBuildReason);
|
||||||
player.sendBlockChange(adjacentBlock.getLocation(), adjacentBlock.getTypeId(), adjacentBlock.getData());
|
player.sendBlockChange(adjacentBlock.getLocation(), adjacentBlock.getType(), adjacentBlock.getData());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1589,7 +1589,7 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
|
|
||||||
//exception for blocks on a specific watch list
|
//exception for blocks on a specific watch list
|
||||||
if(!this.onLeftClickWatchList(clickedBlockType) && !instance.config_mods_accessTrustIds.Contains(new MaterialInfo(clickedBlock.getTypeId(), clickedBlock.getData(), null)))
|
if(!this.onLeftClickWatchList(clickedBlockType) && !instance.config_mods_accessTrustIds.Contains(new MaterialInfo(clickedBlock.getType(), clickedBlock.getData(), null)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1603,7 +1603,7 @@ class PlayerEventHandler implements Listener
|
||||||
clickedBlockType == Material.JUKEBOX ||
|
clickedBlockType == Material.JUKEBOX ||
|
||||||
clickedBlockType == Material.ANVIL ||
|
clickedBlockType == Material.ANVIL ||
|
||||||
clickedBlockType == Material.CAKE_BLOCK ||
|
clickedBlockType == Material.CAKE_BLOCK ||
|
||||||
instance.config_mods_containerTrustIds.Contains(new MaterialInfo(clickedBlock.getTypeId(), clickedBlock.getData(), null)))))
|
instance.config_mods_containerTrustIds.Contains(new MaterialInfo(clickedBlock.getType(), clickedBlock.getData(), null)))))
|
||||||
{
|
{
|
||||||
if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
||||||
|
|
||||||
|
|
@ -1688,7 +1688,7 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
|
|
||||||
//otherwise apply rules for buttons and switches
|
//otherwise apply rules for buttons and switches
|
||||||
else if(clickedBlock != null && instance.config_claims_preventButtonsSwitches && (clickedBlockType == null || clickedBlockType == Material.STONE_BUTTON || clickedBlockType == Material.WOOD_BUTTON || clickedBlockType == Material.LEVER || instance.config_mods_accessTrustIds.Contains(new MaterialInfo(clickedBlock.getTypeId(), clickedBlock.getData(), null))))
|
else if(clickedBlock != null && instance.config_claims_preventButtonsSwitches && (clickedBlockType == null || clickedBlockType == Material.STONE_BUTTON || clickedBlockType == Material.WOOD_BUTTON || clickedBlockType == Material.LEVER || instance.config_mods_accessTrustIds.Contains(new MaterialInfo(clickedBlock.getType(), clickedBlock.getData(), null))))
|
||||||
{
|
{
|
||||||
if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
||||||
Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim);
|
Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim);
|
||||||
|
|
@ -1952,33 +1952,6 @@ class PlayerEventHandler implements Listener
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if holding a non-vanilla item
|
|
||||||
else if(Material.getMaterial(itemInHand.getTypeId()) == null)
|
|
||||||
{
|
|
||||||
//assume it's a long range tool and project out ahead
|
|
||||||
if(action == Action.RIGHT_CLICK_AIR)
|
|
||||||
{
|
|
||||||
//try to find a far away non-air block along line of sight
|
|
||||||
clickedBlock = getTargetBlock(player, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
//if target is claimed, require build trust permission
|
|
||||||
if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
|
||||||
Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim);
|
|
||||||
if(claim != null)
|
|
||||||
{
|
|
||||||
String reason = claim.allowBreak(player, Material.AIR);
|
|
||||||
if(reason != null)
|
|
||||||
{
|
|
||||||
instance.sendMessage(player, TextMode.Err, reason);
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//if it's a golden shovel
|
//if it's a golden shovel
|
||||||
else if(materialInHand != instance.config_claims_modificationTool || hand != EquipmentSlot.HAND) return;
|
else if(materialInHand != instance.config_claims_modificationTool || hand != EquipmentSlot.HAND) return;
|
||||||
|
|
||||||
|
|
@ -2518,11 +2491,11 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
|
|
||||||
//determines whether a block type is an inventory holder. uses a caching strategy to save cpu time
|
//determines whether a block type is an inventory holder. uses a caching strategy to save cpu time
|
||||||
private ConcurrentHashMap<Integer, Boolean> inventoryHolderCache = new ConcurrentHashMap<Integer, Boolean>();
|
private ConcurrentHashMap<Material, Boolean> inventoryHolderCache = new ConcurrentHashMap<Material, Boolean>();
|
||||||
private boolean isInventoryHolder(Block clickedBlock)
|
private boolean isInventoryHolder(Block clickedBlock)
|
||||||
{
|
{
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
Integer cacheKey = clickedBlock.getTypeId();
|
Material cacheKey = clickedBlock.getType();
|
||||||
Boolean cachedValue = this.inventoryHolderCache.get(cacheKey);
|
Boolean cachedValue = this.inventoryHolderCache.get(cacheKey);
|
||||||
if(cachedValue != null)
|
if(cachedValue != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class RestoreNatureExecutionTask implements Runnable
|
||||||
{
|
{
|
||||||
BlockSnapshot blockUpdate = this.snapshots[x][y][z];
|
BlockSnapshot blockUpdate = this.snapshots[x][y][z];
|
||||||
Block currentBlock = blockUpdate.location.getBlock();
|
Block currentBlock = blockUpdate.location.getBlock();
|
||||||
if(blockUpdate.typeId != currentBlock.getTypeId() || blockUpdate.data != currentBlock.getData())
|
if(blockUpdate.typeId != currentBlock.getType()|| blockUpdate.data != currentBlock.getData())
|
||||||
{
|
{
|
||||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(blockUpdate.location, false, cachedClaim);
|
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(blockUpdate.location, false, cachedClaim);
|
||||||
if(claim != null)
|
if(claim != null)
|
||||||
|
|
@ -82,7 +82,8 @@ class RestoreNatureExecutionTask implements Runnable
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
currentBlock.setTypeIdAndData(blockUpdate.typeId, blockUpdate.data, false);
|
currentBlock.setType(blockUpdate.typeId, false);
|
||||||
|
currentBlock.setData(blockUpdate.data, false);
|
||||||
}
|
}
|
||||||
catch(IllegalArgumentException e)
|
catch(IllegalArgumentException e)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
private boolean aggressiveMode;
|
private boolean aggressiveMode;
|
||||||
|
|
||||||
//two lists of materials
|
//two lists of materials
|
||||||
private ArrayList<Integer> notAllowedToHang; //natural blocks which don't naturally hang in their air
|
private ArrayList<Material> notAllowedToHang; //natural blocks which don't naturally hang in their air
|
||||||
private ArrayList<Integer> playerBlocks; //a "complete" list of player-placed blocks. MUST BE MAINTAINED as patches introduce more
|
private ArrayList<Material> playerBlocks; //a "complete" list of player-placed blocks. MUST BE MAINTAINED as patches introduce more
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public RestoreNatureProcessingTask(BlockSnapshot[][][] snapshots, int miny, Environment environment, Biome biome, Location lesserBoundaryCorner, Location greaterBoundaryCorner, int seaLevel, boolean aggressiveMode, boolean creativeMode, Player player)
|
public RestoreNatureProcessingTask(BlockSnapshot[][][] snapshots, int miny, Environment environment, Biome biome, Location lesserBoundaryCorner, Location greaterBoundaryCorner, int seaLevel, boolean aggressiveMode, boolean creativeMode, Player player)
|
||||||
|
|
@ -65,19 +65,19 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.creativeMode = creativeMode;
|
this.creativeMode = creativeMode;
|
||||||
|
|
||||||
this.notAllowedToHang = new ArrayList<Integer>();
|
this.notAllowedToHang = new ArrayList<Material>();
|
||||||
this.notAllowedToHang.add(Material.DIRT.getId());
|
this.notAllowedToHang.add(Material.DIRT);
|
||||||
this.notAllowedToHang.add(Material.LONG_GRASS.getId());
|
this.notAllowedToHang.add(Material.LONG_GRASS);
|
||||||
this.notAllowedToHang.add(Material.SNOW.getId());
|
this.notAllowedToHang.add(Material.SNOW);
|
||||||
this.notAllowedToHang.add(Material.LOG.getId());
|
this.notAllowedToHang.add(Material.LOG);
|
||||||
|
|
||||||
if(this.aggressiveMode)
|
if(this.aggressiveMode)
|
||||||
{
|
{
|
||||||
this.notAllowedToHang.add(Material.GRASS.getId());
|
this.notAllowedToHang.add(Material.GRASS);
|
||||||
this.notAllowedToHang.add(Material.STONE.getId());
|
this.notAllowedToHang.add(Material.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.playerBlocks = new ArrayList<Integer>();
|
this.playerBlocks = new ArrayList<Material>();
|
||||||
this.playerBlocks.addAll(RestoreNatureProcessingTask.getPlayerBlocks(this.environment, this.biome));
|
this.playerBlocks.addAll(RestoreNatureProcessingTask.getPlayerBlocks(this.environment, this.biome));
|
||||||
|
|
||||||
//in aggressive or creative world mode, also treat these blocks as user placed, to be removed
|
//in aggressive or creative world mode, also treat these blocks as user placed, to be removed
|
||||||
|
|
@ -85,25 +85,25 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
//like a single-block tower of iron ore or a giant penis constructed with melons
|
//like a single-block tower of iron ore or a giant penis constructed with melons
|
||||||
if(this.aggressiveMode || this.creativeMode)
|
if(this.aggressiveMode || this.creativeMode)
|
||||||
{
|
{
|
||||||
this.playerBlocks.add(Material.IRON_ORE.getId());
|
this.playerBlocks.add(Material.IRON_ORE);
|
||||||
this.playerBlocks.add(Material.GOLD_ORE.getId());
|
this.playerBlocks.add(Material.GOLD_ORE);
|
||||||
this.playerBlocks.add(Material.DIAMOND_ORE.getId());
|
this.playerBlocks.add(Material.DIAMOND_ORE);
|
||||||
this.playerBlocks.add(Material.MELON_BLOCK.getId());
|
this.playerBlocks.add(Material.MELON_BLOCK);
|
||||||
this.playerBlocks.add(Material.MELON_STEM.getId());
|
this.playerBlocks.add(Material.MELON_STEM);
|
||||||
this.playerBlocks.add(Material.BEDROCK.getId());
|
this.playerBlocks.add(Material.BEDROCK);
|
||||||
this.playerBlocks.add(Material.COAL_ORE.getId());
|
this.playerBlocks.add(Material.COAL_ORE);
|
||||||
this.playerBlocks.add(Material.PUMPKIN.getId());
|
this.playerBlocks.add(Material.PUMPKIN);
|
||||||
this.playerBlocks.add(Material.PUMPKIN_STEM.getId());
|
this.playerBlocks.add(Material.PUMPKIN_STEM);
|
||||||
this.playerBlocks.add(Material.MELON.getId());
|
this.playerBlocks.add(Material.MELON);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.aggressiveMode)
|
if(this.aggressiveMode)
|
||||||
{
|
{
|
||||||
this.playerBlocks.add(Material.LEAVES.getId());
|
this.playerBlocks.add(Material.LEAVES);
|
||||||
this.playerBlocks.add(Material.LEAVES_2.getId());
|
this.playerBlocks.add(Material.LEAVES_2);
|
||||||
this.playerBlocks.add(Material.LOG.getId());
|
this.playerBlocks.add(Material.LOG);
|
||||||
this.playerBlocks.add(Material.LOG_2.getId());
|
this.playerBlocks.add(Material.LOG_2);
|
||||||
this.playerBlocks.add(Material.VINE.getId());
|
this.playerBlocks.add(Material.VINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,9 +163,9 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
{
|
{
|
||||||
//note: see minecraft wiki data values for leaves
|
//note: see minecraft wiki data values for leaves
|
||||||
BlockSnapshot block = snapshots[x][y][z];
|
BlockSnapshot block = snapshots[x][y][z];
|
||||||
if(block.typeId == Material.LEAVES.getId() && (block.data & 0x4) != 0)
|
if(block.typeId == Material.LEAVES && (block.data & 0x4) != 0)
|
||||||
{
|
{
|
||||||
block.typeId = Material.AIR.getId();
|
block.typeId = Material.AIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -182,7 +182,7 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
{
|
{
|
||||||
for(int y = snapshots[0].length - 2; y > miny; y--)
|
for(int y = snapshots[0].length - 2; y > miny; y--)
|
||||||
{
|
{
|
||||||
if(snapshots[x][y][z].typeId != Material.SANDSTONE.getId()) continue;
|
if(snapshots[x][y][z].typeId != Material.SANDSTONE) continue;
|
||||||
|
|
||||||
BlockSnapshot leftBlock = this.snapshots[x + 1][y][z];
|
BlockSnapshot leftBlock = this.snapshots[x + 1][y][z];
|
||||||
BlockSnapshot rightBlock = this.snapshots[x - 1][y][z];
|
BlockSnapshot rightBlock = this.snapshots[x - 1][y][z];
|
||||||
|
|
@ -192,21 +192,21 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
BlockSnapshot aboveBlock = this.snapshots[x][y + 1][z];
|
BlockSnapshot aboveBlock = this.snapshots[x][y + 1][z];
|
||||||
|
|
||||||
//skip blocks which may cause a cave-in
|
//skip blocks which may cause a cave-in
|
||||||
if(aboveBlock.typeId == Material.SAND.getId() && underBlock.typeId == Material.AIR.getId()) continue;
|
if(aboveBlock.typeId == Material.SAND && underBlock.typeId == Material.AIR) continue;
|
||||||
|
|
||||||
//count adjacent non-air/non-leaf blocks
|
//count adjacent non-air/non-leaf blocks
|
||||||
if( leftBlock.typeId == Material.SAND.getId() ||
|
if( leftBlock.typeId == Material.SAND ||
|
||||||
rightBlock.typeId == Material.SAND.getId() ||
|
rightBlock.typeId == Material.SAND ||
|
||||||
upBlock.typeId == Material.SAND.getId() ||
|
upBlock.typeId == Material.SAND ||
|
||||||
downBlock.typeId == Material.SAND.getId() ||
|
downBlock.typeId == Material.SAND ||
|
||||||
aboveBlock.typeId == Material.SAND.getId() ||
|
aboveBlock.typeId == Material.SAND ||
|
||||||
underBlock.typeId == Material.SAND.getId())
|
underBlock.typeId == Material.SAND)
|
||||||
{
|
{
|
||||||
snapshots[x][y][z].typeId = Material.SAND.getId();
|
snapshots[x][y][z].typeId = Material.SAND;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snapshots[x][y][z].typeId = Material.AIR.getId();
|
snapshots[x][y][z].typeId = Material.AIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -224,7 +224,7 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
{
|
{
|
||||||
int thisy = this.highestY(x, z, true);
|
int thisy = this.highestY(x, z, true);
|
||||||
|
|
||||||
while(thisy > this.seaLevel - 1 && (this.snapshots[x][thisy][z].typeId == Material.STONE.getId() || this.snapshots[x][thisy][z].typeId == Material.SANDSTONE.getId()))
|
while(thisy > this.seaLevel - 1 && (this.snapshots[x][thisy][z].typeId == Material.STONE || this.snapshots[x][thisy][z].typeId == Material.SANDSTONE))
|
||||||
{
|
{
|
||||||
BlockSnapshot leftBlock = this.snapshots[x + 1][thisy][z];
|
BlockSnapshot leftBlock = this.snapshots[x + 1][thisy][z];
|
||||||
BlockSnapshot rightBlock = this.snapshots[x - 1][thisy][z];
|
BlockSnapshot rightBlock = this.snapshots[x - 1][thisy][z];
|
||||||
|
|
@ -233,26 +233,26 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
|
|
||||||
//count adjacent non-air/non-leaf blocks
|
//count adjacent non-air/non-leaf blocks
|
||||||
byte adjacentBlockCount = 0;
|
byte adjacentBlockCount = 0;
|
||||||
if(leftBlock.typeId != Material.AIR.getId() && leftBlock.typeId != Material.LEAVES.getId() && leftBlock.typeId != Material.VINE.getId())
|
if(leftBlock.typeId != Material.AIR && leftBlock.typeId != Material.LEAVES && leftBlock.typeId != Material.VINE)
|
||||||
{
|
{
|
||||||
adjacentBlockCount++;
|
adjacentBlockCount++;
|
||||||
}
|
}
|
||||||
if(rightBlock.typeId != Material.AIR.getId() && rightBlock.typeId != Material.LEAVES.getId() && rightBlock.typeId != Material.VINE.getId())
|
if(rightBlock.typeId != Material.AIR && rightBlock.typeId != Material.LEAVES && rightBlock.typeId != Material.VINE)
|
||||||
{
|
{
|
||||||
adjacentBlockCount++;
|
adjacentBlockCount++;
|
||||||
}
|
}
|
||||||
if(downBlock.typeId != Material.AIR.getId() && downBlock.typeId != Material.LEAVES.getId() && downBlock.typeId != Material.VINE.getId())
|
if(downBlock.typeId != Material.AIR && downBlock.typeId != Material.LEAVES && downBlock.typeId != Material.VINE)
|
||||||
{
|
{
|
||||||
adjacentBlockCount++;
|
adjacentBlockCount++;
|
||||||
}
|
}
|
||||||
if(upBlock.typeId != Material.AIR.getId() && upBlock.typeId != Material.LEAVES.getId() && upBlock.typeId != Material.VINE.getId())
|
if(upBlock.typeId != Material.AIR && upBlock.typeId != Material.LEAVES && upBlock.typeId != Material.VINE)
|
||||||
{
|
{
|
||||||
adjacentBlockCount++;
|
adjacentBlockCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(adjacentBlockCount < 3)
|
if(adjacentBlockCount < 3)
|
||||||
{
|
{
|
||||||
this.snapshots[x][thisy][z].typeId = Material.AIR.getId();
|
this.snapshots[x][thisy][z].typeId = Material.AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
thisy--;
|
thisy--;
|
||||||
|
|
@ -278,8 +278,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
BlockSnapshot block = snapshots[x][y][z];
|
BlockSnapshot block = snapshots[x][y][z];
|
||||||
|
|
||||||
//skip non-logs
|
//skip non-logs
|
||||||
if(block.typeId != Material.LOG.getId()) continue;
|
if(block.typeId != Material.LOG) continue;
|
||||||
if(block.typeId != Material.LOG_2.getId()) continue;
|
if(block.typeId != Material.LOG_2) continue;
|
||||||
|
|
||||||
//if in jungle biome, skip jungle logs
|
//if in jungle biome, skip jungle logs
|
||||||
if(jungleBiome && block.data == 3) continue;
|
if(jungleBiome && block.data == 3) continue;
|
||||||
|
|
@ -291,9 +291,9 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
BlockSnapshot downBlock = this.snapshots[x][y][z - 1];
|
BlockSnapshot downBlock = this.snapshots[x][y][z - 1];
|
||||||
|
|
||||||
//if any, remove the log
|
//if any, remove the log
|
||||||
if(leftBlock.typeId == Material.LOG.getId() || rightBlock.typeId == Material.LOG.getId() || upBlock.typeId == Material.LOG.getId() || downBlock.typeId == Material.LOG.getId())
|
if(leftBlock.typeId == Material.LOG || rightBlock.typeId == Material.LOG || upBlock.typeId == Material.LOG || downBlock.typeId == Material.LOG)
|
||||||
{
|
{
|
||||||
this.snapshots[x][y][z].typeId = Material.AIR.getId();
|
this.snapshots[x][y][z].typeId = Material.AIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -316,7 +316,7 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
BlockSnapshot block = snapshots[x][y][z];
|
BlockSnapshot block = snapshots[x][y][z];
|
||||||
if(this.playerBlocks.contains(block.typeId))
|
if(this.playerBlocks.contains(block.typeId))
|
||||||
{
|
{
|
||||||
block.typeId = Material.AIR.getId();
|
block.typeId = Material.AIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -338,11 +338,11 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
BlockSnapshot block = snapshots[x][y][z];
|
BlockSnapshot block = snapshots[x][y][z];
|
||||||
BlockSnapshot underBlock = snapshots[x][y - 1][z];
|
BlockSnapshot underBlock = snapshots[x][y - 1][z];
|
||||||
|
|
||||||
if(underBlock.typeId == Material.AIR.getId() || underBlock.typeId == Material.STATIONARY_WATER.getId() || underBlock.typeId == Material.STATIONARY_LAVA.getId() || underBlock.typeId == Material.LEAVES.getId())
|
if(underBlock.typeId == Material.AIR || underBlock.typeId == Material.STATIONARY_WATER || underBlock.typeId == Material.STATIONARY_LAVA || underBlock.typeId == Material.LEAVES)
|
||||||
{
|
{
|
||||||
if(this.notAllowedToHang.contains(block.typeId))
|
if(this.notAllowedToHang.contains(block.typeId))
|
||||||
{
|
{
|
||||||
block.typeId = Material.AIR.getId();
|
block.typeId = Material.AIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -353,24 +353,24 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private void removeWallsAndTowers()
|
private void removeWallsAndTowers()
|
||||||
{
|
{
|
||||||
int [] excludedBlocksArray = new int []
|
Material [] excludedBlocksArray = new Material []
|
||||||
{
|
{
|
||||||
Material.CACTUS.getId(),
|
Material.CACTUS,
|
||||||
Material.LONG_GRASS.getId(),
|
Material.LONG_GRASS,
|
||||||
Material.RED_MUSHROOM.getId(),
|
Material.RED_MUSHROOM,
|
||||||
Material.BROWN_MUSHROOM.getId(),
|
Material.BROWN_MUSHROOM,
|
||||||
Material.DEAD_BUSH.getId(),
|
Material.DEAD_BUSH,
|
||||||
Material.SAPLING.getId(),
|
Material.SAPLING,
|
||||||
Material.YELLOW_FLOWER.getId(),
|
Material.YELLOW_FLOWER,
|
||||||
Material.RED_ROSE.getId(),
|
Material.RED_ROSE,
|
||||||
Material.SUGAR_CANE_BLOCK.getId(),
|
Material.SUGAR_CANE_BLOCK,
|
||||||
Material.VINE.getId(),
|
Material.VINE,
|
||||||
Material.PUMPKIN.getId(),
|
Material.PUMPKIN,
|
||||||
Material.WATER_LILY.getId(),
|
Material.WATER_LILY,
|
||||||
Material.LEAVES.getId()
|
Material.LEAVES
|
||||||
};
|
};
|
||||||
|
|
||||||
ArrayList<Integer> excludedBlocks = new ArrayList<Integer>();
|
ArrayList<Material> excludedBlocks = new ArrayList<Material>();
|
||||||
for(int i = 0; i < excludedBlocksArray.length; i++) excludedBlocks.add(excludedBlocksArray[i]);
|
for(int i = 0; i < excludedBlocksArray.length; i++) excludedBlocks.add(excludedBlocksArray[i]);
|
||||||
|
|
||||||
boolean changed;
|
boolean changed;
|
||||||
|
|
@ -388,7 +388,7 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
int lefty = this.highestY(x - 1, z, false);
|
int lefty = this.highestY(x - 1, z, false);
|
||||||
while(lefty < thisy && righty < thisy)
|
while(lefty < thisy && righty < thisy)
|
||||||
{
|
{
|
||||||
this.snapshots[x][thisy--][z].typeId = Material.AIR.getId();
|
this.snapshots[x][thisy--][z].typeId = Material.AIR;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -396,7 +396,7 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
int downy = this.highestY(x, z - 1, false);
|
int downy = this.highestY(x, z - 1, false);
|
||||||
while(upy < thisy && downy < thisy)
|
while(upy < thisy && downy < thisy)
|
||||||
{
|
{
|
||||||
this.snapshots[x][thisy--][z].typeId = Material.AIR.getId();
|
this.snapshots[x][thisy--][z].typeId = Material.AIR;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -414,15 +414,15 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
int y = this.highestY(x, z, true);
|
int y = this.highestY(x, z, true);
|
||||||
BlockSnapshot block = snapshots[x][y][z];
|
BlockSnapshot block = snapshots[x][y][z];
|
||||||
|
|
||||||
if(block.typeId == Material.STONE.getId() || block.typeId == Material.GRAVEL.getId() || block.typeId == Material.SOIL.getId() || block.typeId == Material.DIRT.getId() || block.typeId == Material.SANDSTONE.getId())
|
if(block.typeId == Material.STONE || block.typeId == Material.GRAVEL || block.typeId == Material.SOIL || block.typeId == Material.DIRT || block.typeId == Material.SANDSTONE)
|
||||||
{
|
{
|
||||||
if(this.biome == Biome.DESERT || this.biome == Biome.DESERT_HILLS || this.biome == Biome.BEACHES)
|
if(this.biome == Biome.DESERT || this.biome == Biome.DESERT_HILLS || this.biome == Biome.BEACHES)
|
||||||
{
|
{
|
||||||
this.snapshots[x][y][z].typeId = Material.SAND.getId();
|
this.snapshots[x][y][z].typeId = Material.SAND;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.snapshots[x][y][z].typeId = Material.GRASS.getId();
|
this.snapshots[x][y][z].typeId = Material.GRASS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -432,19 +432,19 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private void fillHolesAndTrenches()
|
private void fillHolesAndTrenches()
|
||||||
{
|
{
|
||||||
ArrayList<Integer> fillableBlocks = new ArrayList<Integer>();
|
ArrayList<Material> fillableBlocks = new ArrayList<Material>();
|
||||||
fillableBlocks.add(Material.AIR.getId());
|
fillableBlocks.add(Material.AIR);
|
||||||
fillableBlocks.add(Material.STATIONARY_WATER.getId());
|
fillableBlocks.add(Material.STATIONARY_WATER);
|
||||||
fillableBlocks.add(Material.STATIONARY_LAVA.getId());
|
fillableBlocks.add(Material.STATIONARY_LAVA);
|
||||||
fillableBlocks.add(Material.LONG_GRASS.getId());
|
fillableBlocks.add(Material.LONG_GRASS);
|
||||||
|
|
||||||
ArrayList<Integer> notSuitableForFillBlocks = new ArrayList<Integer>();
|
ArrayList<Material> notSuitableForFillBlocks = new ArrayList<Material>();
|
||||||
notSuitableForFillBlocks.add(Material.LONG_GRASS.getId());
|
notSuitableForFillBlocks.add(Material.LONG_GRASS);
|
||||||
notSuitableForFillBlocks.add(Material.CACTUS.getId());
|
notSuitableForFillBlocks.add(Material.CACTUS);
|
||||||
notSuitableForFillBlocks.add(Material.STATIONARY_WATER.getId());
|
notSuitableForFillBlocks.add(Material.STATIONARY_WATER);
|
||||||
notSuitableForFillBlocks.add(Material.STATIONARY_LAVA.getId());
|
notSuitableForFillBlocks.add(Material.STATIONARY_LAVA);
|
||||||
notSuitableForFillBlocks.add(Material.LOG.getId());
|
notSuitableForFillBlocks.add(Material.LOG);
|
||||||
notSuitableForFillBlocks.add(Material.LOG_2.getId());
|
notSuitableForFillBlocks.add(Material.LOG_2);
|
||||||
|
|
||||||
boolean changed;
|
boolean changed;
|
||||||
do
|
do
|
||||||
|
|
@ -505,11 +505,11 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
{
|
{
|
||||||
BlockSnapshot block = this.snapshots[x][y][z];
|
BlockSnapshot block = this.snapshots[x][y][z];
|
||||||
BlockSnapshot underBlock = this.snapshots[x][y][z];
|
BlockSnapshot underBlock = this.snapshots[x][y][z];
|
||||||
if(block.typeId == Material.STATIONARY_WATER.getId() || block.typeId == Material.STATIONARY_LAVA.getId())
|
if(block.typeId == Material.STATIONARY_WATER || block.typeId == Material.STATIONARY_LAVA)
|
||||||
{
|
{
|
||||||
if(underBlock.typeId == Material.AIR.getId() || (underBlock.data != 0))
|
if(underBlock.typeId == Material.AIR || (underBlock.data != 0))
|
||||||
{
|
{
|
||||||
block.typeId = Material.AIR.getId();
|
block.typeId = Material.AIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -529,7 +529,7 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
BlockSnapshot block = snapshots[x][y][z];
|
BlockSnapshot block = snapshots[x][y][z];
|
||||||
|
|
||||||
//only consider air blocks and flowing water blocks for upgrade to water source blocks
|
//only consider air blocks and flowing water blocks for upgrade to water source blocks
|
||||||
if(block.typeId == Material.AIR.getId() || (block.typeId == Material.STATIONARY_WATER.getId() && block.data != 0))
|
if(block.typeId == Material.AIR || (block.typeId == Material.STATIONARY_WATER && block.data != 0))
|
||||||
{
|
{
|
||||||
BlockSnapshot leftBlock = this.snapshots[x + 1][y][z];
|
BlockSnapshot leftBlock = this.snapshots[x + 1][y][z];
|
||||||
BlockSnapshot rightBlock = this.snapshots[x - 1][y][z];
|
BlockSnapshot rightBlock = this.snapshots[x - 1][y][z];
|
||||||
|
|
@ -538,23 +538,23 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
BlockSnapshot underBlock = this.snapshots[x][y - 1][z];
|
BlockSnapshot underBlock = this.snapshots[x][y - 1][z];
|
||||||
|
|
||||||
//block underneath MUST be source water
|
//block underneath MUST be source water
|
||||||
if(underBlock.typeId != Material.STATIONARY_WATER.getId() || underBlock.data != 0) continue;
|
if(underBlock.typeId != Material.STATIONARY_WATER || underBlock.data != 0) continue;
|
||||||
|
|
||||||
//count adjacent source water blocks
|
//count adjacent source water blocks
|
||||||
byte adjacentSourceWaterCount = 0;
|
byte adjacentSourceWaterCount = 0;
|
||||||
if(leftBlock.typeId == Material.STATIONARY_WATER.getId() && leftBlock.data == 0)
|
if(leftBlock.typeId == Material.STATIONARY_WATER && leftBlock.data == 0)
|
||||||
{
|
{
|
||||||
adjacentSourceWaterCount++;
|
adjacentSourceWaterCount++;
|
||||||
}
|
}
|
||||||
if(rightBlock.typeId == Material.STATIONARY_WATER.getId() && rightBlock.data == 0)
|
if(rightBlock.typeId == Material.STATIONARY_WATER && rightBlock.data == 0)
|
||||||
{
|
{
|
||||||
adjacentSourceWaterCount++;
|
adjacentSourceWaterCount++;
|
||||||
}
|
}
|
||||||
if(upBlock.typeId == Material.STATIONARY_WATER.getId() && upBlock.data == 0)
|
if(upBlock.typeId == Material.STATIONARY_WATER && upBlock.data == 0)
|
||||||
{
|
{
|
||||||
adjacentSourceWaterCount++;
|
adjacentSourceWaterCount++;
|
||||||
}
|
}
|
||||||
if(downBlock.typeId == Material.STATIONARY_WATER.getId() && downBlock.data == 0)
|
if(downBlock.typeId == Material.STATIONARY_WATER && downBlock.data == 0)
|
||||||
{
|
{
|
||||||
adjacentSourceWaterCount++;
|
adjacentSourceWaterCount++;
|
||||||
}
|
}
|
||||||
|
|
@ -562,7 +562,7 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
//at least two adjacent blocks must be source water
|
//at least two adjacent blocks must be source water
|
||||||
if(adjacentSourceWaterCount >= 2)
|
if(adjacentSourceWaterCount >= 2)
|
||||||
{
|
{
|
||||||
block.typeId = Material.STATIONARY_WATER.getId();
|
block.typeId = Material.STATIONARY_WATER;
|
||||||
block.data = 0;
|
block.data = 0;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
@ -588,10 +588,10 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
for(int y = this.seaLevel - 1; y < snapshots[0].length - 1; y++)
|
for(int y = this.seaLevel - 1; y < snapshots[0].length - 1; y++)
|
||||||
{
|
{
|
||||||
BlockSnapshot block = snapshots[x][y][z];
|
BlockSnapshot block = snapshots[x][y][z];
|
||||||
if(block.typeId == Material.STATIONARY_WATER.getId() || block.typeId == Material.STATIONARY_LAVA.getId() ||
|
if(block.typeId == Material.STATIONARY_WATER || block.typeId == Material.STATIONARY_LAVA ||
|
||||||
block.typeId == Material.WATER.getId() || block.typeId == Material.LAVA.getId())
|
block.typeId == Material.WATER || block.typeId == Material.LAVA)
|
||||||
{
|
{
|
||||||
block.typeId = Material.AIR.getId();
|
block.typeId = Material.AIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -605,14 +605,14 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
for(y = snapshots[0].length - 1; y > 0; y--)
|
for(y = snapshots[0].length - 1; y > 0; y--)
|
||||||
{
|
{
|
||||||
BlockSnapshot block = this.snapshots[x][y][z];
|
BlockSnapshot block = this.snapshots[x][y][z];
|
||||||
if(block.typeId != Material.AIR.getId() &&
|
if(block.typeId != Material.AIR &&
|
||||||
!(ignoreLeaves && block.typeId == Material.SNOW.getId()) &&
|
!(ignoreLeaves && block.typeId == Material.SNOW) &&
|
||||||
!(ignoreLeaves && block.typeId == Material.LEAVES.getId()) &&
|
!(ignoreLeaves && block.typeId == Material.LEAVES) &&
|
||||||
!(ignoreLeaves && block.typeId == Material.LEAVES_2.getId()) &&
|
!(ignoreLeaves && block.typeId == Material.LEAVES_2) &&
|
||||||
!(block.typeId == Material.STATIONARY_WATER.getId()) &&
|
!(block.typeId == Material.STATIONARY_WATER) &&
|
||||||
!(block.typeId == Material.WATER.getId()) &&
|
!(block.typeId == Material.WATER) &&
|
||||||
!(block.typeId == Material.LAVA.getId()) &&
|
!(block.typeId == Material.LAVA) &&
|
||||||
!(block.typeId == Material.STATIONARY_LAVA.getId()))
|
!(block.typeId == Material.STATIONARY_LAVA))
|
||||||
{
|
{
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
@ -622,187 +622,187 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
static ArrayList<Integer> getPlayerBlocks(Environment environment, Biome biome)
|
static ArrayList<Material> getPlayerBlocks(Environment environment, Biome biome)
|
||||||
{
|
{
|
||||||
//NOTE on this list. why not make a list of natural blocks?
|
//NOTE on this list. why not make a list of natural blocks?
|
||||||
//answer: better to leave a few player blocks than to remove too many natural blocks. remember we're "restoring nature"
|
//answer: better to leave a few player blocks than to remove too many natural blocks. remember we're "restoring nature"
|
||||||
//a few extra player blocks can be manually removed, but it will be impossible to guess exactly which natural materials to use in manual repair of an overzealous block removal
|
//a few extra player blocks can be manually removed, but it will be impossible to guess exactly which natural materials to use in manual repair of an overzealous block removal
|
||||||
ArrayList<Integer> playerBlocks = new ArrayList<Integer>();
|
ArrayList<Material> playerBlocks = new ArrayList<Material>();
|
||||||
playerBlocks.add(Material.FIRE.getId());
|
playerBlocks.add(Material.FIRE);
|
||||||
playerBlocks.add(Material.BED_BLOCK.getId());
|
playerBlocks.add(Material.BED_BLOCK);
|
||||||
playerBlocks.add(Material.WOOD.getId());
|
playerBlocks.add(Material.WOOD);
|
||||||
playerBlocks.add(Material.BOOKSHELF.getId());
|
playerBlocks.add(Material.BOOKSHELF);
|
||||||
playerBlocks.add(Material.BREWING_STAND.getId());
|
playerBlocks.add(Material.BREWING_STAND);
|
||||||
playerBlocks.add(Material.BRICK.getId());
|
playerBlocks.add(Material.BRICK);
|
||||||
playerBlocks.add(Material.COBBLESTONE.getId());
|
playerBlocks.add(Material.COBBLESTONE);
|
||||||
playerBlocks.add(Material.GLASS.getId());
|
playerBlocks.add(Material.GLASS);
|
||||||
playerBlocks.add(Material.LAPIS_BLOCK.getId());
|
playerBlocks.add(Material.LAPIS_BLOCK);
|
||||||
playerBlocks.add(Material.DISPENSER.getId());
|
playerBlocks.add(Material.DISPENSER);
|
||||||
playerBlocks.add(Material.NOTE_BLOCK.getId());
|
playerBlocks.add(Material.NOTE_BLOCK);
|
||||||
playerBlocks.add(Material.POWERED_RAIL.getId());
|
playerBlocks.add(Material.POWERED_RAIL);
|
||||||
playerBlocks.add(Material.DETECTOR_RAIL.getId());
|
playerBlocks.add(Material.DETECTOR_RAIL);
|
||||||
playerBlocks.add(Material.PISTON_STICKY_BASE.getId());
|
playerBlocks.add(Material.PISTON_STICKY_BASE);
|
||||||
playerBlocks.add(Material.PISTON_BASE.getId());
|
playerBlocks.add(Material.PISTON_BASE);
|
||||||
playerBlocks.add(Material.PISTON_EXTENSION.getId());
|
playerBlocks.add(Material.PISTON_EXTENSION);
|
||||||
playerBlocks.add(Material.WOOL.getId());
|
playerBlocks.add(Material.WOOL);
|
||||||
playerBlocks.add(Material.PISTON_MOVING_PIECE.getId());
|
playerBlocks.add(Material.PISTON_MOVING_PIECE);
|
||||||
playerBlocks.add(Material.GOLD_BLOCK.getId());
|
playerBlocks.add(Material.GOLD_BLOCK);
|
||||||
playerBlocks.add(Material.IRON_BLOCK.getId());
|
playerBlocks.add(Material.IRON_BLOCK);
|
||||||
playerBlocks.add(Material.DOUBLE_STEP.getId());
|
playerBlocks.add(Material.DOUBLE_STEP);
|
||||||
playerBlocks.add(Material.STEP.getId());
|
playerBlocks.add(Material.STEP);
|
||||||
playerBlocks.add(Material.CROPS.getId());
|
playerBlocks.add(Material.CROPS);
|
||||||
playerBlocks.add(Material.TNT.getId());
|
playerBlocks.add(Material.TNT);
|
||||||
playerBlocks.add(Material.MOSSY_COBBLESTONE.getId());
|
playerBlocks.add(Material.MOSSY_COBBLESTONE);
|
||||||
playerBlocks.add(Material.TORCH.getId());
|
playerBlocks.add(Material.TORCH);
|
||||||
playerBlocks.add(Material.FIRE.getId());
|
playerBlocks.add(Material.FIRE);
|
||||||
playerBlocks.add(Material.WOOD_STAIRS.getId());
|
playerBlocks.add(Material.WOOD_STAIRS);
|
||||||
playerBlocks.add(Material.CHEST.getId());
|
playerBlocks.add(Material.CHEST);
|
||||||
playerBlocks.add(Material.REDSTONE_WIRE.getId());
|
playerBlocks.add(Material.REDSTONE_WIRE);
|
||||||
playerBlocks.add(Material.DIAMOND_BLOCK.getId());
|
playerBlocks.add(Material.DIAMOND_BLOCK);
|
||||||
playerBlocks.add(Material.WORKBENCH.getId());
|
playerBlocks.add(Material.WORKBENCH);
|
||||||
playerBlocks.add(Material.FURNACE.getId());
|
playerBlocks.add(Material.FURNACE);
|
||||||
playerBlocks.add(Material.BURNING_FURNACE.getId());
|
playerBlocks.add(Material.BURNING_FURNACE);
|
||||||
playerBlocks.add(Material.WOODEN_DOOR.getId());
|
playerBlocks.add(Material.WOODEN_DOOR);
|
||||||
playerBlocks.add(Material.SIGN_POST.getId());
|
playerBlocks.add(Material.SIGN_POST);
|
||||||
playerBlocks.add(Material.LADDER.getId());
|
playerBlocks.add(Material.LADDER);
|
||||||
playerBlocks.add(Material.RAILS.getId());
|
playerBlocks.add(Material.RAILS);
|
||||||
playerBlocks.add(Material.COBBLESTONE_STAIRS.getId());
|
playerBlocks.add(Material.COBBLESTONE_STAIRS);
|
||||||
playerBlocks.add(Material.WALL_SIGN.getId());
|
playerBlocks.add(Material.WALL_SIGN);
|
||||||
playerBlocks.add(Material.STONE_PLATE.getId());
|
playerBlocks.add(Material.STONE_PLATE);
|
||||||
playerBlocks.add(Material.LEVER.getId());
|
playerBlocks.add(Material.LEVER);
|
||||||
playerBlocks.add(Material.IRON_DOOR_BLOCK.getId());
|
playerBlocks.add(Material.IRON_DOOR_BLOCK);
|
||||||
playerBlocks.add(Material.WOOD_PLATE.getId());
|
playerBlocks.add(Material.WOOD_PLATE);
|
||||||
playerBlocks.add(Material.REDSTONE_TORCH_ON.getId());
|
playerBlocks.add(Material.REDSTONE_TORCH_ON);
|
||||||
playerBlocks.add(Material.REDSTONE_TORCH_OFF.getId());
|
playerBlocks.add(Material.REDSTONE_TORCH_OFF);
|
||||||
playerBlocks.add(Material.STONE_BUTTON.getId());
|
playerBlocks.add(Material.STONE_BUTTON);
|
||||||
playerBlocks.add(Material.SNOW_BLOCK.getId());
|
playerBlocks.add(Material.SNOW_BLOCK);
|
||||||
playerBlocks.add(Material.JUKEBOX.getId());
|
playerBlocks.add(Material.JUKEBOX);
|
||||||
playerBlocks.add(Material.FENCE.getId());
|
playerBlocks.add(Material.FENCE);
|
||||||
playerBlocks.add(Material.PORTAL.getId());
|
playerBlocks.add(Material.PORTAL);
|
||||||
playerBlocks.add(Material.JACK_O_LANTERN.getId());
|
playerBlocks.add(Material.JACK_O_LANTERN);
|
||||||
playerBlocks.add(Material.CAKE_BLOCK.getId());
|
playerBlocks.add(Material.CAKE_BLOCK);
|
||||||
playerBlocks.add(Material.DIODE_BLOCK_ON.getId());
|
playerBlocks.add(Material.DIODE_BLOCK_ON);
|
||||||
playerBlocks.add(Material.DIODE_BLOCK_OFF.getId());
|
playerBlocks.add(Material.DIODE_BLOCK_OFF);
|
||||||
playerBlocks.add(Material.TRAP_DOOR.getId());
|
playerBlocks.add(Material.TRAP_DOOR);
|
||||||
playerBlocks.add(Material.SMOOTH_BRICK.getId());
|
playerBlocks.add(Material.SMOOTH_BRICK);
|
||||||
playerBlocks.add(Material.HUGE_MUSHROOM_1.getId());
|
playerBlocks.add(Material.HUGE_MUSHROOM_1);
|
||||||
playerBlocks.add(Material.HUGE_MUSHROOM_2.getId());
|
playerBlocks.add(Material.HUGE_MUSHROOM_2);
|
||||||
playerBlocks.add(Material.IRON_FENCE.getId());
|
playerBlocks.add(Material.IRON_FENCE);
|
||||||
playerBlocks.add(Material.THIN_GLASS.getId());
|
playerBlocks.add(Material.THIN_GLASS);
|
||||||
playerBlocks.add(Material.MELON_STEM.getId());
|
playerBlocks.add(Material.MELON_STEM);
|
||||||
playerBlocks.add(Material.FENCE_GATE.getId());
|
playerBlocks.add(Material.FENCE_GATE);
|
||||||
playerBlocks.add(Material.BRICK_STAIRS.getId());
|
playerBlocks.add(Material.BRICK_STAIRS);
|
||||||
playerBlocks.add(Material.SMOOTH_STAIRS.getId());
|
playerBlocks.add(Material.SMOOTH_STAIRS);
|
||||||
playerBlocks.add(Material.ENCHANTMENT_TABLE.getId());
|
playerBlocks.add(Material.ENCHANTMENT_TABLE);
|
||||||
playerBlocks.add(Material.BREWING_STAND.getId());
|
playerBlocks.add(Material.BREWING_STAND);
|
||||||
playerBlocks.add(Material.CAULDRON.getId());
|
playerBlocks.add(Material.CAULDRON);
|
||||||
playerBlocks.add(Material.DIODE_BLOCK_ON.getId());
|
playerBlocks.add(Material.DIODE_BLOCK_ON);
|
||||||
playerBlocks.add(Material.DIODE_BLOCK_ON.getId());
|
playerBlocks.add(Material.DIODE_BLOCK_ON);
|
||||||
playerBlocks.add(Material.WEB.getId());
|
playerBlocks.add(Material.WEB);
|
||||||
playerBlocks.add(Material.SPONGE.getId());
|
playerBlocks.add(Material.SPONGE);
|
||||||
playerBlocks.add(Material.GRAVEL.getId());
|
playerBlocks.add(Material.GRAVEL);
|
||||||
playerBlocks.add(Material.EMERALD_BLOCK.getId());
|
playerBlocks.add(Material.EMERALD_BLOCK);
|
||||||
playerBlocks.add(Material.SANDSTONE.getId());
|
playerBlocks.add(Material.SANDSTONE);
|
||||||
playerBlocks.add(Material.WOOD_STEP.getId());
|
playerBlocks.add(Material.WOOD_STEP);
|
||||||
playerBlocks.add(Material.WOOD_DOUBLE_STEP.getId());
|
playerBlocks.add(Material.WOOD_DOUBLE_STEP);
|
||||||
playerBlocks.add(Material.ENDER_CHEST.getId());
|
playerBlocks.add(Material.ENDER_CHEST);
|
||||||
playerBlocks.add(Material.SANDSTONE_STAIRS.getId());
|
playerBlocks.add(Material.SANDSTONE_STAIRS);
|
||||||
playerBlocks.add(Material.SPRUCE_WOOD_STAIRS.getId());
|
playerBlocks.add(Material.SPRUCE_WOOD_STAIRS);
|
||||||
playerBlocks.add(Material.JUNGLE_WOOD_STAIRS.getId());
|
playerBlocks.add(Material.JUNGLE_WOOD_STAIRS);
|
||||||
playerBlocks.add(Material.COMMAND.getId());
|
playerBlocks.add(Material.COMMAND);
|
||||||
playerBlocks.add(Material.BEACON.getId());
|
playerBlocks.add(Material.BEACON);
|
||||||
playerBlocks.add(Material.COBBLE_WALL.getId());
|
playerBlocks.add(Material.COBBLE_WALL);
|
||||||
playerBlocks.add(Material.FLOWER_POT.getId());
|
playerBlocks.add(Material.FLOWER_POT);
|
||||||
playerBlocks.add(Material.CARROT.getId());
|
playerBlocks.add(Material.CARROT);
|
||||||
playerBlocks.add(Material.POTATO.getId());
|
playerBlocks.add(Material.POTATO);
|
||||||
playerBlocks.add(Material.WOOD_BUTTON.getId());
|
playerBlocks.add(Material.WOOD_BUTTON);
|
||||||
playerBlocks.add(Material.SKULL.getId());
|
playerBlocks.add(Material.SKULL);
|
||||||
playerBlocks.add(Material.ANVIL.getId());
|
playerBlocks.add(Material.ANVIL);
|
||||||
playerBlocks.add(Material.SPONGE.getId());
|
playerBlocks.add(Material.SPONGE);
|
||||||
playerBlocks.add(Material.DOUBLE_STONE_SLAB2.getId());
|
playerBlocks.add(Material.DOUBLE_STONE_SLAB2);
|
||||||
playerBlocks.add(Material.STAINED_GLASS.getId());
|
playerBlocks.add(Material.STAINED_GLASS);
|
||||||
playerBlocks.add(Material.STAINED_GLASS_PANE.getId());
|
playerBlocks.add(Material.STAINED_GLASS_PANE);
|
||||||
playerBlocks.add(Material.BANNER.getId());
|
playerBlocks.add(Material.BANNER);
|
||||||
playerBlocks.add(Material.STANDING_BANNER.getId());
|
playerBlocks.add(Material.STANDING_BANNER);
|
||||||
playerBlocks.add(Material.ACACIA_STAIRS.getId());
|
playerBlocks.add(Material.ACACIA_STAIRS);
|
||||||
playerBlocks.add(Material.BIRCH_WOOD_STAIRS.getId());
|
playerBlocks.add(Material.BIRCH_WOOD_STAIRS);
|
||||||
playerBlocks.add(Material.DARK_OAK_STAIRS.getId());
|
playerBlocks.add(Material.DARK_OAK_STAIRS);
|
||||||
playerBlocks.add(Material.TRAPPED_CHEST.getId());
|
playerBlocks.add(Material.TRAPPED_CHEST);
|
||||||
playerBlocks.add(Material.GOLD_PLATE.getId());
|
playerBlocks.add(Material.GOLD_PLATE);
|
||||||
playerBlocks.add(Material.IRON_PLATE.getId());
|
playerBlocks.add(Material.IRON_PLATE);
|
||||||
playerBlocks.add(Material.REDSTONE_COMPARATOR_OFF.getId());
|
playerBlocks.add(Material.REDSTONE_COMPARATOR_OFF);
|
||||||
playerBlocks.add(Material.REDSTONE_COMPARATOR_ON.getId());
|
playerBlocks.add(Material.REDSTONE_COMPARATOR_ON);
|
||||||
playerBlocks.add(Material.DAYLIGHT_DETECTOR.getId());
|
playerBlocks.add(Material.DAYLIGHT_DETECTOR);
|
||||||
playerBlocks.add(Material.DAYLIGHT_DETECTOR_INVERTED.getId());
|
playerBlocks.add(Material.DAYLIGHT_DETECTOR_INVERTED);
|
||||||
playerBlocks.add(Material.REDSTONE_BLOCK.getId());
|
playerBlocks.add(Material.REDSTONE_BLOCK);
|
||||||
playerBlocks.add(Material.HOPPER.getId());
|
playerBlocks.add(Material.HOPPER);
|
||||||
playerBlocks.add(Material.QUARTZ_BLOCK.getId());
|
playerBlocks.add(Material.QUARTZ_BLOCK);
|
||||||
playerBlocks.add(Material.QUARTZ_STAIRS.getId());
|
playerBlocks.add(Material.QUARTZ_STAIRS);
|
||||||
playerBlocks.add(Material.DROPPER.getId());
|
playerBlocks.add(Material.DROPPER);
|
||||||
playerBlocks.add(Material.SLIME_BLOCK.getId());
|
playerBlocks.add(Material.SLIME_BLOCK);
|
||||||
playerBlocks.add(Material.IRON_TRAPDOOR.getId());
|
playerBlocks.add(Material.IRON_TRAPDOOR);
|
||||||
playerBlocks.add(Material.PRISMARINE.getId());
|
playerBlocks.add(Material.PRISMARINE);
|
||||||
playerBlocks.add(Material.HAY_BLOCK.getId());
|
playerBlocks.add(Material.HAY_BLOCK);
|
||||||
playerBlocks.add(Material.CARPET.getId());
|
playerBlocks.add(Material.CARPET);
|
||||||
playerBlocks.add(Material.SEA_LANTERN.getId());
|
playerBlocks.add(Material.SEA_LANTERN);
|
||||||
playerBlocks.add(Material.RED_SANDSTONE_STAIRS.getId());
|
playerBlocks.add(Material.RED_SANDSTONE_STAIRS);
|
||||||
playerBlocks.add(Material.STONE_SLAB2.getId());
|
playerBlocks.add(Material.STONE_SLAB2);
|
||||||
playerBlocks.add(Material.ACACIA_FENCE.getId());
|
playerBlocks.add(Material.ACACIA_FENCE);
|
||||||
playerBlocks.add(Material.ACACIA_FENCE_GATE.getId());
|
playerBlocks.add(Material.ACACIA_FENCE_GATE);
|
||||||
playerBlocks.add(Material.BIRCH_FENCE.getId());
|
playerBlocks.add(Material.BIRCH_FENCE);
|
||||||
playerBlocks.add(Material.BIRCH_FENCE_GATE.getId());
|
playerBlocks.add(Material.BIRCH_FENCE_GATE);
|
||||||
playerBlocks.add(Material.DARK_OAK_FENCE.getId());
|
playerBlocks.add(Material.DARK_OAK_FENCE);
|
||||||
playerBlocks.add(Material.DARK_OAK_FENCE_GATE.getId());
|
playerBlocks.add(Material.DARK_OAK_FENCE_GATE);
|
||||||
playerBlocks.add(Material.JUNGLE_FENCE.getId());
|
playerBlocks.add(Material.JUNGLE_FENCE);
|
||||||
playerBlocks.add(Material.JUNGLE_FENCE_GATE.getId());
|
playerBlocks.add(Material.JUNGLE_FENCE_GATE);
|
||||||
playerBlocks.add(Material.SPRUCE_FENCE.getId());
|
playerBlocks.add(Material.SPRUCE_FENCE);
|
||||||
playerBlocks.add(Material.SPRUCE_FENCE_GATE.getId());
|
playerBlocks.add(Material.SPRUCE_FENCE_GATE);
|
||||||
playerBlocks.add(Material.ACACIA_DOOR.getId());
|
playerBlocks.add(Material.ACACIA_DOOR);
|
||||||
playerBlocks.add(Material.SPRUCE_DOOR.getId());
|
playerBlocks.add(Material.SPRUCE_DOOR);
|
||||||
playerBlocks.add(Material.DARK_OAK_DOOR.getId());
|
playerBlocks.add(Material.DARK_OAK_DOOR);
|
||||||
playerBlocks.add(Material.JUNGLE_DOOR.getId());
|
playerBlocks.add(Material.JUNGLE_DOOR);
|
||||||
playerBlocks.add(Material.BIRCH_DOOR.getId());
|
playerBlocks.add(Material.BIRCH_DOOR);
|
||||||
playerBlocks.add(Material.COAL_BLOCK.getId());
|
playerBlocks.add(Material.COAL_BLOCK);
|
||||||
playerBlocks.add(Material.REDSTONE_LAMP_OFF.getId());
|
playerBlocks.add(Material.REDSTONE_LAMP_OFF);
|
||||||
playerBlocks.add(Material.REDSTONE_LAMP_ON.getId());
|
playerBlocks.add(Material.REDSTONE_LAMP_ON);
|
||||||
playerBlocks.add(Material.PURPUR_BLOCK.getId());
|
playerBlocks.add(Material.PURPUR_BLOCK);
|
||||||
playerBlocks.add(Material.PURPUR_SLAB.getId());
|
playerBlocks.add(Material.PURPUR_SLAB);
|
||||||
playerBlocks.add(Material.PURPUR_DOUBLE_SLAB.getId());
|
playerBlocks.add(Material.PURPUR_DOUBLE_SLAB);
|
||||||
playerBlocks.add(Material.PURPUR_PILLAR.getId());
|
playerBlocks.add(Material.PURPUR_PILLAR);
|
||||||
playerBlocks.add(Material.PURPUR_STAIRS.getId());
|
playerBlocks.add(Material.PURPUR_STAIRS);
|
||||||
playerBlocks.add(Material.NETHER_WART_BLOCK.getId());
|
playerBlocks.add(Material.NETHER_WART_BLOCK);
|
||||||
playerBlocks.add(Material.RED_NETHER_BRICK.getId());
|
playerBlocks.add(Material.RED_NETHER_BRICK);
|
||||||
playerBlocks.add(Material.BONE_BLOCK.getId());
|
playerBlocks.add(Material.BONE_BLOCK);
|
||||||
|
|
||||||
//these are unnatural in the standard world, but not in the nether
|
//these are unnatural in the standard world, but not in the nether
|
||||||
if(environment != Environment.NETHER)
|
if(environment != Environment.NETHER)
|
||||||
{
|
{
|
||||||
playerBlocks.add(Material.NETHERRACK.getId());
|
playerBlocks.add(Material.NETHERRACK);
|
||||||
playerBlocks.add(Material.SOUL_SAND.getId());
|
playerBlocks.add(Material.SOUL_SAND);
|
||||||
playerBlocks.add(Material.GLOWSTONE.getId());
|
playerBlocks.add(Material.GLOWSTONE);
|
||||||
playerBlocks.add(Material.NETHER_BRICK.getId());
|
playerBlocks.add(Material.NETHER_BRICK);
|
||||||
playerBlocks.add(Material.NETHER_FENCE.getId());
|
playerBlocks.add(Material.NETHER_FENCE);
|
||||||
playerBlocks.add(Material.NETHER_BRICK_STAIRS.getId());
|
playerBlocks.add(Material.NETHER_BRICK_STAIRS);
|
||||||
playerBlocks.add(Material.MAGMA.getId());
|
playerBlocks.add(Material.MAGMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
//these are unnatural in the standard and nether worlds, but not in the end
|
//these are unnatural in the standard and nether worlds, but not in the end
|
||||||
if(environment != Environment.THE_END)
|
if(environment != Environment.THE_END)
|
||||||
{
|
{
|
||||||
playerBlocks.add(Material.OBSIDIAN.getId());
|
playerBlocks.add(Material.OBSIDIAN);
|
||||||
playerBlocks.add(Material.ENDER_STONE.getId());
|
playerBlocks.add(Material.ENDER_STONE);
|
||||||
playerBlocks.add(Material.ENDER_PORTAL_FRAME.getId());
|
playerBlocks.add(Material.ENDER_PORTAL_FRAME);
|
||||||
playerBlocks.add(Material.CHORUS_PLANT.getId());
|
playerBlocks.add(Material.CHORUS_PLANT);
|
||||||
playerBlocks.add(Material.CHORUS_FLOWER.getId());
|
playerBlocks.add(Material.CHORUS_FLOWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
//these are unnatural in sandy biomes, but not elsewhere
|
//these are unnatural in sandy biomes, but not elsewhere
|
||||||
if(biome == Biome.DESERT || biome == Biome.DESERT_HILLS || biome == Biome.BEACHES || environment != Environment.NORMAL)
|
if(biome == Biome.DESERT || biome == Biome.DESERT_HILLS || biome == Biome.BEACHES || environment != Environment.NORMAL)
|
||||||
{
|
{
|
||||||
playerBlocks.add(Material.LEAVES.getId());
|
playerBlocks.add(Material.LEAVES);
|
||||||
playerBlocks.add(Material.LEAVES_2.getId());
|
playerBlocks.add(Material.LEAVES_2);
|
||||||
playerBlocks.add(Material.LOG.getId());
|
playerBlocks.add(Material.LOG);
|
||||||
playerBlocks.add(Material.LOG_2.getId());
|
playerBlocks.add(Material.LOG_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return playerBlocks;
|
return playerBlocks;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user