mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 02:36:59 +00:00
Bugfixes
This commit is contained in:
parent
6bbe1c8518
commit
aa7a1ddd4e
@ -25,104 +25,114 @@ public class CommandIrisStudioGoto extends MortarCommand
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(MortarSender sender, String[] args)
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
{
|
{
|
||||||
if(args.length < 1)
|
try
|
||||||
{
|
{
|
||||||
sender.sendMessage("/iris std goto " + getArgsUsage());
|
if(args.length < 1)
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sender.isPlayer())
|
|
||||||
{
|
|
||||||
Player p = sender.player();
|
|
||||||
World world = p.getWorld();
|
|
||||||
|
|
||||||
if(!IrisWorlds.isIrisWorld(world))
|
|
||||||
{
|
{
|
||||||
sender.sendMessage("You must be in an iris world.");
|
sender.sendMessage("/iris std goto " + getArgsUsage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IrisTerrainProvider g = IrisWorlds.getProvider(world);
|
if(sender.isPlayer())
|
||||||
int tries = 10000;
|
|
||||||
boolean cave = false;
|
|
||||||
IrisBiome biome2 = null;
|
|
||||||
if(args.length > 1)
|
|
||||||
{
|
{
|
||||||
if(args[1].equalsIgnoreCase("-cave"))
|
Player p = sender.player();
|
||||||
|
World world = p.getWorld();
|
||||||
|
|
||||||
|
if(!IrisWorlds.isIrisWorld(world))
|
||||||
{
|
{
|
||||||
cave = true;
|
sender.sendMessage("You must be in an iris world.");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
IrisTerrainProvider g = IrisWorlds.getProvider(world);
|
||||||
|
int tries = 10000;
|
||||||
|
boolean cave = false;
|
||||||
|
IrisBiome biome2 = null;
|
||||||
|
if(args.length > 1)
|
||||||
{
|
{
|
||||||
biome2 = g.loadBiome(args[1]);
|
if(args[1].equalsIgnoreCase("-cave"))
|
||||||
|
|
||||||
if(biome2 == null)
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(args[1] + " is not a biome. Use the file name (without extension)");
|
cave = true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(String i : args)
|
|
||||||
{
|
|
||||||
if(i.equalsIgnoreCase("-cave"))
|
|
||||||
{
|
|
||||||
cave = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisBiome biome = args[0].equals("this") ? g.sampleTrueBiome(p.getLocation().getBlockX(), p.getLocation().getBlockZ()) : g.loadBiome(args[0]);
|
|
||||||
|
|
||||||
if(biome == null)
|
|
||||||
{
|
|
||||||
sender.sendMessage(args[0] + " is not a biome. Use the file name (without extension)");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(tries > 0)
|
|
||||||
{
|
|
||||||
tries--;
|
|
||||||
|
|
||||||
int xx = (int) (RNG.r.i(-29999970, 29999970));
|
|
||||||
int zz = (int) (RNG.r.i(-29999970, 29999970));
|
|
||||||
if((cave ? g.sampleCaveBiome(xx, zz) : g.sampleTrueBiome(xx, zz)).getLoadKey().equals(biome.getLoadKey()))
|
|
||||||
{
|
|
||||||
if(biome2 != null)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < 64; i++)
|
|
||||||
{
|
|
||||||
int ax = xx + RNG.r.i(-64, 32);
|
|
||||||
int az = zz + RNG.r.i(-64, 32);
|
|
||||||
|
|
||||||
if((cave ? g.sampleCaveBiome(ax, az) : g.sampleTrueBiome(ax, az)).getLoadKey().equals(biome2.getLoadKey()))
|
|
||||||
{
|
|
||||||
tries--;
|
|
||||||
p.teleport(new Location(world, xx, world.getHighestBlockYAt(xx, zz), zz));
|
|
||||||
sender.sendMessage("Found border in " + (10000 - tries) + " tries!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p.teleport(new Location(world, xx, world.getHighestBlockYAt(xx, zz), zz));
|
biome2 = g.loadBiome(args[1]);
|
||||||
sender.sendMessage("Found in " + (10000 - tries) + " tries!");
|
|
||||||
return true;
|
if(biome2 == null)
|
||||||
|
{
|
||||||
|
sender.sendMessage(args[1] + " is not a biome. Use the file name (without extension)");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(String i : args)
|
||||||
|
{
|
||||||
|
if(i.equalsIgnoreCase("-cave"))
|
||||||
|
{
|
||||||
|
cave = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IrisBiome biome = args[0].equals("this") ? g.sampleTrueBiome(p.getLocation().getBlockX(), p.getLocation().getBlockZ()) : g.loadBiome(args[0]);
|
||||||
|
|
||||||
|
if(biome == null)
|
||||||
|
{
|
||||||
|
sender.sendMessage(args[0] + " is not a biome. Use the file name (without extension)");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(tries > 0)
|
||||||
|
{
|
||||||
|
tries--;
|
||||||
|
|
||||||
|
int xx = (int) (RNG.r.i(-29999970, 29999970));
|
||||||
|
int zz = (int) (RNG.r.i(-29999970, 29999970));
|
||||||
|
if((cave ? g.sampleCaveBiome(xx, zz) : g.sampleTrueBiome(xx, zz)).getLoadKey().equals(biome.getLoadKey()))
|
||||||
|
{
|
||||||
|
if(biome2 != null)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 64; i++)
|
||||||
|
{
|
||||||
|
int ax = xx + RNG.r.i(-64, 32);
|
||||||
|
int az = zz + RNG.r.i(-64, 32);
|
||||||
|
|
||||||
|
if((cave ? g.sampleCaveBiome(ax, az) : g.sampleTrueBiome(ax, az)).getLoadKey().equals(biome2.getLoadKey()))
|
||||||
|
{
|
||||||
|
tries--;
|
||||||
|
p.teleport(new Location(world, xx, world.getHighestBlockYAt(xx, zz), zz));
|
||||||
|
sender.sendMessage("Found border in " + (10000 - tries) + " tries!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p.teleport(new Location(world, xx, world.getHighestBlockYAt(xx, zz), zz));
|
||||||
|
sender.sendMessage("Found in " + (10000 - tries) + " tries!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage("Tried to find " + biome.getName() + " looked in 10,000 places no dice.");
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage("Tried to find " + biome.getName() + " looked in 10,000 places no dice.");
|
else
|
||||||
|
{
|
||||||
return true;
|
sender.sendMessage("Players only.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
catch(Throwable e)
|
||||||
{
|
{
|
||||||
sender.sendMessage("Players only.");
|
Iris.error("Failed goto!");
|
||||||
|
e.printStackTrace();
|
||||||
|
sender.sendMessage("We cant seem to aquire a lock on the biome cache. Please report the error in the console to our github. Thanks!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -139,6 +139,11 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
|
|||||||
|
|
||||||
public IrisBiome loadBiome(String i)
|
public IrisBiome loadBiome(String i)
|
||||||
{
|
{
|
||||||
|
if(getData() == null)
|
||||||
|
{
|
||||||
|
return Iris.globaldata.getBiomeLoader().load(i);
|
||||||
|
}
|
||||||
|
|
||||||
return getData().getBiomeLoader().load(i);
|
return getData().getBiomeLoader().load(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,18 @@ public class GenLayerUpdate extends BlockPopulator
|
|||||||
@Override
|
@Override
|
||||||
public void populate(World w, Random r, Chunk c)
|
public void populate(World w, Random r, Chunk c)
|
||||||
{
|
{
|
||||||
AtomicSliverMap map = gen.getParallaxChunk(c.getX(), c.getZ());
|
AtomicSliverMap map = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
map = gen.getParallaxChunk(c.getX(), c.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(Throwable e)
|
||||||
|
{
|
||||||
|
map = new AtomicSliverMap();
|
||||||
|
}
|
||||||
|
|
||||||
RNG rx = rng.nextParallelRNG(c.getX() + r.nextInt()).nextParallelRNG(c.getZ() + r.nextInt());
|
RNG rx = rng.nextParallelRNG(c.getX() + r.nextInt()).nextParallelRNG(c.getZ() + r.nextInt());
|
||||||
|
|
||||||
if(gen.getDimension().isVanillaCaves())
|
if(gen.getDimension().isVanillaCaves())
|
||||||
|
@ -2,11 +2,11 @@ package com.volmit.iris.object;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.volmit.iris.util.M;
|
||||||
|
import org.bukkit.Axis;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.*;
|
||||||
import org.bukkit.block.data.Directional;
|
|
||||||
import org.bukkit.block.data.MultipleFacing;
|
|
||||||
import org.bukkit.block.data.Rotatable;
|
|
||||||
import org.bukkit.util.BlockVector;
|
import org.bukkit.util.BlockVector;
|
||||||
|
|
||||||
import com.volmit.iris.util.Desc;
|
import com.volmit.iris.util.Desc;
|
||||||
@ -111,6 +111,56 @@ public class IrisObjectRotation
|
|||||||
return BlockFace.SOUTH;
|
return BlockFace.SOUTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlockFace faceForAxis(Axis axis)
|
||||||
|
{
|
||||||
|
switch(axis)
|
||||||
|
{
|
||||||
|
case X:
|
||||||
|
return BlockFace.EAST;
|
||||||
|
case Y:
|
||||||
|
return BlockFace.UP;
|
||||||
|
case Z:
|
||||||
|
return BlockFace.NORTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
return BlockFace.NORTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Axis axisFor(BlockFace f)
|
||||||
|
{
|
||||||
|
switch(f)
|
||||||
|
{
|
||||||
|
case NORTH:
|
||||||
|
case SOUTH:
|
||||||
|
return Axis.Z;
|
||||||
|
case EAST:
|
||||||
|
case WEST:
|
||||||
|
return Axis.X;
|
||||||
|
case UP:
|
||||||
|
case DOWN:
|
||||||
|
return Axis.Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Axis.X;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Axis axisFor2D(BlockFace f)
|
||||||
|
{
|
||||||
|
switch(f)
|
||||||
|
{
|
||||||
|
case NORTH:
|
||||||
|
case SOUTH:
|
||||||
|
return Axis.Z;
|
||||||
|
case EAST:
|
||||||
|
case WEST:
|
||||||
|
case UP:
|
||||||
|
case DOWN:
|
||||||
|
return Axis.X;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Axis.X;
|
||||||
|
}
|
||||||
|
|
||||||
public BlockData rotate(BlockData dd, int spinxx, int spinyy, int spinzz)
|
public BlockData rotate(BlockData dd, int spinxx, int spinyy, int spinzz)
|
||||||
{
|
{
|
||||||
BlockData d = dd;
|
BlockData d = dd;
|
||||||
@ -142,6 +192,17 @@ public class IrisObjectRotation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(d instanceof Orientable)
|
||||||
|
{
|
||||||
|
Orientable g = ((Orientable) d);
|
||||||
|
BlockFace f = faceForAxis(g.getAxis());
|
||||||
|
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
|
||||||
|
bv = rotate(bv.clone(), spinx, spiny, spinz);
|
||||||
|
BlockFace t = getFace(bv);
|
||||||
|
Axis a = !((Orientable) d).getAxes().contains(Axis.Y) ? axisFor(t) : axisFor2D(t);
|
||||||
|
((Orientable) d).setAxis(a);
|
||||||
|
}
|
||||||
|
|
||||||
else if(d instanceof Rotatable)
|
else if(d instanceof Rotatable)
|
||||||
{
|
{
|
||||||
Rotatable g = ((Rotatable) d);
|
Rotatable g = ((Rotatable) d);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user