Skip to content

Commit

Permalink
Merge pull request #660 from thatsIch/b-659-NPE-sculpting-tool
Browse files Browse the repository at this point in the history
Fixes #659 NPE on usage of the FZ sculpting tool
  • Loading branch information
thatsIch committed Dec 30, 2014
2 parents 02e59fa + fec00fe commit 97dabc4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/appeng/parts/PartPlacement.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import cpw.mods.fml.common.gameevent.TickEvent;

import appeng.api.AEApi;
import appeng.api.definitions.Items;
import appeng.api.parts.IFacadePart;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartItem;
Expand Down Expand Up @@ -92,11 +93,16 @@ public void playerInteract(PlayerInteractEvent event)
if ( te instanceof IPartHost && this.wasCanceled )
event.setCanceled( true );
}
else if ( event.entityPlayer != null )
else
{
ItemStack held = event.entityPlayer.getHeldItem();
boolean supportedItem = AEApi.instance().items().itemMemoryCard.sameAsStack( held )
|| AEApi.instance().items().itemColorApplicator.sameAsStack( held );
final Items items = AEApi.instance().items();

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 )
{
NetworkHandler.instance.sendToServer( new PacketClick( event.x, event.y, event.z, event.face, 0, 0, 0 ) );
Expand Down

0 comments on commit 97dabc4

Please sign in to comment.