This commit is contained in:
Dan Macbook 2020-08-02 11:35:35 -04:00
parent ea3e7f9ace
commit 7863660a47
10 changed files with 98 additions and 97 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

91
pom.xml
View File

@ -15,40 +15,44 @@
<development.location.dan>${user.home}\Documents\development\server\plugins\${project.name}.jar</development.location.dan> <development.location.dan>${user.home}\Documents\development\server\plugins\${project.name}.jar</development.location.dan>
<lint.in>${project.basedir}\lint\in.jar</lint.in> <lint.in>${project.basedir}\lint\in.jar</lint.in>
</properties> </properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
<include>**/*.yml</include>
<include>**/*.txt</include>
<include>**/*.properties</include>
<include>**/*.json</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>false</minimizeJar>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles> <profiles>
<profile> <profile>
<id>dan</id> <id>dan</id>
<build> <build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
<include>**/*.yml</include>
<include>**/*.txt</include>
<include>**/*.properties</include>
<include>**/*.json</include>
</includes>
</resource>
</resources>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>
@ -77,36 +81,7 @@
<profile> <profile>
<id>release</id> <id>release</id>
<build> <build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
<include>**/*.yml</include>
<include>**/*.txt</include>
<include>**/*.properties</include>
<include>**/*.html</include>
</includes>
</resource>
</resources>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>false</minimizeJar>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>

View File

@ -24,7 +24,7 @@ public class CommandIrisGoto extends MortarCommand
@Override @Override
public boolean handle(MortarSender sender, String[] args) public boolean handle(MortarSender sender, String[] args)
{ {
if(args.length <= 1) if(args.length < 1)
{ {
sender.sendMessage("/iris world goto " + getArgsUsage()); sender.sendMessage("/iris world goto " + getArgsUsage());
return true; return true;

View File

@ -26,7 +26,7 @@ public class CommandIrisMetrics extends MortarCommand
{ {
if(sender.isPlayer()) if(sender.isPlayer())
{ {
Player p = (Player) sender; Player p = sender.player();
World world = p.getWorld(); World world = p.getWorld();
IrisChunkGenerator g = (IrisChunkGenerator) world.getGenerator(); IrisChunkGenerator g = (IrisChunkGenerator) world.getGenerator();
IrisMetrics m = g.getMetrics(); IrisMetrics m = g.getMetrics();

View File

@ -79,17 +79,17 @@ public class CommandIrisStudioCreate extends MortarCommand
b1.setMin(3); b1.setMin(3);
b1.setMax(7); b1.setMax(7);
IrisBiomeGeneratorLink b2 = new IrisBiomeGeneratorLink(); IrisBiomeGeneratorLink b2 = new IrisBiomeGeneratorLink();
b1.setGenerator(gen.getLoadKey()); b2.setGenerator(gen.getLoadKey());
b1.setMin(12); b2.setMin(12);
b1.setMax(35); b2.setMax(35);
IrisBiomeGeneratorLink b3 = new IrisBiomeGeneratorLink(); IrisBiomeGeneratorLink b3 = new IrisBiomeGeneratorLink();
b1.setGenerator(gen.getLoadKey()); b3.setGenerator(gen.getLoadKey());
b1.setMin(-1); b3.setMin(-1);
b1.setMax(1); b3.setMax(1);
IrisBiomeGeneratorLink b4 = new IrisBiomeGeneratorLink(); IrisBiomeGeneratorLink b4 = new IrisBiomeGeneratorLink();
b1.setGenerator(gen.getLoadKey()); b4.setGenerator(gen.getLoadKey());
b1.setMin(-5); b4.setMin(-5);
b1.setMax(-38); b4.setMax(-38);
exampleLand2.getLayers().get(0).getPalette().clear(); exampleLand2.getLayers().get(0).getPalette().clear();
exampleLand2.getLayers().get(0).getPalette().add("RED_SAND"); exampleLand2.getLayers().get(0).getPalette().add("RED_SAND");
exampleShore1.getLayers().get(0).getPalette().clear(); exampleShore1.getLayers().get(0).getPalette().clear();

View File

@ -25,7 +25,8 @@ public class CommandIrisWhatBlock extends MortarCommand
{ {
if(sender.isPlayer()) if(sender.isPlayer())
{ {
BlockData bd = ((Player) sender).getTargetBlockExact(128, FluidCollisionMode.NEVER).getBlockData(); Player p = sender.player();
BlockData bd = p.getTargetBlockExact(128, FluidCollisionMode.NEVER).getBlockData();
sender.sendMessage("Material: " + ChatColor.GREEN + bd.getMaterial().name()); sender.sendMessage("Material: " + ChatColor.GREEN + bd.getMaterial().name());
sender.sendMessage("Full: " + ChatColor.WHITE + bd.getAsString(true)); sender.sendMessage("Full: " + ChatColor.WHITE + bd.getAsString(true));
} }

View File

@ -1,7 +1,6 @@
package com.volmit.iris.command; package com.volmit.iris.command;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.FluidCollisionMode;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -9,10 +8,8 @@ import com.volmit.iris.Iris;
import com.volmit.iris.util.MortarCommand; import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender; import com.volmit.iris.util.MortarSender;
public class CommandIrisWhatHand extends MortarCommand public class CommandIrisWhatHand extends MortarCommand {
{ public CommandIrisWhatHand() {
public CommandIrisWhatHand()
{
super("hand", "h"); super("hand", "h");
setDescription("Get the block data for holding."); setDescription("Get the block data for holding.");
requiresPermission(Iris.perm.studio); requiresPermission(Iris.perm.studio);
@ -25,7 +22,8 @@ public class CommandIrisWhatHand extends MortarCommand
{ {
if(sender.isPlayer()) if(sender.isPlayer())
{ {
BlockData bd = ((Player) sender).getTargetBlockExact(128, FluidCollisionMode.NEVER).getBlockData(); Player p = sender.player();
BlockData bd = p.getInventory().getItemInMainHand().getType().createBlockData();
sender.sendMessage("Material: " + ChatColor.GREEN + bd.getMaterial().name()); sender.sendMessage("Material: " + ChatColor.GREEN + bd.getMaterial().name());
sender.sendMessage("Full: " + ChatColor.WHITE + bd.getAsString(true)); sender.sendMessage("Full: " + ChatColor.WHITE + bd.getAsString(true));
} }
@ -39,8 +37,7 @@ public class CommandIrisWhatHand extends MortarCommand
} }
@Override @Override
protected String getArgsUsage() protected String getArgsUsage() {
{
return ""; return "";
} }
} }

View File

@ -14,6 +14,7 @@ import org.bukkit.generator.ChunkGenerator.ChunkData;
import com.volmit.iris.object.IrisBiome; import com.volmit.iris.object.IrisBiome;
import com.volmit.iris.util.BlockDataTools; import com.volmit.iris.util.BlockDataTools;
import com.volmit.iris.util.HeightMap; import com.volmit.iris.util.HeightMap;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.KMap; import com.volmit.iris.util.KMap;
import com.volmit.iris.util.M; import com.volmit.iris.util.M;
@ -172,19 +173,18 @@ public class AtomicSliver
lock.lock(); lock.lock();
this.block = new KMap<Integer, BlockData>(); this.block = new KMap<Integer, BlockData>();
int h = din.readByte() - Byte.MIN_VALUE; int h = din.readByte() - Byte.MIN_VALUE;
int p = din.readByte() - Byte.MIN_VALUE;
KList<BlockData> palette = new KList<BlockData>();
highestBlock = h; highestBlock = h;
for(int i = 0; i < p; i++)
{
palette.add(BlockDataTools.getBlockData(din.readUTF()));
}
for(int i = 0; i <= h; i++) for(int i = 0; i <= h; i++)
{ {
BlockData v = BlockDataTools.getBlockData(din.readUTF()); block.put(i, palette.get(din.readByte() - Byte.MIN_VALUE).clone());
if(v == null)
{
block.put(i, AIR);
continue;
}
block.put(i, v);
} }
modified = false; modified = false;
lock.unlock(); lock.unlock();
@ -194,12 +194,33 @@ public class AtomicSliver
{ {
lock.lock(); lock.lock();
dos.writeByte(highestBlock + Byte.MIN_VALUE); dos.writeByte(highestBlock + Byte.MIN_VALUE);
KList<String> palette = new KList<>();
for(int i = 0; i <= highestBlock; i++) for(int i = 0; i <= highestBlock; i++)
{ {
BlockData dat = block.get(i); BlockData dat = block.get(i);
dos.writeUTF((dat == null ? AIR : dat).getAsString(true)); String d = (dat == null ? AIR : dat).getAsString(true);
if(!palette.contains(d))
{
palette.add(d);
}
} }
dos.writeByte(palette.size() + Byte.MIN_VALUE);
for(String i : palette)
{
dos.writeUTF(i);
}
for(int i = 0; i <= highestBlock; i++)
{
BlockData dat = block.get(i);
String d = (dat == null ? AIR : dat).getAsString(true);
dos.writeByte(palette.indexOf(d) + Byte.MIN_VALUE);
}
lock.unlock(); lock.unlock();
} }

View File

@ -8,18 +8,19 @@ import com.volmit.iris.Iris;
public class BlockDataTools public class BlockDataTools
{ {
private static final BlockData AIR = Material.AIR.createBlockData();
private static final KMap<String, BlockData> bdc = new KMap<>(); private static final KMap<String, BlockData> bdc = new KMap<>();
private static final KList<String> nulls = new KList<>(); private static final KList<String> nulls = new KList<>();
public static BlockData getBlockData(String bd) public static BlockData getBlockData(String bd)
{try
{ {
if(bdc.containsKey(bd)) if(bdc.containsKey(bd))
{ {
return bdc.get(bd).clone(); return bdc.get(bd).clone();
} }
try
{
BlockData bdx = parseBlockData(bd); BlockData bdx = parseBlockData(bd);
if(bdx == null) if(bdx == null)
@ -39,7 +40,7 @@ public class BlockDataTools
Iris.warn("Unknown Block Data '" + bd + "'"); Iris.warn("Unknown Block Data '" + bd + "'");
} }
return null; return AIR;
} }
public static BlockData parseBlockData(String ix) public static BlockData parseBlockData(String ix)
@ -75,7 +76,7 @@ public class BlockDataTools
} }
return null; return AIR;
} }
public static boolean isLit(BlockData mat) public static boolean isLit(BlockData mat)

View File

@ -0,0 +1,6 @@
package com.volmit.iris.util;
public class Denv
{
}