@Override public void screenTargetMoved( final ScreenTarget target, final int x, final int y, final int height) { if (this.m_useTargetPositionning) { final Point2i position = this.getComputedPosition(x, y, height); super.setPosition(position.getX(), position.getY(), false); } }
@Override protected void execute(final int screenX, final int screenY) { final AbstractBuildingDefinition buildingDefinition = BuildingDefinitionHelper.getFirstBuildingFor(this.m_havenCatalogEntry); final Point2i cell = this.m_worldEditor.getCellCoordFromMouse(screenX, screenY); final Point2i cellOffset = this.m_worldEditor .getHavenWorldImages() .getBuildingCellOffset(buildingDefinition.getEditorGroupId()); final int cellX = cell.getX() + cellOffset.getX(); final int cellY = cell.getY() + cellOffset.getY(); final InsertBuildingValidator validator = new InsertBuildingValidator( this.m_worldEditor.getWorkingHavenWorld(), ClientPartitionPatchLibrary.INSTANCE); final BuildingStruct info = new BuildingStruct( InsertBuilding.UID_GENERATOR, buildingDefinition.getId(), 0, (short) cellX, (short) cellY); validator.validate(info); final BuildingItem item = this.m_worldEditor.createBuilding(info); (this.m_modification = new AddBuildingModification(item)).addErrors(validator.getErrors()); }