mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-30 04:34:43 +02:00
Change from using Block to BlockState in many locations
Convert Herbalism ability to use BlockState instead of Block. Move all block checks back to BlockChecks. Don't need this if we're using BlockState Convert Excavation to BlockState. We don't need to return booleans here because we never edit the block state.Switch ModCheck.getCustomBlock to use BlockState More work on the conversion to BlockState More conversion to BlockState Better way to handle mining drops, I believe. Remove useless imports. A test of making the diff look nicer BlockChecks diff cleanup Herbalism diff cleanup Gotta update the block states here. Moar blockstate. Little more blockState stuff. Even more blockstate.
This commit is contained in:
@ -4,6 +4,7 @@ import java.io.IOException;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public interface ChunkManager {
|
||||
@ -60,6 +61,7 @@ public interface ChunkManager {
|
||||
public void saveChunk(int cx, int cz, World world);
|
||||
|
||||
public boolean isChunkLoaded(int cx, int cz, World world);
|
||||
|
||||
/**
|
||||
* Informs the ChunkletManager a chunk is loaded
|
||||
*
|
||||
@ -128,6 +130,14 @@ public interface ChunkManager {
|
||||
*/
|
||||
public boolean isTrue(Block block);
|
||||
|
||||
/**
|
||||
* Check to see if a given BlockState location is set to true
|
||||
*
|
||||
* @param location BlockState location to check
|
||||
* @return true if the given BlockState location is set to true, false if otherwise
|
||||
*/
|
||||
public boolean isTrue(BlockState blockState);
|
||||
|
||||
/**
|
||||
* Set a given location to true, should create stores as necessary if the location does not exist
|
||||
*
|
||||
@ -145,6 +155,13 @@ public interface ChunkManager {
|
||||
*/
|
||||
public void setTrue(Block block);
|
||||
|
||||
/**
|
||||
* Set a given BlockState location to true, should create stores as necessary if the location does not exist
|
||||
*
|
||||
* @param block BlockState location to set
|
||||
*/
|
||||
public void setTrue(BlockState blockState);
|
||||
|
||||
/**
|
||||
* Set a given location to false, should not create stores if one does not exist for the given location
|
||||
*
|
||||
@ -162,6 +179,13 @@ public interface ChunkManager {
|
||||
*/
|
||||
public void setFalse(Block block);
|
||||
|
||||
/**
|
||||
* Set a given BlockState location to false, should not create stores if one does not exist for the given location
|
||||
*
|
||||
* @param block BlockState location to set
|
||||
*/
|
||||
public void setFalse(BlockState blockState);
|
||||
|
||||
/**
|
||||
* Delete any ChunkletStores that are empty
|
||||
*/
|
||||
|
@ -14,6 +14,7 @@ import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.getspout.spoutapi.chunkstore.mcMMOSimpleRegionFile;
|
||||
|
||||
@ -317,6 +318,15 @@ public class HashChunkManager implements ChunkManager {
|
||||
return isTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isTrue(BlockState blockState) {
|
||||
if (blockState == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isTrue(blockState.getX(), blockState.getY(), blockState.getZ(), blockState.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setTrue(int x, int y, int z, World world) {
|
||||
if (world == null)
|
||||
@ -352,6 +362,14 @@ public class HashChunkManager implements ChunkManager {
|
||||
setTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrue(BlockState blockState) {
|
||||
if (blockState == null)
|
||||
return;
|
||||
|
||||
setTrue(blockState.getX(), blockState.getY(), blockState.getZ(), blockState.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setFalse(int x, int y, int z, World world) {
|
||||
if (world == null)
|
||||
@ -380,12 +398,22 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void setFalse(Block block) {
|
||||
if (block == null)
|
||||
if (block == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setFalse(block.getX(), block.getY(), block.getZ(), block.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setFalse(BlockState blockState) {
|
||||
if (blockState == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setFalse(blockState.getX(), blockState.getY(), blockState.getZ(), blockState.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void cleanUp() {}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class NullChunkManager implements ChunkManager {
|
||||
@ -73,18 +74,29 @@ public class NullChunkManager implements ChunkManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTrue(BlockState blockState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrue(int x, int y, int z, World world) {}
|
||||
|
||||
@Override
|
||||
public void setTrue(Block block) {}
|
||||
|
||||
@Override
|
||||
public void setTrue(BlockState blockState) {}
|
||||
|
||||
@Override
|
||||
public void setFalse(int x, int y, int z, World world) {}
|
||||
|
||||
@Override
|
||||
public void setFalse(Block block) {}
|
||||
|
||||
@Override
|
||||
public void setFalse(BlockState blockState) {}
|
||||
|
||||
@Override
|
||||
public void cleanUp() {}
|
||||
}
|
Reference in New Issue
Block a user