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

Adapt the "onAlloyIteraction" and "canUpgrade" methods to subclasses of "ITier" #8252

Open
wants to merge 1 commit into
base: 1.21.x
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/api/java/mekanism/api/IAlloyInteraction.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package mekanism.api;

import mekanism.api.tier.AlloyTier;
import mekanism.api.tier.ITier;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;
Expand All @@ -19,5 +19,5 @@ public interface IAlloyInteraction {
* @param stack - the stack of alloy being right-clicked
* @param tier - the tier of the alloy
*/
void onAlloyInteraction(Player player, ItemStack stack, @NotNull AlloyTier tier);
<TIER extends ITier> void onAlloyInteraction(Player player, ItemStack stack, @NotNull TIER tier);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package mekanism.common.content.network.transmitter;

import mekanism.api.tier.AlloyTier;
import mekanism.api.tier.ITier;
import mekanism.common.upgrade.transmitter.TransmitterUpgradeData;
import org.jetbrains.annotations.NotNull;
Expand All @@ -15,7 +14,7 @@ public interface IUpgradeableTransmitter<DATA extends TransmitterUpgradeData> {

ITier getTier();

default boolean canUpgrade(AlloyTier alloyTier) {
default <TIER extends ITier> boolean canUpgrade(TIER alloyTier) {
return alloyTier.getBaseTier().ordinal() == getTier().getBaseTier().ordinal() + 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import mekanism.api.IConfigurable;
import mekanism.api.providers.IBlockProvider;
import mekanism.api.text.EnumColor;
import mekanism.api.tier.AlloyTier;
import mekanism.api.tier.BaseTier;
import mekanism.api.tier.ITier;
import mekanism.client.model.data.TransmitterModelData;
import mekanism.common.Mekanism;
import mekanism.common.MekanismLang;
Expand Down Expand Up @@ -322,7 +322,7 @@ protected TransmitterModelData initModelData() {
}

@Override
public void onAlloyInteraction(Player player, ItemStack stack, @NotNull AlloyTier tier) {
public <TIER extends ITier> void onAlloyInteraction(Player player, ItemStack stack, @NotNull TIER tier) {
if (getLevel() != null && getTransmitter().hasTransmitterNetwork()) {
DynamicNetwork<?, ?, ?> transmitterNetwork = getTransmitter().getTransmitterNetwork();
List<Transmitter<?, ?, ?>> list = new ArrayList<>(transmitterNetwork.getTransmitters());
Expand Down