|
@@ -99,6 +99,7 @@ import net.minecraft.nbt.NBTUtil;
|
|
import net.minecraft.network.play.client.CChatMessagePacket;
|
|
import net.minecraft.network.play.client.CChatMessagePacket;
|
|
import net.minecraft.network.play.client.CClientStatusPacket;
|
|
import net.minecraft.network.play.client.CClientStatusPacket;
|
|
import net.minecraft.network.play.server.SEntityVelocityPacket;
|
|
import net.minecraft.network.play.server.SEntityVelocityPacket;
|
|
|
|
+import net.minecraft.network.play.server.SPlaySoundEffectPacket;
|
|
import net.minecraft.network.play.server.SSpawnPositionPacket;
|
|
import net.minecraft.network.play.server.SSpawnPositionPacket;
|
|
import net.minecraft.network.play.server.STitlePacket;
|
|
import net.minecraft.network.play.server.STitlePacket;
|
|
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
|
|
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
|
|
@@ -546,6 +547,11 @@ public class MinecraftFunctions
|
|
((PlayerEntity) in[0].get(sc)).getInventoryEnderChest().setInventorySlotContents(in[1].getInt(sc), ((ItemStack) in[2].get(sc)).copy());
|
|
((PlayerEntity) in[0].get(sc)).getInventoryEnderChest().setInventorySlotContents(in[1].getInt(sc), ((ItemStack) in[2].get(sc)).copy());
|
|
return Void.TYPE;
|
|
return Void.TYPE;
|
|
});
|
|
});
|
|
|
|
+ sm.registerFunction("player.setdisplayname", (sc, in) ->
|
|
|
|
+ {
|
|
|
|
+ ((ModEntityPlayerMP) in[0].get(sc)).setTabListDisplayName(in[1].getString(sc));
|
|
|
|
+ return Void.TYPE;
|
|
|
|
+ });
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------
|
|
// Players-library
|
|
// Players-library
|
|
@@ -715,7 +721,7 @@ public class MinecraftFunctions
|
|
((ItemStack) in[0].get(sc)).setCount(in[1].getInt(sc));
|
|
((ItemStack) in[0].get(sc)).setCount(in[1].getInt(sc));
|
|
return Void.TYPE;
|
|
return Void.TYPE;
|
|
});
|
|
});
|
|
- sm.registerFunction("item.getname", (sc, in) -> ((ItemStack) in[0].get(sc)).getDisplayName());
|
|
|
|
|
|
+ sm.registerFunction("item.getname", (sc, in) -> ((ItemStack) in[0].get(sc)).getDisplayName().getFormattedText());
|
|
sm.registerFunction("item.setname", (sc, in) ->
|
|
sm.registerFunction("item.setname", (sc, in) ->
|
|
{
|
|
{
|
|
((ItemStack) in[0].get(sc)).setDisplayName(new StringTextComponent(SnuviUtils.connect(sc, in, 1)));
|
|
((ItemStack) in[0].get(sc)).setDisplayName(new StringTextComponent(SnuviUtils.connect(sc, in, 1)));
|
|
@@ -1160,6 +1166,13 @@ public class MinecraftFunctions
|
|
// ---------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------
|
|
// entity commands
|
|
// entity commands
|
|
// ---------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------
|
|
|
|
+ sm.registerFunction("entity.setburning", (sc, in) ->
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ ((Entity) in[0].get(sc)).setFire(in[1].getInt(sc));
|
|
|
|
+ return Void.TYPE;
|
|
|
|
+ });
|
|
|
|
+ sm.registerFunction("entity.isburning", (sc, in) -> ((Entity) in[0].get(sc)).isBurning());
|
|
sm.registerFunction("entity.getlook", (sc, in) ->
|
|
sm.registerFunction("entity.getlook", (sc, in) ->
|
|
{
|
|
{
|
|
Object[] o = new Object[3];
|
|
Object[] o = new Object[3];
|
|
@@ -2139,21 +2152,23 @@ public class MinecraftFunctions
|
|
// particle library
|
|
// particle library
|
|
// ---------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------
|
|
sm.registerFunction("sound.get", (sc, in) -> Mapper.getSound(in[0].getString(sc)));
|
|
sm.registerFunction("sound.get", (sc, in) -> Mapper.getSound(in[0].getString(sc)));
|
|
|
|
+ sm.registerFunction("sound.getcategory", (sc, in) -> Mapper.getSoundCategory(in[0].getString(sc)));
|
|
sm.registerFunction("sound.spawn", (sc, in) ->
|
|
sm.registerFunction("sound.spawn", (sc, in) ->
|
|
{
|
|
{
|
|
Location l = (Location) in[0].get(sc);
|
|
Location l = (Location) in[0].get(sc);
|
|
ServerWorld sw = (ServerWorld) l.getWorld();
|
|
ServerWorld sw = (ServerWorld) l.getWorld();
|
|
- float volume = in.length >= 3 ? in[2].getFloat(sc) : 1.0f;
|
|
|
|
- float pitch = in.length >= 4 ? in[3].getFloat(sc) : (sw.rand.nextFloat() * 0.1f + 0.9f);
|
|
|
|
- sw.playSound(null, l.getX(), l.getY(), l.getZ(), (SoundEvent) in[1].get(sc), SoundCategory.MASTER, volume, pitch);
|
|
|
|
|
|
+ float volume = in.length >= 4 ? in[3].getFloat(sc) : 1.0f;
|
|
|
|
+ float pitch = in.length >= 5 ? in[4].getFloat(sc) : (sw.rand.nextFloat() * 0.1f + 0.9f);
|
|
|
|
+ sw.playSound(null, l.getX(), l.getY(), l.getZ(), (SoundEvent) in[1].get(sc), (SoundCategory) in[2].get(sc), volume, pitch);
|
|
return Void.TYPE;
|
|
return Void.TYPE;
|
|
});
|
|
});
|
|
sm.registerFunction("sound.spawnforplayer", (sc, in) ->
|
|
sm.registerFunction("sound.spawnforplayer", (sc, in) ->
|
|
{
|
|
{
|
|
ServerPlayerEntity p = (ServerPlayerEntity) in[0].get(sc);
|
|
ServerPlayerEntity p = (ServerPlayerEntity) in[0].get(sc);
|
|
- float volume = in.length >= 3 ? in[2].getFloat(sc) : 1.0f;
|
|
|
|
- float pitch = in.length >= 4 ? in[3].getFloat(sc) : (p.world.rand.nextFloat() * 0.1f + 0.9f);
|
|
|
|
- p.playSound((SoundEvent) in[1].get(sc), volume, pitch);
|
|
|
|
|
|
+ float volume = in.length >= 4 ? in[3].getFloat(sc) : 1.0f;
|
|
|
|
+ float pitch = in.length >= 5 ? in[4].getFloat(sc) : (p.world.rand.nextFloat() * 0.1f + 0.9f);
|
|
|
|
+ p.connection.sendPacket(new SPlaySoundEffectPacket((SoundEvent) in[1].get(sc),
|
|
|
|
+ (SoundCategory) in[2].get(sc), p.posX, p.posY, p.posZ, volume, pitch));
|
|
return Void.TYPE;
|
|
return Void.TYPE;
|
|
});
|
|
});
|
|
|
|
|