Search in sources :

Example 36 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project NyaSamaRailway by NSDN.

the class ItemNTP8Bit method clearCart.

public void clearCart(ItemStack itemStack, EntityPlayer player) {
    power.set(itemStack, 0);
    brake.set(itemStack, 5);
    dir.set(itemStack, 0);
    cart.set(itemStack, -1);
    if (player instanceof EntityPlayerMP) {
        TrainPacket packet = new TrainPacket();
        packet.fromStack(itemStack);
        NetworkWrapper.instance.sendTo(packet, (EntityPlayerMP) player);
    }
    player.addChatComponentMessage(new ChatComponentTranslation("info.ntp.cleared"));
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) TrainPacket(club.nsdn.nyasamarailway.network.TrainPacket)

Example 37 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project NyaSamaRailway by NSDN.

the class NSPCT10M method interactFirst.

@Override
public boolean interactFirst(EntityPlayer player) {
    if (MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, player))) {
        return true;
    } else if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != player) {
        return true;
    } else if (this.riddenByEntity != null && this.riddenByEntity != player) {
        return false;
    } else {
        if (player != null) {
            ItemStack stack = player.getCurrentEquippedItem();
            if (stack != null) {
                if (stack.getItem() instanceof Item1N4148 || stack.getItem() instanceof ItemNTP8Bit || stack.getItem() instanceof ItemNTP32Bit) {
                    return true;
                }
                if (stack.getItem() instanceof ItemMinecart)
                    return true;
            }
            if (!this.worldObj.isRemote) {
                player.mountEntity(this);
                player.addChatComponentMessage(new ChatComponentTranslation("info.nsr.x"));
            }
        }
        return true;
    }
}
Also used : ItemNTP32Bit(club.nsdn.nyasamarailway.item.tool.ItemNTP32Bit) ItemNTP8Bit(club.nsdn.nyasamarailway.item.tool.ItemNTP8Bit) Item1N4148(club.nsdn.nyasamarailway.item.tool.Item1N4148) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) ItemMinecart(net.minecraft.item.ItemMinecart) MinecartInteractEvent(net.minecraftforge.event.entity.minecart.MinecartInteractEvent) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack)

Example 38 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project NyaSamaRailway by NSDN.

the class NSPCT8J method modifyHighSpeedMode.

public void modifyHighSpeedMode(EntityPlayer player) {
    setHighSpeedMode(!getHighSpeedMode());
    player.addChatComponentMessage(new ChatComponentTranslation("info.nspc8j.mode", String.valueOf(getHighSpeedMode()).toUpperCase()));
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation)

Example 39 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project Minechem by iopleke.

the class ElementAchievement method func_150951_e.

/**
     * Returns the title
     *
     * @return an {@link net.minecraft.util.IChatComponent}
     */
@Override
public IChatComponent func_150951_e() {
    IChatComponent iChatComponent = new ChatComponentTranslation(defaultElementTitle, element.shortName);
    iChatComponent.getChatStyle().setColor(this.getSpecial() ? EnumChatFormatting.DARK_PURPLE : EnumChatFormatting.GREEN);
    return iChatComponent;
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) IChatComponent(net.minecraft.util.IChatComponent)

Example 40 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project LogisticsPipes by RS485.

the class LogisticsEventListener method onPlayerInteract.

@SubscribeEvent
public void onPlayerInteract(final PlayerInteractEvent event) {
    if (MainProxy.isServer(event.entityPlayer.worldObj)) {
        if (event.action == Action.LEFT_CLICK_BLOCK) {
            final TileEntity tile = event.entityPlayer.worldObj.getTileEntity(event.x, event.y, event.z);
            if (tile instanceof LogisticsTileGenericPipe) {
                if (((LogisticsTileGenericPipe) tile).pipe instanceof CoreRoutedPipe) {
                    if (!((CoreRoutedPipe) ((LogisticsTileGenericPipe) tile).pipe).canBeDestroyedByPlayer(event.entityPlayer)) {
                        event.setCanceled(true);
                        event.entityPlayer.addChatComponentMessage(new ChatComponentTranslation("lp.chat.permissiondenied"));
                        ((LogisticsTileGenericPipe) tile).scheduleNeighborChange();
                        event.entityPlayer.worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
                        ((CoreRoutedPipe) ((LogisticsTileGenericPipe) tile).pipe).delayTo = System.currentTimeMillis() + 200;
                        ((CoreRoutedPipe) ((LogisticsTileGenericPipe) tile).pipe).repeatFor = 10;
                    } else {
                        ((CoreRoutedPipe) ((LogisticsTileGenericPipe) tile).pipe).setDestroyByPlayer();
                    }
                }
            }
        }
        if (event.action == Action.RIGHT_CLICK_BLOCK) {
            WorldCoordinatesWrapper worldCoordinates = new WorldCoordinatesWrapper(event.entityPlayer.worldObj, event.x, event.y, event.z);
            TileEntity tileEntity = worldCoordinates.getTileEntity();
            if (tileEntity instanceof TileEntityChest || SimpleServiceLocator.ironChestProxy.isIronChest(tileEntity)) {
                //@formatter:off
                List<WeakReference<ModuleQuickSort>> list = worldCoordinates.getAdjacentTileEntities().filter(adjacent -> adjacent.tileEntity instanceof LogisticsTileGenericPipe).filter(adjacent -> ((LogisticsTileGenericPipe) adjacent.tileEntity).pipe instanceof PipeLogisticsChassi).filter(adjacent -> ((PipeLogisticsChassi) ((LogisticsTileGenericPipe) adjacent.tileEntity).pipe).getPointedOrientation() == adjacent.direction.getOpposite()).map(adjacent -> (PipeLogisticsChassi) ((LogisticsTileGenericPipe) adjacent.tileEntity).pipe).flatMap(pipeLogisticsChassi -> Arrays.stream(pipeLogisticsChassi.getModules().getModules())).filter(logisticsModule -> logisticsModule instanceof ModuleQuickSort).map(logisticsModule -> new WeakReference<>((ModuleQuickSort) logisticsModule)).collect(Collectors.toList());
                if (!list.isEmpty()) {
                    LogisticsEventListener.chestQuickSortConnection.put(event.entityPlayer, list);
                }
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Action(net.minecraftforge.event.entity.player.PlayerInteractEvent.Action) Arrays(java.util.Arrays) ModuleQuickSort(logisticspipes.modules.ModuleQuickSort) MainProxy(logisticspipes.proxy.MainProxy) VersionChecker(logisticspipes.ticks.VersionChecker) PlayerCollectionList(logisticspipes.utils.PlayerCollectionList) Configs(logisticspipes.config.Configs) ChestGuiOpened(logisticspipes.network.packets.chassis.ChestGuiOpened) ChatComponentText(net.minecraft.util.ChatComponentText) LogisticsHUDRenderer(logisticspipes.renderer.LogisticsHUDRenderer) LogisticsGuiOverrenderer(logisticspipes.renderer.LogisticsGuiOverrenderer) Map(java.util.Map) FMLClientHandler(cpw.mods.fml.client.FMLClientHandler) PlayerLoggedInEvent(cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent) PlayerLoggedOutEvent(cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent) ClientConnectedToServerEvent(cpw.mods.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent) EntityItem(net.minecraft.entity.item.EntityItem) ChestGuiClosed(logisticspipes.network.packets.chassis.ChestGuiClosed) Side(cpw.mods.fml.relauncher.Side) SideOnly(cpw.mods.fml.relauncher.SideOnly) UnWatch(net.minecraftforge.event.world.ChunkWatchEvent.UnWatch) WorldEvent(net.minecraftforge.event.world.WorldEvent) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) PacketHandler(logisticspipes.network.PacketHandler) Collectors(java.util.stream.Collectors) List(java.util.List) EntityJoinWorldEvent(net.minecraftforge.event.entity.EntityJoinWorldEvent) SimpleServiceLocator(logisticspipes.proxy.SimpleServiceLocator) PipeLogisticsChassi(logisticspipes.pipes.PipeLogisticsChassi) EntityPlayer(net.minecraft.entity.player.EntityPlayer) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent) PlayerIdentifier(logisticspipes.utils.PlayerIdentifier) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) Queue(java.util.Queue) PlayerConfig(logisticspipes.config.PlayerConfig) WorldCoordinatesWrapper(network.rs485.logisticspipes.world.WorldCoordinatesWrapper) ChunkCoordIntPair(net.minecraft.world.ChunkCoordIntPair) Setter(lombok.Setter) Getter(lombok.Getter) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) GuiReopenPacket(logisticspipes.network.packets.gui.GuiReopenPacket) HashMap(java.util.HashMap) PlayerConfigToClientPacket(logisticspipes.network.packets.PlayerConfigToClientPacket) Watch(net.minecraftforge.event.world.ChunkWatchEvent.Watch) TileEntityChest(net.minecraft.tileentity.TileEntityChest) ItemStack(net.minecraft.item.ItemStack) IItemAdvancedExistance(logisticspipes.interfaces.IItemAdvancedExistance) TextureStitchEvent(net.minecraftforge.client.event.TextureStitchEvent) EntityClientPlayerMP(net.minecraft.client.entity.EntityClientPlayerMP) WeakReference(java.lang.ref.WeakReference) LinkedList(java.util.LinkedList) PlayerInteractEvent(net.minecraftforge.event.entity.player.PlayerInteractEvent) WeakHashMap(java.util.WeakHashMap) IOException(java.io.IOException) GuiChest(net.minecraft.client.gui.inventory.GuiChest) GuiOpenEvent(net.minecraftforge.client.event.GuiOpenEvent) QuickSortChestMarkerStorage(logisticspipes.utils.QuickSortChestMarkerStorage) TileEntity(net.minecraft.tileentity.TileEntity) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) AllArgsConstructor(lombok.AllArgsConstructor) TileEntityChest(net.minecraft.tileentity.TileEntityChest) PipeLogisticsChassi(logisticspipes.pipes.PipeLogisticsChassi) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) WeakReference(java.lang.ref.WeakReference) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) ModuleQuickSort(logisticspipes.modules.ModuleQuickSort) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) WorldCoordinatesWrapper(network.rs485.logisticspipes.world.WorldCoordinatesWrapper) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Aggregations

ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)77 ItemStack (net.minecraft.item.ItemStack)19 EntityPlayer (net.minecraft.entity.player.EntityPlayer)13 TileEntity (net.minecraft.tileentity.TileEntity)13 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)11 ArrayList (java.util.ArrayList)5 Block (net.minecraft.block.Block)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 World (net.minecraft.world.World)4 Item1N4148 (club.nsdn.nyasamarailway.item.tool.Item1N4148)3 ItemNTP32Bit (club.nsdn.nyasamarailway.item.tool.ItemNTP32Bit)3 ItemNTP8Bit (club.nsdn.nyasamarailway.item.tool.ItemNTP8Bit)3 TrainPacket (club.nsdn.nyasamarailway.network.TrainPacket)3 TileEntityActuator (club.nsdn.nyasamatelecom.api.tileentity.TileEntityActuator)3 EntityItem (net.minecraft.entity.item.EntityItem)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 TileEntityRailSniffer (club.nsdn.nyasamarailway.tileblock.signal.TileEntityRailSniffer)2 TileEntityReceiver (club.nsdn.nyasamatelecom.api.tileentity.TileEntityReceiver)2 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)2 Side (cpw.mods.fml.relauncher.Side)2