-
Notifications
You must be signed in to change notification settings - Fork 18
/
EnlightenedBushTileEntity.java
42 lines (35 loc) · 1.23 KB
/
EnlightenedBushTileEntity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package knightminer.inspirations.building.tileentity;
import knightminer.inspirations.building.InspirationsBuilding;
import knightminer.inspirations.library.util.TextureBlockUtil;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.TileEntity;
import javax.annotation.Nonnull;
public class EnlightenedBushTileEntity extends TileEntity {
public EnlightenedBushTileEntity() {
super(InspirationsBuilding.tileEnlightenedBush);
}
/*
* Networking
*/
@Nonnull
@Override
public CompoundNBT getUpdateTag() {
// new tag instead of super since default implementation calls the super of writeToNBT
return write(new CompoundNBT());
}
@Override
public SUpdateTileEntityPacket getUpdatePacket() {
// note that this sends all of the tile data. you should change this if you use additional tile data
CompoundNBT tag = getTileData().copy();
write(tag);
return new SUpdateTileEntityPacket(this.getPos(), 0, tag);
}
@Override
public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) {
CompoundNBT tag = pkt.getNbtCompound();
TextureBlockUtil.updateTextureBlock(this, tag);
read(tag);
}
}