net.minecraft.network.play.server.SPacketUpdateTileEntity Java Examples

The following examples show how to use net.minecraft.network.play.server.SPacketUpdateTileEntity. 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: TileEntityGearbox.java    From Valkyrien-Skies with Apache License 2.0 6 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
    NBTTagCompound tagToSend = new NBTTagCompound();
    tagToSend.setDouble("rotation", rotation);
    tagToSend.setShort("input_facing", (byte) inputFacing.ordinal());
    byte validSides = 0;
    for (int i = 0; i < 6; i++) {
        if (connectedSidesRatios[i].isPresent()) {
            validSides |= 1 << i;
            tagToSend.setFloat("side_rotation_ratio" + i,
                connectedSidesRatios[i].get().floatValue());
        }
    }

    tagToSend.setByte("valid_sides_byte", validSides);
    return new SPacketUpdateTileEntity(this.getPos(), 0, tagToSend);
}
 
Example #2
Source File: TileMicrowaveReciever.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
	NBTTagCompound nbt = pkt.getNbtCompound();

	canRender = nbt.getBoolean("canRender");
	powerMadeLastTick = nbt.getInteger("amtPwr");
	readNetworkData(nbt);
}
 
Example #3
Source File: TileEntityEnergyBase.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
@Nullable
public SPacketUpdateTileEntity getUpdatePacket() {
    NBTTagCompound nbtTagCompound = new NBTTagCompound();
    this.writeToNBT(nbtTagCompound);
    return new SPacketUpdateTileEntity(pos, this.getBlockMetadata(), nbtTagCompound);
}
 
Example #4
Source File: TileEntityShoji.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Nullable
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
    NBTTagCompound nbtTag = new NBTTagCompound();
    writeToNBT(nbtTag);
    return new SPacketUpdateTileEntity(getPos(), 1, nbtTag);
}
 
Example #5
Source File: TileEntityTransportRail.java    From Signals with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt){
    if(pkt.getTileEntityType() == 0) {
        forward = pkt.getNbtCompound().getBoolean("forward");
        world.markBlockRangeForRenderUpdate(pos, pos);
    }
}
 
Example #6
Source File: TileAtmosphereTerraformer.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
	NBTTagCompound nbt = pkt.getNbtCompound();
	readFromNBT(nbt);
	setText();
	
}
 
Example #7
Source File: TileEntityEnderUtilities.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public SPacketUpdateTileEntity getUpdatePacket()
{
    if (this.getWorld() != null)
    {
        return new SPacketUpdateTileEntity(this.getPos(), 0, this.getUpdatePacketTag(new NBTTagCompound()));
    }

    return null;
}
 
Example #8
Source File: TileStationGravityController.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
	NBTTagCompound nbt = writeToNBT(new NBTTagCompound());
	nbt.setInteger("gravity", gravity);
	

	SPacketUpdateTileEntity packet = new SPacketUpdateTileEntity(pos, 0, nbt);
	return packet;
}
 
Example #9
Source File: TileStationAltitudeController.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
	NBTTagCompound nbt = writeToNBT(new NBTTagCompound());
	nbt.setInteger("gravity", gravity);
	

	SPacketUpdateTileEntity packet = new SPacketUpdateTileEntity(pos, 0, nbt);
	return packet;
}
 
Example #10
Source File: FWTile.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
	if (block instanceof Syncable) {
		return new FWPacketUpdateTileEntity<>(((MCNetworkManager) Game.network()).toMCPacket(((MCNetworkManager) Game.network()).writePacket(0, (Syncable) block)),
		this.getPos(), this.getBlockMetadata(), this.getTileData());
	}
	return null;
}
 
Example #11
Source File: TileEntitySignalBase.java    From Signals with GNU General Public License v3.0 5 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket(){
    NBTTagCompound tag = new NBTTagCompound();
    tag.setString("text", text);
    tag.setString("arguments", arguments);
    return new SPacketUpdateTileEntity(getPos(), 0, tag);
}
 
Example #12
Source File: TileEntityBeaconPost.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket()
{
	NBTTagCompound data = new NBTTagCompound();
	this.writeToNBT(data);
	return new SPacketUpdateTileEntity(pos, 0, data);
}
 
Example #13
Source File: TileMicrowaveReciever.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
	NBTTagCompound nbt = new NBTTagCompound();
	nbt.setBoolean("canRender", canRender);
	nbt.setInteger("amtPwr", powerMadeLastTick);
	writeNetworkData(nbt);
	return new SPacketUpdateTileEntity(pos, 0, nbt);
}
 
Example #14
Source File: TileEntityScanner.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket()
{
	NBTTagCompound data = new NBTTagCompound();
	this.writeToNBT(data);
	return new SPacketUpdateTileEntity(pos, 0, data);
}
 
Example #15
Source File: TileEntityComponentBox.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket()
{
	NBTTagCompound data = new NBTTagCompound();
	this.writeToNBT(data);
	return new SPacketUpdateTileEntity(pos, 0, data);
}
 
Example #16
Source File: TileEntityCharger.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket()
{
	NBTTagCompound data = new NBTTagCompound();
	this.writeToNBT(data);
	return new SPacketUpdateTileEntity(pos, 0, data);
}
 
Example #17
Source File: TileEntityGiantPropellerPart.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
    NBTTagCompound toSend = super.writeToNBT(new NBTTagCompound());
    toSend.setDouble("propeller_angle", propellerAngle);
    // Use super.writeToNBT to avoid sending the rotation node over nbt.
    return new SPacketUpdateTileEntity(pos, 0, toSend);
}
 
Example #18
Source File: TileEntitySignalBase.java    From Signals with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt){
    if(pkt.getTileEntityType() == 0) {
        text = pkt.getNbtCompound().getString("text");
        arguments = pkt.getNbtCompound().getString("arguments");
    }
}
 
Example #19
Source File: TileEntityBlueprintArchive.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket()
{
	NBTTagCompound data = new NBTTagCompound();
	this.writeToNBT(data);
	return new SPacketUpdateTileEntity(pos, 0, data);
}
 
Example #20
Source File: TileRocketBuilder.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
	super.getUpdatePacket();
	NBTTagCompound nbt = new NBTTagCompound();

	writeToNBT(nbt);

	return new SPacketUpdateTileEntity(pos, 0, nbt);
}
 
Example #21
Source File: TileTFC.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Allows for a specialized description packet to be created. This is often used to sync tile entity data from the
 * server to the client easily. For example this is used by signs to synchronise the text to be displayed.
 */
@Override
public SPacketUpdateTileEntity getUpdatePacket()
{
	NBTTagCompound nbt = new NBTTagCompound();
	this.writeSyncableNBT(nbt);
	return new SPacketUpdateTileEntity(this.pos, this.getBlockMetadata(), nbt);
}
 
Example #22
Source File: TileEntityGearbox.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
    nextRotation = pkt.getNbtCompound().getDouble("rotation");
    inputFacing = EnumFacing.values()[pkt.getNbtCompound()
        .getByte("input_facing")];
    byte validSidesByte = pkt.getNbtCompound().getByte("valid_sides_byte");
    for (int i = 0; i < 6; i++) {
        if ((validSidesByte & (1 << i)) != 0) {
            this.connectedSidesRatios[i] = Optional
                .of((double) pkt.getNbtCompound().getFloat("side_rotation_ratio" + i));
        } else {
            this.connectedSidesRatios[i] = Optional.empty();
        }
    }
}
 
Example #23
Source File: TileEntityGiantPropellerPart.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
    super.onDataPacket(net, pkt);
    this.nextPropellerAngle = pkt.getNbtCompound().getDouble("propeller_angle");
}
 
Example #24
Source File: TileEntityBasicRotationTile.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
    nextRotation = pkt.getNbtCompound().getDouble("rotation");
}
 
Example #25
Source File: TileEntityTFStorage.java    From TofuCraftReload with MIT License 4 votes vote down vote up
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
    super.onDataPacket(net, packet);
    readPacketNBT(packet.getNbtCompound());
}
 
Example #26
Source File: BasicNodeTileEntity.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
    readFromNBT(pkt.getNbtCompound());
}
 
Example #27
Source File: TilePlanetSelector.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {

	super.onDataPacket(net, pkt);
	readAdditionalNBT(pkt.getNbtCompound());
}
 
Example #28
Source File: TileSpaceLaser.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override 
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
	this.readFromNBT(pkt.getNbtCompound());
	isRunning = pkt.getNbtCompound().getBoolean("IsRunning");
}
 
Example #29
Source File: TileGuidanceComputerHatch.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
	return new SPacketUpdateTileEntity(pos, getBlockMetadata(), getUpdateTag());
}
 
Example #30
Source File: TileEntityBasicRotationTile.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
    NBTTagCompound tagToSend = new NBTTagCompound();
    tagToSend.setDouble("rotation", rotation);
    return new SPacketUpdateTileEntity(this.getPos(), 0, tagToSend);
}