Skip to content

Commit

Permalink
MVP for anvil
Browse files Browse the repository at this point in the history
  • Loading branch information
dordsor21 committed Aug 20, 2023
1 parent fe33be5 commit cbba479
Show file tree
Hide file tree
Showing 34 changed files with 3,580 additions and 253 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,16 @@ public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) {
return CraftItemStack.asCraftMirror(stack);
}

@Override
public char[] getIbdToStateOrdinal() {
return new char[0];
}

@Override
public int[] getOrdinalToIbdID() {
return new int[0];
}

@Override
public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) {
final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,16 @@ public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) {
return CraftItemStack.asCraftMirror(stack);
}

@Override
public char[] getIbdToStateOrdinal() {
return new char[0];
}

@Override
public int[] getOrdinalToIbdID() {
return new int[0];
}

@Override
public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) {
final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,16 @@ public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) {
return CraftItemStack.asCraftMirror(stack);
}

@Override
public char[] getIbdToStateOrdinal() {
return new char[0];
}

@Override
public int[] getOrdinalToIbdID() {
return new int[0];
}

@Override
public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) {
final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,16 @@ public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) {
return CraftItemStack.asCraftMirror(stack);
}

@Override
public char[] getIbdToStateOrdinal() {
return new char[0];
}

@Override
public int[] getOrdinalToIbdID() {
return new int[0];
}

@Override
public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) {
final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.bukkit.plugin.PluginManager;

import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -320,6 +321,16 @@ public FAWEPlatformAdapterImpl getPlatformAdapter() {
return platformAdapter;
}

@Override
public Path getWorldsFolder() {
return Bukkit.getWorldContainer().toPath();
}

@Override
public boolean isWorldLoaded(String world) {
return Bukkit.getWorld(world) != null;
}

private void setupPlotSquared() {
Plugin plotSquared = this.plugin.getServer().getPluginManager().getPlugin("PlotSquared");
if (plotSquared == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,4 @@ public BlockState adapt(BlockData blockData) {
}
}

protected abstract char[] getIbdToStateOrdinal();

protected abstract int[] getOrdinalToIbdID();

}
Original file line number Diff line number Diff line change
Expand Up @@ -392,4 +392,14 @@ default List<org.bukkit.entity.Entity> getEntities(org.bukkit.World world) {
return TaskManager.taskManager().sync(world::getEntities);
}

/**
* Get a char array of minecraft internal IDs against FAWE char IDs
*/
char[] getIbdToStateOrdinal();

/**
* Get an int array of FAWE char IDs against minecraft internal IDs
*/
int[] getOrdinalToIbdID();

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ private boolean init() {
}

@Override
protected char[] getIbdToStateOrdinal() {
public char[] getIbdToStateOrdinal() {
return new char[Character.MAX_VALUE + 1];
}

@Override
protected int[] getOrdinalToIbdID() {
public int[] getOrdinalToIbdID() {
return new int[Character.MAX_VALUE + 1];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,4 +495,20 @@ public static ItemStack adapt(BaseItemStack item) {
return getAdapter().adapt(item);
//FAWE end
}

//FAWE start
/**
* Get a char array of minecraft internal IDs against FAWE char IDs
*/
public static char[] getIbdToStateOrdinal() {
return getAdapter().getIbdToStateOrdinal();
}

/**
* Get an int array of FAWE char IDs against minecraft internal IDs
*/
public static int[] getOrdinalToIbdID() {
return getAdapter().getOrdinalToIbdID();
}
//FAWE end
}
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,17 @@ public IBatchProcessor getPlatformPostProcessor(boolean fastMode) {
}
return this.plugin.getBukkitImplAdapter().getTickingPostProcessor();
}

@Nullable
@Override
public char[] getIbdToStateOrdinal() {
return BukkitAdapter.getIbdToStateOrdinal();
}

@Nullable
@Override
public int[] getOrdinalToIbdID() {
return BukkitAdapter.getOrdinalToIbdID();
}
//FAWE end
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.sk89q.worldedit.entity.Player;

import java.io.File;
import java.nio.file.Path;
import java.util.Collection;
import java.util.UUID;

Expand Down Expand Up @@ -49,4 +50,8 @@ default boolean isChunksStretched() {

FAWEPlatformAdapterImpl getPlatformAdapter();

Path getWorldsFolder();

boolean isWorldLoaded(String world);

}
Loading

0 comments on commit cbba479

Please sign in to comment.