-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ecs-gestalt): Migrate Components to gestalt's Components. (#51)
Ref: MovingBlocks/Terasology#4753 Co-authored-by: Tobias Nett <skaldarnar@googlemail.com>
- Loading branch information
1 parent
846afe8
commit b10038a
Showing
16 changed files
with
106 additions
and
108 deletions.
There are no files selected for viewing
9 changes: 6 additions & 3 deletions
9
src/main/java/org/terasology/additionalRails/action/HooverCartAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
src/main/java/org/terasology/additionalRails/components/ActivatorRailComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.gestalt.entitysystem.component.EmptyComponent; | ||
|
||
/** | ||
* Component, which differentiates the Activator Rail from others. | ||
* @author Aleksander Wójtowicz <anuar2k@outlook.com> | ||
*/ | ||
public class ActivatorRailComponent implements Component { | ||
public class ActivatorRailComponent extends EmptyComponent<ActivatorRailComponent> { | ||
} |
21 changes: 4 additions & 17 deletions
21
src/main/java/org/terasology/additionalRails/components/BoosterRailComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,8 @@ | ||
/* | ||
* Copyright 2017 MovingBlocks | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.gestalt.entitysystem.component.EmptyComponent; | ||
|
||
public class BoosterRailComponent implements Component { | ||
public class BoosterRailComponent extends EmptyComponent<BoosterRailComponent> { | ||
} |
12 changes: 10 additions & 2 deletions
12
src/main/java/org/terasology/additionalRails/components/BoreDrillComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.engine.entitySystem.prefab.Prefab; | ||
import org.terasology.gestalt.entitysystem.component.Component; | ||
|
||
public class BoreDrillComponent implements Component { | ||
public class BoreDrillComponent implements Component<BoreDrillComponent> { | ||
public Prefab damageType; | ||
|
||
@Override | ||
public void copyFrom(BoreDrillComponent other) { | ||
this.damageType = other.damageType; | ||
} | ||
} |
12 changes: 10 additions & 2 deletions
12
src/main/java/org/terasology/additionalRails/components/CargoCartComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
|
||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.gestalt.entitysystem.component.Component; | ||
|
||
public class CargoCartComponent implements Component { | ||
public class CargoCartComponent implements Component<CargoCartComponent> { | ||
public int weight = 0; | ||
|
||
@Override | ||
public void copyFrom(CargoCartComponent other) { | ||
this.weight = other.weight; | ||
} | ||
} |
7 changes: 5 additions & 2 deletions
7
src/main/java/org/terasology/additionalRails/components/ExampleActivableCartComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.gestalt.entitysystem.component.EmptyComponent; | ||
|
||
/** | ||
* Example component differentiating our new cart type from other carts. | ||
* @author Aleksander Wójtowicz <anuar2k@outlook.com> | ||
*/ | ||
public class ExampleActivableCartComponent implements Component { | ||
public class ExampleActivableCartComponent extends EmptyComponent<ExampleActivableCartComponent> { | ||
} |
12 changes: 10 additions & 2 deletions
12
src/main/java/org/terasology/additionalRails/components/ExplosiveCartComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.gestalt.entitysystem.component.Component; | ||
|
||
/** | ||
* Component differentiating Explosive Cart. | ||
* @author Aleksander Wójtowicz <anuar2k@outlook.com> | ||
*/ | ||
public class ExplosiveCartComponent implements Component { | ||
public class ExplosiveCartComponent implements Component<ExplosiveCartComponent> { | ||
/** | ||
* Defines how long does it take to make the cart explode after being activated by Activator Rail. | ||
*/ | ||
public long fuseLengthMs = 4000; | ||
|
||
@Override | ||
public void copyFrom(ExplosiveCartComponent other) { | ||
this.fuseLengthMs = other.fuseLengthMs; | ||
} | ||
} |
21 changes: 4 additions & 17 deletions
21
src/main/java/org/terasology/additionalRails/components/HarvestCartComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,8 @@ | ||
/* | ||
* Copyright 2017 MovingBlocks | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.gestalt.entitysystem.component.EmptyComponent; | ||
|
||
public class HarvestCartComponent implements Component { | ||
public class HarvestCartComponent extends EmptyComponent<HarvestCartComponent> { | ||
} |
12 changes: 10 additions & 2 deletions
12
src/main/java/org/terasology/additionalRails/components/HooverCartComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.gestalt.entitysystem.component.Component; | ||
|
||
/** | ||
* Component used to differentiate Hoover Cart from other ones. | ||
*/ | ||
public class HooverCartComponent implements Component { | ||
public class HooverCartComponent implements Component<HooverCartComponent> { | ||
public int energy = 0; | ||
|
||
@Override | ||
public void copyFrom(HooverCartComponent other) { | ||
this.energy = other.energy; | ||
} | ||
} |
26 changes: 9 additions & 17 deletions
26
src/main/java/org/terasology/additionalRails/components/LocomotiveComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,14 @@ | ||
/* | ||
* Copyright 2017 MovingBlocks | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.gestalt.entitysystem.component.Component; | ||
|
||
public class LocomotiveComponent implements Component { | ||
public class LocomotiveComponent implements Component<LocomotiveComponent> { | ||
public boolean active = false; | ||
|
||
@Override | ||
public void copyFrom(LocomotiveComponent other) { | ||
this.active = other.active; | ||
} | ||
} |
21 changes: 4 additions & 17 deletions
21
src/main/java/org/terasology/additionalRails/components/OnewayBoosterRailComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,8 @@ | ||
/* | ||
* Copyright 2017 MovingBlocks | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.gestalt.entitysystem.component.EmptyComponent; | ||
|
||
public class OnewayBoosterRailComponent implements Component { | ||
public class OnewayBoosterRailComponent extends EmptyComponent<OnewayBoosterRailComponent> { | ||
} |
21 changes: 4 additions & 17 deletions
21
src/main/java/org/terasology/additionalRails/components/PlantCartComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,8 @@ | ||
/* | ||
* Copyright 2017 MovingBlocks | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.gestalt.entitysystem.component.EmptyComponent; | ||
|
||
public class PlantCartComponent implements Component { | ||
public class PlantCartComponent extends EmptyComponent<PlantCartComponent> { | ||
} |
12 changes: 10 additions & 2 deletions
12
src/main/java/org/terasology/additionalRails/components/RailSwitchLeverComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.engine.world.block.ForceBlockActive; | ||
import org.terasology.gestalt.entitysystem.component.Component; | ||
|
||
@ForceBlockActive | ||
public class RailSwitchLeverComponent implements Component { | ||
public class RailSwitchLeverComponent implements Component<RailSwitchLeverComponent> { | ||
/** | ||
* determines if the block is in on or off state | ||
*/ | ||
public boolean isOn; | ||
|
||
@Override | ||
public void copyFrom(RailSwitchLeverComponent other) { | ||
this.isOn = other.isOn; | ||
} | ||
} |
7 changes: 5 additions & 2 deletions
7
src/main/java/org/terasology/additionalRails/components/RailSwitchSignalComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
src/main/java/org/terasology/additionalRails/components/TrackLayerCartComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.gestalt.entitysystem.component.EmptyComponent; | ||
|
||
/** | ||
* Component differentiating Track Layer Cart from others. | ||
* @author anuar2k | ||
*/ | ||
public class TrackLayerCartComponent implements Component { | ||
public class TrackLayerCartComponent extends EmptyComponent<TrackLayerCartComponent> { | ||
} |
7 changes: 5 additions & 2 deletions
7
src/main/java/org/terasology/additionalRails/components/TunnelBoreCartComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
|
||
// Copyright 2021 The Terasology Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package org.terasology.additionalRails.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.gestalt.entitysystem.component.EmptyComponent; | ||
|
||
public class TunnelBoreCartComponent implements Component { | ||
public class TunnelBoreCartComponent extends EmptyComponent<TunnelBoreCartComponent> { | ||
} |