Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ecs-gestalt): Migrate Components to gestalt's Components. #10

Merged
merged 6 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}