12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package me.km.snuviscript;
- import me.hammerle.code.Script;
- import me.km.api.Location;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.World;
- public class ScriptVars
- {
- @SuppressWarnings("")
- public static void setBlockVars(Script qd, World w, BlockPos pos)
- {
- IBlockState state = w.getBlockState(pos);
- qd.setEventVar("block_loc", new Location(w, pos));
- qd.setEventVar("block_type", state.getBlock().getRegistryName().toString());
- qd.setEventVar("block_data", state.getBlock().getMetaFromState(state));
- }
-
- public static void setPlayerVars(Script qd, EntityPlayer p)
- {
- qd.setEventVar("player", p);
- qd.setEventVar("player_name", p.getName());
- }
-
- public static void setSecPlayer(Script qd, EntityPlayer p)
- {
- if(p != null)
- {
- qd.setEventVar("sec_player", p);
- qd.setEventVar("sec_player_name", p.getName());
- }
- }
- public static void setEntityVars(Script qd, Entity ent)
- {
- qd.setEventVar("entity", ent);
- qd.setEventVar("entity_name", ent.getDisplayName().getUnformattedText());
- qd.setEventVar("entity_type", ent.getClass().getSimpleName());
- }
- public static void setItemVars(Script qd, ItemStack stack)
- {
- qd.setEventVar("item", stack);
- }
- }
|