Skip to content

Commit

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

Co-authored-by: Tobias Nett <skaldarnar@googlemail.com>
  • Loading branch information
DarkWeird and skaldarnar committed Aug 25, 2021
1 parent 692b8c6 commit 841e731
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 102 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
/*
* 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.herbalism.component;

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

/**
* This component is used for storing the base genome of a generated herb.
*/
public final class GeneratedHerbComponent implements Component {
public final class GeneratedHerbComponent implements Component<GeneratedHerbComponent> {
/** A string description of this herb's base genome. */
public String herbBaseGenome;

@Override
public void copyFrom(GeneratedHerbComponent other) {
this.herbBaseGenome = other.herbBaseGenome;
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
/*
* 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.herbalism.component;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

/**
* Add this component to an item to indicate that it is a herb.
*/
public class HerbComponent implements Component {
public class HerbComponent extends EmptyComponent<HerbComponent> {
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
/*
* 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.herbalism.component;

import org.terasology.engine.entitySystem.Component;
import com.google.common.collect.Lists;
import org.terasology.gestalt.entitysystem.component.Component;

import java.util.List;

/**
* This component is used for storing the hue ranges of a particular herb.
*/
public class HerbHueComponent implements Component {
public class HerbHueComponent implements Component<HerbHueComponent> {
public List<String> hueRanges;

@Override
public void copyFrom(HerbHueComponent other) {
this.hueRanges = Lists.newArrayList(other.hueRanges);
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
/*
* Copyright 2016 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.herbalism.component;

import org.terasology.engine.entitySystem.Component;
import com.google.common.collect.Lists;
import org.terasology.gestalt.entitysystem.component.Component;

import java.util.List;

/**
* Add this Component to any recipe prefab that is supposed to be creatable in a HerbalismStation or similar.
* Include in prefab along with CraftingStationRecipeComponent to work properly.
*/
public class HerbalismStationRecipeComponent implements Component {
public class HerbalismStationRecipeComponent implements Component<HerbalismStationRecipeComponent> {
// The following variables are unused.
public String recipeId;
public List<String> recipeComponents;
Expand All @@ -35,4 +23,16 @@ public class HerbalismStationRecipeComponent implements Component {

public String itemResult;
public String blockResult;

@Override
public void copyFrom(HerbalismStationRecipeComponent other) {
this.recipeId = other.recipeId;
this.recipeComponents = Lists.newArrayList(other.recipeComponents);
this.recipeTools = Lists.newArrayList(other.recipeTools);
this.recipeFluids = Lists.newArrayList(other.recipeFluids);
this.requiredTemperature = other.requiredTemperature;
this.processingDuration = other.processingDuration;
this.itemResult = other.itemResult;
this.blockResult = other.blockResult;
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
/*
* 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.herbalism.component;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

/**
* Add this component to an item (specficially an herb) to indicate that it's pollinating.
*/
public class PollinatingHerbComponent implements Component {
public class PollinatingHerbComponent extends EmptyComponent<PollinatingHerbComponent> {
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
/*
* Copyright 2016 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.herbalism.component;

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

/**
* Add this component to an item to indicate that it is a predefined herb. That is, a prefab was directly used to generate
* this.
*/
public final class PredefinedHerbComponent implements Component {
public final class PredefinedHerbComponent implements Component<PredefinedHerbComponent> {
public String herbBaseGenome;

@Override
public void copyFrom(PredefinedHerbComponent other) {
this.herbBaseGenome = other.herbBaseGenome;
}
}

0 comments on commit 841e731

Please sign in to comment.