Skip to content

Commit

Permalink
fix(ecs-gestalt): Migrate Components to gestalt's Components. (#10)
Browse files Browse the repository at this point in the history
Ref: MovingBlocks/Terasology#4753

Co-authored-by: Michael Pollind <mpollind@gmail.com>
Co-authored-by: Tobias Nett <skaldarnar@googlemail.com>
Co-authored-by: jdrueckert <jd.rueckert@googlemail.com>
  • Loading branch information
4 people committed Aug 25, 2021
1 parent 42bfe1f commit 82e1612
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -1,42 +1,31 @@
/*
* 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.computer.display.component;

import com.google.common.collect.Lists;
import org.joml.Vector3i;
import org.terasology.engine.entitySystem.Component;
import org.joml.Vector3ic;
import org.terasology.engine.math.Side;
import org.terasology.engine.network.Replicate;
import org.terasology.gestalt.entitysystem.component.Component;

import java.util.List;

@Replicate
public class DisplayComponent implements Component {
private Vector3i monitorSize;
public class DisplayComponent implements Component<DisplayComponent> {
private Vector3i monitorSize = new Vector3i();
private Side front;
private String mode;
private List<String> data;
private List<String> data = Lists.newArrayList();

public DisplayComponent() {
}

public DisplayComponent(Vector3i monitorSize, Side front, String mode, List<String> data) {
this.monitorSize = monitorSize;
public DisplayComponent(Vector3ic monitorSize, Side front, String mode, List<String> data) {
this.monitorSize.set(monitorSize);
this.front = front;
this.mode = mode;
this.data = data;
this.data.addAll(data);
}

public Vector3i getMonitorSize() {
Expand All @@ -62,4 +51,13 @@ public void setMode(String mode) {
public void setData(List<String> data) {
this.data = data;
}

@Override
public void copyFrom(DisplayComponent other) {
this.monitorSize.set(other.monitorSize);
this.front = other.front;
this.mode = other.mode;
this.data.clear();
this.data.addAll(other.data);
}
}
Original file line number Diff line number Diff line change
@@ -1,40 +1,29 @@
/*
* 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.computer.display.component;

import com.google.common.collect.Lists;
import org.joml.Vector3i;
import org.terasology.engine.entitySystem.Component;
import org.joml.Vector3ic;
import org.terasology.engine.math.Side;
import org.terasology.gestalt.entitysystem.component.Component;

import java.util.List;

public class DisplayDataHolderComponent implements Component {
private Vector3i monitorSize;
public class DisplayDataHolderComponent implements Component<DisplayDataHolderComponent> {
private Vector3i monitorSize = new Vector3i();
private Side front;
private String mode;
private List<String> data;
private List<String> data = Lists.newArrayList();

public DisplayDataHolderComponent() {
}

public DisplayDataHolderComponent(Vector3i monitorSize, Side front, String mode, List<String> data) {
this.monitorSize = monitorSize;
public DisplayDataHolderComponent(Vector3ic monitorSize, Side front, String mode, List<String> data) {
this.monitorSize.set(monitorSize);
this.front = front;
this.mode = mode;
this.data = data;
this.data.addAll(data);
}

public Vector3i getMonitorSize() {
Expand All @@ -52,4 +41,13 @@ public String getMode() {
public List<String> getData() {
return data;
}

@Override
public void copyFrom(DisplayDataHolderComponent other) {
this.monitorSize.set(other.monitorSize);
this.front = other.front;
this.mode = other.mode;
this.data.clear();
this.data.addAll(other.data);
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
/*
* 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.computer.display.component;

import org.terasology.engine.entitySystem.Component;
import org.terasology.engine.entitySystem.entity.EntityRef;
import org.terasology.gestalt.entitysystem.component.Component;

public class DisplayRenderComponent implements Component {
public class DisplayRenderComponent implements Component<DisplayRenderComponent> {
public EntityRef monitorChassis;
public EntityRef screen;

@Override
public void copyFrom(DisplayRenderComponent other) {
this.monitorChassis = other.monitorChassis;
this.screen = other.screen;
}
}

0 comments on commit 82e1612

Please sign in to comment.