mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 09:39:05 +00:00
Better Soulstone Handling
This commit is contained in:
1 parent
89f97c35df
commit
90a788ed47
3 files changed
+11
-11
No files matched your search
@@ -69,7 +69,7 @@ public class ServerEventsHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isRemote && item.getItem() == CustomItems.soulstoneEmpty && event.target instanceof EntityLivingBase) {
|
||||
if(!isRemote && item.getItem() == CustomItems.soulstoneEmpty && npcInteracted) {
|
||||
((ItemSoulstoneEmpty)item.getItem()).store((EntityLivingBase)event.target, item, event.entityPlayer);
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s PICKED ENTITY %s", "SOULSTONE", event.entityPlayer.getCommandSenderName(), event.target));
|
||||
@@ -77,7 +77,7 @@ public class ServerEventsHandler {
|
||||
}
|
||||
|
||||
if(item.getItem() == CustomItems.wand && npcInteracted && !isRemote){
|
||||
if (!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.NPC_GUI)){
|
||||
if (!CustomNpcsPermissions.hasPermission(event.entityPlayer, CustomNpcsPermissions.NPC_GUI)){
|
||||
return;
|
||||
}
|
||||
event.setCanceled(true);
|
||||
@@ -87,7 +87,7 @@ public class ServerEventsHandler {
|
||||
}
|
||||
}
|
||||
else if(item.getItem() == CustomItems.cloner && !isRemote && !(event.target instanceof EntityPlayer)){
|
||||
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_CLONER))
|
||||
if(!CustomNpcsPermissions.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_CLONER))
|
||||
return;
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
if(!event.target.writeToNBTOptional(compound))
|
||||
|
||||
@@ -400,7 +400,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
ItemStack currentItem = player.inventory.getCurrentItem();
|
||||
if (currentItem != null) {
|
||||
Item item = currentItem.getItem();
|
||||
if (item == CustomItems.cloner || item == CustomItems.wand || item == CustomItems.mount || item == CustomItems.scripter) {
|
||||
if (item == CustomItems.cloner || item == CustomItems.wand || item == CustomItems.mount || item == CustomItems.scripter || item == CustomItems.soulstoneEmpty) {
|
||||
setAttackTarget(null);
|
||||
setRevengeTarget(null);
|
||||
return true;
|
||||
|
||||
@@ -32,9 +32,9 @@ public class ItemSoulstoneEmpty extends Item {
|
||||
GameRegistry.registerItem(this, name);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public boolean store(EntityLivingBase entity, ItemStack stack, EntityPlayer player) {
|
||||
if(!hasPermission(entity, player) || entity instanceof EntityPlayer)
|
||||
if(!canSoulStone(entity, player) || entity instanceof EntityPlayer)
|
||||
return false;
|
||||
ItemStack stone = new ItemStack(CustomItems.soulstoneFull);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
@@ -44,7 +44,7 @@ public class ItemSoulstoneEmpty extends Item {
|
||||
if(stone.stackTagCompound == null)
|
||||
stone.stackTagCompound = new NBTTagCompound();
|
||||
stone.stackTagCompound.setTag("Entity", compound);
|
||||
|
||||
|
||||
String name = EntityList.getEntityString(entity);
|
||||
if (name == null)
|
||||
name = "generic";
|
||||
@@ -60,18 +60,18 @@ public class ItemSoulstoneEmpty extends Item {
|
||||
else if(entity instanceof EntityLiving && ((EntityLiving)entity).hasCustomNameTag())
|
||||
stone.stackTagCompound.setString("DisplayName", ((EntityLiving)entity).getCustomNameTag());
|
||||
NoppesUtilServer.GivePlayerItem(player, player, stone);
|
||||
|
||||
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
stack.splitStack(1);
|
||||
if(stack.stackSize <= 0)
|
||||
player.destroyCurrentEquippedItem();
|
||||
}
|
||||
|
||||
|
||||
entity.isDead = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasPermission(EntityLivingBase entity, EntityPlayer player){
|
||||
|
||||
public boolean canSoulStone(EntityLivingBase entity, EntityPlayer player){
|
||||
if(NoppesUtilServer.isOp(player) && player.capabilities.isCreativeMode)
|
||||
return true;
|
||||
if(CustomNpcsPermissions.enabled() && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.SOULSTONE_ALL))
|
||||
|
||||
Reference in new issue
Block a user