public PacketErrorUpdateEntity(Entity entity, IErrorLogicSource errorLogicSource) { this.entity = entity; this.errorLogic = errorLogicSource.getErrorLogic(); }
/** * Return true if the tile given in parameter activates the trigger, given the parameters. */ @Override public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) { if (!(tile instanceof IErrorLogicSource)) { return false; } IErrorLogicSource apiary = (IErrorLogicSource) tile; return apiary.getErrorLogic().contains(EnumErrorCode.NO_DRONE); }
/** * Return true if the tile given in parameter activates the trigger, given the parameters. */ @Override public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) { if (!(tile instanceof IErrorLogicSource)) { return false; } IErrorLogicSource apiary = (IErrorLogicSource) tile; return apiary.getErrorLogic().contains(EnumErrorCode.NO_QUEEN); } }
public PacketErrorUpdate(TileEntity tile, IErrorLogicSource errorLogicSource) { this.pos = tile.getPos(); this.errorLogic = errorLogicSource.getErrorLogic(); }
protected final void addErrorLedger(IErrorLogicSource errorSource) { ledgerManager.add(errorSource.getErrorLogic()); }
@Override public void onPacketData(PacketBufferForestry data, EntityPlayer player) { Entity entity = data.readEntityById(player.world); if (entity instanceof IErrorLogicSource) { IErrorLogicSource errorSourceTile = (IErrorLogicSource) entity; IErrorLogic errorLogic = errorSourceTile.getErrorLogic(); errorLogic.readData(data); } } }
@Override public void onPacketData(PacketBufferForestry data, EntityPlayer player) { BlockPos pos = data.readBlockPos(); TileUtil.actOnTile(player.world, pos, IErrorLogicSource.class, errorSourceTile -> { IErrorLogic errorLogic = errorSourceTile.getErrorLogic(); errorLogic.readData(data); }); } }
@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();