|
@@ -41,13 +41,13 @@ import me.km.api.Location;
|
|
import me.km.api.TitleAPI;
|
|
import me.km.api.TitleAPI;
|
|
import me.km.dimensions.ModDimensions;
|
|
import me.km.dimensions.ModDimensions;
|
|
import me.km.effects.EffectUtils;
|
|
import me.km.effects.EffectUtils;
|
|
-import me.km.entities.EntityItemProjectile;
|
|
|
|
import me.km.inventory.InventoryUtils;
|
|
import me.km.inventory.InventoryUtils;
|
|
import me.km.permissions.Permissions;
|
|
import me.km.permissions.Permissions;
|
|
import me.km.table.Table;
|
|
import me.km.table.Table;
|
|
import me.km.utils.ItemStackUtils;
|
|
import me.km.utils.ItemStackUtils;
|
|
import me.km.utils.RecipeUtils;
|
|
import me.km.utils.RecipeUtils;
|
|
import me.km.utils.ReflectionUtils;
|
|
import me.km.utils.ReflectionUtils;
|
|
|
|
+import me.km.utils.SpecialBlockUtils;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.state.IBlockState;
|
|
import net.minecraft.block.state.IBlockState;
|
|
import net.minecraft.command.ICommandSender;
|
|
import net.minecraft.command.ICommandSender;
|
|
@@ -63,14 +63,14 @@ import net.minecraft.entity.monster.EntityCreeper;
|
|
import net.minecraft.entity.passive.EntityVillager;
|
|
import net.minecraft.entity.passive.EntityVillager;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.entity.player.EntityPlayerMP;
|
|
import net.minecraft.entity.player.EntityPlayerMP;
|
|
-import net.minecraft.entity.player.InventoryPlayer;
|
|
|
|
import net.minecraft.entity.projectile.EntityPotion;
|
|
import net.minecraft.entity.projectile.EntityPotion;
|
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
|
import net.minecraft.inventory.IInventory;
|
|
import net.minecraft.inventory.IInventory;
|
|
-import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.network.play.client.CPacketChatMessage;
|
|
import net.minecraft.network.play.client.CPacketChatMessage;
|
|
|
|
+import net.minecraft.network.play.client.CPacketClientStatus;
|
|
import net.minecraft.network.play.server.SPacketSpawnPosition;
|
|
import net.minecraft.network.play.server.SPacketSpawnPosition;
|
|
|
|
+import net.minecraft.potion.Potion;
|
|
import net.minecraft.potion.PotionUtils;
|
|
import net.minecraft.potion.PotionUtils;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.tileentity.TileEntityChest;
|
|
import net.minecraft.tileentity.TileEntityChest;
|
|
@@ -78,7 +78,9 @@ import net.minecraft.tileentity.TileEntitySign;
|
|
import net.minecraft.util.DamageSource;
|
|
import net.minecraft.util.DamageSource;
|
|
import net.minecraft.util.EnumFacing;
|
|
import net.minecraft.util.EnumFacing;
|
|
import net.minecraft.util.EnumParticleTypes;
|
|
import net.minecraft.util.EnumParticleTypes;
|
|
|
|
+import net.minecraft.util.ResourceLocation;
|
|
import net.minecraft.util.SoundCategory;
|
|
import net.minecraft.util.SoundCategory;
|
|
|
|
+import net.minecraft.util.SoundEvent;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.math.Vec3d;
|
|
import net.minecraft.util.math.Vec3d;
|
|
import net.minecraft.util.text.TextComponentString;
|
|
import net.minecraft.util.text.TextComponentString;
|
|
@@ -90,10 +92,6 @@ public class SnuviParser
|
|
private final BiFunction<Object[], Script, Object>[] methods;
|
|
private final BiFunction<Object[], Script, Object>[] methods;
|
|
private final HashBiMap<String, Integer> translator;
|
|
private final HashBiMap<String, Integer> translator;
|
|
|
|
|
|
- private void nothing()
|
|
|
|
- {
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public Integer translateMethod(String s)
|
|
public Integer translateMethod(String s)
|
|
{
|
|
{
|
|
return translator.get(s);
|
|
return translator.get(s);
|
|
@@ -137,6 +135,18 @@ public class SnuviParser
|
|
registerConsumer(list, "clearbenchmark", (args, qd) ->
|
|
registerConsumer(list, "clearbenchmark", (args, qd) ->
|
|
qd.clearBenchmark());
|
|
qd.clearBenchmark());
|
|
|
|
|
|
|
|
+ // -------------------------------------------------------------
|
|
|
|
+ // Command-Bibliothek
|
|
|
|
+ // -------------------------------------------------------------
|
|
|
|
+ registerConsumer(list, "command.add", (args, qd) ->
|
|
|
|
+ KajetansMod.scripts.registerScriptCommand(args[0].toString()));
|
|
|
|
+ registerConsumer(list, "command.remove", (args, qd) ->
|
|
|
|
+ KajetansMod.scripts.unregisterScriptCommand(args[0].toString()));
|
|
|
|
+ registerFunction(list, "command.exists", (args, qd) ->
|
|
|
|
+ KajetansMod.scripts.isRegisteredScriptCommand(args[0].toString()));
|
|
|
|
+ registerConsumer(list, "command.clear", (args, qd) ->
|
|
|
|
+ KajetansMod.scripts.clearScriptCommands());
|
|
|
|
+
|
|
// -------------------------------------------------------------
|
|
// -------------------------------------------------------------
|
|
// Permission-Bibliothek
|
|
// Permission-Bibliothek
|
|
// -------------------------------------------------------------
|
|
// -------------------------------------------------------------
|
|
@@ -178,8 +188,8 @@ public class SnuviParser
|
|
giveItem(args));
|
|
giveItem(args));
|
|
registerConsumer(list, "player.shootprojectile", (args, qd) ->
|
|
registerConsumer(list, "player.shootprojectile", (args, qd) ->
|
|
EffectUtils.launchProjectile((EntityPlayer) args[0], getClass(args[1].toString()), ScriptUtils.getDouble(args[2]), args[3]));
|
|
EffectUtils.launchProjectile((EntityPlayer) args[0], getClass(args[1].toString()), ScriptUtils.getDouble(args[2]), args[3]));
|
|
- registerConsumer(list, "player.respawn", (args, qd) -> nothing()
|
|
|
|
- /* TODO ((EntityPlayerMP) args[0]).respawnPlayer()*/);
|
|
|
|
|
|
+ registerConsumer(list, "player.respawn", (args, qd) ->
|
|
|
|
+ ((EntityPlayerMP) args[0]).connection.processClientStatus(new CPacketClientStatus(CPacketClientStatus.State.PERFORM_RESPAWN)));
|
|
registerConsumer(list, "player.inventorytolist", (args, qd) ->
|
|
registerConsumer(list, "player.inventorytolist", (args, qd) ->
|
|
qd.setVar(args[0], ((EntityPlayer) args[1]).inventory.mainInventory));
|
|
qd.setVar(args[0], ((EntityPlayer) args[1]).inventory.mainInventory));
|
|
registerFunction(list, "player.getamount", (args, qd) ->
|
|
registerFunction(list, "player.getamount", (args, qd) ->
|
|
@@ -223,7 +233,7 @@ public class SnuviParser
|
|
registerFunction(list, "player.hasfly", (args, qd) ->
|
|
registerFunction(list, "player.hasfly", (args, qd) ->
|
|
((EntityPlayer) args[0]).capabilities.allowFlying);
|
|
((EntityPlayer) args[0]).capabilities.allowFlying);
|
|
registerFunction(list, "player.getlastdamager", (args, qd) ->
|
|
registerFunction(list, "player.getlastdamager", (args, qd) ->
|
|
- ((EntityPlayer) args[0]).getLastDamageSource().getSourceOfDamage());
|
|
|
|
|
|
+ getLastDamager(args));
|
|
registerConsumer(list, "player.settag", (args, qd) ->
|
|
registerConsumer(list, "player.settag", (args, qd) ->
|
|
setTag(args));
|
|
setTag(args));
|
|
registerFunction(list, "player.gettag", (args, qd) ->
|
|
registerFunction(list, "player.gettag", (args, qd) ->
|
|
@@ -264,6 +274,8 @@ public class SnuviParser
|
|
qd.setVar(args[0], KajetansMod.chatManager.getRanks((EntityPlayer) args[1])));
|
|
qd.setVar(args[0], KajetansMod.chatManager.getRanks((EntityPlayer) args[1])));
|
|
registerConsumer(list, "rank.register", (args, qd) ->
|
|
registerConsumer(list, "rank.register", (args, qd) ->
|
|
KajetansMod.chatManager.registerRank(args[0].toString(), ScriptUtils.getInt(args[1]), args[2].toString()));
|
|
KajetansMod.chatManager.registerRank(args[0].toString(), ScriptUtils.getInt(args[1]), args[2].toString()));
|
|
|
|
+ registerConsumer(list, "rank.player", (args, qd) ->
|
|
|
|
+ KajetansMod.chatManager.registerPlayerRank(UUID.fromString(args[0].toString()), args[1].toString()));
|
|
registerConsumer(list, "rank.clear", (args, qd) ->
|
|
registerConsumer(list, "rank.clear", (args, qd) ->
|
|
KajetansMod.chatManager.clearRanks());
|
|
KajetansMod.chatManager.clearRanks());
|
|
|
|
|
|
@@ -312,7 +324,7 @@ public class SnuviParser
|
|
registerFunction(list, "item.getdata", (args, qd) ->
|
|
registerFunction(list, "item.getdata", (args, qd) ->
|
|
((ItemStack) args[0]).getMetadata());
|
|
((ItemStack) args[0]).getMetadata());
|
|
registerConsumer(list, "item.setdata", (args, qd) ->
|
|
registerConsumer(list, "item.setdata", (args, qd) ->
|
|
- ((ItemStack) args[0]).setItemDamage((short) ScriptUtils.getInt(args[1])));
|
|
|
|
|
|
+ ((ItemStack) args[0]).setItemDamage(ScriptUtils.getInt(args[1])));
|
|
registerFunction(list, "item.getamount", (args, qd) ->
|
|
registerFunction(list, "item.getamount", (args, qd) ->
|
|
((ItemStack) args[0]).getCount());
|
|
((ItemStack) args[0]).getCount());
|
|
registerConsumer(list, "item.setamount", (args, qd) ->
|
|
registerConsumer(list, "item.setamount", (args, qd) ->
|
|
@@ -418,7 +430,7 @@ public class SnuviParser
|
|
registerConsumer(list, "job.registerjob", (args, qd) ->
|
|
registerConsumer(list, "job.registerjob", (args, qd) ->
|
|
KajetansMod.jobs.registerJob(ScriptUtils.getByte(args[0]), ScriptUtils.connect(args, 1)));
|
|
KajetansMod.jobs.registerJob(ScriptUtils.getByte(args[0]), ScriptUtils.connect(args, 1)));
|
|
registerConsumer(list, "job.registerrecipe", (args, qd) ->
|
|
registerConsumer(list, "job.registerrecipe", (args, qd) ->
|
|
- KajetansMod.jobs.registerRecipe(ScriptUtils.getByte(args[0]), Item.getByNameOrId(args[1].toString()), ScriptUtils.getByte(args[2])));
|
|
|
|
|
|
+ KajetansMod.jobs.registerRecipe(ScriptUtils.getByte(args[0]), ScriptUtils.getItem(args[1].toString()), ScriptUtils.getByte(args[2])));
|
|
registerConsumer(list, "job.registermaterial", (args, qd) ->
|
|
registerConsumer(list, "job.registermaterial", (args, qd) ->
|
|
KajetansMod.jobs.registerPreferedBlock(ScriptUtils.getByte(args[0]), Block.getBlockFromName(args[1].toString())));
|
|
KajetansMod.jobs.registerPreferedBlock(ScriptUtils.getByte(args[0]), Block.getBlockFromName(args[1].toString())));
|
|
registerConsumer(list, "job.registerskill", (args, qd) ->
|
|
registerConsumer(list, "job.registerskill", (args, qd) ->
|
|
@@ -432,7 +444,7 @@ public class SnuviParser
|
|
registerFunction(list, "job.hasjob", (args, qd) ->
|
|
registerFunction(list, "job.hasjob", (args, qd) ->
|
|
KajetansMod.jobs.hasJob((EntityPlayer) args[0], ScriptUtils.getByte(args[1])));
|
|
KajetansMod.jobs.hasJob((EntityPlayer) args[0], ScriptUtils.getByte(args[1])));
|
|
registerFunction(list, "job.hasrecipe", (args, qd) ->
|
|
registerFunction(list, "job.hasrecipe", (args, qd) ->
|
|
- KajetansMod.jobs.hasRecipe((EntityPlayer) args[0], Item.getByNameOrId(args[1].toString())));
|
|
|
|
|
|
+ KajetansMod.jobs.hasRecipe((EntityPlayer) args[0], ScriptUtils.getItem(args[1].toString())));
|
|
registerConsumer(list, "job.getjobs", (args, qd) ->
|
|
registerConsumer(list, "job.getjobs", (args, qd) ->
|
|
qd.setVar(args[0], KajetansMod.jobs.getJobs((EntityPlayer) args[1])));
|
|
qd.setVar(args[0], KajetansMod.jobs.getJobs((EntityPlayer) args[1])));
|
|
registerFunction(list, "job.isregmaterial", (args, qd) ->
|
|
registerFunction(list, "job.isregmaterial", (args, qd) ->
|
|
@@ -534,9 +546,9 @@ public class SnuviParser
|
|
registerConsumer(list, "entity.setvars", (args, qd) ->
|
|
registerConsumer(list, "entity.setvars", (args, qd) ->
|
|
ScriptVars.setEntityVars(qd, Utils.getNearestEntity(((Location) args[0]).getWorld(), ((Location) args[0]).getPos(), 3, (Class<? extends Entity>) getClass("net.minecraft.entity." + args[1]))));
|
|
ScriptVars.setEntityVars(qd, Utils.getNearestEntity(((Location) args[0]).getWorld(), ((Location) args[0]).getPos(), 3, (Class<? extends Entity>) getClass("net.minecraft.entity." + args[1]))));
|
|
registerConsumer(list, "entity.addeffect", (args, qd) ->
|
|
registerConsumer(list, "entity.addeffect", (args, qd) ->
|
|
- EffectUtils.addPotionTo((EntityLivingBase) args[0], Utils.getPotion(args[1].toString()), ScriptUtils.getInt(args[2]), ScriptUtils.getInt(args[3])));
|
|
|
|
|
|
+ EffectUtils.addPotionTo((EntityLivingBase) args[0], Potion.getPotionFromResourceLocation(args[1].toString()), ScriptUtils.getInt(args[2]), ScriptUtils.getInt(args[3])));
|
|
registerFunction(list, "entity.haseffect", (args, qd) ->
|
|
registerFunction(list, "entity.haseffect", (args, qd) ->
|
|
- ((EntityLivingBase) args[0]).isPotionActive(Utils.getPotion(args[1].toString())));
|
|
|
|
|
|
+ ((EntityLivingBase) args[0]).isPotionActive(Potion.getPotionFromResourceLocation(args[1].toString())));
|
|
registerConsumer(list, "entity.goto", (args, qd) ->
|
|
registerConsumer(list, "entity.goto", (args, qd) ->
|
|
NmsUtilities.walkTo((EntityLiving) args[0], ((Location) args[1]).getPos(), ScriptUtils.getDouble(args[2])));
|
|
NmsUtilities.walkTo((EntityLiving) args[0], ((Location) args[1]).getPos(), ScriptUtils.getDouble(args[2])));
|
|
registerConsumer(list, "entity.explode", (args, qd) ->
|
|
registerConsumer(list, "entity.explode", (args, qd) ->
|
|
@@ -768,7 +780,7 @@ public class SnuviParser
|
|
registerConsumer(list, "inv.loadblock", (args, qd) ->
|
|
registerConsumer(list, "inv.loadblock", (args, qd) ->
|
|
qd.setVar(args[0], newInventory((Location) args[1], qd, args[2].toString())));
|
|
qd.setVar(args[0], newInventory((Location) args[1], qd, args[2].toString())));
|
|
registerConsumer(list, "inv.setitem", (args, qd) ->
|
|
registerConsumer(list, "inv.setitem", (args, qd) ->
|
|
- ((IInventory) args[0]).setInventorySlotContents(ScriptUtils.getInt(args[1]), ((ItemStack) args[2]).copy()));
|
|
|
|
|
|
+ ((IInventory) args[0]).setInventorySlotContents(ScriptUtils.getInt(args[1]), (ItemStack) args[2]));
|
|
registerFunction(list, "inv.getitem", (args, qd) ->
|
|
registerFunction(list, "inv.getitem", (args, qd) ->
|
|
((IInventory) args[0]).getStackInSlot(ScriptUtils.getInt(args[1])));
|
|
((IInventory) args[0]).getStackInSlot(ScriptUtils.getInt(args[1])));
|
|
registerConsumer(list, "inv.open", (args, qd) ->
|
|
registerConsumer(list, "inv.open", (args, qd) ->
|
|
@@ -1006,7 +1018,7 @@ public class SnuviParser
|
|
private ItemStack addItemAmountChest(Object[] args) throws IllegalStringLocationException, IllegalItemStackStringException
|
|
private ItemStack addItemAmountChest(Object[] args) throws IllegalStringLocationException, IllegalItemStackStringException
|
|
{
|
|
{
|
|
Location l = (Location) args[0];
|
|
Location l = (Location) args[0];
|
|
- ItemStack stack = ((ItemStack) args[1]).copy();
|
|
|
|
|
|
+ ItemStack stack = ((ItemStack) args[1]);
|
|
TileEntity te = l.getWorld().getTileEntity(l.getBlockPos());
|
|
TileEntity te = l.getWorld().getTileEntity(l.getBlockPos());
|
|
if(te == null || !(te instanceof TileEntityChest))
|
|
if(te == null || !(te instanceof TileEntityChest))
|
|
{
|
|
{
|
|
@@ -1019,7 +1031,7 @@ public class SnuviParser
|
|
private ItemStack removeItemAmountChest(Object[] args) throws IllegalStringLocationException, IllegalItemStackStringException
|
|
private ItemStack removeItemAmountChest(Object[] args) throws IllegalStringLocationException, IllegalItemStackStringException
|
|
{
|
|
{
|
|
Location l = (Location) args[0];
|
|
Location l = (Location) args[0];
|
|
- ItemStack stack = ((ItemStack) args[1]).copy();
|
|
|
|
|
|
+ ItemStack stack = ((ItemStack) args[1]);
|
|
TileEntity te = l.getWorld().getTileEntity(l.getBlockPos());
|
|
TileEntity te = l.getWorld().getTileEntity(l.getBlockPos());
|
|
if(te == null || !(te instanceof TileEntityChest))
|
|
if(te == null || !(te instanceof TileEntityChest))
|
|
{
|
|
{
|
|
@@ -1074,11 +1086,11 @@ public class SnuviParser
|
|
BlockPos pos = l.getBlockPos();
|
|
BlockPos pos = l.getBlockPos();
|
|
ItemStack stack = ((ItemStack) args[1]).copy();
|
|
ItemStack stack = ((ItemStack) args[1]).copy();
|
|
int amount = stack.getCount();
|
|
int amount = stack.getCount();
|
|
- while(amount > 64)
|
|
|
|
|
|
+ while(amount > stack.getMaxStackSize())
|
|
{
|
|
{
|
|
- stack.setCount(64);
|
|
|
|
- amount -= 64;
|
|
|
|
- ItemStackUtils.drop(w, pos, stack);
|
|
|
|
|
|
+ stack.setCount(stack.getMaxStackSize());
|
|
|
|
+ amount -= stack.getMaxStackSize();
|
|
|
|
+ ItemStackUtils.drop(w, pos, stack.copy());
|
|
}
|
|
}
|
|
if(amount > 0)
|
|
if(amount > 0)
|
|
{
|
|
{
|
|
@@ -1088,21 +1100,9 @@ public class SnuviParser
|
|
}
|
|
}
|
|
|
|
|
|
private ItemStack giveItem(Object[] args) throws PlayerNotFoundException, IllegalItemStackStringException
|
|
private ItemStack giveItem(Object[] args) throws PlayerNotFoundException, IllegalItemStackStringException
|
|
- {
|
|
|
|
- EntityPlayer affectedPlayer = ((EntityPlayer) args[0]);
|
|
|
|
|
|
+ {
|
|
ItemStack stack = ((ItemStack) args[1]).copy();
|
|
ItemStack stack = ((ItemStack) args[1]).copy();
|
|
- int amount = stack.getCount();
|
|
|
|
- InventoryPlayer inv = affectedPlayer.inventory;
|
|
|
|
- int left = 0;
|
|
|
|
- while(amount > 64)
|
|
|
|
- {
|
|
|
|
- stack.setCount(64);
|
|
|
|
- amount -= 64;
|
|
|
|
- left += InventoryUtils.addToInventory(inv, stack);
|
|
|
|
- }
|
|
|
|
- stack.setCount(amount);
|
|
|
|
- left += InventoryUtils.addToInventory(inv, stack);
|
|
|
|
- stack.setCount(left);
|
|
|
|
|
|
+ stack.setCount(InventoryUtils.addToInventory(((EntityPlayer) args[0]).inventory, stack));
|
|
return stack;
|
|
return stack;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1151,12 +1151,12 @@ public class SnuviParser
|
|
{
|
|
{
|
|
Location l = ((Location) args[0]);
|
|
Location l = ((Location) args[0]);
|
|
Vec3d v = l.getPos();
|
|
Vec3d v = l.getPos();
|
|
- EffectUtils.playSound((WorldServer) l.getWorld(), ReflectionUtils.getSoundEvent(args[1].toString()), SoundCategory.MASTER, v.xCoord, v.yCoord, v.zCoord);
|
|
|
|
|
|
+ EffectUtils.playSound((WorldServer) l.getWorld(), SoundEvent.REGISTRY.getObject(new ResourceLocation(args[1].toString())), SoundCategory.MASTER, v.xCoord, v.yCoord, v.zCoord);
|
|
}
|
|
}
|
|
|
|
|
|
private void playSoundPlayer(Object[] args) throws IllegalStringLocationException
|
|
private void playSoundPlayer(Object[] args) throws IllegalStringLocationException
|
|
{
|
|
{
|
|
- EffectUtils.playSound((EntityPlayerMP) args[0], ReflectionUtils.getSoundEvent(args[1].toString()), SoundCategory.MASTER);
|
|
|
|
|
|
+ EffectUtils.playSound((EntityPlayerMP) args[0], SoundEvent.REGISTRY.getObject(new ResourceLocation(args[1].toString())), SoundCategory.MASTER);
|
|
}
|
|
}
|
|
|
|
|
|
private void playParticle(Object[] args) throws IllegalStringLocationException
|
|
private void playParticle(Object[] args) throws IllegalStringLocationException
|
|
@@ -1259,7 +1259,7 @@ public class SnuviParser
|
|
{
|
|
{
|
|
Location l = (Location) args[0];
|
|
Location l = (Location) args[0];
|
|
TileEntitySign sign = (TileEntitySign) l.getWorld().getTileEntity(l.getBlockPos());
|
|
TileEntitySign sign = (TileEntitySign) l.getWorld().getTileEntity(l.getBlockPos());
|
|
- sign.signText[ScriptUtils.getInt(args[1])] = new TextComponentString(ScriptUtils.connect(args, 2));
|
|
|
|
|
|
+ SpecialBlockUtils.setSignLine(sign, ScriptUtils.getInt(args[1]), ScriptUtils.connect(args, 2));
|
|
}
|
|
}
|
|
|
|
|
|
private String getSign(Object[] args) throws IllegalStringLocationException
|
|
private String getSign(Object[] args) throws IllegalStringLocationException
|
|
@@ -1468,7 +1468,7 @@ public class SnuviParser
|
|
}
|
|
}
|
|
else if(args[1] instanceof ItemStack && args[0] instanceof ItemStack)
|
|
else if(args[1] instanceof ItemStack && args[0] instanceof ItemStack)
|
|
{
|
|
{
|
|
- return InventoryUtils.doItemStacksMatch((ItemStack) args[0], (ItemStack) args[1]);
|
|
|
|
|
|
+ return InventoryUtils.stackEqualExact((ItemStack) args[0], (ItemStack) args[1]);
|
|
}
|
|
}
|
|
else if(args[1] instanceof Number && args[0] instanceof Number)
|
|
else if(args[1] instanceof Number && args[0] instanceof Number)
|
|
{
|
|
{
|
|
@@ -1478,11 +1478,7 @@ public class SnuviParser
|
|
{
|
|
{
|
|
Location l = (Location) args[0];
|
|
Location l = (Location) args[0];
|
|
Location l2 = (Location) args[1];
|
|
Location l2 = (Location) args[1];
|
|
- BlockPos pos1 = l.getBlockPos();
|
|
|
|
- BlockPos pos2 = l2.getBlockPos();
|
|
|
|
- return pos1.getX() == pos2.getX() &&
|
|
|
|
- pos1.getY() == pos2.getY() &&
|
|
|
|
- pos1.getZ() == pos2.getZ() && l.getWorld().equals(l2.getWorld());
|
|
|
|
|
|
+ return l.getPos().equals(l2.getPos()) && l.getWorld().equals(l2.getWorld());
|
|
}
|
|
}
|
|
return args[0].equals(args[1]);
|
|
return args[0].equals(args[1]);
|
|
}
|
|
}
|
|
@@ -1502,6 +1498,16 @@ public class SnuviParser
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private Entity getLastDamager(Object[] args)
|
|
|
|
+ {
|
|
|
|
+ DamageSource ds = ((EntityPlayer) args[0]).getLastDamageSource();
|
|
|
|
+ if(ds == null)
|
|
|
|
+ {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ return ds.getSourceOfDamage();
|
|
|
|
+ }
|
|
|
|
+
|
|
private SnuviInventory newInventory(Location l, Script qd, String s)
|
|
private SnuviInventory newInventory(Location l, Script qd, String s)
|
|
{
|
|
{
|
|
TileEntityChest chest = (TileEntityChest) l.getWorld().getTileEntity(l.getBlockPos());
|
|
TileEntityChest chest = (TileEntityChest) l.getWorld().getTileEntity(l.getBlockPos());
|
|
@@ -1565,7 +1571,7 @@ public class SnuviParser
|
|
|
|
|
|
private String getPotionType(Object[] args)
|
|
private String getPotionType(Object[] args)
|
|
{
|
|
{
|
|
- return PotionUtils.getPotionFromItem(((EntityPotion) args[0]).getPotion()).toString();
|
|
|
|
|
|
+ return PotionUtils.getPotionFromItem(((EntityPotion) args[0]).getPotion()).getRegistryName().getResourcePath();
|
|
}
|
|
}
|
|
|
|
|
|
private void setTag(Object[] args)
|
|
private void setTag(Object[] args)
|