diff --git a/core/AppEng.java b/core/AppEng.java index 5da22af3..67e698d8 100644 --- a/core/AppEng.java +++ b/core/AppEng.java @@ -6,6 +6,7 @@ import java.util.concurrent.TimeUnit; import appeng.api.config.TunnelType; import appeng.core.api.IIMCHandler; +import appeng.core.api.imc.IMCBlackListSpatial; import appeng.core.api.imc.IMCGrinder; import appeng.core.api.imc.IMCMatterCannon; import appeng.core.api.imc.IMCP2PAttunement; @@ -71,6 +72,7 @@ public class AppEng public AppEng() { instance = this; + IMCHandlers.put( "blacklist-block-spatial", new IMCBlackListSpatial() ); IMCHandlers.put( "whitelist-spatial", new IMCSpatial() ); IMCHandlers.put( "add-grindable", new IMCGrinder() ); IMCHandlers.put( "add-mattercannon-ammo", new IMCMatterCannon() ); diff --git a/core/Registration.java b/core/Registration.java index 6e72e4a2..24c37295 100644 --- a/core/Registration.java +++ b/core/Registration.java @@ -647,6 +647,11 @@ public class Registration IMovableRegistry mr = AEApi.instance().registries().moveable(); + /** + * You can't move bed rock. + */ + mr.blacklistBlock( net.minecraft.init.Blocks.bedrock ); + /* * White List Vanilla... */ diff --git a/core/api/imc/IMCBlackListSpatial.java b/core/api/imc/IMCBlackListSpatial.java new file mode 100644 index 00000000..e2e78e40 --- /dev/null +++ b/core/api/imc/IMCBlackListSpatial.java @@ -0,0 +1,32 @@ +package appeng.core.api.imc; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import appeng.api.AEApi; +import appeng.core.AELog; +import appeng.core.api.IIMCHandler; +import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; + +public class IMCBlackListSpatial implements IIMCHandler +{ + + @Override + public void post(IMCMessage m) + { + + ItemStack is = m.getItemStackValue(); + if ( is != null ) + { + Block blk = Block.getBlockFromItem( is.getItem() ); + if ( blk != null ) + { + AEApi.instance().registries().moveable().blacklistBlock( blk ); + return; + } + } + + AELog.info( "Bad Block blacklisted by " + m.getSender() ); + + } + +} diff --git a/core/features/registries/MovableTileRegistry.java b/core/features/registries/MovableTileRegistry.java index 7f34b7b3..1bb5916f 100644 --- a/core/features/registries/MovableTileRegistry.java +++ b/core/features/registries/MovableTileRegistry.java @@ -1,8 +1,10 @@ package appeng.core.features.registries; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedList; +import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; import appeng.api.exceptions.AppEngException; import appeng.api.movable.IMovableHandler; @@ -13,6 +15,8 @@ import appeng.spatial.DefaultSpatialHandler; public class MovableTileRegistry implements IMovableRegistry { + private HashSet blacklisted = new HashSet(); + private HashMap, IMovableHandler> Valid = new HashMap, IMovableHandler>(); private LinkedList> test = new LinkedList>(); private LinkedList handlers = new LinkedList(); @@ -100,7 +104,8 @@ public class MovableTileRegistry implements IMovableRegistry if ( c.getName().equals( TileEntity.class.getName() ) ) { - throw new RuntimeException( new AppEngException( "Someone tried to make all tiles movable, this is a clear violation of the purpose of the white list." ) ); + throw new RuntimeException( new AppEngException( + "Someone tried to make all tiles movable, this is a clear violation of the purpose of the white list." ) ); } test.add( c ); @@ -126,4 +131,15 @@ public class MovableTileRegistry implements IMovableRegistry return dsh; } + @Override + public void blacklistBlock(Block blk) + { + blacklisted.add( blk ); + } + + public boolean isBlacklisted(Block blk) + { + return blacklisted.contains( blk ); + } + } diff --git a/spatial/CachedPlane.java b/spatial/CachedPlane.java index 125c5d33..10c81f04 100644 --- a/spatial/CachedPlane.java +++ b/spatial/CachedPlane.java @@ -80,6 +80,10 @@ public class CachedPlane public boolean dontSkip(int y) { + ExtendedBlockStorage extendedblockstorage = storage[y >> 4]; + if ( reg.isBlacklisted( extendedblockstorage.getBlockByExtId( x, y & 15, z ) ) ) + return false; + return skipThese == null ? true : !skipThese.contains( y ); } @@ -114,6 +118,7 @@ public class CachedPlane World wrld; Block matrixFrame = AEApi.instance().blocks().blockMatrixFrame.block(); + IMovableRegistry reg = AEApi.instance().registries().moveable(); LinkedList updates = new LinkedList(); diff --git a/tile/grindstone/TileGrinder.java b/tile/grindstone/TileGrinder.java index ea7fc93d..1702eb0f 100644 --- a/tile/grindstone/TileGrinder.java +++ b/tile/grindstone/TileGrinder.java @@ -35,6 +35,9 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable private void addItem(InventoryAdaptor sia, ItemStack output) { + if ( output == null ) + return; + ItemStack notAdded = sia.addItems( output ); if ( notAdded != null ) {