mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Bugfixes
This commit is contained in:
parent
6bbe1c8518
commit
aa7a1ddd4e
@ -25,104 +25,114 @@ public class CommandIrisStudioGoto extends MortarCommand
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(args.length < 1)
|
||||
try
|
||||
{
|
||||
sender.sendMessage("/iris std goto " + getArgsUsage());
|
||||
return true;
|
||||
}
|
||||
|
||||
if(sender.isPlayer())
|
||||
{
|
||||
Player p = sender.player();
|
||||
World world = p.getWorld();
|
||||
|
||||
if(!IrisWorlds.isIrisWorld(world))
|
||||
if(args.length < 1)
|
||||
{
|
||||
sender.sendMessage("You must be in an iris world.");
|
||||
sender.sendMessage("/iris std goto " + getArgsUsage());
|
||||
return true;
|
||||
}
|
||||
|
||||
IrisTerrainProvider g = IrisWorlds.getProvider(world);
|
||||
int tries = 10000;
|
||||
boolean cave = false;
|
||||
IrisBiome biome2 = null;
|
||||
if(args.length > 1)
|
||||
if(sender.isPlayer())
|
||||
{
|
||||
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(biome2 == null)
|
||||
if(args[1].equalsIgnoreCase("-cave"))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
cave = true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
p.teleport(new Location(world, xx, world.getHighestBlockYAt(xx, zz), zz));
|
||||
sender.sendMessage("Found in " + (10000 - tries) + " tries!");
|
||||
return true;
|
||||
biome2 = g.loadBiome(args[1]);
|
||||
|
||||
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.");
|
||||
|
||||
return true;
|
||||
else
|
||||
{
|
||||
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;
|
||||
|
@ -139,6 +139,11 @@ public abstract class ContextualTerrainProvider implements TerrainProvider, List
|
||||
|
||||
public IrisBiome loadBiome(String i)
|
||||
{
|
||||
if(getData() == null)
|
||||
{
|
||||
return Iris.globaldata.getBiomeLoader().load(i);
|
||||
}
|
||||
|
||||
return getData().getBiomeLoader().load(i);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,18 @@ public class GenLayerUpdate extends BlockPopulator
|
||||
@Override
|
||||
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());
|
||||
|
||||
if(gen.getDimension().isVanillaCaves())
|
||||
|
@ -2,11 +2,11 @@ package com.volmit.iris.object;
|
||||
|
||||
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.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
import org.bukkit.block.data.Rotatable;
|
||||
import org.bukkit.block.data.*;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import com.volmit.iris.util.Desc;
|
||||
@ -111,6 +111,56 @@ public class IrisObjectRotation
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
Rotatable g = ((Rotatable) d);
|
||||
|
Loading…
x
Reference in New Issue
Block a user