-
Notifications
You must be signed in to change notification settings - Fork 9
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. (#35)
Ref: MovingBlocks/Terasology#4753 Co-authored-by: Tobias Nett <skaldarnar@googlemail.com>
- Loading branch information
1 parent
b2c3d42
commit f49230b
Showing
4 changed files
with
51 additions
and
68 deletions.
There are no files selected for viewing
27 changes: 10 additions & 17 deletions
27
src/main/java/org/terasology/fluid/component/FluidComponent.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 2014 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.fluid.component; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.engine.network.Replicate; | ||
import org.terasology.gestalt.entitysystem.component.Component; | ||
|
||
/** | ||
* This component indicates that an entity is a fluid, and contains basic attributes of the fluid. | ||
*/ | ||
public class FluidComponent implements Component { | ||
public class FluidComponent implements Component<FluidComponent> { | ||
/** The type of the fluid */ | ||
@Replicate | ||
public String fluidType; | ||
|
||
/** The volume of the fluid */ | ||
@Replicate | ||
public float volume; | ||
|
||
@Override | ||
public void copyFrom(FluidComponent other) { | ||
this.fluidType = other.fluidType; | ||
this.volume = other.volume; | ||
} | ||
} |
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
33 changes: 16 additions & 17 deletions
33
src/main/java/org/terasology/fluid/component/FluidInventoryAccessComponent.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,29 +1,28 @@ | ||
/* | ||
* Copyright 2015 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.fluid.component; | ||
|
||
import org.terasology.engine.entitySystem.Component; | ||
import org.terasology.engine.math.IntegerRange; | ||
import org.terasology.gestalt.entitysystem.component.Component; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* A component for integration with a Computer module. | ||
*/ | ||
public class FluidInventoryAccessComponent implements Component { | ||
public class FluidInventoryAccessComponent implements Component<FluidInventoryAccessComponent> { | ||
public Map<String, IntegerRange> input; | ||
public Map<String, IntegerRange> output; | ||
|
||
@Override | ||
public void copyFrom(FluidInventoryAccessComponent other) { | ||
this.input.clear(); | ||
for (Map.Entry<String, IntegerRange> entry : other.input.entrySet()) { | ||
this.input.put(entry.getKey(), entry.getValue().copy()); | ||
} | ||
this.output.clear(); | ||
for (Map.Entry<String, IntegerRange> entry : other.output.entrySet()) { | ||
this.output.put(entry.getKey(), entry.getValue().copy()); | ||
} | ||
} | ||
} |
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