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

Modify part of tooltips to read en_us.lang #171

Open
wants to merge 2 commits into
base: 1.12
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package mcjty.rftoolscontrol.blocks.craftingstation;

import mcjty.lib.gui.GenericGuiContainer;
import mcjty.rftoolscontrol.blocks.GenericRFToolsBlock;
import mcjty.rftoolscontrol.setup.GuiProxy;
import net.minecraft.block.material.Material;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.Arrays;
import java.util.List;
import java.util.function.BiFunction;

public class CraftingStationBlock extends GenericRFToolsBlock<CraftingStationTileEntity, CraftingStationContainer> {

public CraftingStationBlock() {
super(Material.IRON, CraftingStationTileEntity.class, CraftingStationContainer::new, "craftingstation", false);
}

@SideOnly(Side.CLIENT)
@Override
public BiFunction<CraftingStationTileEntity, CraftingStationContainer, GenericGuiContainer<? super CraftingStationTileEntity>> getGuiFactory() {
return GuiCraftingStation::new;
}

@Override
public int getGuiID() {
return GuiProxy.GUI_CRAFTINGSTATION;
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, World playerIn, List<String> list, ITooltipFlag advanced) {
super.addInformation(stack, playerIn, list, advanced);
list.addAll(Arrays.asList(I18n.format("tooltips." + RFToolsControl.MODID + "." + "craftingstation").split("0x0a")));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package mcjty.rftoolscontrol.blocks.multitank;

import mcjty.lib.container.EmptyContainer;
import mcjty.lib.gui.GenericGuiContainer;
import mcjty.rftoolscontrol.blocks.GenericRFToolsBlock;
import mcjty.rftoolscontrol.setup.GuiProxy;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.Arrays;
import java.util.List;
import java.util.function.BiFunction;

public class MultiTankBlock extends GenericRFToolsBlock<MultiTankTileEntity, EmptyContainer> {

public MultiTankBlock() {
super(Material.IRON, MultiTankTileEntity.class, EmptyContainer::new, "tank", false);
}

@Override
public RotationType getRotationType() {
return RotationType.NONE;
}

@SideOnly(Side.CLIENT)
@Override
public BiFunction<MultiTankTileEntity, EmptyContainer, GenericGuiContainer<? super MultiTankTileEntity>> getGuiFactory() {
return GuiMultiTank::new;
}

@Override
public int getGuiID() {
return GuiProxy.GUI_TANK;
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, World playerIn, List<String> list, ITooltipFlag advanced) {
super.addInformation(stack, playerIn, list, advanced);
list.addAll(Arrays.asList(I18n.format("tooltips." + RFToolsControl.MODID + "." + "tank").split("0x0a")));
}

@Override
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
return layer == BlockRenderLayer.SOLID || layer == BlockRenderLayer.TRANSLUCENT;
}

@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package mcjty.rftoolscontrol.blocks.node;

import mcjty.lib.container.EmptyContainer;
import mcjty.lib.gui.GenericGuiContainer;
import mcjty.rftoolscontrol.blocks.GenericRFToolsBlock;
import mcjty.rftoolscontrol.setup.GuiProxy;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.ProbeMode;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.Arrays;
import java.util.List;
import java.util.function.BiFunction;

public class NodeBlock extends GenericRFToolsBlock<NodeTileEntity, EmptyContainer> {

public NodeBlock() {
super(Material.IRON, NodeTileEntity.class, EmptyContainer::new, "node", false);
}

@SideOnly(Side.CLIENT)
@Override
public BiFunction<NodeTileEntity, EmptyContainer, GenericGuiContainer<? super NodeTileEntity>> getGuiFactory() {
return GuiNode::new;
}

@Override
public int getGuiID() {
return GuiProxy.GUI_NODE;
}

@Override
public boolean needsRedstoneCheck() {
return true;
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, World playerIn, List<String> list, ITooltipFlag advanced) {
super.addInformation(stack, playerIn, list, advanced);
list.addAll(Arrays.asList(I18n.format("tooltips." + RFToolsControl.MODID + "." + "node").split("0x0a")));
}

@Override
@Optional.Method(modid = "theoneprobe")
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
super.addProbeInfo(mode, probeInfo, player, world, blockState, data);
TileEntity te = world.getTileEntity(data.getPos());
if (te instanceof NodeTileEntity) {
NodeTileEntity node = (NodeTileEntity) te;
probeInfo.text(TextFormatting.GREEN + "Channel: " + node.getChannelName());
probeInfo.text(TextFormatting.GREEN + "Name: " + node.getNodeName());
}
}


private int getInputStrength(World world, BlockPos pos, EnumFacing side) {
return world.getRedstonePower(pos.offset(side), side);
}

@Override
protected void checkRedstone(World world, BlockPos pos) {
IBlockState state = world.getBlockState(pos);
TileEntity te = world.getTileEntity(pos);
if (state.getBlock() instanceof NodeBlock && te instanceof NodeTileEntity) {
NodeTileEntity processor = (NodeTileEntity)te;
int powered = 0;
if (getInputStrength(world, pos, EnumFacing.DOWN) > 0) {
powered += 1;
}
if (getInputStrength(world, pos, EnumFacing.UP) > 0) {
powered += 2;
}
if (getInputStrength(world, pos, EnumFacing.NORTH) > 0) {
powered += 4;
}
if (getInputStrength(world, pos, EnumFacing.SOUTH) > 0) {
powered += 8;
}
if (getInputStrength(world, pos, EnumFacing.WEST) > 0) {
powered += 16;
}
if (getInputStrength(world, pos, EnumFacing.EAST) > 0) {
powered += 32;
}
processor.setPowerInput(powered);
}
}

@Override
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
return true;
}

@Override
protected int getRedstoneOutput(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
TileEntity te = world.getTileEntity(pos);
if (state.getBlock() instanceof NodeBlock && te instanceof NodeTileEntity) {
NodeTileEntity processor = (NodeTileEntity) te;
return processor.getPowerOut(side.getOpposite());
}
return 0;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
package mcjty.rftoolscontrol.blocks.processor;

import mcjty.lib.gui.GenericGuiContainer;
import mcjty.rftoolscontrol.blocks.GenericRFToolsBlock;
import mcjty.rftoolscontrol.setup.GuiProxy;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.ProbeMode;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.Arrays;
import java.util.List;
import java.util.function.BiFunction;

public class ProcessorBlock extends GenericRFToolsBlock<ProcessorTileEntity, ProcessorContainer> {

@Override
public boolean needsRedstoneCheck() {
return true;
}

public ProcessorBlock() {
super(Material.IRON, ProcessorTileEntity.class, ProcessorContainer::new, "processor", false);
}

@Override
public void initModel() {
ProcessorRenderer.register();
super.initModel();
}

@SideOnly(Side.CLIENT)
@Override
public BiFunction<ProcessorTileEntity, ProcessorContainer, GenericGuiContainer<? super ProcessorTileEntity>> getGuiFactory() {
return GuiProcessor::new;
}

@Override
public int getGuiID() {
return GuiProxy.GUI_PROCESSOR;
}

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, World playerIn, List<String> list, ITooltipFlag advanced) {
super.addInformation(stack, playerIn, list, advanced);
list.addAll(Arrays.asList(I18n.format("tooltips." + RFToolsControl.MODID + "." + "processor").split("0x0a")));
}

@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
super.neighborChanged(state, world, pos, blockIn, fromPos);
TileEntity te = world.getTileEntity(pos);
if (te instanceof ProcessorTileEntity) {
((ProcessorTileEntity) te).markFluidSlotsDirty();
}
}

@Override
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
super.onNeighborChange(world, pos, neighbor);
TileEntity te = world.getTileEntity(pos);
if (te instanceof ProcessorTileEntity) {
((ProcessorTileEntity) te).markFluidSlotsDirty();
}
}

@Override
@Optional.Method(modid = "theoneprobe")
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
super.addProbeInfo(mode, probeInfo, player, world, blockState, data);
TileEntity te = world.getTileEntity(data.getPos());
if (te instanceof ProcessorTileEntity) {
ProcessorTileEntity processor = (ProcessorTileEntity) te;
if (processor.hasNetworkCard()) {
probeInfo.text(TextFormatting.GREEN + "Channel: " + processor.getChannelName());
probeInfo.text(TextFormatting.GREEN + "Nodes: " + processor.getNodeCount());
}
if (mode == ProbeMode.EXTENDED) {
List<String> lastMessages = processor.getLastMessages(6);
if (!lastMessages.isEmpty()) {
IProbeInfo v = probeInfo.vertical(probeInfo.defaultLayoutStyle().borderColor(0xffff0000));
for (String s : lastMessages) {
v.text(" " + s);
}
}
}
}
}


private int getInputStrength(World world, BlockPos pos, EnumFacing side) {
return world.getRedstonePower(pos.offset(side), side);
}

@Override
protected void checkRedstone(World world, BlockPos pos) {
IBlockState state = world.getBlockState(pos);
TileEntity te = world.getTileEntity(pos);
if (state.getBlock() instanceof ProcessorBlock && te instanceof ProcessorTileEntity) {
ProcessorTileEntity processor = (ProcessorTileEntity)te;
int powered = 0;
if (getInputStrength(world, pos, EnumFacing.DOWN) > 0) {
powered += 1;
}
if (getInputStrength(world, pos, EnumFacing.UP) > 0) {
powered += 2;
}
if (getInputStrength(world, pos, EnumFacing.NORTH) > 0) {
powered += 4;
}
if (getInputStrength(world, pos, EnumFacing.SOUTH) > 0) {
powered += 8;
}
if (getInputStrength(world, pos, EnumFacing.WEST) > 0) {
powered += 16;
}
if (getInputStrength(world, pos, EnumFacing.EAST) > 0) {
powered += 32;
}
processor.setPowerInput(powered);
}
}

@Override
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
return true;
}

@Override
protected int getRedstoneOutput(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
TileEntity te = world.getTileEntity(pos);
if (state.getBlock() instanceof ProcessorBlock && te instanceof ProcessorTileEntity) {
ProcessorTileEntity processor = (ProcessorTileEntity) te;
return processor.getPowerOut(side.getOpposite());
}
return 0;
}

}
Loading