- 4
- 1
- 0
При вызове метода add() почему-то writeToNBT() записывает, что angle = 2, а asymut = 1.
А при чтении (readFromNBT) вообще выдаёт нули.
P.S. Я новичок в моддинге.
А при чтении (readFromNBT) вообще выдаёт нули.
P.S. Я новичок в моддинге.
public class MortarTile extends TileEntity {
private float azimuth;
private float angle;
public MortarTile(){
this.azimuth = 0;
this.angle = 0;
}
@Override
public void readFromNBT(NBTTagCompound compound) {
this.azimuth = compound.getFloat("azimuth");
this.angle = compound.getFloat("angle");
super.readFromNBT(compound);
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setFloat("azimuth", this.azimuth);
compound.setFloat("angle", this.angle);
return super.writeToNBT(compound);
}
public void add(){
this.angle++;
this.azimuth++;
this.markDirty();
}
public float getAngle() {
return this.angle;
}
public float getAzimuth() {
return this.azimuth;
}
}
private float azimuth;
private float angle;
public MortarTile(){
this.azimuth = 0;
this.angle = 0;
}
@Override
public void readFromNBT(NBTTagCompound compound) {
this.azimuth = compound.getFloat("azimuth");
this.angle = compound.getFloat("angle");
super.readFromNBT(compound);
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setFloat("azimuth", this.azimuth);
compound.setFloat("angle", this.angle);
return super.writeToNBT(compound);
}
public void add(){
this.angle++;
this.azimuth++;
this.markDirty();
}
public float getAngle() {
return this.angle;
}
public float getAzimuth() {
return this.azimuth;
}
}