Skip to content

Commit

Permalink
Replace TileEntity.getCustomManipulators() with TileEntity.getContain…
Browse files Browse the repository at this point in the history
…ers() for BlockSnapshot creation.
  • Loading branch information
JBYoshi committed May 8, 2018
1 parent 5fdd7d1 commit 02959fb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import org.spongepowered.common.data.util.DataQueries;
import org.spongepowered.common.data.util.DataUtil;
import org.spongepowered.common.data.util.NbtDataUtil;
import org.spongepowered.common.interfaces.data.IMixinCustomDataHolder;
import org.spongepowered.common.world.SpongeBlockChangeFlag;

import java.util.Iterator;
Expand Down Expand Up @@ -123,7 +122,7 @@ public SpongeBlockSnapshotBuilder from(Location<World> location) {
this.compound = new NBTTagCompound();
org.spongepowered.api.block.tileentity.TileEntity te = location.getTileEntity().get();
((TileEntity) te).writeToNBT(this.compound);
this.manipulators = ((IMixinCustomDataHolder) te).getCustomManipulators().stream()
this.manipulators = te.getContainers().stream()
.map(DataManipulator::asImmutable)
.collect(Collectors.toList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import org.spongepowered.common.data.util.DataVersions;
import org.spongepowered.common.interfaces.block.IMixinBlock;
import org.spongepowered.common.interfaces.block.IMixinBlockState;
import org.spongepowered.common.interfaces.data.IMixinCustomDataHolder;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -104,7 +103,7 @@ public BlockSnapshot snapshotFor(Location<World> location) {
.worldId(location.getExtent().getUniqueId());
if (this.block.hasTileEntity() && location.getBlockType().equals(this.block)) {
final TileEntity tileEntity = location.getTileEntity().get();
for (DataManipulator<?, ?> manipulator : ((IMixinCustomDataHolder) tileEntity).getCustomManipulators()) {
for (DataManipulator<?, ?> manipulator : tileEntity.getContainers()) {
builder.add(manipulator);
}
final NBTTagCompound compound = new NBTTagCompound();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@
import org.spongepowered.common.event.tracking.phase.block.BlockPhase;
import org.spongepowered.common.interfaces.IMixinChunk;
import org.spongepowered.common.interfaces.block.tile.IMixinTileEntity;
import org.spongepowered.common.interfaces.data.IMixinCustomDataHolder;
import org.spongepowered.common.interfaces.entity.IMixinEntity;
import org.spongepowered.common.interfaces.entity.player.IMixinEntityPlayer;
import org.spongepowered.common.interfaces.util.math.IMixinBlockPos;
Expand Down Expand Up @@ -742,7 +741,7 @@ public BlockSnapshot createSnapshot(int x, int y, int z) {
}
if (te.isPresent()) {
final TileEntity tileEntity = te.get();
for (DataManipulator<?, ?> manipulator : ((IMixinCustomDataHolder) tileEntity).getCustomManipulators()) {
for (DataManipulator<?, ?> manipulator : tileEntity.getContainers()) {
builder.add(manipulator);
}
final NBTTagCompound compound = new NBTTagCompound();
Expand Down

0 comments on commit 02959fb

Please sign in to comment.