mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-07-05 16:40:04 +00:00
- so certain people can look at the diff and complain about my sloppy code :( Signed-off-by: Jesse Boyd <jessepaleg@gmail.com>
68 lines
2.0 KiB
Java
68 lines
2.0 KiB
Java
package com.boydti.fawe.object;
|
|
|
|
import com.boydti.fawe.FaweCache;
|
|
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
|
import com.boydti.fawe.object.queue.DelegateFaweQueue;
|
|
import com.sk89q.jnbt.CompoundTag;
|
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
|
|
|
public class ChangeSetFaweQueue extends DelegateFaweQueue {
|
|
private FaweChangeSet set;
|
|
|
|
public ChangeSetFaweQueue(FaweChangeSet set, FaweQueue parent) {
|
|
super(parent);
|
|
this.set = set;
|
|
}
|
|
|
|
public FaweChangeSet getChangeSet() {
|
|
return set;
|
|
}
|
|
|
|
public void setChangeSet(FaweChangeSet set) {
|
|
this.set = set;
|
|
}
|
|
|
|
@Override
|
|
public boolean setBlock(int x, int y, int z, int combinedId) {
|
|
|
|
if (super.setBlock(x, y, z, combinedId)) {
|
|
int combinedFrom = getParent().getCombinedId4Data(x, y, z);
|
|
BlockTypes typeFrom = BlockTypes.getFromStateId(combinedFrom);
|
|
if (typeFrom.getMaterial().hasContainer()) {
|
|
CompoundTag nbt = getParent().getTileEntity(x, y, z);
|
|
if (nbt != null) {
|
|
set.addTileRemove(nbt);
|
|
}
|
|
}
|
|
set.add(x, y, z, combinedFrom, combinedId);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean setBiome(int x, int z, BaseBiome biome) {
|
|
if (super.setBiome(x, z, biome)) {
|
|
int oldBiome = getParent().getBiomeId(x, z);
|
|
if (oldBiome != biome.getId()) {
|
|
set.addBiomeChange(x, z, FaweCache.getBiome(oldBiome), biome);
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public void setTile(int x, int y, int z, CompoundTag tag) {
|
|
super.setTile(x, y, z, tag);
|
|
set.addTileCreate(tag);
|
|
}
|
|
|
|
@Override
|
|
public void setEntity(int x, int y, int z, CompoundTag tag) {
|
|
super.setEntity(x, y, z, tag);
|
|
set.addEntityCreate(tag);
|
|
}
|
|
}
|