Slices for entities & tiles

This commit is contained in:
Daniel Mills 2021-08-05 19:27:30 -04:00
parent fa95f96a6d
commit 8a079c98cc
4 changed files with 120 additions and 16 deletions

View File

@ -0,0 +1,29 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.matter;
import com.volmit.iris.util.nbt.tag.CompoundTag;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class MatterEntity {
private final CompoundTag tileData;
}

View File

@ -0,0 +1,29 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.matter;
import com.volmit.iris.util.nbt.tag.CompoundTag;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class MatterTile {
private final CompoundTag tileData;
}

View File

@ -0,0 +1,50 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.matter.slices;
import com.volmit.iris.util.matter.MatterEntity;
import com.volmit.iris.util.matter.MatterTile;
import com.volmit.iris.util.matter.Sliced;
import com.volmit.iris.util.nbt.io.NBTUtil;
import com.volmit.iris.util.nbt.tag.CompoundTag;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
@Sliced
public class EntityMatter extends RawMatter<MatterEntity> {
public EntityMatter() {
this(1, 1, 1);
}
public EntityMatter(int width, int height, int depth) {
super(width, height, depth, MatterEntity.class);
}
@Override
public void writeNode(MatterEntity b, DataOutputStream dos) throws IOException {
NBTUtil.write(b.getTileData(), dos, false);
}
@Override
public MatterEntity readNode(DataInputStream din) throws IOException {
return new MatterEntity((CompoundTag) NBTUtil.read(din, false).getTag());
}
}

View File

@ -18,37 +18,33 @@
package com.volmit.iris.util.matter.slices; package com.volmit.iris.util.matter.slices;
import com.volmit.iris.engine.parallax.ParallaxAccess; import com.volmit.iris.util.matter.MatterTile;
import com.volmit.iris.engine.parallax.ParallaxWorld;
import com.volmit.iris.util.data.B;
import com.volmit.iris.util.matter.Sliced; import com.volmit.iris.util.matter.Sliced;
import org.bukkit.World; import com.volmit.iris.util.nbt.io.NBTUtil;
import org.bukkit.block.Chest; import com.volmit.iris.util.nbt.tag.CompoundTag;
import org.bukkit.block.TileState;
import org.bukkit.block.data.BlockData;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
@Sliced @Sliced
public class TileMatter extends RawMatter<TileState> { public class TileMatter extends RawMatter<MatterTile> {
public TileMatter() { public TileMatter() {
this(1, 1, 1); this(1, 1, 1);
} }
public TileMatter(int width, int height, int depth) { public TileMatter(int width, int height, int depth) {
super(width, height, depth, TileState.class); super(width, height, depth, MatterTile.class);
}
@Override
public void writeNode(MatterTile b, DataOutputStream dos) throws IOException {
NBTUtil.write(b.getTileData(), dos, false);
} }
@Override @Override
public void writeNode(TileState b, DataOutputStream dos) throws IOException { public MatterTile readNode(DataInputStream din) throws IOException {
return new MatterTile((CompoundTag) NBTUtil.read(din, false).getTag());
}
@Override
public TileState readNode(DataInputStream din) throws IOException {
return null;
} }
} }