@BasicObjectMethod.Inject( value = IErrorLogicSource.class, modId = Constants.MOD_ID, doc = "function():table -- Get any errors preventing operation" ) public static Object[] getErrors(IContext<IErrorLogicSource> context, Object[] arg) { return new Object[]{ context.getTarget().getErrorLogic().getErrorStates().stream() .map(IErrorState::getUniqueName) .collect(LuaList.toLuaList()).asMap() }; } }
@Override public void detectAndSendChanges() { super.detectAndSendChanges(); if (entity instanceof IErrorLogicSource) { IErrorLogicSource errorLogicSource = (IErrorLogicSource) entity; ImmutableSet<IErrorState> errorStates = errorLogicSource.getErrorLogic().getErrorStates(); if (previousErrorStates == null || !errorStates.equals(previousErrorStates)) { PacketErrorUpdateEntity packet = new PacketErrorUpdateEntity(entity, errorLogicSource); sendPacketToListeners(packet); } previousErrorStates = errorStates; } } }
ImmutableSet<IErrorState> errorStates = errorLogicSource.getErrorLogic().getErrorStates();