Add out of energy message to network items
This commit is contained in:
@@ -12,6 +12,7 @@ import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
@@ -39,6 +40,8 @@ public class WirelessFluidGridNetworkItem implements INetworkItem {
|
||||
((WirelessFluidGridItem) stack.getItem()).getType() != WirelessFluidGridItem.Type.CREATIVE &&
|
||||
energy != null &&
|
||||
energy.getEnergyStored() <= RS.SERVER_CONFIG.getWirelessFluidGrid().getOpenUsage()) {
|
||||
sendOutOfEnergyMessage();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,8 +68,14 @@ public class WirelessFluidGridNetworkItem implements INetworkItem {
|
||||
handler.close(player);
|
||||
|
||||
player.closeScreen();
|
||||
|
||||
sendOutOfEnergyMessage();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void sendOutOfEnergyMessage() {
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage.network_item.out_of_energy", new TranslationTextComponent(stack.getItem().getTranslationKey())));
|
||||
}
|
||||
}
|
@@ -12,6 +12,7 @@ import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
@@ -39,6 +40,8 @@ public class WirelessGridNetworkItem implements INetworkItem {
|
||||
((WirelessGridItem) stack.getItem()).getType() != WirelessGridItem.Type.CREATIVE &&
|
||||
energy != null &&
|
||||
energy.getEnergyStored() <= RS.SERVER_CONFIG.getWirelessGrid().getOpenUsage()) {
|
||||
sendOutOfEnergyMessage();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,8 +68,14 @@ public class WirelessGridNetworkItem implements INetworkItem {
|
||||
handler.close(player);
|
||||
|
||||
player.closeScreen();
|
||||
|
||||
sendOutOfEnergyMessage();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void sendOutOfEnergyMessage() {
|
||||
player.sendMessage(new TranslationTextComponent("misc.refinedstorage.network_item.out_of_energy", new TranslationTextComponent(stack.getItem().getTranslationKey())));
|
||||
}
|
||||
}
|
@@ -94,6 +94,7 @@
|
||||
"misc.refinedstorage.network_item.not_found": "Network not found.",
|
||||
"misc.refinedstorage.network_item.shortcut_not_found": "There isn't any %s in your inventory.",
|
||||
"misc.refinedstorage.network_item.shortcut_duplicate": "There is more than one %s in your inventory.",
|
||||
"misc.refinedstorage.network_item.out_of_energy": "The %s is out of energy.",
|
||||
"misc.refinedstorage.network_card.tooltip": "Linked to %d, %d, %d in %s.",
|
||||
"misc.refinedstorage.pattern.inputs": "Inputs",
|
||||
"misc.refinedstorage.pattern.outputs": "Outputs",
|
||||
|
Reference in New Issue
Block a user