-
Notifications
You must be signed in to change notification settings - Fork 651
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Refactored any subclass of `AEInternalModelData` to use `hasProperty()` and `getData()` in case something replaces them with a wrapper again. Added a new spin property to `AEModelData` as global property for any other `IModelData` needing a common spin property. Co-authored-by: Sebastian Hartte <sebastian@hartte.de>
- Loading branch information
Showing
11 changed files
with
285 additions
and
81 deletions.
There are no files selected for viewing
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
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
18 changes: 18 additions & 0 deletions
18
src/main/java/appeng/client/render/cablebus/P2PTunnelFrequencyModel.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
67 changes: 61 additions & 6 deletions
67
src/main/java/appeng/client/render/cablebus/P2PTunnelFrequencyModelData.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,21 +1,76 @@ | ||
/* | ||
* This file is part of Applied Energistics 2. | ||
* Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved. | ||
* | ||
* Applied Energistics 2 is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Applied Energistics 2 is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>. | ||
*/ | ||
|
||
package appeng.client.render.cablebus; | ||
|
||
import net.minecraftforge.client.model.data.ModelProperty; | ||
import java.util.Objects; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import appeng.client.render.model.AEInternalModelData; | ||
import net.minecraftforge.client.model.data.IModelData; | ||
import net.minecraftforge.client.model.data.ModelProperty; | ||
|
||
public final class P2PTunnelFrequencyModelData extends AEInternalModelData { | ||
public final class P2PTunnelFrequencyModelData implements IModelData { | ||
|
||
public static final ModelProperty<Long> FREQUENCY = new ModelProperty<>(); | ||
|
||
private final long frequency; | ||
private final Long frequency; | ||
|
||
public P2PTunnelFrequencyModelData(long frequency) { | ||
this.frequency = frequency; | ||
} | ||
|
||
public long getFrequency() { | ||
return frequency; | ||
@Override | ||
public boolean hasProperty(ModelProperty<?> prop) { | ||
return prop == FREQUENCY; | ||
} | ||
|
||
@Override | ||
@Nullable | ||
@SuppressWarnings("unchecked") | ||
public <T> T getData(ModelProperty<T> prop) { | ||
if (prop == FREQUENCY) { | ||
return (T) this.frequency; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
@Override | ||
@Nullable | ||
public <T> T setData(ModelProperty<T> prop, T data) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(frequency); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
P2PTunnelFrequencyModelData that = (P2PTunnelFrequencyModelData) o; | ||
return frequency.equals(that.frequency); | ||
} | ||
} |
27 changes: 0 additions & 27 deletions
27
src/main/java/appeng/client/render/model/AEInternalModelData.java
This file was deleted.
Oops, something went wrong.
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
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
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
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,17 +1,76 @@ | ||
/* | ||
* This file is part of Applied Energistics 2. | ||
* Copyright (c) 2021, TeamAppliedEnergistics, All rights reserved. | ||
* | ||
* Applied Energistics 2 is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Applied Energistics 2 is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>. | ||
*/ | ||
|
||
package appeng.parts.automation; | ||
|
||
import appeng.client.render.model.AEInternalModelData; | ||
import java.util.Objects; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import net.minecraftforge.client.model.data.IModelData; | ||
import net.minecraftforge.client.model.data.ModelProperty; | ||
|
||
public class PlaneModelData extends AEInternalModelData { | ||
public class PlaneModelData implements IModelData { | ||
|
||
public static final ModelProperty<PlaneConnections> CONNECTIONS = new ModelProperty<>(); | ||
|
||
private final PlaneConnections connections; | ||
|
||
public PlaneModelData(PlaneConnections connections) { | ||
this.connections = connections; | ||
this.connections = Objects.requireNonNull(connections); | ||
} | ||
|
||
@Override | ||
public boolean hasProperty(ModelProperty<?> prop) { | ||
return prop == CONNECTIONS; | ||
} | ||
|
||
@Override | ||
@Nullable | ||
@SuppressWarnings("unchecked") | ||
public <T> T getData(ModelProperty<T> prop) { | ||
if (prop == CONNECTIONS) { | ||
return (T) this.connections; | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
@Nullable | ||
public <T> T setData(ModelProperty<T> prop, T data) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return connections.hashCode(); | ||
} | ||
|
||
public PlaneConnections getConnections() { | ||
return connections; | ||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
PlaneModelData that = (PlaneModelData) o; | ||
return connections.equals(that.connections); | ||
} | ||
|
||
} |
Oops, something went wrong.