Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ public void readFromNBT(NBTTagCompound tag) {
@Nonnull
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
tag.setTag("BlockTag", block);
tag.setTag("DescTag", desc);
if (block != null)
tag.setTag("BlockTag", block);
if (desc != null)
tag.setTag("DescTag", desc);
tag.setInteger("Time", time);
tag.setInteger("MaxTime", maxTime);
tag.setByte("Dir", (byte) dir);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.rwtema.funkylocomotion.blocks;

import java.lang.ref.WeakReference;
import javax.annotation.Nonnull;
import com.rwtema.funkylocomotion.movers.MoverEventHandler;
import com.rwtema.funkylocomotion.movers.MovingTileRegistry;
import net.minecraft.entity.player.EntityPlayer;
Expand All @@ -8,9 +10,6 @@
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.relauncher.Side;

import javax.annotation.Nonnull;
import java.lang.ref.WeakReference;

public class TileMovingServer extends TileMovingBase {

public WeakReference<EntityPlayer> activatingPlayer = null;
Expand All @@ -26,25 +25,23 @@ public TileMovingServer() {
@Override
@Nonnull
public NBTTagCompound getUpdateTag() {
if (desc == null)
if (this.desc == null)
return super.getUpdateTag();

super.writeToNBT(desc);

desc.setInteger("Time", time);
desc.setInteger("MaxTime", maxTime);
desc.setByte("Dir", (byte) dir);
this.desc.setInteger("Time", this.time);
this.desc.setInteger("MaxTime", this.maxTime);
this.desc.setByte("Dir", (byte) this.dir);

if (lightLevel > 0)
desc.setByte("Light", (byte) lightLevel);
if (lightOpacity > 0)
desc.setShort("Opacity", (short) lightOpacity);

if (collisions.length > 0) {
desc.setTag("Collisions", TagsAxis(collisions));
}
if (this.block != null)
this.desc.setTag("BlockTag", this.block);
if (this.collisions.length > 0)
this.desc.setTag("Collisions", TagsAxis(this.collisions));
if (this.lightLevel != 0)
this.desc.setByte("Light", (byte) this.lightLevel);
if (this.lightOpacity != 0)
this.desc.setShort("Opacity", (short) this.lightOpacity);

return desc;
return this.desc;
}

@Override
Expand Down