mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-08 16:56:07 +00:00
refactor blockdata
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package com.dfsek.terra.api.structures.script.functions;
|
||||
|
||||
import com.dfsek.terra.api.math.vector.Vector2;
|
||||
import com.dfsek.terra.api.platform.TerraPlugin;
|
||||
import com.dfsek.terra.api.structures.parser.lang.Returnable;
|
||||
import com.dfsek.terra.api.structures.parser.lang.functions.Function;
|
||||
import com.dfsek.terra.api.structures.structure.Rotation;
|
||||
import com.dfsek.terra.api.structures.structure.buffer.Buffer;
|
||||
import com.dfsek.terra.api.structures.tokenizer.Position;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class LootFunction implements Function<Void> {
|
||||
private final Returnable<String> data;
|
||||
private final Returnable<Number> x, y, z;
|
||||
private final Position position;
|
||||
|
||||
public LootFunction(Returnable<Number> x, Returnable<Number> y, Returnable<Number> z, Returnable<String> data, TerraPlugin main, Position position) {
|
||||
this.position = position;
|
||||
this.data = data;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return "block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void apply(Buffer buffer, Rotation rotation, Random random, int recursions) {
|
||||
Vector2 xz = new Vector2(x.apply(buffer, rotation, random, recursions).doubleValue(), z.apply(buffer, rotation, random, recursions).doubleValue());
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Position getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReturnType returnType() {
|
||||
return ReturnType.VOID;
|
||||
}
|
||||
}
|
||||
@@ -34,8 +34,7 @@ public class StructureBuffer implements Buffer {
|
||||
|
||||
@Override
|
||||
public Buffer addItem(BufferedItem item, Vector3 location) {
|
||||
bufferedItemMap.putIfAbsent(location, new Cell());
|
||||
bufferedItemMap.get(location).add(item);
|
||||
bufferedItemMap.computeIfAbsent(location, l -> new Cell()).add(item);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -50,8 +49,7 @@ public class StructureBuffer implements Buffer {
|
||||
|
||||
@Override
|
||||
public Buffer setMark(Mark mark, Vector3 location) {
|
||||
bufferedItemMap.putIfAbsent(location, new Cell());
|
||||
bufferedItemMap.get(location).setMark(mark);
|
||||
bufferedItemMap.computeIfAbsent(location, l -> new Cell()).setMark(mark);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.dfsek.terra.api.structures.structure.buffer.items;
|
||||
|
||||
import com.dfsek.terra.api.math.vector.Location;
|
||||
import com.dfsek.terra.api.platform.block.BlockData;
|
||||
|
||||
public class BufferedLootApplication implements BufferedItem {
|
||||
@Override
|
||||
public void paste(Location origin) {
|
||||
BlockData data = origin.getBlock().getBlockData();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user