diff --git a/src/main/java/org/terasology/substanceMatters/components/FluidSubstanceComponent.java b/src/main/java/org/terasology/substanceMatters/components/FluidSubstanceComponent.java index 5facba9..0a35f2e 100644 --- a/src/main/java/org/terasology/substanceMatters/components/FluidSubstanceComponent.java +++ b/src/main/java/org/terasology/substanceMatters/components/FluidSubstanceComponent.java @@ -1,21 +1,8 @@ -/* - * 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.substanceMatters.components; -import org.terasology.engine.entitySystem.Component; +import org.terasology.gestalt.entitysystem.component.EmptyComponent; -public class FluidSubstanceComponent implements Component { +public class FluidSubstanceComponent extends EmptyComponent { } diff --git a/src/main/java/org/terasology/substanceMatters/components/MaterialCompositionComponent.java b/src/main/java/org/terasology/substanceMatters/components/MaterialCompositionComponent.java index 3d88399..312b234 100644 --- a/src/main/java/org/terasology/substanceMatters/components/MaterialCompositionComponent.java +++ b/src/main/java/org/terasology/substanceMatters/components/MaterialCompositionComponent.java @@ -1,31 +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.substanceMatters.components; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import org.terasology.engine.entitySystem.Component; import org.terasology.engine.entitySystem.entity.EntityRef; import org.terasology.engine.entitySystem.prefab.Prefab; import org.terasology.engine.entitySystem.prefab.PrefabManager; -import org.terasology.module.inventory.systems.InventoryUtils; -import org.terasology.module.inventory.components.ItemDifferentiating; import org.terasology.engine.network.Replicate; import org.terasology.engine.registry.CoreRegistry; import org.terasology.engine.utilities.Assets; +import org.terasology.gestalt.entitysystem.component.Component; +import org.terasology.module.inventory.components.ItemDifferentiating; +import org.terasology.module.inventory.systems.InventoryUtils; import java.util.Collections; import java.util.Comparator; @@ -35,7 +22,7 @@ /** * A list of the contents of an item. Not intended to be added directly to a prefab with json. */ -public class MaterialCompositionComponent implements Component, ItemDifferentiating { +public class MaterialCompositionComponent implements Component, ItemDifferentiating { /** * A map of the substance prefab and how much is contained */ @@ -178,4 +165,9 @@ public String toDisplayString() { display = display.trim(); return display; } + + @Override + public void copyFrom(MaterialCompositionComponent other) { + this.contents = Maps.newHashMap(other.contents); + } } diff --git a/src/main/java/org/terasology/substanceMatters/components/MaterialItemComponent.java b/src/main/java/org/terasology/substanceMatters/components/MaterialItemComponent.java index 1b30e36..1efdce0 100644 --- a/src/main/java/org/terasology/substanceMatters/components/MaterialItemComponent.java +++ b/src/main/java/org/terasology/substanceMatters/components/MaterialItemComponent.java @@ -1,27 +1,14 @@ -/* - * 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.substanceMatters.components; -import org.terasology.engine.entitySystem.Component; +import org.terasology.gestalt.entitysystem.component.Component; import org.terasology.module.inventory.components.ItemDifferentiating; /** * Attach this to items that are made of a particular substance. The icon will be tinted to the substance's definition. */ -public class MaterialItemComponent implements Component, ItemDifferentiating { +public class MaterialItemComponent implements Component, ItemDifferentiating { public String icon; @Override @@ -46,4 +33,9 @@ public boolean equals(Object o) { public int hashCode() { return icon != null ? icon.hashCode() : 0; } + + @Override + public void copyFrom(MaterialItemComponent other) { + this.icon = other.icon; + } } diff --git a/src/main/java/org/terasology/substanceMatters/components/SubstanceComponent.java b/src/main/java/org/terasology/substanceMatters/components/SubstanceComponent.java index fdf2c0d..aa6fbbc 100644 --- a/src/main/java/org/terasology/substanceMatters/components/SubstanceComponent.java +++ b/src/main/java/org/terasology/substanceMatters/components/SubstanceComponent.java @@ -1,29 +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.substanceMatters.components; -import org.terasology.engine.entitySystem.Component; +import org.terasology.gestalt.entitysystem.component.Component; /** * A definition for a substance. Color values are for generated icons. */ -public class SubstanceComponent implements Component { +public class SubstanceComponent implements Component { public String name; public String description = ""; public int hue; public float saturationScale = 1f; public float brightnessScale = 1f; + + @Override + public void copyFrom(SubstanceComponent other) { + this.name = other.name; + this.description = other.description; + this.hue = other.hue; + this.saturationScale = other.saturationScale; + this.brightnessScale = other.brightnessScale; + } } diff --git a/src/main/java/org/terasology/substanceMatters/processParts/InjectSubstancesComponent.java b/src/main/java/org/terasology/substanceMatters/processParts/InjectSubstancesComponent.java index ea9af3a..4503bc0 100644 --- a/src/main/java/org/terasology/substanceMatters/processParts/InjectSubstancesComponent.java +++ b/src/main/java/org/terasology/substanceMatters/processParts/InjectSubstancesComponent.java @@ -1,26 +1,13 @@ -/* - * 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.substanceMatters.processParts; import com.google.common.collect.Maps; -import org.terasology.engine.entitySystem.Component; +import org.terasology.gestalt.entitysystem.component.Component; import java.util.Map; -public class InjectSubstancesComponent implements Component { +public class InjectSubstancesComponent implements Component { /** * A map of substance prefab and how much is added */ @@ -31,4 +18,9 @@ public class InjectSubstancesComponent implements Component { */ public Map replace = Maps.newHashMap(); + @Override + public void copyFrom(InjectSubstancesComponent other) { + this.add = Maps.newHashMap(other.add); + this.replace = Maps.newHashMap(other.replace); + } } diff --git a/src/main/java/org/terasology/substanceMatters/processParts/TransferSubstancesComponent.java b/src/main/java/org/terasology/substanceMatters/processParts/TransferSubstancesComponent.java index a18d8c4..71d6907 100644 --- a/src/main/java/org/terasology/substanceMatters/processParts/TransferSubstancesComponent.java +++ b/src/main/java/org/terasology/substanceMatters/processParts/TransferSubstancesComponent.java @@ -1,26 +1,19 @@ -/* - * 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.substanceMatters.processParts; -import org.terasology.engine.entitySystem.Component; +import org.terasology.gestalt.entitysystem.component.Component; /** * Creates an material item containing the materials that it is composed of based on the original input items. The item will appear like the largest amount of substance. */ -public class TransferSubstancesComponent implements Component { +public class TransferSubstancesComponent implements Component { boolean extract = true; boolean inject = true; + + @Override + public void copyFrom(TransferSubstancesComponent other) { + this.extract = other.extract; + this.inject = other.inject; + } }