codechicken.lib.data.MCDataOutput Java Examples

The following examples show how to use codechicken.lib.data.MCDataOutput. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PartFrame.java    From Framez with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void writeDesc(MCDataOutput packet) {

    if (hidden == null)
        hidden = new boolean[6];

    super.writeDesc(packet);

    for (int i = 0; i < 6; i++)
        packet.writeBoolean(hidden[i]);

    for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
        Collection<IFrameSideModifier> c = getSideModifiers(d);
        packet.writeInt(c.size());
        for (IFrameModifier m : c)
            packet.writeString(m.getType());
    }
}
 
Example #2
Source File: ServerUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static void openContainer(ServerPlayerEntity player, INamedContainerProvider containerProvider, Consumer<MCDataOutput> packetConsumer) {
    if (player.world.isRemote()) {
        return;
    }
    player.closeContainer();
    player.getNextWindowId();
    int containerId = player.currentWindowId;

    Container container = containerProvider.createMenu(containerId, player.inventory, player);
    ContainerType<?> type = container.getType();

    PacketCustom packet = new PacketCustom(CCLNetwork.NET_CHANNEL, C_OPEN_CONTAINER);
    packet.writeRegistryIdUnsafe(ForgeRegistries.CONTAINERS, type);
    packet.writeVarInt(containerId);
    packet.writeTextComponent(containerProvider.getDisplayName());
    packetConsumer.accept(packet);

    packet.sendToPlayer(player);
    player.openContainer = container;
    player.openContainer.addListener(player);
    MinecraftForge.EVENT_BUS.post(new PlayerContainerEvent.Open(player, container));
}
 
Example #3
Source File: TileEnderTank.java    From EnderStorage with MIT License 5 votes vote down vote up
@Override
public void writeToPacket(MCDataOutput packet) {
    super.writeToPacket(packet);
    packet.writeByte(rotation);
    packet.writeFluidStack(liquid_state.s_liquid);
    packet.writeBoolean(pressure_state.a_pressure);
}
 
Example #4
Source File: PartPressureTube.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void writeDesc(MCDataOutput packet){
    for(int i = 0; i < 6; i++) {
        packet.writeBoolean(tube.sidesConnected[i]);
    }
    NBTTagCompound tag = new NBTTagCompound();
    tube.writeToNBT(tag);
    packet.writeNBTTagCompound(tag);
}
 
Example #5
Source File: ConfigTagImpl.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void write(MCDataOutput out) {
    if (isCategory()) {
        out.writeVarInt(children.size());
        for (Entry<String, ConfigTagImpl> entry : children.entrySet()) {
            out.writeString(entry.getKey());
            entry.getValue().write(out);
        }
    } else {
        type.write(out, listType, value);
    }
}
 
Example #6
Source File: ConfigSyncManager.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void write(MCDataOutput out) {
    out.writeVarInt(syncTags.size());
    for (ConfigTag tag : syncTags) {
        out.writeString(tag.getQualifiedName());
        tag.write(out);
    }
}
 
Example #7
Source File: ConfigTag.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void write(MCDataOutput out, TagType listType, Object value) {
    List list = (List) value;
    out.writeVarInt(list.size());
    for (Object o : list) {
        listType.write(out, null, o);
    }
}
 
Example #8
Source File: ConfigTag.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void write(MCDataOutput out, TagType listType, Object value) {
    out.writeDouble((Double) value);
}
 
Example #9
Source File: TubeModule.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Optional.Method(modid = ModIds.FMP)
public void writeDesc(MCDataOutput data){
    data.writeInt(dir.ordinal());
}
 
Example #10
Source File: WirelessPart.java    From WirelessRedstone with MIT License 4 votes vote down vote up
@Override
public void writeDesc(MCDataOutput packet) {
    packet.writeByte(state);
}
 
Example #11
Source File: TransceiverPart.java    From WirelessRedstone with MIT License 4 votes vote down vote up
@Override
public void writeDesc(MCDataOutput packet) {
    super.writeDesc(packet);
    packet.writeShort(currentfreq);
}
 
Example #12
Source File: PartChiselTorch.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void writeDesc(MCDataOutput packet) {
	super.writeDesc(packet);
	packet.writeInt(idx);
}
 
Example #13
Source File: TileEnderChest.java    From EnderStorage with MIT License 4 votes vote down vote up
@Override
public void writeToPacket(MCDataOutput packet) {
    super.writeToPacket(packet);
    packet.writeByte(rotation);
}
 
Example #14
Source File: ConfigTag.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void write(MCDataOutput out, TagType listType, Object value) {
    INT.write(out, listType, value);
}
 
Example #15
Source File: ConfigTag.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void write(MCDataOutput out, TagType listType, Object value) {
    out.writeSignedVarLong((Long) value);
}
 
Example #16
Source File: ConfigTag.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void write(MCDataOutput out, TagType listType, Object value) {
    out.writeSignedVarInt((Integer) value);
}
 
Example #17
Source File: ConfigTag.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void write(MCDataOutput out, TagType listType, Object value) {
    out.writeString((String) value);
}
 
Example #18
Source File: ConfigTag.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void write(MCDataOutput out, TagType listType, Object value) {
    out.writeBoolean((Boolean) value);
}
 
Example #19
Source File: Frequency.java    From EnderStorage with MIT License 4 votes vote down vote up
public void writeToPacket(MCDataOutput packet) {
    packet.writeCompoundNBT(write_internal(new CompoundNBT()));
}
 
Example #20
Source File: TileFrequencyOwner.java    From EnderStorage with MIT License 4 votes vote down vote up
public void writeToPacket(MCDataOutput packet) {
    frequency.writeToPacket(packet);
}
 
Example #21
Source File: ConfigTag.java    From CodeChickenLib with GNU Lesser General Public License v2.1 votes vote down vote up
public abstract void write(MCDataOutput out, TagType listType, Object value); 
Example #22
Source File: ConfigTag.java    From CodeChickenLib with GNU Lesser General Public License v2.1 votes vote down vote up
void write(MCDataOutput out);