@Override public void setCommandStat(Type type, int amount) { if (m_realPlayer == null) { super.setCommandStat(type, amount); } else { syncToRealPlayer(); m_realPlayer.setCommandStat(type, amount); syncPublicFieldsFromReal(); } }
@Override public void setCommandStat(Type type, int amount) { if (m_realPlayer == null) { super.setCommandStat(type, amount); } else { m_realPlayer.setCommandStat(type, amount); } }
@Override public void setCommandStat(Type type, int amount) {}
@SubscribeEvent public void playerUseItem(final PlayerInteractEvent.RightClickItem event) { if(event.getSide() == Side.CLIENT) return; ItemStack stack = event.getItemStack(); final EntityPlayer player = event.getEntityPlayer(); boolean hasCommandTag = stack.hasTagCompound() ? stack.getTagCompound().hasKey("command") : false; if(hasCommandTag){ String command = stack.getTagCompound().getString("command"); FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().executeCommand(new ICommandSender() { @Override public void setCommandStat(Type type, int amount) { player.setCommandStat(type, amount); } @Override public boolean sendCommandFeedback() { return false; } @Override public MinecraftServer getServer() { return FMLCommonHandler.instance().getMinecraftServerInstance(); } @Override public Vec3d getPositionVector() { return player.getPositionVector(); } @Override public BlockPos getPosition() { return player.getPosition(); } @Override public String getName() { return player.getName(); } @Override public World getEntityWorld() { return player.getEntityWorld(); } @Override public ITextComponent getDisplayName() { return player.getDisplayName(); } @Override public Entity getCommandSenderEntity() { return player; } @Override public boolean canUseCommand(int permLevel, String commandName) { return true; } @Override public void sendMessage(ITextComponent component) { event.getEntityPlayer().sendMessage(component); } }, command); } }
@Override public void setCommandStat(Type type, int amount) { // nope }
@Override public void setCommandStat(Type type, int amount) { // no }
@Override public void setCommandStat(Type type, int amount) { }
@Override public void setCommandStat(Type type, int amount) { if(holder != null) holder.setCommandStat(type, amount); }