Skip to content

Commit

Permalink
add dimension and level name to remove entity solution, added remove …
Browse files Browse the repository at this point in the history
…block entity solution
  • Loading branch information
matthi4s committed Oct 4, 2022
1 parent fe1ba17 commit 6cf18ed
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Analysis/Problem/CrashReport/TickingBlockEntityProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Aternos\Codex\Minecraft\Analysis\Problem\CrashReport;

use Aternos\Codex\Minecraft\Analysis\Solution\CrashReport\RemoveBlockEntitySolution;

/**
* Class TickingBlockEntityProblem
*
Expand All @@ -20,4 +22,12 @@ public static function getPatterns(): array
{
return ["/^Description: Ticking block entity$/"];
}

/**
* @return RemoveBlockEntitySolution
*/
protected function createSolution(): RemoveBlockEntitySolution
{
return new RemoveBlockEntitySolution();
}
}
12 changes: 11 additions & 1 deletion src/Analysis/Problem/CrashReport/TickingEntityProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,27 @@ public function setAnalysis(AnalysisInterface $analysis): static
$this->levelName = $matches[1];
}

$solution = new RemoveEntitySolution();
$solution = $this->createSolution();
$solution->setType($this->getType());
$solution->setName($this->getName());
$solution->setLocationX($this->getLocationX());
$solution->setLocationY($this->getLocationY());
$solution->setLocationZ($this->getLocationZ());
$solution->setDimension($this->getDimension());
$solution->setLevelName($this->getLevelName());

$this->addSolution($solution);
return $this;
}

/**
* @return RemoveEntitySolution
*/
protected function createSolution(): RemoveEntitySolution
{
return new RemoveEntitySolution();
}

/**
* @param InsightInterface $insight
* @return bool
Expand Down
13 changes: 13 additions & 0 deletions src/Analysis/Solution/CrashReport/RemoveBlockEntitySolution.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Aternos\Codex\Minecraft\Analysis\Solution\CrashReport;

/**
* Class RemoveBlockEntitySolution
*
* @package Aternos\Codex\Minecraft\Analysis\Solution\CrashReport
*/
class RemoveBlockEntitySolution extends RemoveEntitySolution
{

}
38 changes: 38 additions & 0 deletions src/Analysis/Solution/CrashReport/RemoveEntitySolution.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class RemoveEntitySolution extends CrashReportSolution
protected ?float $locationX;
protected ?float $locationY;
protected ?float $locationZ;
protected ?string $dimension = null;
protected ?string $levelName = null;

/**
* @inheritDoc
Expand Down Expand Up @@ -115,4 +117,40 @@ public function setLocationZ(?float $locationZ): RemoveEntitySolution
$this->locationZ = $locationZ;
return $this;
}

/**
* @return string|null
*/
public function getDimension(): ?string
{
return $this->dimension;
}

/**
* @param string|null $dimension
* @return $this
*/
public function setDimension(?string $dimension): static
{
$this->dimension = $dimension;
return $this;
}

/**
* @return string|null
*/
public function getLevelName(): ?string
{
return $this->levelName;
}

/**
* @param string|null $levelName
* @return $this
*/
public function setLevelName(?string $levelName): static
{
$this->levelName = $levelName;
return $this;
}
}

0 comments on commit 6cf18ed

Please sign in to comment.