Skip to content

Commit

Permalink
Add means of converting a IChiseledBlockTileEntity ( TileEntity ) int…
Browse files Browse the repository at this point in the history
…o a IBitAccess.
  • Loading branch information
AlgorithmX2 committed Mar 11, 2018
1 parent 1cd4f9c commit 670c41b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/mod/chiselsandbits/api/IChiseledBlockTileEntity.java
Expand Up @@ -8,6 +8,17 @@
public interface IChiseledBlockTileEntity
{

/**
* Used to access the contents of the chiseled block tile entity, context
* about world will be derived from the world on the tile entity.
*
* Note: that invalid world / position data will prevent some operations
* such as caving changes.
*
* @return {@link IBitAccess} for the tile entity.
*/
IBitAccess getBlockAccess();

/**
* Used to write Tile Data into cross world format, can be invoked via
* interface or via reflection on the tile itself.
Expand Down
Expand Up @@ -7,6 +7,7 @@

import mod.chiselsandbits.api.EventBlockBitPostModification;
import mod.chiselsandbits.api.EventFullBlockRestoration;
import mod.chiselsandbits.api.IBitAccess;
import mod.chiselsandbits.api.IChiseledBlockTileEntity;
import mod.chiselsandbits.api.ItemType;
import mod.chiselsandbits.chiseledblock.data.VoxelBlob;
Expand Down Expand Up @@ -956,4 +957,18 @@ public void finishUpdate()
// nothin.
}

@Override
public IBitAccess getBlockAccess()
{
VoxelBlob mask = VoxelBlob.NULL_BLOB;

if ( worldObj != null )
{
mask = new VoxelBlob();
MCMultipartProxy.proxyMCMultiPart.addFiller( getWorld(), getPos(), mask );
}

return new BitAccess( worldObj, pos, getBlob(), mask );
}

}

0 comments on commit 670c41b

Please sign in to comment.