mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-20 04:09:43 +00:00
Merge branch 'master' of https://github.com/CrazyPants/EnderIO
This commit is contained in:
commit
cb993cd6a2
14 files changed
+236
-26
No files matched your search
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -58,7 +59,7 @@ public class BlockReinforcedObsidian extends BlockEio implements IResourceToolti
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, World world, int x, int y, int z) {}
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {}
|
||||
|
||||
@Override
|
||||
public int getDefaultDisplayMask(World world, int x, int y, int z) {
|
||||
|
||||
@@ -349,7 +349,7 @@ public abstract class AbstractMachineBlock<T extends AbstractMachineEntity> exte
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, World world, int x, int y, int z) {}
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {}
|
||||
|
||||
@Override
|
||||
public int getDefaultDisplayMask(World world, int x, int y, int z) {
|
||||
|
||||
@@ -147,7 +147,7 @@ public class BlockZombieGenerator extends AbstractMachineBlock<TileZombieGenerat
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, World world, int x, int y, int z) {
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te != null && te instanceof TileZombieGenerator) {
|
||||
tooltip.add(((TileZombieGenerator)te).getFluidStored(ForgeDirection.UNKNOWN) + " mB");
|
||||
|
||||
@@ -9,13 +9,13 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityPainting;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -30,7 +30,6 @@ import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.gui.IAdvancedTooltipProvider;
|
||||
import crazypants.enderio.gui.TooltipAddera;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
@@ -38,6 +37,7 @@ import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
import crazypants.enderio.waila.IWailaInfoProvider;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.Lang;
|
||||
import crazypants.util.Util;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
|
||||
@@ -385,12 +385,22 @@ public class BlockCapacitorBank extends BlockEio implements IGuiHandler, IAdvanc
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, World world, int x, int y, int z) {
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileCapacitorBank) {
|
||||
TileCapacitorBank cap = (TileCapacitorBank) te;
|
||||
String format = Util.TAB + Util.ALIGNRIGHT + EnumChatFormatting.WHITE;
|
||||
|
||||
tooltip.add(String.format("%s%d%s / %s%d%s RF", EnumChatFormatting.WHITE, cap.getEnergyStored() * 10, EnumChatFormatting.RESET, EnumChatFormatting.WHITE, cap.getMaxEnergyStored() * 10, EnumChatFormatting.RESET));
|
||||
|
||||
tooltip.add(String.format("%s : %s%d%sRF/t ", Lang.localize("capbank.maxIO"), format, cap.getMaxIO() * 10, Util.TAB + Util.ALIGNRIGHT));
|
||||
tooltip.add(String.format("%s : %s%d%sRF/t ", Lang.localize("capbank.maxIn"), format, cap.getMaxInput() * 10, Util.TAB + Util.ALIGNRIGHT));
|
||||
tooltip.add(String.format("%s : %s%d%sRF/t ", Lang.localize("capbank.maxOut"), format, cap.getMaxOutput() * 10, Util.TAB + Util.ALIGNRIGHT));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDefaultDisplayMask(World world, int x, int y, int z) {
|
||||
return IWailaInfoProvider.BIT_DETAILED;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public class BlockPoweredSpawner extends AbstractMachineBlock<TilePoweredSpawner
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, World world, int x, int y, int z) {
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TilePoweredSpawner te = (TilePoweredSpawner) world.getTileEntity(x, y, z);
|
||||
tooltip.add(te.getEntityName());
|
||||
}
|
||||
|
||||
@@ -259,4 +259,16 @@ public class BlockTank extends AbstractMachineBlock<TileTank> implements IAdvanc
|
||||
return stack.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileTank) {
|
||||
TileTank tank = (TileTank) te;
|
||||
FluidStack stored = tank.tank.getFluid();
|
||||
String fluid = stored == null ? Lang.localize("tooltip.none") : stored.getFluid().getLocalizedName(stored);
|
||||
int amount = stored == null ? 0 : stored.amount;
|
||||
|
||||
tooltip.add(String.format("%s%s : %s (%d %s)", EnumChatFormatting.WHITE, Lang.localize("tooltip.fluidStored"), fluid, amount, Lang.localize("fluid.millibucket.abr")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package crazypants.enderio.machine.transceiver;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
@@ -16,6 +18,8 @@ import crazypants.enderio.machine.AbstractMachineBlock;
|
||||
import crazypants.enderio.machine.transceiver.gui.ContainerTransceiver;
|
||||
import crazypants.enderio.machine.transceiver.gui.GuiTransceiver;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.util.Lang;
|
||||
import crazypants.util.Util;
|
||||
|
||||
public class BlockTransceiver extends AbstractMachineBlock<TileTransceiver> {
|
||||
|
||||
@@ -98,5 +102,38 @@ public class BlockTransceiver extends AbstractMachineBlock<TileTransceiver> {
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te instanceof TileTransceiver && player.isSneaking()) {
|
||||
TileTransceiver trans = (TileTransceiver) te;
|
||||
for (ChannelType type : ChannelType.VALUES) {
|
||||
tooltip.add(EnumChatFormatting.WHITE + Lang.localize("trans." + type.name().toLowerCase()));
|
||||
|
||||
List<Channel> recieving = trans.getRecieveChannels(type);
|
||||
List<Channel> sending = trans.getSendChannels(type);
|
||||
String recieve = "[" + buildString(recieving) + "]";
|
||||
String send = "[" + buildString(sending) + "]";
|
||||
|
||||
if(!"[]".equals(recieve)) {
|
||||
tooltip.add(String.format("%s%s " + Util.TAB + ": %s%s", Util.TAB, Lang.localize("trans.recieving"), Util.TAB + Util.ALIGNRIGHT + EnumChatFormatting.WHITE, recieve));
|
||||
}
|
||||
if(!"[]".equals(send)) {
|
||||
tooltip.add(String.format("%s%s " + Util.TAB + ": %s%s", Util.TAB, Lang.localize("trans.sending"), Util.TAB + Util.ALIGNRIGHT + EnumChatFormatting.WHITE, send));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String buildString(List<Channel> channels) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Channel c : channels) {
|
||||
sb.append(c.getName());
|
||||
if (channels.indexOf(c) != channels.size() - 1) {
|
||||
sb.append(", ");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ public enum ChannelType {
|
||||
|
||||
POWER,
|
||||
ITEM,
|
||||
FLUID
|
||||
|
||||
FLUID;
|
||||
|
||||
public static final ChannelType[] VALUES = values();
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package crazypants.enderio.waila;
|
||||
import java.util.List;
|
||||
|
||||
import crazypants.enderio.gui.IAdvancedTooltipProvider;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IWailaInfoProvider {
|
||||
@@ -20,7 +21,7 @@ public interface IWailaInfoProvider {
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
public void getWailaInfo(List<String> tooltip, World world, int x, int y, int z);
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* A bitmask for the default tooltips to show, use static ints in {@link IWailaInfoProvider}
|
||||
|
||||
@@ -4,12 +4,11 @@ import static crazypants.enderio.waila.IWailaInfoProvider.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -19,6 +18,9 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.BlockConduitBundle;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.gui.IAdvancedTooltipProvider;
|
||||
import crazypants.enderio.gui.IResourceTooltipProvider;
|
||||
import crazypants.enderio.gui.TooltipAddera;
|
||||
@@ -32,13 +34,22 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
public static final WailaCompat INSTANCE = new WailaCompat();
|
||||
|
||||
public static void load(IWailaRegistrar registrar) {
|
||||
registrar.registerStackProvider(INSTANCE, BlockConduitBundle.class); // CHANGE BLOCK TYPE IF MORE ARE ADDED
|
||||
registrar.registerHeadProvider(INSTANCE, Block.class);
|
||||
registrar.registerBodyProvider(INSTANCE, Block.class);
|
||||
registrar.registerTailProvider(INSTANCE, Block.class);
|
||||
|
||||
ConfigHandler.instance().addConfig(EnderIO.MOD_NAME, "facades.hidden", "Sneaky Facades");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (accessor.getBlock() instanceof BlockConduitBundle && config.getConfig("facades.hidden")) {
|
||||
IConduitBundle bundle = (IConduitBundle) accessor.getTileEntity();
|
||||
if (bundle.hasFacade()) {
|
||||
return new ItemStack(bundle.getFacadeId(), 1, bundle.getFacadeMetadata());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -96,7 +107,7 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
TooltipAddera.addInformation((IResourceTooltipProvider) block, itemStack, player, currenttip);
|
||||
}
|
||||
|
||||
info.getWailaInfo(currenttip, world, pos.blockX, pos.blockY, pos.blockZ);
|
||||
info.getWailaInfo(currenttip, player, world, pos.blockX, pos.blockY, pos.blockZ);
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
@@ -480,5 +480,15 @@ public class Util {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// copied from WAILA source to avoid API dependency
|
||||
public static String WailaStyle = "\u00A4";
|
||||
public static String WailaIcon = "\u00A5";
|
||||
public static String TAB = WailaStyle + WailaStyle +"a";
|
||||
public static String ALIGNRIGHT = WailaStyle + WailaStyle +"b";
|
||||
public static String ALIGNCENTER = WailaStyle + WailaStyle +"c";
|
||||
public static String HEART = WailaStyle + WailaIcon +"a";
|
||||
public static String HHEART = WailaStyle + WailaIcon +"b";
|
||||
public static String EHEART = WailaStyle + WailaIcon +"c";
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user