Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.brickfix.totemmod;
- import net.minecraft.command.ICommandSender;
- import net.minecraft.command.CommandResultStats.Type;
- import net.minecraft.entity.Entity;
- import net.minecraft.server.MinecraftServer;
- import net.minecraft.util.BlockPos;
- import net.minecraft.util.IChatComponent;
- import net.minecraft.world.World;
- public abstract class TotemBlockLogic implements ICommandSender
- {
- public int trigger(World worldIn)
- {
- MinecraftServer minecraftserver = MinecraftServer.getServer();
- int i = 0;
- if (minecraftserver != null && minecraftserver.func_175578_N())
- {
- try
- {
- i = minecraftserver.getCommandManager().executeCommand(this, getCommand());
- //System.out.println(getCommand());
- return i;
- }
- catch(Throwable t)
- {
- System.out.println("could not execute command");
- return 0;
- }
- }
- return i;
- }
- public abstract String getCommand();
- @Override
- public void addChatMessage(IChatComponent message)
- {
- //We do not want to see a chat message
- }
- @Override
- public String getName()
- {
- // TODO Auto-generated method stub
- return "totem";
- }
- @Override
- public Entity getCommandSenderEntity()
- {
- // This is no entity and not important
- return null;
- }
- @Override
- public boolean sendCommandFeedback()
- {
- //We do not need this
- return false;
- }
- @Override
- public void setCommandStat(Type type, int amount)
- {
- // We do not need this
- }
- @Override
- public IChatComponent getDisplayName()
- {
- return null;
- }
- @Override
- public boolean canUseCommand(int permLevel, String commandName)
- {
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement