Skip to content

Commit

Permalink
add face tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
aagrishankov committed Dec 27, 2020
1 parent eb1d36c commit 291f55b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/scala/extracells/item/ItemBlockECBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import extracells.registries.PartEnum;
import extracells.tileentity.TileEntityFluidInterface;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
Expand All @@ -10,10 +11,12 @@
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

import java.util.Collections;
import java.util.List;

public class ItemBlockECBase extends ItemBlock {
Expand Down Expand Up @@ -67,6 +70,20 @@ public String getUnlocalizedName(ItemStack stack) {
}
}

@SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack is, EntityPlayer p, List l, boolean b) {
super.addInformation(is, p, l, b);
if (is.getItemDamage() == 0) {
String[] tooltip = new String[] {
EnumChatFormatting.RED + "Impact authors do not recommend using this device.",
EnumChatFormatting.RED + "This device is the source of ME network lags and problems.",
EnumChatFormatting.RED + "This item will not be deleted, use at your own risk.",
};
Collections.addAll(l, tooltip);
}
}

@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player,
World world, int x, int y, int z, int side, float hitX, float hitY,
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/extracells/item/ItemPartECBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import org.apache.logging.log4j.Level;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -68,6 +70,20 @@ public String getItemStackDisplayName(ItemStack stack) {
return super.getItemStackDisplayName(stack);
}

@SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack is, EntityPlayer p, List l, boolean b) {
super.addInformation(is, p, l, b);
if (is.getItemDamage() == PartEnum.INTERFACE.ordinal()) {
String[] tooltip = new String[] {
EnumChatFormatting.RED + "Impact authors do not recommend using this device.",
EnumChatFormatting.RED + "This device is the source of ME network lags and problems.",
EnumChatFormatting.RED + "This item will not be deleted, use at your own risk.",
};
Collections.addAll(l, tooltip);
}
}

@Override
public EnumRarity getRarity(ItemStack itemStack) {
if (itemStack != null
Expand Down

0 comments on commit 291f55b

Please sign in to comment.