-
Notifications
You must be signed in to change notification settings - Fork 7
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. (#62)
Ref: MovingBlocks/Terasology#4753 Co-authored-by: Michael Pollind <mpollind@gmail.com> Co-authored-by: Tobias Nett <skaldarnar@googlemail.com>
- Loading branch information
1 parent
35f7294
commit 813d420
Showing
74 changed files
with
604 additions
and
1,144 deletions.
There are no files selected for viewing
27 changes: 10 additions & 17 deletions
27
src/main/java/org/terasology/scenario/components/HubToolExpansionComponent.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,32 +1,25 @@ | ||
/* | ||
* 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.scenario.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import com.google.common.collect.Sets; | ||
import org.terasology.engine.entitySystem.entity.EntityRef; | ||
import org.terasology.engine.network.FieldReplicateType; | ||
import org.terasology.engine.network.Replicate; | ||
import org.terasology.gestalt.entitysystem.component.Component; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
/** | ||
* Component that gets attached to a scenario hub tool that contains the list of entities that are expanded in the treeview of the logic entities | ||
*/ | ||
public class HubToolExpansionComponent implements Component{ | ||
public class HubToolExpansionComponent implements Component<HubToolExpansionComponent> { | ||
@Replicate(FieldReplicateType.SERVER_TO_CLIENT) | ||
public Set<EntityRef> expandedList = new HashSet<>(); | ||
|
||
@Override | ||
public void copyFrom(HubToolExpansionComponent other) { | ||
this.expandedList = Sets.newHashSet(other.expandedList); | ||
} | ||
} |
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
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
27 changes: 10 additions & 17 deletions
27
src/main/java/org/terasology/scenario/components/ScenarioHubToolUpdateComponent.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,33 +1,26 @@ | ||
/* | ||
* 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.scenario.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.engine.entitySystem.entity.EntityRef; | ||
import org.terasology.engine.network.FieldReplicateType; | ||
import org.terasology.engine.network.NoReplicate; | ||
import org.terasology.engine.network.Replicate; | ||
import org.terasology.gestalt.entitysystem.component.Component; | ||
|
||
/** | ||
* Component that lets the client know that the scenario entity was updated and therefore it should redraw on the next update | ||
*/ | ||
public class ScenarioHubToolUpdateComponent implements Component { | ||
public class ScenarioHubToolUpdateComponent implements Component<ScenarioHubToolUpdateComponent> { | ||
@NoReplicate | ||
public String localScreenID; | ||
|
||
@Replicate(FieldReplicateType.SERVER_TO_OWNER) | ||
public EntityRef addedEntity; | ||
|
||
@Override | ||
public void copyFrom(ScenarioHubToolUpdateComponent other) { | ||
this.localScreenID = other.localScreenID; | ||
this.addedEntity = other.addedEntity; | ||
} | ||
} |
26 changes: 9 additions & 17 deletions
26
src/main/java/org/terasology/scenario/components/ScenarioLogicLabelComponent.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,30 +1,22 @@ | ||
/* | ||
* 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.scenario.components; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.engine.network.FieldReplicateType; | ||
import org.terasology.engine.network.Replicate; | ||
import org.terasology.gestalt.entitysystem.component.Component; | ||
|
||
/** | ||
* Label component for a Scenario logic entity, includes the text displayed on a dropdown menu for selecting an entity prefab in the logic editor | ||
* | ||
* Scenario logic entities detailed in {@link ScenarioComponent} | ||
*/ | ||
public class ScenarioLogicLabelComponent implements Component { | ||
public class ScenarioLogicLabelComponent implements Component<ScenarioLogicLabelComponent> { | ||
@Replicate(FieldReplicateType.SERVER_TO_CLIENT) | ||
public String name; | ||
|
||
@Override | ||
public void copyFrom(ScenarioLogicLabelComponent other) { | ||
this.name = other.name; | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.