API Synced or Spatial, also one last change with grinder.
This commit is contained in:
parent
fdc263702e
commit
1a1025b8c9
6 changed files with 64 additions and 1 deletions
|
@ -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() );
|
||||
|
|
|
@ -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...
|
||||
*/
|
||||
|
|
32
core/api/imc/IMCBlackListSpatial.java
Normal file
32
core/api/imc/IMCBlackListSpatial.java
Normal file
|
@ -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() );
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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<Block> blacklisted = new HashSet();
|
||||
|
||||
private HashMap<Class<? extends TileEntity>, IMovableHandler> Valid = new HashMap<Class<? extends TileEntity>, IMovableHandler>();
|
||||
private LinkedList<Class<? extends TileEntity>> test = new LinkedList<Class<? extends TileEntity>>();
|
||||
private LinkedList<IMovableHandler> handlers = new LinkedList<IMovableHandler>();
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<WorldCoord> updates = new LinkedList<WorldCoord>();
|
||||
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue