Merge pull request #660 from thatsIch/b-659-NPE-sculpting-tool
Fixes #659 NPE on usage of the FZ sculpting tool
This commit is contained in:
commit
97dabc4a5c
1 changed files with 9 additions and 3 deletions
|
@ -41,6 +41,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.definitions.Items;
|
||||||
import appeng.api.parts.IFacadePart;
|
import appeng.api.parts.IFacadePart;
|
||||||
import appeng.api.parts.IPartHost;
|
import appeng.api.parts.IPartHost;
|
||||||
import appeng.api.parts.IPartItem;
|
import appeng.api.parts.IPartItem;
|
||||||
|
@ -92,11 +93,16 @@ public class PartPlacement
|
||||||
if ( te instanceof IPartHost && this.wasCanceled )
|
if ( te instanceof IPartHost && this.wasCanceled )
|
||||||
event.setCanceled( true );
|
event.setCanceled( true );
|
||||||
}
|
}
|
||||||
else if ( event.entityPlayer != null )
|
else
|
||||||
{
|
{
|
||||||
ItemStack held = event.entityPlayer.getHeldItem();
|
ItemStack held = event.entityPlayer.getHeldItem();
|
||||||
boolean supportedItem = AEApi.instance().items().itemMemoryCard.sameAsStack( held )
|
final Items items = AEApi.instance().items();
|
||||||
|| AEApi.instance().items().itemColorApplicator.sameAsStack( held );
|
|
||||||
|
final boolean sameAsMemoryCard = items.itemMemoryCard != null && items.itemMemoryCard.sameAsStack( held );
|
||||||
|
final boolean sameAsColorApp = items.itemColorApplicator != null && items.itemColorApplicator.sameAsStack( held );
|
||||||
|
|
||||||
|
final boolean supportedItem = sameAsMemoryCard || sameAsColorApp;
|
||||||
|
|
||||||
if ( event.entityPlayer.isSneaking() && held != null && supportedItem )
|
if ( event.entityPlayer.isSneaking() && held != null && supportedItem )
|
||||||
{
|
{
|
||||||
NetworkHandler.instance.sendToServer( new PacketClick( event.x, event.y, event.z, event.face, 0, 0, 0 ) );
|
NetworkHandler.instance.sendToServer( new PacketClick( event.x, event.y, event.z, event.face, 0, 0, 0 ) );
|
||||||
|
|
Loading…
Reference in a new issue