make dimension registry server side
This commit is contained in:
parent
b9d62c2253
commit
4de4f41a5d
98 changed files with 1008 additions and 608 deletions
|
@ -46,11 +46,13 @@ import common.rng.Random;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Clientside;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.Vec3;
|
||||
import common.util.HitPosition.ObjectType;
|
||||
import common.util.Pair;
|
||||
import common.util.Serverside;
|
||||
import common.vars.Vars;
|
||||
import common.world.Explosion;
|
||||
import common.world.IBlockAccess;
|
||||
|
@ -335,6 +337,7 @@ public class Block {
|
|||
}
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public static void dropItems(AWorldServer world, BlockPos pos, IInventory inventory) {
|
||||
for(int n = 0; n < inventory.getSizeInventory(); n++) {
|
||||
ItemStack stack = inventory.getStackInSlot(n);
|
||||
|
@ -844,7 +847,8 @@ public class Block {
|
|||
return false;
|
||||
}
|
||||
|
||||
public double getResistance(World world, BlockPos pos, State state) {
|
||||
@Serverside
|
||||
public double getResistance(AWorldServer world, BlockPos pos, State state) {
|
||||
return Double.POSITIVE_INFINITY;
|
||||
}
|
||||
|
||||
|
@ -865,9 +869,11 @@ public class Block {
|
|||
}
|
||||
|
||||
|
||||
@Serverside
|
||||
public void tick(AWorldServer world, BlockPos pos, State state, Random rand) {
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void displayTick(World world, BlockPos pos, State state, Random rand) {
|
||||
}
|
||||
|
||||
|
@ -942,17 +948,21 @@ public class Block {
|
|||
entity.fall(distance, 1.0F);
|
||||
}
|
||||
|
||||
public void onRain(World world, BlockPos pos) {
|
||||
@Serverside
|
||||
public void onRain(AWorldServer world, BlockPos pos) {
|
||||
}
|
||||
|
||||
public boolean onShot(World world, BlockPos pos, State state, Entity projectile) {
|
||||
@Serverside
|
||||
public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) {
|
||||
return this.material.blocksMovement();
|
||||
}
|
||||
|
||||
public double powerTick(World world, BlockPos pos, State state, Random rand, double voltage, double currentLimit) {
|
||||
@Serverside
|
||||
public double powerTick(AWorldServer world, BlockPos pos, State state, Random rand, double voltage, double currentLimit) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public boolean checkPlace(World world, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) {
|
||||
Block block = world.getState(pos).getBlock();
|
||||
|
||||
|
@ -1014,6 +1024,7 @@ public class Block {
|
|||
public void onPlace(World world, BlockPos pos, State state, EntityLiving placer) {
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public boolean dispense(AWorldServer world, TileEntity source, Vec3 position, BlockPos pos, Facing side, ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1028,8 +1039,8 @@ public class Block {
|
|||
|
||||
public void getModifiers(Map<Attribute, Float> map, UsageSlot slot) {
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public boolean canRender(IWorldAccess world, BlockPos pos, Facing side) {
|
||||
return side == Facing.DOWN && this.minY > 0.0D ? true
|
||||
: (side == Facing.UP && this.maxY < 1.0D ? true
|
||||
|
@ -1040,11 +1051,13 @@ public class Block {
|
|||
: !world.getState(pos).getBlock().isOpaqueCube())))));
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public BoundingBox getSelectionBox(World world, BlockPos pos) {
|
||||
return new BoundingBox((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ,
|
||||
(double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public int getLightmapValue(IWorldAccess world, BlockPos pos) {
|
||||
Block block = world.getState(pos).getBlock();
|
||||
int light = world.getCombinedLight(pos, block.getLight());
|
||||
|
@ -1059,30 +1072,37 @@ public class Block {
|
|||
public int getRenderType() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public BlockLayer getRenderLayer() {
|
||||
return BlockLayer.SOLID;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public boolean isXrayVisible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void getAnimatedTextures(Map<String, Object> map) {
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel(name).add().all();
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public GuiPosition getItemPosition() {
|
||||
return GuiPosition.NORMAL;
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public State getItemState() {
|
||||
return this.getState();
|
||||
}
|
||||
|
@ -1091,6 +1111,7 @@ public class Block {
|
|||
return this.radiation > 0.0f ? TextColor.GREEN : null;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void getTooltips(ItemStack stack, EntityNPC player, List<String> tooltip) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import common.properties.Property;
|
|||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.Identifyable;
|
||||
|
@ -168,6 +169,7 @@ public class BlockBed extends Block implements Rotatable {
|
|||
return 1;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public BlockLayer getRenderLayer() {
|
||||
return BlockLayer.CUTOUT;
|
||||
}
|
||||
|
@ -184,6 +186,7 @@ public class BlockBed extends Block implements Rotatable {
|
|||
return new Property[] {FACING, PART};
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
if(state.getValue(PART) == EnumPartType.HEAD)
|
||||
return provider.getModel(this.color + "_bed_head_top").add(0, 0, 0, 16, 9, 16)
|
||||
|
@ -199,6 +202,7 @@ public class BlockBed extends Block implements Rotatable {
|
|||
.d("oak_planks").noCull().rotate(ModelRotation.getNorthRot(state.getValue(FACING).getOpposite()));
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public State getItemState() {
|
||||
return this.getState().withProperty(PART, EnumPartType.HEAD).withProperty(FACING, Facing.NORTH);
|
||||
}
|
||||
|
@ -263,6 +267,7 @@ public class BlockBed extends Block implements Rotatable {
|
|||
}
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public boolean checkPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack)
|
||||
{
|
||||
return side == Facing.UP;
|
||||
|
|
|
@ -24,6 +24,7 @@ import common.properties.PropertyEnum;
|
|||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Clientside;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.Identifyable;
|
||||
|
@ -94,6 +95,7 @@ public class BlockDoor extends Block implements Rotatable {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public BoundingBox getSelectionBox(World world, BlockPos pos) {
|
||||
this.setBlockBounds(world, pos);
|
||||
return super.getSelectionBox(world, pos);
|
||||
|
@ -249,6 +251,7 @@ public class BlockDoor extends Block implements Rotatable {
|
|||
return 1;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public BlockLayer getRenderLayer() {
|
||||
return BlockLayer.CUTOUT;
|
||||
}
|
||||
|
@ -261,10 +264,12 @@ public class BlockDoor extends Block implements Rotatable {
|
|||
return new Property[] {HALF, FACING, OPEN, HINGE};
|
||||
}
|
||||
|
||||
@Clientside
|
||||
private static ModelRotation getRotation(Facing rot, int offset) {
|
||||
return ModelRotation.getEastRot(Facing.getHorizontal(rot.getHorizontalIndex() + offset), false);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
String bottom = name + "_bottom";
|
||||
String top = name + "_top";
|
||||
|
@ -286,10 +291,12 @@ public class BlockDoor extends Block implements Rotatable {
|
|||
}
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public GuiPosition getItemPosition() {
|
||||
return GuiPosition.PANE_SIDE;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public State getItemState() {
|
||||
return this.getState().withProperty(HALF, EnumDoorHalf.UPPER).withProperty(FACING, Facing.NORTH);
|
||||
}
|
||||
|
@ -335,6 +342,7 @@ public class BlockDoor extends Block implements Rotatable {
|
|||
}
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public boolean checkPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack)
|
||||
{
|
||||
return side == Facing.UP;
|
||||
|
|
|
@ -8,9 +8,10 @@ import common.model.BlockLayer;
|
|||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockGlass extends Block {
|
||||
public BlockGlass() {
|
||||
|
@ -43,8 +44,9 @@ public class BlockGlass extends Block {
|
|||
Block block = state.getBlock();
|
||||
return world.getState(pos.offset(side.getOpposite())) != state || (block != this && super.canRender(world, pos, side));
|
||||
}
|
||||
|
||||
public boolean onShot(World world, BlockPos pos, State state, Entity projectile) {
|
||||
|
||||
@Serverside
|
||||
public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) {
|
||||
world.destroyBlock(pos, true);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ import common.rng.Random;
|
|||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
@ -192,8 +194,9 @@ public class BlockPane extends Block
|
|||
public boolean isMagnetic() {
|
||||
return this.material == Material.SOLID;
|
||||
}
|
||||
|
||||
public boolean onShot(World world, BlockPos pos, State state, Entity projectile) {
|
||||
|
||||
@Serverside
|
||||
public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) {
|
||||
if(this.material != Material.SOLID)
|
||||
world.destroyBlock(pos, true);
|
||||
return this.material == Material.SOLID;
|
||||
|
|
|
@ -12,6 +12,8 @@ import common.model.GuiPosition;
|
|||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -50,8 +52,9 @@ public class BlockSkull extends Block implements Rotatable {
|
|||
public boolean isXrayVisible() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onShot(World world, BlockPos pos, State state, Entity projectile) {
|
||||
|
||||
@Serverside
|
||||
public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) {
|
||||
world.destroyBlock(pos, true);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import common.properties.PropertyEnum;
|
|||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Clientside;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.Identifyable;
|
||||
|
@ -578,6 +579,7 @@ public class BlockStairs extends Block implements Rotatable
|
|||
this.base.onBroken(worldIn, pos, state);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public int getLightmapValue(IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return this.base.getLightmapValue(worldIn, pos);
|
||||
|
@ -591,6 +593,7 @@ public class BlockStairs extends Block implements Rotatable
|
|||
return this.base.getResistance(exploder);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public BlockLayer getRenderLayer()
|
||||
{
|
||||
return this.base.getRenderLayer();
|
||||
|
|
|
@ -9,8 +9,9 @@ import common.item.Item;
|
|||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Serverside;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockGlowstone extends Block
|
||||
{
|
||||
|
@ -43,8 +44,9 @@ public class BlockGlowstone extends Block
|
|||
{
|
||||
return Items.glowstone_dust;
|
||||
}
|
||||
|
||||
public boolean onShot(World world, BlockPos pos, State state, Entity projectile) {
|
||||
|
||||
@Serverside
|
||||
public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) {
|
||||
world.destroyBlock(pos, true);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import common.rng.Random;
|
|||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
@ -207,7 +208,8 @@ public class BlockButton extends Block implements Directional
|
|||
super.onRemoved(worldIn, pos, state);
|
||||
}
|
||||
|
||||
public double getResistance(World worldIn, BlockPos pos, State state) {
|
||||
@Serverside
|
||||
public double getResistance(AWorldServer worldIn, BlockPos pos, State state) {
|
||||
return state.getValue(POWERED) ? 0.0 : super.getResistance(worldIn, pos, state);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ import common.util.BlockPos;
|
|||
import common.util.BoundingBox;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -546,7 +548,8 @@ public class BlockCauldron extends Block
|
|||
worldIn.setState(pos, state.withProperty(LEVEL, Integer.valueOf(ExtMath.clampi(level, 0, 3))), 2);
|
||||
}
|
||||
|
||||
public void onRain(World worldIn, BlockPos pos)
|
||||
@Serverside
|
||||
public void onRain(AWorldServer worldIn, BlockPos pos)
|
||||
{
|
||||
if (worldIn.rand.chance(20)) // == 1
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@ import common.util.BoundingBox;
|
|||
import common.util.DirectionVec;
|
||||
import common.util.Facing;
|
||||
import common.util.Identifyable;
|
||||
import common.util.Serverside;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
@ -231,7 +232,8 @@ public class BlockLever extends Block
|
|||
super.onRemoved(worldIn, pos, state);
|
||||
}
|
||||
|
||||
public double getResistance(World worldIn, BlockPos pos, State state) {
|
||||
@Serverside
|
||||
public double getResistance(AWorldServer worldIn, BlockPos pos, State state) {
|
||||
return state.getValue(POWERED) ? 0.0 : super.getResistance(worldIn, pos, state);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ import common.properties.Property;
|
|||
import common.properties.PropertyBool;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Serverside;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -24,7 +26,8 @@ public class BlockPressurePlate extends BlockBasePressurePlate
|
|||
this.sensitivity = sensitivityIn;
|
||||
}
|
||||
|
||||
public double getResistance(World worldIn, BlockPos pos, State state) {
|
||||
@Serverside
|
||||
public double getResistance(AWorldServer worldIn, BlockPos pos, State state) {
|
||||
return state.getValue(POWERED) ? 0.0 : super.getResistance(worldIn, pos, state);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ import common.properties.Property;
|
|||
import common.properties.PropertyInteger;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Serverside;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -36,7 +38,8 @@ public class BlockPressurePlateWeighted extends BlockBasePressurePlate
|
|||
}
|
||||
}
|
||||
|
||||
public double getResistance(World worldIn, BlockPos pos, State state) {
|
||||
@Serverside
|
||||
public double getResistance(AWorldServer worldIn, BlockPos pos, State state) {
|
||||
return state.getValue(POWER) > 0 ? (double)(15 - state.getValue(POWER)) * 10000.0 : super.getResistance(worldIn, pos, state);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import common.rng.Random;
|
|||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
@ -311,7 +312,8 @@ public class BlockTripWireHook extends Block implements Rotatable
|
|||
super.onRemoved(worldIn, pos, state);
|
||||
}
|
||||
|
||||
public double getResistance(World worldIn, BlockPos pos, State state) {
|
||||
@Serverside
|
||||
public double getResistance(AWorldServer worldIn, BlockPos pos, State state) {
|
||||
return state.getValue(POWERED) ? 0.0 : super.getResistance(worldIn, pos, state);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import common.rng.Random;
|
|||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.world.IBlockAccess;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
|
@ -282,6 +283,7 @@ public class BlockWire extends Block
|
|||
return false;
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public double doPowerPhase(AWorldServer world, BlockPos pos, Random rand, double voltage, double currentLimit) { // TODO: implement
|
||||
Queue<BlockPos> queue = new ArrayDeque<BlockPos>();
|
||||
Set<BlockPos> traversed = Sets.newHashSet();
|
||||
|
@ -310,11 +312,13 @@ public class BlockWire extends Block
|
|||
return converted;
|
||||
}
|
||||
|
||||
public double getResistance(World worldIn, BlockPos pos, State state) {
|
||||
@Serverside
|
||||
public double getResistance(AWorldServer worldIn, BlockPos pos, State state) {
|
||||
return 5.0;
|
||||
}
|
||||
|
||||
public double powerTick(World worldIn, BlockPos pos, State state, Random rand, double voltage, double currentLimit) {
|
||||
@Serverside
|
||||
public double powerTick(AWorldServer worldIn, BlockPos pos, State state, Random rand, double voltage, double currentLimit) {
|
||||
return 0.01;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import common.properties.PropertyInteger;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.world.AWorldServer;
|
||||
|
@ -101,11 +102,13 @@ public class BlockStandingSign extends BlockSign implements Rotatable
|
|||
}
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public boolean checkPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack)
|
||||
{
|
||||
return side != Facing.DOWN && worldIn.getState(pos).getBlock().getMaterial().isSolid();
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel("oak_planks")
|
||||
.add(0, 8, 7, 16, 16, 9).all().noCull()
|
||||
|
|
|
@ -13,13 +13,10 @@ import common.init.BlockRegistry;
|
|||
import common.init.Blocks;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.MetalType;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.rng.Random;
|
||||
import common.rng.WeightedList;
|
||||
import common.tags.TagObject;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Vec3;
|
||||
import common.vars.Vars;
|
||||
import common.world.State;
|
||||
import common.world.Weather;
|
||||
import common.world.World;
|
||||
|
@ -205,9 +202,9 @@ public abstract class Dimension extends Section {
|
|||
private SkyboxType skyboxTexture = null;
|
||||
private ColorGenerator starColorFunc = null;
|
||||
private ColorGenerator deepstarColorFunc = null;
|
||||
private String[] baseNames; // synced only
|
||||
private String[] baseNames = new String[0]; // synced only
|
||||
private int sunColor = 0xffffffff;
|
||||
private int[] moonColors = null;
|
||||
private int[] moonColors = new int[0];
|
||||
|
||||
// common
|
||||
private float gravity = 1.0f;
|
||||
|
@ -873,14 +870,6 @@ public abstract class Dimension extends Section {
|
|||
return this.denseFog;
|
||||
}
|
||||
|
||||
|
||||
protected int calcSunColor() {
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
protected int[] calcMoonColors() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
public boolean isBaseDestroyed() {
|
||||
return false;
|
||||
|
@ -916,11 +905,11 @@ public abstract class Dimension extends Section {
|
|||
|
||||
|
||||
public final int getSunColor() {
|
||||
return this.sunColor != 0xffffffff ? this.sunColor : this.calcSunColor();
|
||||
return this.sunColor;
|
||||
}
|
||||
|
||||
public final int[] getMoonColors() {
|
||||
return this.moonColors != null ? this.moonColors : this.calcMoonColors();
|
||||
return this.moonColors;
|
||||
}
|
||||
|
||||
public final void setSunColor(int color) {
|
||||
|
@ -931,6 +920,14 @@ public abstract class Dimension extends Section {
|
|||
this.moonColors = colors;
|
||||
}
|
||||
|
||||
public final void setBaseNames(String[] names) {
|
||||
this.baseNames = names;
|
||||
}
|
||||
|
||||
public final String[] getBaseNames() {
|
||||
return this.baseNames;
|
||||
}
|
||||
|
||||
|
||||
public final State getFiller() {
|
||||
return this.filler;
|
||||
|
@ -989,43 +986,6 @@ public abstract class Dimension extends Section {
|
|||
}
|
||||
|
||||
|
||||
public final void setBaseNames(String[] names) {
|
||||
this.baseNames = names;
|
||||
}
|
||||
|
||||
public final String[] getBaseNames() {
|
||||
if(this.baseNames != null)
|
||||
return this.baseNames;
|
||||
if(this == Space.INSTANCE)
|
||||
return new String[0];
|
||||
String planet = null;
|
||||
String star = null;
|
||||
Dimension dim = this;
|
||||
switch(this.getType()) {
|
||||
case MOON:
|
||||
dim = UniverseRegistry.getPlanet((Moon)dim);
|
||||
planet = dim.getDisplay();
|
||||
case PLANET:
|
||||
dim = UniverseRegistry.getStar((Planet)dim);
|
||||
star = dim.getDisplay();
|
||||
case STAR:
|
||||
Sector sector = UniverseRegistry.getSector((Star)dim);
|
||||
String sect = sector.getDisplay();
|
||||
String galaxy = UniverseRegistry.getGalaxy(sector).getDisplay();
|
||||
if(planet != null)
|
||||
return new String[] {planet, star, sect, galaxy};
|
||||
else if(star != null)
|
||||
return new String[] {star, sect, galaxy};
|
||||
else
|
||||
return new String[] {sect, galaxy};
|
||||
case AREA:
|
||||
return new String[] {UniverseRegistry.getDomain((Area)dim).getDisplay()};
|
||||
default:
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Dimension create(DimType type) {
|
||||
if(type == null)
|
||||
return null;
|
||||
|
@ -1060,14 +1020,14 @@ public abstract class Dimension extends Section {
|
|||
return tag;
|
||||
}
|
||||
|
||||
public final TagObject writeData() {
|
||||
public final TagObject writeData(boolean send) {
|
||||
TagObject tag = new TagObject();
|
||||
tag.setLong("Seed", this.seed);
|
||||
tag.setLong("Time", this.timeExisted);
|
||||
if(this == Space.INSTANCE)
|
||||
return tag;
|
||||
tag.setBool("Exterminated", this.exterminated);
|
||||
if(this.isCustom())
|
||||
if(send || this.isCustom())
|
||||
this.toTags(tag);
|
||||
if(!this.exterminated && this.hasWeather())
|
||||
tag.setString("Weather", this.weather.getName());
|
||||
|
@ -1075,15 +1035,7 @@ public abstract class Dimension extends Section {
|
|||
}
|
||||
|
||||
public final void readData(TagObject tag) {
|
||||
if(tag.hasLong("Seed")) {
|
||||
this.seed = tag.getLong("Seed");
|
||||
}
|
||||
else {
|
||||
Random rand = new Random();
|
||||
if(!Vars.seed.isEmpty())
|
||||
rand.setSeed((long)Vars.seed.hashCode() ^ ~((long)UniverseRegistry.getName(this).hashCode()));
|
||||
this.seed = rand.longv();
|
||||
}
|
||||
this.seed = tag.getLong("Seed");
|
||||
this.timeExisted = tag.getLong("Time");
|
||||
if(this == Space.INSTANCE)
|
||||
return;
|
||||
|
|
|
@ -2,7 +2,6 @@ package common.dimension;
|
|||
|
||||
import common.block.Block;
|
||||
import common.init.Blocks;
|
||||
import common.init.UniverseRegistry;
|
||||
|
||||
public final class Moon extends Dimension {
|
||||
Moon() {
|
||||
|
@ -32,19 +31,6 @@ public final class Moon extends Dimension {
|
|||
public final DimType getType() {
|
||||
return DimType.MOON;
|
||||
}
|
||||
|
||||
protected int calcSunColor() {
|
||||
Planet planet = UniverseRegistry.getPlanet(this);
|
||||
if(planet == null)
|
||||
return super.calcSunColor();
|
||||
Star star = UniverseRegistry.getStar(planet);
|
||||
return star == null ? super.calcSunColor() : ((star.getSkyColor() & 0xffffff) | (star.isExterminated() ? 0x80000000 : 0));
|
||||
}
|
||||
|
||||
protected int[] calcMoonColors() {
|
||||
Planet planet = UniverseRegistry.getPlanet(this);
|
||||
return planet == null ? super.calcMoonColors() : new int[] {(planet.getSkyColor() & 0xffffff) | (planet.isExterminated() ? 0x80000000 : 0)};
|
||||
}
|
||||
|
||||
public boolean isBaseDestroyed() {
|
||||
return (this.getSunColor() & 0xff000000) != 0;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package common.dimension;
|
||||
|
||||
import java.util.List;
|
||||
import common.init.UniverseRegistry;
|
||||
|
||||
public final class Planet extends Dimension {
|
||||
public static int radiusToSize(int radius) {
|
||||
int size = (int)(Math.sqrt((double)radius * (double)radius * 4.0 * Math.PI) / 2.0);
|
||||
|
@ -46,20 +43,6 @@ public final class Planet extends Dimension {
|
|||
public final DimType getType() {
|
||||
return DimType.PLANET;
|
||||
}
|
||||
|
||||
protected int calcSunColor() {
|
||||
Star star = UniverseRegistry.getStar(this);
|
||||
return star == null ? super.calcSunColor() : ((star.getSkyColor() & 0xffffff) | (star.isExterminated() ? 0x80000000 : 0));
|
||||
}
|
||||
|
||||
protected int[] calcMoonColors() {
|
||||
List<Moon> moons = UniverseRegistry.getMoons(this);
|
||||
int[] colors = new int[moons.size()];
|
||||
for(int z = 0; z < colors.length; z++) {
|
||||
colors[z] = (moons.get(z).getSkyColor() & 0xffffff) | (moons.get(z).isExterminated() ? 0x80000000 : 0);
|
||||
}
|
||||
return colors;
|
||||
}
|
||||
|
||||
public boolean isBaseDestroyed() {
|
||||
return (this.getSunColor() & 0xff000000) != 0;
|
||||
|
|
|
@ -31,12 +31,14 @@ import common.rng.Random;
|
|||
import common.tags.TagObject;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.ParticleType;
|
||||
import common.util.PortalType;
|
||||
import common.util.Position;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.vars.Vars;
|
||||
import common.world.Explosion;
|
||||
|
@ -1417,10 +1419,7 @@ public abstract class Entity
|
|||
return distance < d0 * d0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Like writeOptional but does not check if the entity is ridden. Used for saving ridden entities with their
|
||||
* riders.
|
||||
*/
|
||||
@Serverside
|
||||
public boolean writeMount(TagObject tag)
|
||||
{
|
||||
String s = EntityRegistry.getEntityString(this);
|
||||
|
@ -1437,11 +1436,7 @@ public abstract class Entity
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Either write this entity to the tag given and return true, or return false without doing anything. If this
|
||||
* returns false the entity is not saved on disk. Ridden entities return false here as they are saved with their
|
||||
* rider.
|
||||
*/
|
||||
@Serverside
|
||||
public boolean writeOptional(TagObject tag)
|
||||
{
|
||||
String s = EntityRegistry.getEntityString(this);
|
||||
|
@ -1482,9 +1477,7 @@ public abstract class Entity
|
|||
// return this.persistentId != 0L;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Save the entity to tags (calls an abstract helper method to write extra data)
|
||||
*/
|
||||
@Serverside
|
||||
public void writeTags(TagObject tag)
|
||||
{
|
||||
// if(this.persistentId != 0L) {
|
||||
|
@ -1610,14 +1603,10 @@ public abstract class Entity
|
|||
// return EntityRegistry.getEntityString(this);
|
||||
// }
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from tags.
|
||||
*/
|
||||
@Serverside
|
||||
protected abstract void readEntity(TagObject tag);
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to tags.
|
||||
*/
|
||||
@Serverside
|
||||
protected abstract void writeEntity(TagObject tag);
|
||||
|
||||
public void onChunkLoad()
|
||||
|
@ -1956,6 +1945,7 @@ public abstract class Entity
|
|||
this.motionZ = z;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
}
|
||||
|
@ -2285,9 +2275,7 @@ public abstract class Entity
|
|||
this.setLocationAndAngles(entityIn.posX, entityIn.posY, entityIn.posZ, entityIn.rotYaw, entityIn.rotPitch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares this entity in new dimension by copying data from entity in old dimension
|
||||
*/
|
||||
@Serverside
|
||||
public void copyDataFromOld(Entity entityIn)
|
||||
{
|
||||
TagObject tag = new TagObject();
|
||||
|
|
|
@ -33,24 +33,35 @@ import common.pathfinding.PathNavigateGround;
|
|||
import common.tags.TagObject;
|
||||
import java.util.List;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.ParticleType;
|
||||
import common.util.Serverside;
|
||||
import common.vars.Vars;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityHorse extends EntityAnimal implements IInvBasic
|
||||
{
|
||||
private static final Predicate<Entity> horseBreedingSelector = new Predicate<Entity>()
|
||||
{
|
||||
public boolean test(Entity p_apply_1_)
|
||||
{
|
||||
return p_apply_1_ instanceof EntityHorse && ((EntityHorse)p_apply_1_).isBreeding();
|
||||
}
|
||||
};
|
||||
private static final String[] horseTextures = new String[] {"textures/creature/horse_white.png", "textures/creature/horse_creamy.png", "textures/creature/horse_chestnut.png", "textures/creature/horse_brown.png", "textures/creature/horse_black.png", "textures/creature/horse_gray.png", "textures/creature/horse_darkbrown.png"};
|
||||
private static final String[] HORSE_TEXTURES_ABBR = new String[] {"hwh", "hcr", "hch", "hbr", "hbl", "hgr", "hdb"};
|
||||
private static final String[] horseMarkingTextures = new String[] {null, "textures/creature/horse_markings_white.png", "textures/creature/horse_markings_whitefield.png", "textures/creature/horse_markings_whitedots.png", "textures/creature/horse_markings_blackdots.png"};
|
||||
private static final String[] HORSE_MARKING_TEXTURES_ABBR = new String[] {"", "wo_", "wmo", "wdo", "bdo"};
|
||||
public class EntityHorse extends EntityAnimal implements IInvBasic {
|
||||
@Serverside
|
||||
private static final Predicate<Entity> horseBreedingSelector = new Predicate<Entity>() {
|
||||
public boolean test(Entity entity) {
|
||||
return entity instanceof EntityHorse horse && horse.isBreeding();
|
||||
}
|
||||
};
|
||||
@Clientside
|
||||
private static final String[] horseTextures = new String[] {
|
||||
"textures/creature/horse_white.png", "textures/creature/horse_creamy.png", "textures/creature/horse_chestnut.png",
|
||||
"textures/creature/horse_brown.png", "textures/creature/horse_black.png", "textures/creature/horse_gray.png", "textures/creature/horse_darkbrown.png"
|
||||
};
|
||||
@Clientside
|
||||
private static final String[] HORSE_TEXTURES_ABBR = new String[] {"hwh", "hcr", "hch", "hbr", "hbl", "hgr", "hdb"};
|
||||
@Clientside
|
||||
private static final String[] horseMarkingTextures = new String[] {
|
||||
null, "textures/creature/horse_markings_white.png", "textures/creature/horse_markings_whitefield.png",
|
||||
"textures/creature/horse_markings_whitedots.png", "textures/creature/horse_markings_blackdots.png"
|
||||
};
|
||||
@Clientside
|
||||
private static final String[] HORSE_MARKING_TEXTURES_ABBR = new String[] {"", "wo_", "wmo", "wdo", "bdo"};
|
||||
|
||||
private int eatingHaystackCounter;
|
||||
private int openMouthCounter;
|
||||
private int jumpRearingCounter;
|
||||
|
@ -59,10 +70,6 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
protected boolean horseJumping;
|
||||
private InventoryBasic horseChest;
|
||||
private boolean hasReproduced;
|
||||
|
||||
/**
|
||||
* "The higher this value, the more likely the horse is to be tamed next time a player rides it."
|
||||
*/
|
||||
protected int temper;
|
||||
protected float jumpPower;
|
||||
private boolean field_110294_bI;
|
||||
|
@ -72,11 +79,12 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
private float prevRearingAmount;
|
||||
private float mouthOpenness;
|
||||
private float prevMouthOpenness;
|
||||
|
||||
/** Used to determine the sound that the horse should make when it steps */
|
||||
private int gallopTime;
|
||||
@Clientside
|
||||
private String texturePrefix;
|
||||
@Clientside
|
||||
private String[] horseTexturesArray = new String[3];
|
||||
@Clientside
|
||||
private boolean validTexture = false;
|
||||
|
||||
public EntityHorse(World worldIn)
|
||||
|
@ -107,10 +115,10 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
this.dataWatcher.addObject(22, Integer.valueOf(0));
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public void setHorseType(int type)
|
||||
{
|
||||
this.dataWatcher.updateObject(19, Byte.valueOf((byte)type));
|
||||
this.resetTexturePrefix();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,10 +129,10 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
return this.dataWatcher.getWatchableObjectByte(19);
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public void setHorseVariant(int variant)
|
||||
{
|
||||
this.dataWatcher.updateObject(20, Integer.valueOf(variant));
|
||||
this.resetTexturePrefix();
|
||||
}
|
||||
|
||||
public int getHorseVariant()
|
||||
|
@ -156,12 +164,6 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
|
||||
case 2:
|
||||
return "Maultier";
|
||||
|
||||
case 3:
|
||||
return "Zombiepferd";
|
||||
|
||||
case 4:
|
||||
return "Skelettpferd";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -287,10 +289,10 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
return this.hasReproduced;
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public void setHorseArmorStack(ItemStack itemStackIn)
|
||||
{
|
||||
this.dataWatcher.updateObject(22, itemStackIn != null && itemStackIn.getItem() instanceof ItemHorseArmor armor ? ItemRegistry.getId(armor) : 0);
|
||||
this.resetTexturePrefix();
|
||||
}
|
||||
|
||||
public void setBreeding(boolean breeding)
|
||||
|
@ -484,6 +486,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
// }
|
||||
}
|
||||
|
||||
@Serverside
|
||||
protected EntityHorse getClosestHorse(Entity entityIn, double distance)
|
||||
{
|
||||
double d0 = Double.MAX_VALUE;
|
||||
|
@ -651,21 +654,25 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
return 400;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public boolean hasSpecificTexture()
|
||||
{
|
||||
return this.getHorseType() == 0 || this.getHorseArmorItem() != null;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
private void resetTexturePrefix()
|
||||
{
|
||||
this.texturePrefix = null;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public boolean hasValidTexture()
|
||||
{
|
||||
return this.validTexture;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
private void setHorseTexturePaths()
|
||||
{
|
||||
this.texturePrefix = "horse/";
|
||||
|
@ -719,6 +726,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
// }
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String getHorseTexture()
|
||||
{
|
||||
if (this.texturePrefix == null)
|
||||
|
@ -729,6 +737,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
return this.texturePrefix;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String[] getVariantTexturePaths()
|
||||
{
|
||||
if (this.texturePrefix == null)
|
||||
|
@ -1207,6 +1216,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
// }
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public void dropChestItems()
|
||||
{
|
||||
this.dropItemsInChest(this, this.horseChest);
|
||||
|
@ -1315,6 +1325,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
}
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public void writeEntity(TagObject tagCompound)
|
||||
{
|
||||
super.writeEntity(tagCompound);
|
||||
|
@ -1360,6 +1371,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
}
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public void readEntity(TagObject tagCompund)
|
||||
{
|
||||
super.readEntity(tagCompund);
|
||||
|
@ -1465,6 +1477,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
}
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public EntityHorse createChild(EntityLiving ageable)
|
||||
{
|
||||
EntityHorse entityhorse = (EntityHorse)ageable;
|
||||
|
@ -1528,6 +1541,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
return entityhorse1;
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public Object onInitialSpawn(Object livingdata)
|
||||
{
|
||||
livingdata = super.onInitialSpawn(livingdata);
|
||||
|
@ -1628,9 +1642,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* "Spawns particles for the horse entity. par1 tells whether to spawn hearts. If it is false, it spawns smoke."
|
||||
*/
|
||||
@Clientside
|
||||
protected void spawnHorseParticles(boolean p_110216_1_)
|
||||
{
|
||||
ParticleType enumparticletypes = p_110216_1_ ? ParticleType.HEART : ParticleType.SMOKE;
|
||||
|
@ -1641,6 +1653,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
}
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
if (id == 7)
|
||||
|
@ -1783,6 +1796,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
return 0x886038;
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public static class GroupData
|
||||
{
|
||||
public int horseType;
|
||||
|
|
|
@ -35,6 +35,7 @@ import common.pathfinding.PathEntity;
|
|||
import common.pathfinding.PathNavigateGround;
|
||||
import common.tags.TagObject;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Vec3;
|
||||
import common.vars.Vars;
|
||||
|
@ -346,6 +347,7 @@ public class EntityRabbit extends EntityAnimal {
|
|||
this.worldObj.setState(pos, Blocks.air.getState(), 2);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id) {
|
||||
if(id == 1) {
|
||||
this.createRunningParticles();
|
||||
|
|
|
@ -31,6 +31,7 @@ import common.item.tool.ItemShears;
|
|||
import common.pathfinding.PathNavigateGround;
|
||||
import common.rng.Random;
|
||||
import common.tags.TagObject;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -145,6 +146,7 @@ public class EntitySheep extends EntityAnimal
|
|||
return BlockWool.getByColor(this.getFleeceColor()).getItem();
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
if (id == 10)
|
||||
|
|
|
@ -31,6 +31,7 @@ import common.item.consumable.ItemFood;
|
|||
import common.item.material.ItemDye;
|
||||
import common.pathfinding.PathNavigateGround;
|
||||
import common.tags.TagObject;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.ParticleType;
|
||||
import common.vars.Vars;
|
||||
|
@ -429,6 +430,7 @@ public class EntityWolf extends EntityTameable
|
|||
return super.interact(player);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
if (id == 8)
|
||||
|
|
|
@ -12,6 +12,7 @@ import common.item.Item;
|
|||
import common.item.ItemStack;
|
||||
import common.tags.TagObject;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.ParticleType;
|
||||
import common.vars.Vars;
|
||||
import common.world.Explosion;
|
||||
|
@ -147,6 +148,7 @@ public class EntityTntCart extends EntityCart
|
|||
}
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
if (id == 10)
|
||||
|
|
|
@ -11,6 +11,7 @@ import common.entity.types.IObjectData;
|
|||
import common.init.SoundEvent;
|
||||
import common.tags.TagObject;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.ParticleType;
|
||||
import common.util.PortalType;
|
||||
|
@ -332,6 +333,7 @@ public class EntityXp extends Entity implements IObjectData
|
|||
return this.xpValue;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
this.xpValue = id;
|
||||
|
|
|
@ -46,13 +46,13 @@ import common.entity.projectile.EntityPotion;
|
|||
import common.entity.projectile.EntitySnowball;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.entity.types.IEntityMultiPart;
|
||||
import common.init.DimensionRegistry;
|
||||
import common.init.ItemRegistry;
|
||||
import common.init.Items;
|
||||
import common.init.NameRegistry;
|
||||
import common.init.SoundEvent;
|
||||
import common.init.SpeciesRegistry;
|
||||
import common.init.TradeRegistry;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.init.SpeciesRegistry.ModelType;
|
||||
import common.inventory.Container;
|
||||
import common.inventory.ContainerPlayer;
|
||||
|
@ -88,6 +88,7 @@ import common.sound.MovingSoundMinecartRiding;
|
|||
import common.tags.TagObject;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.ParticleType;
|
||||
|
@ -2968,6 +2969,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
}
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
if (this.isPlayer() && id == 9)
|
||||
|
@ -3325,7 +3327,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
|
||||
if (tagCompund.hasInt("SpawnX") && tagCompund.hasInt("SpawnY") && tagCompund.hasInt("SpawnZ") && tagCompund.hasString("SpawnDim"))
|
||||
{
|
||||
Dimension dim = UniverseRegistry.getDimension(tagCompund.getString("SpawnDim"));
|
||||
Dimension dim = DimensionRegistry.getDimension(tagCompund.getString("SpawnDim"));
|
||||
this.spawnPos = dim == null ? null : new WorldPos(tagCompund.getInt("SpawnX"), tagCompund.getInt("SpawnY"),
|
||||
tagCompund.getInt("SpawnZ"), dim);
|
||||
// this.spawnForced = tagCompund.getBoolean("SpawnForced");
|
||||
|
@ -3333,7 +3335,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
|
||||
if (tagCompund.hasInt("OriginX") && tagCompund.hasInt("OriginY") && tagCompund.hasInt("OriginZ") && tagCompund.hasString("OriginDim"))
|
||||
{
|
||||
Dimension dim = UniverseRegistry.getDimension(tagCompund.getString("OriginDim"));
|
||||
Dimension dim = DimensionRegistry.getDimension(tagCompund.getString("OriginDim"));
|
||||
this.originPos = dim == null ? new WorldPos(0, 64, 0, Space.INSTANCE) : new WorldPos(tagCompund.getInt("OriginX"), tagCompund.getInt("OriginY"),
|
||||
tagCompund.getInt("OriginZ"), dim);
|
||||
}
|
||||
|
@ -3437,7 +3439,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
tagCompound.setInt("SpawnX", this.spawnPos.getX());
|
||||
tagCompound.setInt("SpawnY", this.spawnPos.getY());
|
||||
tagCompound.setInt("SpawnZ", this.spawnPos.getZ());
|
||||
tagCompound.setString("SpawnDim", UniverseRegistry.getName(dim));
|
||||
tagCompound.setString("SpawnDim", DimensionRegistry.getName(dim));
|
||||
}
|
||||
// tagCompound.setBoolean("SpawnForced", this.spawnForced);
|
||||
}
|
||||
|
@ -3449,7 +3451,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
tagCompound.setInt("OriginX", this.originPos.getX());
|
||||
tagCompound.setInt("OriginY", this.originPos.getY());
|
||||
tagCompound.setInt("OriginZ", this.originPos.getZ());
|
||||
tagCompound.setString("OriginDim", UniverseRegistry.getName(dim));
|
||||
tagCompound.setString("OriginDim", DimensionRegistry.getName(dim));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import common.util.ExtMath;
|
|||
import common.util.HitPosition;
|
||||
import common.util.Vec3;
|
||||
import common.vars.Vars;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -214,7 +215,7 @@ public class EntityBullet extends Entity implements IProjectile, IObjectData {
|
|||
protected void onHitBlock(BlockPos pos) {
|
||||
if(!this.worldObj.client) {
|
||||
State state = pos != null ? this.worldObj.getState(pos) : null;
|
||||
if(state == null || state.getBlock().onShot(this.worldObj, pos, state, this)) {
|
||||
if(state == null || state.getBlock().onShot((AWorldServer)this.worldObj, pos, state, this)) {
|
||||
this.playSound(SoundEvent.METALHIT, 0.5F);
|
||||
this.setDead();
|
||||
}
|
||||
|
|
|
@ -13,8 +13,10 @@ import common.init.Items;
|
|||
import common.item.ItemStack;
|
||||
import common.tags.TagObject;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.ParticleType;
|
||||
import common.util.Serverside;
|
||||
import common.world.World;
|
||||
|
||||
public abstract class EntityAnimal extends EntityLiving
|
||||
|
@ -217,6 +219,7 @@ public abstract class EntityAnimal extends EntityLiving
|
|||
}
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public void setInLove(int loveTicks, boolean update)
|
||||
{
|
||||
boolean last = this.isInLove();
|
||||
|
@ -225,14 +228,13 @@ public abstract class EntityAnimal extends EntityLiving
|
|||
this.dataWatcher.updateObject(30, (byte)(this.isInLove() ? 1 : 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the mob is currently able to mate with the specified mob.
|
||||
*/
|
||||
@Serverside
|
||||
public boolean canMateWith(EntityAnimal otherAnimal)
|
||||
{
|
||||
return otherAnimal == this ? false : (otherAnimal.getClass() != this.getClass() ? false : this.isInLove() && otherAnimal.isInLove());
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
if (id == 18)
|
||||
|
|
|
@ -54,8 +54,10 @@ import common.rng.Random;
|
|||
import common.tags.TagObject;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.ParticleType;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.vars.Vars;
|
||||
import common.world.State;
|
||||
|
@ -1312,6 +1314,7 @@ public abstract class EntityLiving extends Entity
|
|||
}
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
if (id == 2)
|
||||
|
@ -2578,6 +2581,7 @@ public abstract class EntityLiving extends Entity
|
|||
return 16;
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public Object onInitialSpawn(Object livingdata) {
|
||||
return livingdata;
|
||||
}
|
||||
|
@ -3106,6 +3110,7 @@ public abstract class EntityLiving extends Entity
|
|||
public void setScaleForAge() {
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public EntityLiving createChild(EntityLiving ageable) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package common.entity.types;
|
|||
|
||||
import common.ai.EntityAISit;
|
||||
import common.tags.TagObject;
|
||||
import common.util.Clientside;
|
||||
import common.util.ParticleType;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -78,6 +79,7 @@ public abstract class EntityTameable extends EntityAnimal implements IEntityOwna
|
|||
}
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
if (id == 7)
|
||||
|
|
40
common/src/main/java/common/init/DimensionRegistry.java
Normal file
40
common/src/main/java/common/init/DimensionRegistry.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
package common.init;
|
||||
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.dimension.Dimension;
|
||||
import common.dimension.Section;
|
||||
|
||||
public abstract class DimensionRegistry {
|
||||
protected static final List<Dimension> DIMENSIONS = Lists.newArrayList();
|
||||
protected static final Map<Integer, Dimension> ID_MAP = Maps.newTreeMap();
|
||||
protected static final Map<Dimension, Integer> IDS = new IdentityHashMap();
|
||||
protected static final Map<String, Section> NAME_MAP = Maps.newTreeMap();
|
||||
protected static final Map<Section, String> NAMES = new IdentityHashMap();
|
||||
|
||||
public static List<Dimension> getDimensions() {
|
||||
return DIMENSIONS;
|
||||
}
|
||||
|
||||
public static Dimension getDimension(int dim) {
|
||||
return ID_MAP.get(dim);
|
||||
}
|
||||
|
||||
public static int getId(Dimension dim) {
|
||||
if(dim == null)
|
||||
return -1;
|
||||
Integer id = IDS.get(dim);
|
||||
return id == null ? -1 : id;
|
||||
}
|
||||
|
||||
public static String getName(Section dim) {
|
||||
return dim == null ? null : NAMES.get(dim);
|
||||
}
|
||||
|
||||
public static Dimension getDimension(String name) {
|
||||
return NAME_MAP.get(name) instanceof Dimension dim ? dim : null;
|
||||
}
|
||||
}
|
|
@ -49,6 +49,7 @@ import common.item.spawner.ItemMobTemplate;
|
|||
import common.item.spawner.ItemCharTemplate;
|
||||
import common.log.Log;
|
||||
import common.tags.TagObject;
|
||||
import common.util.Serverside;
|
||||
import common.world.World;
|
||||
|
||||
public abstract class EntityRegistry {
|
||||
|
@ -102,6 +103,7 @@ public abstract class EntityRegistry {
|
|||
return entity;
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public static Entity createFromTags(TagObject tag, World world) {
|
||||
Entity entity = null;
|
||||
|
||||
|
|
|
@ -10,6 +10,5 @@ public abstract class Registry {
|
|||
CraftingRegistry.register();
|
||||
SmeltingRegistry.register();
|
||||
EntityRegistry.register();
|
||||
UniverseRegistry.register();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,760 +0,0 @@
|
|||
package common.init;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import common.biome.Biome;
|
||||
import common.biome.Scaling;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.collect.Sets;
|
||||
import common.dimension.Area;
|
||||
import common.dimension.CloudType;
|
||||
import common.dimension.DimType;
|
||||
import common.dimension.Dimension;
|
||||
import common.dimension.Dimension.PopulatorType;
|
||||
import common.dimension.Domain;
|
||||
import common.dimension.Galaxy;
|
||||
import common.dimension.Moon;
|
||||
import common.dimension.Section;
|
||||
import common.dimension.Planet;
|
||||
import common.dimension.Sector;
|
||||
import common.dimension.Semi;
|
||||
import common.dimension.Space;
|
||||
import common.dimension.Star;
|
||||
import common.entity.Entity;
|
||||
import common.entity.animal.EntityBat;
|
||||
import common.entity.animal.EntityCat;
|
||||
import common.entity.animal.EntityChicken;
|
||||
import common.entity.animal.EntityCow;
|
||||
import common.entity.animal.EntityFox;
|
||||
import common.entity.animal.EntityHorse;
|
||||
import common.entity.animal.EntityMouse;
|
||||
import common.entity.animal.EntityPig;
|
||||
import common.entity.animal.EntityRabbit;
|
||||
import common.entity.animal.EntitySheep;
|
||||
import common.entity.animal.EntityWolf;
|
||||
import common.entity.npc.EntityArachnoid;
|
||||
import common.entity.npc.EntityBloodElf;
|
||||
import common.entity.npc.EntityCultivator;
|
||||
import common.entity.npc.EntityElf;
|
||||
import common.entity.npc.EntityFireDemon;
|
||||
import common.entity.npc.EntityHaunter;
|
||||
import common.entity.npc.EntityMage;
|
||||
import common.entity.npc.EntityMerfolk;
|
||||
import common.entity.npc.EntityMetalhead;
|
||||
import common.entity.npc.EntitySlime;
|
||||
import common.entity.npc.EntitySpirit;
|
||||
import common.entity.npc.EntityTiefling;
|
||||
import common.entity.npc.EntityUndead;
|
||||
import common.entity.npc.EntityWoodElf;
|
||||
import common.entity.npc.EntityZombie;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.world.Weather;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class UniverseRegistry {
|
||||
private static final List<Section> SECTIONS = Lists.newArrayList();
|
||||
private static final List<Dimension> DIMENSIONS = Lists.newArrayList();
|
||||
private static final Map<Integer, Dimension> ID_MAP = Maps.newTreeMap();
|
||||
private static final Map<Dimension, Integer> IDS = new IdentityHashMap();
|
||||
private static final Map<String, Section> NAME_MAP = Maps.newTreeMap();
|
||||
private static final Map<Section, String> NAMES = new IdentityHashMap();
|
||||
private static final Set<String> NAME_LIST = Sets.newTreeSet();
|
||||
|
||||
private static final Map<Moon, Planet> MOON_PLANET = Maps.newHashMap();
|
||||
private static final Map<Planet, List<Moon>> PLANET_MOONS = Maps.newHashMap();
|
||||
private static final Map<Planet, Star> PLANET_STAR = Maps.newHashMap();
|
||||
private static final Map<Star, List<Planet>> STAR_PLANETS = Maps.newHashMap();
|
||||
private static final Map<Star, Sector> STAR_SECTOR = Maps.newHashMap();
|
||||
private static final Map<Sector, List<Star>> SECTOR_STARS = Maps.newHashMap();
|
||||
private static final Map<Sector, Galaxy> SECTOR_GALAXY = Maps.newHashMap();
|
||||
private static final Map<Galaxy, List<Sector>> GALAXY_SECTORS = Maps.newHashMap();
|
||||
private static final Map<Area, Domain> AREA_DOMAIN = Maps.newHashMap();
|
||||
private static final Map<Domain, List<Area>> DOMAIN_AREAS = Maps.newHashMap();
|
||||
private static final Set<Semi> SEMI = Sets.newHashSet();
|
||||
|
||||
public static List<Dimension> getDimensions() {
|
||||
return DIMENSIONS;
|
||||
}
|
||||
|
||||
public static List<Section> getSections() {
|
||||
return SECTIONS;
|
||||
}
|
||||
|
||||
public static Collection<Galaxy> getGalaxies() {
|
||||
return GALAXY_SECTORS.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Sector> getSectors() {
|
||||
return SECTOR_GALAXY.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Domain> getDomains() {
|
||||
return DOMAIN_AREAS.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Star> getStars() {
|
||||
return STAR_SECTOR.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Planet> getPlanets() {
|
||||
return PLANET_STAR.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Moon> getMoons() {
|
||||
return MOON_PLANET.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Area> getAreas() {
|
||||
return AREA_DOMAIN.keySet();
|
||||
}
|
||||
|
||||
public static Collection<Semi> getSemis() {
|
||||
return SEMI;
|
||||
}
|
||||
|
||||
public static List<Sector> getSectors(Galaxy galaxy) {
|
||||
return GALAXY_SECTORS.get(galaxy);
|
||||
}
|
||||
|
||||
public static List<Star> getStars(Sector sector) {
|
||||
return SECTOR_STARS.get(sector);
|
||||
}
|
||||
|
||||
public static List<Planet> getPlanets(Star star) {
|
||||
return STAR_PLANETS.get(star);
|
||||
}
|
||||
|
||||
public static List<Moon> getMoons(Planet planet) {
|
||||
return PLANET_MOONS.get(planet);
|
||||
}
|
||||
|
||||
public static List<Area> getAreas(Domain domain) {
|
||||
return DOMAIN_AREAS.get(domain);
|
||||
}
|
||||
|
||||
public static Star getStar(Planet planet) {
|
||||
return PLANET_STAR.get(planet);
|
||||
}
|
||||
|
||||
public static Planet getPlanet(Moon moon) {
|
||||
return MOON_PLANET.get(moon);
|
||||
}
|
||||
|
||||
public static Sector getSector(Star star) {
|
||||
return STAR_SECTOR.get(star);
|
||||
}
|
||||
|
||||
public static Galaxy getGalaxy(Sector sector) {
|
||||
return SECTOR_GALAXY.get(sector);
|
||||
}
|
||||
|
||||
public static Domain getDomain(Area area) {
|
||||
return AREA_DOMAIN.get(area);
|
||||
}
|
||||
|
||||
public static Dimension getDimension(int dim) {
|
||||
return ID_MAP.get(dim);
|
||||
}
|
||||
|
||||
public static int getId(Dimension dim) {
|
||||
if(dim == null)
|
||||
return -1;
|
||||
Integer id = IDS.get(dim);
|
||||
return id == null ? -1 : id;
|
||||
}
|
||||
|
||||
public static String getName(Section dim) {
|
||||
return dim == null ? null : NAMES.get(dim);
|
||||
}
|
||||
|
||||
public static Dimension getDimension(String name) {
|
||||
return NAME_MAP.get(name) instanceof Dimension dim ? dim : null;
|
||||
}
|
||||
|
||||
public static Section getSection(String name) {
|
||||
return NAME_MAP.get(name);
|
||||
}
|
||||
|
||||
public static Set<String> getWorldNames() {
|
||||
return NAME_LIST;
|
||||
}
|
||||
|
||||
public static boolean isRegistered(String name) {
|
||||
return NAME_MAP.containsKey(name);
|
||||
}
|
||||
|
||||
public static boolean isType(String name, DimType type) {
|
||||
return NAME_MAP.containsKey(name) && NAME_MAP.get(name) instanceof Dimension dim && dim.getType() == type;
|
||||
}
|
||||
|
||||
public static Galaxy registerCustomGalaxy(String name, String display) {
|
||||
Galaxy galaxy = new Galaxy(true);
|
||||
registerGalaxyInt(name, display, galaxy);
|
||||
return galaxy;
|
||||
}
|
||||
|
||||
public static Sector registerCustomSector(String name, String display, String galaxy) {
|
||||
Section base = NAME_MAP.get(galaxy);
|
||||
if(!(base instanceof Galaxy baseGalaxy))
|
||||
throw new IllegalArgumentException("Galaxie " + galaxy + " existiert nicht");
|
||||
Sector sector = new Sector(true);
|
||||
registerSectorInt(name, display, sector, baseGalaxy);
|
||||
return sector;
|
||||
}
|
||||
|
||||
public static Domain registerCustomDomain(String name, String display) {
|
||||
Domain domain = new Domain(true);
|
||||
registerDomainInt(name, display, domain);
|
||||
return domain;
|
||||
}
|
||||
|
||||
public static Star registerCustomStar(String name, String display, Star dim, String sector) {
|
||||
Section base = NAME_MAP.get(sector);
|
||||
if(!(base instanceof Sector baseSector))
|
||||
throw new IllegalArgumentException("Sektor " + sector + " existiert nicht");
|
||||
if(!dim.isCustom())
|
||||
dim = (Star)dim.makeCustomCopy();
|
||||
registerStarInt(name, display, dim, baseSector);
|
||||
return dim;
|
||||
}
|
||||
|
||||
public static Planet registerCustomPlanet(String name, String display, Planet dim, String star) {
|
||||
Section base = NAME_MAP.get(star);
|
||||
if(!(base instanceof Star baseStar))
|
||||
throw new IllegalArgumentException("Stern " + star + " existiert nicht");
|
||||
if(!dim.isCustom())
|
||||
dim = (Planet)dim.makeCustomCopy();
|
||||
registerPlanetInt(name, display, dim, baseStar);
|
||||
return dim;
|
||||
}
|
||||
|
||||
public static Moon registerCustomMoon(String name, String display, Moon dim, String planet) {
|
||||
Section base = NAME_MAP.get(planet);
|
||||
if(!(base instanceof Planet basePlanet))
|
||||
throw new IllegalArgumentException("Planet " + planet + " existiert nicht");
|
||||
if(!dim.isCustom())
|
||||
dim = (Moon)dim.makeCustomCopy();
|
||||
registerMoonInt(name, display, dim, basePlanet);
|
||||
return dim;
|
||||
}
|
||||
|
||||
public static Area registerCustomArea(String name, String display, Area dim, String domain) {
|
||||
Section base = NAME_MAP.get(domain);
|
||||
if(!(base instanceof Domain baseDomain))
|
||||
throw new IllegalArgumentException("Bereich " + domain + " existiert nicht");
|
||||
if(!dim.isCustom())
|
||||
dim = (Area)dim.makeCustomCopy();
|
||||
registerAreaInt(name, display, dim, baseDomain);
|
||||
return dim;
|
||||
}
|
||||
|
||||
public static Semi registerCustomSemi(String name, String display, Semi dim) {
|
||||
if(!dim.isCustom())
|
||||
dim = (Semi)dim.makeCustomCopy();
|
||||
registerSemiInt(name, display, dim);
|
||||
return dim;
|
||||
}
|
||||
|
||||
|
||||
private static void register(String name, String display, Section obj) {
|
||||
if(NAME_MAP.containsKey(name))
|
||||
throw new IllegalArgumentException("Objekt " + name + " ist bereits registriert");
|
||||
obj.setDisplay(display);
|
||||
NAME_MAP.put(name, obj);
|
||||
NAMES.put(obj, name);
|
||||
SECTIONS.add(obj);
|
||||
if(obj instanceof Dimension dim) {
|
||||
NAME_LIST.add(name);
|
||||
ID_MAP.put(DIMENSIONS.size(), dim);
|
||||
IDS.put(dim, DIMENSIONS.size());
|
||||
DIMENSIONS.add(dim);
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerGalaxyInt(String name, String display, Galaxy galaxy) {
|
||||
register(name, display, galaxy);
|
||||
GALAXY_SECTORS.put(galaxy, Lists.newArrayList());
|
||||
}
|
||||
|
||||
private static void registerSectorInt(String name, String display, Sector sector, Galaxy galaxy) {
|
||||
register(name, display, sector);
|
||||
SECTOR_GALAXY.put(sector, galaxy);
|
||||
SECTOR_STARS.put(sector, Lists.newArrayList());
|
||||
GALAXY_SECTORS.get(galaxy).add(sector);
|
||||
}
|
||||
|
||||
private static void registerDomainInt(String name, String display, Domain domain) {
|
||||
register(name, display, domain);
|
||||
DOMAIN_AREAS.put(domain, Lists.newArrayList());
|
||||
}
|
||||
|
||||
private static void registerStarInt(String name, String display, Star star, Sector sector) {
|
||||
register(name, display, star);
|
||||
STAR_SECTOR.put(star, sector);
|
||||
STAR_PLANETS.put(star, Lists.newArrayList());
|
||||
SECTOR_STARS.get(sector).add(star);
|
||||
}
|
||||
|
||||
private static void registerPlanetInt(String name, String display, Planet planet, Star star) {
|
||||
register(name, display, planet);
|
||||
PLANET_STAR.put(planet, star);
|
||||
PLANET_MOONS.put(planet, Lists.newArrayList());
|
||||
STAR_PLANETS.get(star).add(planet);
|
||||
}
|
||||
|
||||
private static void registerMoonInt(String name, String display, Moon moon, Planet planet) {
|
||||
register(name, display, moon);
|
||||
MOON_PLANET.put(moon, planet);
|
||||
PLANET_MOONS.get(planet).add(moon);
|
||||
}
|
||||
|
||||
private static void registerAreaInt(String name, String display, Area area, Domain domain) {
|
||||
register(name, display, area);
|
||||
AREA_DOMAIN.put(area, domain);
|
||||
DOMAIN_AREAS.get(domain).add(area);
|
||||
}
|
||||
|
||||
private static void registerSemiInt(String name, String display, Semi semi) {
|
||||
register(name, display, semi);
|
||||
SEMI.add(semi);
|
||||
}
|
||||
|
||||
|
||||
private static Galaxy lastGalaxy;
|
||||
private static Sector lastSector;
|
||||
private static Domain lastDomain;
|
||||
private static Star lastStar;
|
||||
private static Planet lastPlanet;
|
||||
|
||||
private static String fromDisplay(String display) {
|
||||
return display.toLowerCase().replace("'", "").replace(' ', '_');
|
||||
}
|
||||
|
||||
private static void registerGalaxy(String name, String display, Runnable sub) {
|
||||
registerGalaxyInt(name, display, lastGalaxy = new Galaxy(false));
|
||||
sub.run();
|
||||
lastGalaxy = null;
|
||||
}
|
||||
|
||||
private static void registerSector(String name, String display, Runnable sub) {
|
||||
registerSectorInt(name, display, lastSector = new Sector(false), lastGalaxy);
|
||||
sub.run();
|
||||
lastSector = null;
|
||||
}
|
||||
|
||||
private static void registerDomain(String name, String display, Runnable sub) {
|
||||
registerDomainInt(name, display, lastDomain = new Domain(false));
|
||||
sub.run();
|
||||
lastDomain = null;
|
||||
}
|
||||
|
||||
private static void registerStar(String name, String display, Dimension dim, Runnable sub) {
|
||||
registerStarInt(name, display, lastStar = (Star)dim, lastSector);
|
||||
sub.run();
|
||||
lastStar = null;
|
||||
}
|
||||
|
||||
private static void registerPlanet(String name, String display, Dimension dim) {
|
||||
registerPlanetInt(name, display, (Planet)dim, lastStar);
|
||||
}
|
||||
|
||||
private static void registerPlanet(String name, String display, Dimension dim, Runnable sub) {
|
||||
registerPlanetInt(name, display, lastPlanet = (Planet)dim, lastStar);
|
||||
sub.run();
|
||||
lastPlanet = null;
|
||||
}
|
||||
|
||||
private static void registerMoon(String name, String display, Dimension dim) {
|
||||
registerMoonInt(name, display, (Moon)dim, lastPlanet);
|
||||
}
|
||||
|
||||
private static void registerArea(String name, String display, Dimension dim) {
|
||||
registerAreaInt(name, display, (Area)dim, lastDomain);
|
||||
}
|
||||
|
||||
private static void registerSemi(String name, String display, Dimension dim) {
|
||||
registerSemiInt(name, display, (Semi)dim);
|
||||
}
|
||||
|
||||
private static void registerGalaxy(String display, Runnable sub) {
|
||||
registerGalaxy(fromDisplay(display), "Galaxie " + display, sub);
|
||||
}
|
||||
|
||||
private static void registerSector(String display, Runnable sub) {
|
||||
registerSector(fromDisplay(display), "Sektor " + display, sub);
|
||||
}
|
||||
|
||||
private static void registerDomain(String display, Runnable sub) {
|
||||
registerDomain(fromDisplay(display), display, sub);
|
||||
}
|
||||
|
||||
private static void registerStar(String display, Dimension dim, Runnable sub) {
|
||||
registerStar(fromDisplay(display), "Stern " + display, dim, sub);
|
||||
}
|
||||
|
||||
private static void registerPlanet(String display, Dimension dim) {
|
||||
registerPlanet(fromDisplay(display), "Planet " + display, dim);
|
||||
}
|
||||
|
||||
private static void registerPlanet(String display, Dimension dim, Runnable sub) {
|
||||
registerPlanet(fromDisplay(display), "Planet " + display, dim, sub);
|
||||
}
|
||||
|
||||
private static void registerMoon(String display, Dimension dim) {
|
||||
registerMoon(fromDisplay(display), "Mond " + display, dim);
|
||||
}
|
||||
|
||||
private static void registerArea(String display, Dimension dim) {
|
||||
registerArea(fromDisplay(display), display, dim);
|
||||
}
|
||||
|
||||
private static void registerSemi(String display, Dimension dim) {
|
||||
registerSemi(fromDisplay(display), display, dim);
|
||||
}
|
||||
|
||||
private static void registerStar(String display, int radius, float gravity, float temp, Runnable sub) {
|
||||
registerStar(display, new Star(radius, gravity, temp), sub);
|
||||
}
|
||||
|
||||
private static void registerMoon(String display, int radius, long orbit, long rotation, float gravity, float temperature) {
|
||||
registerMoon(display, new Moon(radius, orbit, rotation, gravity, temperature));
|
||||
}
|
||||
|
||||
private static void registerMoon(String display, int radius, long orbitRotation, float gravity, float temperature) {
|
||||
registerMoon(display, new Moon(radius, orbitRotation, gravity, temperature));
|
||||
}
|
||||
|
||||
// public static final Biome PLAIN = new Biome(12.0f, 40.0f, Scaling.PLAINS_LOW);
|
||||
// public static final Biome DESERT = new Biome(60.0f, 0.0f, Scaling.PLAINS_LOW);
|
||||
// public static final Biome HILLS = new Biome(-12.0f, 30.0f, Scaling.HILLS_LARGE);
|
||||
// public static final Biome FOREST = new Biome(8.0f, 80.0f);
|
||||
// public static final Biome TAIGA = new Biome(-10.0f, 80.0f, Scaling.PLAINS_MEDIUM);
|
||||
// public static final Biome SWAMP = new Biome(12.0f, 90.0f, Scaling.SEA_POND);
|
||||
// public static final Biome ICE = new Biome(-20.0f, 50.0f, Scaling.PLAINS_LOW);
|
||||
// public static final Biome ICE_HILLS = new Biome(-20.0f, 50.0f, Scaling.HILLS_LOW);
|
||||
// public static final Biome BEACH = new Biome(12.0f, 40.0f, Scaling.SEA_SHORE);
|
||||
// public static final Biome DESERT_HILLS = new Biome(60.0f, 0.0f, Scaling.HILLS_LOW);
|
||||
// public static final Biome FOREST_HILLS = new Biome(8.0f, 80.0f, Scaling.HILLS_LOW);
|
||||
// public static final Biome TAIGA_HILLS = new Biome(-10.0f, 80.0f, Scaling.HILLS_LOW);
|
||||
// public static final Biome HILLS_EDGE = new Biome(-12.0f, 30.0f, Scaling.HILLS_MEDIUM);
|
||||
// public static final Biome TROPIC = new Biome(18.0f, 90.0f);
|
||||
// public static final Biome TROPIC_HILLS = new Biome(18.0f, 90.0f, Scaling.HILLS_LOW);
|
||||
// public static final Biome TROPIC_EDGE = new Biome(18.0f, 80.0f);
|
||||
// public static final Biome STONE_BEACH = new Biome(-12.0f, 30.0f, Scaling.SEA_VARYING);
|
||||
// public static final Biome ICE_BEACH = new Biome(-18.0f, 30.0f, Scaling.SEA_SHORE);
|
||||
// public static final Biome BIRCH_FOREST = new Biome(4.0f, 60.0f);
|
||||
// public static final Biome BIRCH_HILLS = new Biome(4.0f, 60.0f, Scaling.HILLS_LOW);
|
||||
// public static final Biome DARK_FOREST = new Biome(8.0f, 80.0f);
|
||||
// public static final Biome ICE_TAIGA = new Biome(-40.0f, 40.0f, Scaling.PLAINS_MEDIUM);
|
||||
// public static final Biome ICE_TAIGA_HILLS = new Biome(-40.0f, 40.0f, Scaling.HILLS_LOW);
|
||||
// public static final Biome LARGE_TAIGA = new Biome(-8.0f, 80.0f, Scaling.PLAINS_MEDIUM);
|
||||
// public static final Biome LARGE_TAIGA_HILLS = new Biome(-8.0f, 80.0f, Scaling.HILLS_LOW);
|
||||
// public static final Biome LARGE_HILLS = new Biome(-12.0f, 30.0f, Scaling.HILLS_LARGE);
|
||||
// public static final Biome SAVANNA = new Biome(28.0f, 0.0f, Scaling.PLAINS_LOW);
|
||||
// public static final Biome SAVANNA_PLATEAU = new Biome(20.0f, 0.0f, Scaling.HILLS_PLATEAU);
|
||||
//
|
||||
// public static final Biome DESERT_MOD = new Biome(60.0f, 0.0f, 0.225F, 0.25F);
|
||||
// public static final Biome HILLS_MOD = new Biome(-12.0f, 30.0f, Scaling.HILLS_LARGE);
|
||||
// public static final Biome FLOWER_FOREST = new Biome(8.0f, 80.0f, 0.1F, 0.4F);
|
||||
// public static final Biome TAIGA_MOD = new Biome(-10.0f, 80.0f, 0.3F, 0.4F);
|
||||
// public static final Biome SWAMP_MOD = new Biome(12.0f, 90.0f, -0.1F, 0.3F);
|
||||
// public static final Biome ICE_SPIKES = new Biome(-20.0f, 50.0f, 0.425F, 0.45F);
|
||||
// public static final Biome TROPIC_MOD = new Biome(18.0f, 90.0f, 0.2F, 0.4F);
|
||||
// public static final Biome TROPIC_EDGE_MOD = new Biome(18.0f, 80.0f, 0.2F, 0.4F);
|
||||
// public static final Biome BIRCH_FOREST_MOD = new Biome(4.0f, 60.0f, 0.2F, 0.4F);
|
||||
// public static final Biome BIRCH_HILLS_MOD = new Biome(4.0f, 60.0f, 0.55F, 0.5F);
|
||||
// public static final Biome DARK_FOREST_MOD = new Biome(8.0f, 80.0f, 0.2F, 0.4F);
|
||||
// public static final Biome ICE_TAIGA_MOD = new Biome(-40.0f, 40.0f, 0.3F, 0.4F);
|
||||
// public static final Biome SPRUCE_TAIGA = new Biome(-10.0f, 80.0f, Scaling.PLAINS_MEDIUM);
|
||||
// public static final Biome REDWOOD_TAIGA = new Biome(-10.0f, 80.0f, 0.3F, 0.4F);
|
||||
// public static final Biome LARGE_HILLS_MOD = new Biome(-12.0f, 30.0f, Scaling.HILLS_LARGE);
|
||||
// public static final Biome SAVANNA_MOD = new Biome(24.0f, 0.0f, 0.3625F, 1.225F);
|
||||
// public static final Biome SAVANNA_PLATEAU_MOD = new Biome(20.0f, 0.0f, 1.05F, 1.2125F);
|
||||
//
|
||||
// .setBiomeGen(Biome.FOREST, false, 4, 4, 6, 50).enableMobs().enableSnow()
|
||||
// .setFrostBiomes(Biome.ICE, Biome.ICE, Biome.ICE, Biome.ICE_TAIGA, Biome.LARGE_TAIGA)
|
||||
// .setColdBiomes(Biome.FOREST, Biome.HILLS, Biome.TAIGA, Biome.PLAIN)
|
||||
// .setMediumBiomes(Biome.FOREST, Biome.DARK_FOREST, Biome.HILLS, Biome.PLAIN, Biome.BIRCH_FOREST,
|
||||
// Biome.SWAMP, Biome.TROPIC)
|
||||
// .setHotBiomes(Biome.DESERT, Biome.DESERT, Biome.DESERT, Biome.SAVANNA, Biome.SAVANNA, Biome.PLAIN)
|
||||
|
||||
static void register() { // TODO: add mushroom 0.2F, 0.3F .addSpawn(EntityDwarf.class, 8, 4, 8)
|
||||
register("space", "Der Weltraum", Space.INSTANCE);
|
||||
|
||||
registerGalaxy("milkyway", "Galaxie Milchstraße", () -> {
|
||||
registerSector("Solar", () -> {
|
||||
registerStar("Sol", 695508000, 274.0f, 5778.0f, () -> {
|
||||
registerPlanet("Terra", new Planet(6378136, 8766144L, 24000L, 28.0f, 9.81f, 259.15f)
|
||||
.setPerlinGen(Blocks.stone.getState(), Blocks.water.getState(), 63)
|
||||
.setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState())
|
||||
.setPopulator(PopulatorType.BASIC)
|
||||
.setBiomeGen(new Biome(8.0f, 80.0f), false, 4, 4, 6, 50).enableSnow()
|
||||
.setFrostBiomes(new Biome(-20.0f, 50.0f, Scaling.PLAINS_LOW), new Biome(-20.0f, 50.0f, Scaling.PLAINS_LOW), new Biome(-20.0f, 50.0f, Scaling.PLAINS_LOW), new Biome(-40.0f, 40.0f, Scaling.PLAINS_MEDIUM), new Biome(-8.0f, 80.0f, Scaling.PLAINS_MEDIUM))
|
||||
.setColdBiomes(new Biome(8.0f, 80.0f), new Biome(-12.0f, 30.0f, Scaling.HILLS_LARGE), new Biome(-10.0f, 80.0f, Scaling.PLAINS_MEDIUM), new Biome(12.0f, 40.0f, Scaling.PLAINS_LOW))
|
||||
.setMediumBiomes(new Biome(8.0f, 80.0f), new Biome(8.0f, 80.0f, 0.1F, 0.4F), new Biome(8.0f, 80.0f), new Biome(-12.0f, 30.0f, Scaling.HILLS_LARGE), new Biome(12.0f, 40.0f, Scaling.PLAINS_LOW), new Biome(4.0f, 60.0f),
|
||||
new Biome(12.0f, 90.0f, Scaling.SEA_POND), new Biome(18.0f, 90.0f))
|
||||
.setHotBiomes(new Biome(60.0f, 0.0f, Scaling.PLAINS_LOW), new Biome(60.0f, 0.0f, Scaling.PLAINS_LOW), new Biome(60.0f, 0.0f, Scaling.HILLS_LOW), new Biome(28.0f, 0.0f, Scaling.PLAINS_LOW), new Biome(20.0f, 0.0f, Scaling.HILLS_PLATEAU), new Biome(12.0f, 40.0f, Scaling.PLAINS_LOW))
|
||||
.enableCavesRavines(Blocks.lava.getState()).setDungeons(8)
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), Blocks.stone.getState(), null, 8, 8, 255, true)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
|
||||
.addMetalOres(MetalType.values())
|
||||
.addOre(Blocks.dirt.getState(), 10, 0, 33, 0, 256, false)
|
||||
.addOre(Blocks.gravel.getState(), 8, 0, 33, 0, 256, false)
|
||||
.addOre(Blocks.rock.getState(), 6, 0, 22, 24, 72, false)
|
||||
.addOre(Blocks.coal_ore.getState(), 20, 0, 17, 0, 128, false)
|
||||
.addOre(Blocks.charge_ore.getState(), 8, 0, 8, 0, 16, false)
|
||||
.addOre(Blocks.lapis_ore.getState(), 1, 0, 7, 16, 16, true)
|
||||
.addOre(Blocks.diamond_ore.getState(), 1, 0, 8, 0, 16, false)
|
||||
.addOre(Blocks.ruby_ore.getState(), 1, 0, 4, 12, 8, true)
|
||||
.addOre(Blocks.cinnabar_ore.getState(), 1, 0, 11, 0, 24, false)
|
||||
.addSpawn(EntitySheep.class, 12, 4, 4)
|
||||
.addSpawn(EntityRabbit.class, 10, 3, 10)
|
||||
.addSpawn(EntityPig.class, 10, 4, 4)
|
||||
.addSpawn(EntityChicken.class, 10, 4, 4)
|
||||
.addSpawn(EntityCow.class, 8, 4, 4)
|
||||
.addSpawn(EntityArachnoid.class, 100, 4, 4)
|
||||
.addSpawn(EntityZombie.class, 100, 4, 4)
|
||||
.addSpawn(EntityUndead.class, 100, 4, 4)
|
||||
.addSpawn(EntityHaunter.class, 100, 4, 4)
|
||||
.addSpawn(EntitySlime.class, 100, 4, 4)
|
||||
.addSpawn(EntityMage.class, 5, 1, 1)
|
||||
.addSpawn(EntityBat.class, 10, 8, 8)
|
||||
.addSpawn(EntityMouse.class, 10, 8, 8)
|
||||
.addSpawn(EntityWolf.class, 5, 2, 4)
|
||||
.addSpawn(EntityFox.class, 4, 2, 6)
|
||||
.addSpawn(EntityWoodElf.class, 100, 4, 16)
|
||||
.addSpawn(EntityElf.class, 12, 4, 16)
|
||||
.addSpawn(EntityMerfolk.class, 10, 4, 4)
|
||||
.addSpawn(EntityHorse.class, 5, 2, 6)
|
||||
.addSpawn(EntityCat.class, 2, 1, 1)
|
||||
.enableVillages().enableMineshafts().enableScattered().enableStrongholds(), () -> {
|
||||
registerMoon("Luna", 1737100, 655728L, 1.62f, 210.0f);
|
||||
});
|
||||
registerPlanet("mercury", "Planet Merkur", new Planet(0x666666, 0x535353, 0x858585, 2440530, 2111297L, 1407509L, 3.7f, 440.0f)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63));
|
||||
registerPlanet("Venus", new Planet(0xc0c0c0, 0xa0a0a0, 0xe0e0e0, 6051800, 5392908L, 5832449L, 8.87f, 737.0f)
|
||||
.setPerlinGen(Blocks.sand.getState(), Blocks.air.getState(), 63));
|
||||
registerPlanet("Mars", new Planet(0xd6905b, 0xbd723a, 0xbd9273, 3396190, 16487781L, 24623L, 3.71f, 208.0f)
|
||||
.setPerlinGen(Blocks.red_sand.getState(), Blocks.air.getState(), 63), () -> {
|
||||
registerMoon("Phobos", 11080, 7654L, 0.0057f, 233.0f);
|
||||
registerMoon("Deimos", 6270, 30312L, 0.003f, 233.0f);
|
||||
});
|
||||
registerPlanet("Jupiter", new Planet(0xffd5ba, 0xb89f90, 0xc7b5a9, 71492000, 103989391L, 9925L, 24.79f, 163.0f).enableDenseFog()
|
||||
.setFlatGen(Blocks.hydrogen.getState(), 256).setCloudHeight(576.0f), () -> {
|
||||
|
||||
});
|
||||
registerPlanet("Saturn", new Planet(0xf1d1a1, 0xd3b385, 0xeed7b5, 60268000, 258141008L, 10656L, 10.44f, 133.0f).enableDenseFog()
|
||||
.setFlatGen(Blocks.hydrogen.getState(), 256).setCloudHeight(576.0f), () -> {
|
||||
|
||||
});
|
||||
registerPlanet("Uranus", new Planet(0xcee6ff, 0xadd2f9, 0x8eb0d3, 25559000, 736503770L, 17240L, 8.87f, 78.0f)
|
||||
.setPerlinGen(Blocks.packed_ice.getState(), Blocks.water.getState(), 70)
|
||||
.addOre(Blocks.diamond_ore.getState(), 4, 4, 12, 0, 60, false), () -> {
|
||||
|
||||
});
|
||||
registerPlanet("neptune", "Planet Neptun", new Planet(0xb4d9ff, 0x85bef9, 0x649bd3, 24764000, 1444584441L, 16110L, 11.15f, 72.0f)
|
||||
.setPerlinGen(Blocks.packed_ice.getState(), Blocks.water.getState(), 70)
|
||||
.addOre(Blocks.diamond_ore.getState(), 4, 2, 1, 0, 60, false), () -> {
|
||||
registerMoon("Triton", 1353400, 141044L, 0.779f, 38.0f);
|
||||
// registerMoon("Nereid", , L, f, .0f);
|
||||
// registerMoon("Naiad", , L, f, .0f);
|
||||
// registerMoon("Thalassa", , L, f, .0f);
|
||||
// registerMoon("Despina", , L, f, .0f);
|
||||
// registerMoon("Galatea", , L, f, .0f);
|
||||
// registerMoon("Larissa", , L, f, .0f);
|
||||
// registerMoon("Proteus", , L, f, .0f);
|
||||
// registerMoon("Halimede", , L, f, .0f);
|
||||
// registerMoon("Psamathe", , L, f, .0f);
|
||||
// registerMoon("Sao", , L, f, .0f);
|
||||
// registerMoon("Laomedeia", , L, f, .0f);
|
||||
// registerMoon("Neso", , L, f, .0f);
|
||||
// registerMoon("Hippocamp", , L, f, .0f);
|
||||
});
|
||||
registerPlanet("Ceres", new Planet(0x666666, 0x535353, 0x858585, 473000, 40315496L, 9074L, 0.27f, 167.0f)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63));
|
||||
registerPlanet("Pluto", new Planet(0x666666, 0x535353, 0x858585, 1188300, 2173127098L, 153293L, 0.62f, 40.0f)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63), () -> {
|
||||
registerMoon("Charon", 606000, 153293L, 0.288f, 53.0f);
|
||||
registerMoon("Nix", 22500, 596511L, 0.0028f, 38.0f);
|
||||
registerMoon("Hydra", 27500, 916842L, 0.051f, 23.0f);
|
||||
registerMoon("Kerberos", 7000, 772021L, 0.0015f, 19.0f);
|
||||
registerMoon("Styx", 5500, 483877L, 77760L, 0.0013f, 18.0f);
|
||||
});
|
||||
registerPlanet("Haumea", new Planet(0x666666, 0x535353, 0x858585, 816000, 2487831667L, 3914L, 0.63f, 48.0f)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63));
|
||||
registerPlanet("Makemake", new Planet(0x666666, 0x535353, 0x858585, 715000, 2684193293L, 22826L, 0.4f, 30.0f)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63));
|
||||
registerPlanet("Eris", new Planet(0x666666, 0x535353, 0x858585, 1163000, 4900274496L, 378862L, 0.82f, 30.0f)
|
||||
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63));
|
||||
});
|
||||
registerStar("Gi'rok", 603421976, 232.0f, 5220.0f, () -> {
|
||||
registerPlanet("gharoth", "Elbenplanet Gharoth", new Planet(2806382, 4837386L, 52960L, 30.0f, 10.0f, 257.3f + 8.0f) //TODO: check temp
|
||||
.setSimpleGen(Blocks.dirt.getState(), Blocks.water.getState(), 64)
|
||||
.setSimpleReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState())
|
||||
.setPopulator(PopulatorType.ELVEN_FOREST).enableCaves(Blocks.air.getState()).setDungeons(4).enableSnow()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
|
||||
.addOre(Blocks.thetium_ore.getState(), 1, 0, 3, 0, 14, false)
|
||||
.addOre(Blocks.gyriyn_ore.getState(), 0, 2, 3, 0, 12, false)
|
||||
.addSpawn(EntitySheep.class, 12, 4, 4)
|
||||
.addSpawn(EntityRabbit.class, 10, 3, 10)
|
||||
.addSpawn(EntityChicken.class, 10, 4, 4)
|
||||
.addSpawn(EntityMouse.class, 10, 8, 8)
|
||||
.addSpawn(EntityWoodElf.class, 100, 4, 16)
|
||||
.addSpawn(EntityElf.class, 12, 4, 16)
|
||||
.addSpawn(EntityFox.class, 3, 2, 5));
|
||||
registerPlanet("transylvania", "Vampirplanet Transsylvanien", new Planet(8374921, 33850466L, 49760L, 20.0f, 10.0f, 255.5f)
|
||||
.setPerlinGen(Blocks.rock.getState(), Blocks.water.getState(), 63)
|
||||
.setTerranianReplacer(Blocks.grass.getState(), Blocks.dirt.getState(), Blocks.gravel.getState(), Blocks.sand.getState()).setBiomeGen(new Biome(8.0f, 80.0f), true, 5, 3, 3, 30)
|
||||
.setPopulator(PopulatorType.FOREST).enableCavesRavines(Blocks.lava.getState()).setDungeons(10).enableSnow()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.grass.getState(), 4, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 50, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
|
||||
.addOre(Blocks.coal_ore.getState(), 12, 0, 14, 4, 28, false)
|
||||
.addOre(Blocks.lead_ore.getState(), 2, 0, 8, 0, 8, false)
|
||||
.addOre(Blocks.ardite_ore.getState(), 0, 2, 3, 0, 12, false)
|
||||
.addOre(Blocks.nichun_ore.getState(), 0, 10, 1, 0, 10, false)
|
||||
.addSpawn(EntitySheep.class, 12, 4, 4)
|
||||
.addSpawn(EntityCow.class, 8, 4, 4)
|
||||
.addSpawn(EntityArachnoid.class, 100, 4, 4)
|
||||
.addSpawn(EntityZombie.class, 100, 4, 4)
|
||||
.addSpawn(EntityUndead.class, 100, 4, 4)
|
||||
.addSpawn(EntitySlime.class, 100, 4, 4)
|
||||
.addSpawn(EntityBat.class, 10, 8, 8)
|
||||
.addSpawn(EntityMouse.class, 10, 8, 8)
|
||||
.addSpawn(EntityWolf.class, 5, 2, 4)
|
||||
.addSpawn(EntityHorse.class, 5, 2, 6), () -> {
|
||||
registerMoon("yrdinath", "Eismond Yrdinath", new Moon(0xccccff, 2503812, 46743637L, 17460L, 2.5f, 239.15f, Blocks.snow, Blocks.ice, 0.1F, 0.2F) //TODO: check height
|
||||
.enableSnow().setDefaultWeather(Weather.SNOW)
|
||||
.addSpawn(EntitySheep.class, 50, 4, 4)
|
||||
.addSpawn(EntitySpirit.class, 10, 1, 1));
|
||||
registerMoon("mythril", "Eismond Mythril", new Moon(0xbbbbff, 2213749, 42659432L, 15330L, 2.25f, 221.65f, Blocks.snow, Blocks.ice, 0.1F, 0.2F)
|
||||
.enableSnow().setDefaultWeather(Weather.SNOW)
|
||||
.addSpawn(EntitySheep.class, 50, 4, 4)
|
||||
.addSpawn(EntitySpirit.class, 10, 1, 1));
|
||||
});
|
||||
registerPlanet("mesar", "Wüstenplanet Me'sar", new Planet(0xff7f3f, 0xff6022, 0xff6f00, 9823183, 56643366L, 87340L, 11.0f, 333.15f)
|
||||
.setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63, 0.2f, 0.4f)
|
||||
.setMesarianReplacer(Blocks.red_sand.getState(), Blocks.dirt.getState()).setPopulator(PopulatorType.MESARIAN)
|
||||
.enableCavesRavines(Blocks.lava.getState())
|
||||
.addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
|
||||
.addOre(Blocks.iron_ore.getState(), 6, 2, 24, 0, 64, false)
|
||||
.addOre(Blocks.gold_ore.getState(), 4, 2, 20, 0, 48, false)
|
||||
.addOre(Blocks.lead_ore.getState(), 6, 0, 14, 0, 32, false)
|
||||
.addOre(Blocks.copper_ore.getState(), 8, 2, 12, 0, 52, false)
|
||||
.addOre(Blocks.coal_ore.getState(), 8, 4, 30, 0, 16, false)
|
||||
.addOre(Blocks.stone.getState(), 8, 4, 33, 0, 80, false));
|
||||
});
|
||||
});
|
||||
});
|
||||
registerGalaxy("Drkthrn", () -> {
|
||||
registerSector("blvck", "Sectvr Blvck", () -> {
|
||||
registerStar("Ov'rol", new Star(0x000000, 832718528, 302.0f, 12666.0f, Blocks.goo), () -> {
|
||||
registerPlanet("blackplanet", "Der Schwarze Planet", new Planet(0x000000, 0x000000, 0x000000, 13038204, 4632918508L, 204556L, 12.0f, 0.0f)
|
||||
.setPerlinGen(Blocks.blackened_stone.getState(), Blocks.goo.getState(), 63)
|
||||
.setSimpleAltReplacer(Blocks.blackened_soil.getState(), Blocks.blackened_dirt.getState(), Blocks.blackened_cobble.getState())
|
||||
.setPopulator(PopulatorType.BLACKENED)
|
||||
.enableCaves(Blocks.air.getState()).setDungeons(4)
|
||||
.addLake(Blocks.goo.getState(), null, null, 8, 8, 255, true)
|
||||
// .addOre(Blocks.PLACEHOLDER_ore.getState(), 0, 2, 3, 0, 12, false)
|
||||
.addSpawn(EntityMetalhead.class, 50, 1, 1)
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Dimension warp = new Semi(0x0c001f, 0x190033, 124072917, 285.0f, 3).setCloudTexture(CloudType.DENSE).setCloudHeight(238.0f)
|
||||
.setPerlinGen(Blocks.obsidian.getState(), Blocks.lava.getState(), 63, 1.0F, 2.0F).setPopulator(PopulatorType.CHAOS)
|
||||
.enableCavesRavines(Blocks.air.getState()).enableLongCaves().enableSnow()
|
||||
.addLake(Blocks.water.getState(), null, Blocks.obsidian.getState(), 8, 0, 255, false)
|
||||
.addLake(Blocks.lava.getState(), null, null, 1, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_water.getState(), 1, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true)
|
||||
.setStarBrightness(0.9f).setDeepStarBrightness(0.6f)
|
||||
.setStarColorSin(25.0f, 0.1f, 0.25f, 0xff00ff, 1, 4).setDeepStarColorSin(25.0f, 0.1f, 0.5f, 0xff00ff, 1, 4);
|
||||
for(Class<? extends Entity> clazz : EntityRegistry.getAllClasses()) {
|
||||
if(EntityLiving.class.isAssignableFrom(clazz))
|
||||
warp.addSpawn((Class<? extends EntityLiving>)clazz, 1, 1, 8);
|
||||
}
|
||||
registerSemi("warp", "Der Warp", warp);
|
||||
|
||||
registerDomain("Tian'Xin", () -> {
|
||||
registerArea("Ni'enrath", new Area(0x7f00ff, 532109, 276.15f, 1).setLightColor(0x07000f).setBlockColor(0xcf6fff)
|
||||
.setPerlinGen(Blocks.tian.getState(), Blocks.spring_water.getState(), 63, 0.1F, 1.0F)
|
||||
.setSimpleAltReplacer(Blocks.tian_soil.getState(), Blocks.tian.getState())
|
||||
.setPopulator(PopulatorType.TIAN).enableLongCaves().enableSnow()
|
||||
.addLake(Blocks.spring_water.getState(), Blocks.tian.getState(), Blocks.tian.getState(), 4, 0, 255, false)
|
||||
.addLiquid(Blocks.flowing_spring_water.getState(), 50, 8, 255, false)
|
||||
.addSpawn(EntityCultivator.class, 50, 1, 1)
|
||||
.addSpawn(EntityMerfolk.class, 10, 4, 4)
|
||||
.addSpawn(EntityRabbit.class, 10, 3, 10)
|
||||
.addSpawn(EntityBat.class, 10, 8, 8)
|
||||
.addSpawn(EntityMouse.class, 10, 8, 8));
|
||||
});
|
||||
registerDomain("Digital", () -> {
|
||||
registerArea("Cyberspace", new Area(0x000000, 16777216, 293.15f, 15).setLightColor(0x00ff00).setBlockColor(0xff0000).enableBlockLightSubtraction()
|
||||
.setFlatGen(Blocks.green_clay.getState(), 2));
|
||||
});
|
||||
registerDomain("hell", "Hölle", () -> {
|
||||
registerArea("thedric", "Kreis Thedric", new Area(0x330707, 105639735, 347.15f, 2).enableLongCaves().enableFortresses()
|
||||
.enableWorldCeiling().enableDenseFog()
|
||||
.setCavernGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
|
||||
.setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState()).setPopulator(PopulatorType.HELL)
|
||||
.addSpawn(EntityFireDemon.class, 50, 4, 4)
|
||||
.addSpawn(EntityTiefling.class, 100, 4, 4)
|
||||
.addSpawn(EntityBloodElf.class, 10, 1, 2)
|
||||
.addSpawn(EntityMetalhead.class, 1, 1, 1));
|
||||
registerArea("kyroth", "Kreis Kyroth", new Area(0x990000, 86742970, 387.15f, 3).enableLongCaves()
|
||||
.setSimpleGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 64)
|
||||
.setSimpleReplacer(Blocks.obsidian.getState(), Blocks.soul_sand.getState())
|
||||
.addLake(Blocks.lava.getState(), null, null, 4, 8, 255, false)
|
||||
.addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true)
|
||||
.addSpawn(EntityFireDemon.class, 50, 4, 4)
|
||||
.addSpawn(EntityTiefling.class, 100, 4, 4)
|
||||
.addSpawn(EntityBloodElf.class, 50, 2, 10)
|
||||
.addSpawn(EntityCultivator.class, 10, 1, 1));
|
||||
registerArea("ahrd", "Kreis Ahrd", new Area(0xcc0000, 67028432, 467.15f, 15).enableLongCaves()
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63, 1.0F, 0.5F)
|
||||
.setSimpleAltReplacer(Blocks.soul_sand.getState())
|
||||
.addLake(Blocks.lava.getState(), Blocks.soul_sand.getState(), Blocks.soul_sand.getState(),
|
||||
2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true)
|
||||
.addSpawn(EntityFireDemon.class, 50, 4, 4)
|
||||
.addSpawn(EntityTiefling.class, 100, 4, 4)
|
||||
.addSpawn(EntityBloodElf.class, 50, 2, 10)
|
||||
.addSpawn(EntityCultivator.class, 10, 1, 1));
|
||||
registerArea("mizorath", "Kreis Mizorath", new Area(0xff0000, 54029584, 1067.15f, 15)
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.blood.getState(), 63, -0.2F, 0.1F)
|
||||
.setSimpleAltReplacer(Blocks.soul_sand.getState())
|
||||
.addSpawn(EntityFireDemon.class, 50, 4, 4)
|
||||
.addSpawn(EntityTiefling.class, 100, 4, 4)
|
||||
.addSpawn(EntityBloodElf.class, 50, 2, 10)
|
||||
.addSpawn(EntityCultivator.class, 10, 1, 1));
|
||||
registerArea("dargoth", "Kreis Dargoth", new Area(0xff3f0c, 43293629, 1707.15f, 15)
|
||||
.setPerlinGen(Blocks.hellrock.getState(), Blocks.magma.getState(), 63, -0.2F, 0.1F)
|
||||
.setSimpleAltReplacer(Blocks.soul_sand.getState())
|
||||
.addSpawn(EntityFireDemon.class, 50, 4, 4)
|
||||
.addSpawn(EntityTiefling.class, 100, 4, 4)
|
||||
.addSpawn(EntityBloodElf.class, 50, 2, 10)
|
||||
.addSpawn(EntityCultivator.class, 10, 1, 1));
|
||||
registerArea("aasirith", "Kreis Aasirith", new Area(0x191919, 36291872, 2482.0f, 1).enableLongCaves()
|
||||
.setPerlinGen(Blocks.rock.getState(), Blocks.magma.getState(), 63, 0.125F, 0.05F)
|
||||
.setSimpleAltReplacer(Blocks.ash.getState(), Blocks.rock.getState(), Blocks.ash.getState())
|
||||
.addLake(Blocks.lava.getState(), Blocks.rock.getState(), Blocks.rock.getState(),
|
||||
2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true)
|
||||
.addSpawn(EntityFireDemon.class, 50, 4, 4)
|
||||
.addSpawn(EntityTiefling.class, 100, 4, 4)
|
||||
.addSpawn(EntityBloodElf.class, 50, 2, 10)
|
||||
.addSpawn(EntityCultivator.class, 10, 1, 1));
|
||||
});
|
||||
}
|
||||
}
|
|
@ -16,9 +16,11 @@ import common.model.ModelProvider;
|
|||
import common.model.GuiPosition;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.World;
|
||||
|
@ -146,6 +148,7 @@ public class Item {
|
|||
return this.magnetic;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public final boolean isGleaming(ItemStack stack) {
|
||||
return this.gleaming || stack.isItemEnchanted();
|
||||
}
|
||||
|
@ -172,10 +175,12 @@ public class Item {
|
|||
return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
|
||||
}
|
||||
|
||||
@Serverside
|
||||
protected final ItemStack dispenseProjectile(AWorldServer world, Facing facing, ItemStack stack, IProjectile entity) {
|
||||
return this.dispenseProjectile(world, facing, stack, entity, 1.1f, 6.0f);
|
||||
}
|
||||
|
||||
@Serverside
|
||||
protected final ItemStack dispenseProjectile(AWorldServer world, Facing facing, ItemStack stack, IProjectile entity, float velocity, float inaccuracy) {
|
||||
entity.setThrowableHeading((double)facing.getFrontOffsetX(), (double)((float)facing.getFrontOffsetY() + 0.1F),
|
||||
(double)facing.getFrontOffsetZ(), velocity, inaccuracy);
|
||||
|
@ -230,10 +235,6 @@ public class Item {
|
|||
return ItemAction.NONE;
|
||||
}
|
||||
|
||||
public ItemAction getItemPosition() {
|
||||
return ItemAction.NONE;
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -241,11 +242,6 @@ public class Item {
|
|||
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityNPC playerIn, int timeLeft) {
|
||||
}
|
||||
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) {
|
||||
if(this.block != null)
|
||||
this.block.getTooltips(stack, playerIn, tooltip);
|
||||
}
|
||||
|
||||
public boolean canEnchant(ItemStack stack) {
|
||||
return this.getMaxAmount() == 1 && this.isDamageable();
|
||||
}
|
||||
|
@ -271,10 +267,6 @@ public class Item {
|
|||
return this.block != null ? this.block.getRadiation() * (float)stack.getSize() : 0.0f;
|
||||
}
|
||||
|
||||
public boolean canRenderHand() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public WieldType getWieldType() {
|
||||
return null;
|
||||
}
|
||||
|
@ -282,51 +274,6 @@ public class Item {
|
|||
public boolean isAdminItem() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getHotbarText(EntityNPC player, ItemStack stack) {
|
||||
return stack.getColoredName();
|
||||
}
|
||||
|
||||
public int getRenderColor(ItemStack stack, int pass) {
|
||||
if(pass > 0)
|
||||
return 16777215;
|
||||
int i = stack.getDyeColor();
|
||||
return i < 0 ? 16777215 : i;
|
||||
}
|
||||
|
||||
public boolean hasBuiltinModel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String[] getTextures(String name) {
|
||||
return new String[] {name};
|
||||
}
|
||||
|
||||
public Model getCustomModel(ModelProvider provider, String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public GuiPosition getCustomPosition() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String[] getSprites() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getSprite(EntityNPC player, ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
if(this.block == null || !this.block.dispense(world, source, position, blockpos, facing, stack))
|
||||
BlockDispenser.dispense(world, 6.0, facing, position, stack.split(1));
|
||||
return stack;
|
||||
}
|
||||
|
||||
public int getDispenseSoundId() {
|
||||
return 1000;
|
||||
}
|
||||
|
||||
public final boolean canBeDyed() {
|
||||
return this.defColor != 0xffffffff;
|
||||
|
@ -340,4 +287,75 @@ public class Item {
|
|||
this.defColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public ItemAction getItemPosition() {
|
||||
return ItemAction.NONE;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) {
|
||||
if(this.block != null)
|
||||
this.block.getTooltips(stack, playerIn, tooltip);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public boolean canRenderHand() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String getHotbarText(EntityNPC player, ItemStack stack) {
|
||||
return stack.getColoredName();
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public int getRenderColor(ItemStack stack, int pass) {
|
||||
if(pass > 0)
|
||||
return 16777215;
|
||||
int i = stack.getDyeColor();
|
||||
return i < 0 ? 16777215 : i;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public boolean hasBuiltinModel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String[] getTextures(String name) {
|
||||
return new String[] {name};
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public Model getCustomModel(ModelProvider provider, String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public GuiPosition getCustomPosition() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String[] getSprites() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String getSprite(EntityNPC player, ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
if(this.block == null || !this.block.dispense(world, source, position, blockpos, facing, stack))
|
||||
BlockDispenser.dispense(world, 6.0, facing, position, stack.split(1));
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public int getDispenseSoundId() {
|
||||
return 1000;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -220,10 +220,6 @@ public final class ItemStack {
|
|||
return this.item.getItemUseAction();
|
||||
}
|
||||
|
||||
public ItemAction getItemPosition() {
|
||||
return this.item.getItemPosition();
|
||||
}
|
||||
|
||||
public int getItemDamage() {
|
||||
return this.isItemStackDamageable() ? this.damage : 0;
|
||||
}
|
||||
|
@ -244,10 +240,6 @@ public final class ItemStack {
|
|||
return this.name != null;
|
||||
}
|
||||
|
||||
public boolean isGleaming() {
|
||||
return this.item.isGleaming(this);
|
||||
}
|
||||
|
||||
public TextColor getColor() {
|
||||
return this.item.getColor(this);
|
||||
}
|
||||
|
|
|
@ -21,8 +21,10 @@ import common.model.Model;
|
|||
import common.model.ModelProvider;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.Facing;
|
||||
import common.util.Pair;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.World;
|
||||
|
@ -43,6 +45,7 @@ public class ItemPotion extends Item
|
|||
return POTIONS;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public static int mixColors(Collection<StatusEffect> effects) {
|
||||
if(effects == null || effects.isEmpty())
|
||||
return Items.water_bottle.getPotionColor();
|
||||
|
@ -163,11 +166,13 @@ public class ItemPotion extends Item
|
|||
return itemStackIn;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public int getPotionColor()
|
||||
{
|
||||
return this.effect == null ? 0x385dc6 : this.effect.getPotion().getColor();
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public int getRenderColor(ItemStack stack, int renderPass)
|
||||
{
|
||||
return renderPass > 0 ? 16777215 : this.getPotionColor();
|
||||
|
@ -194,9 +199,7 @@ public class ItemPotion extends Item
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* allows items to add custom lines of information to the mouseover description
|
||||
*/
|
||||
@Clientside
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
if (this.effect != null)
|
||||
|
@ -251,14 +254,17 @@ public class ItemPotion extends Item
|
|||
return effects;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String[] getTextures(String name) {
|
||||
return new String[] {"potion_overlay", "bottle"};
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
return this.dispenseProjectile(world, facing, stack, new EntityPotion(world, position.xCoord, position.yCoord, position.zCoord, stack.copy()), 1.375f, 3.0f);
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public int getDispenseSoundId() {
|
||||
return 1002;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,9 @@ import common.model.ModelProvider;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Clientside;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.World;
|
||||
|
@ -27,6 +29,7 @@ public class ItemArmor extends Item
|
|||
public final UsageSlot armorType;
|
||||
public final int damageReduceAmount;
|
||||
private final ToolMaterial material;
|
||||
@Clientside
|
||||
private final String texture;
|
||||
|
||||
public ItemArmor(ToolMaterial material, String texture, UsageSlot armorType)
|
||||
|
@ -58,7 +61,8 @@ public class ItemArmor extends Item
|
|||
{
|
||||
return this.material;
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public String getArmorTexture()
|
||||
{
|
||||
return this.texture;
|
||||
|
@ -102,7 +106,8 @@ public class ItemArmor extends Item
|
|||
if(this.material.getMagicReduction(this.armorType) > 0.0f)
|
||||
map.put(Attribute.MAGIC_RESISTANCE, this.material.getMagicReduction(this.armorType));
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public boolean hasBuiltinModel() {
|
||||
return true;
|
||||
}
|
||||
|
@ -132,6 +137,7 @@ public class ItemArmor extends Item
|
|||
// }
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
BlockPos pos = blockpos.offset(facing);
|
||||
int i = pos.getX();
|
||||
|
|
|
@ -27,9 +27,11 @@ import common.model.ModelProvider;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityDispenser;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.ParticleType;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.util.Vec3i;
|
||||
import common.world.State;
|
||||
|
@ -319,10 +321,12 @@ public class ItemBucket extends Item
|
|||
// return this.fillBlock == null && renderPass == 1 ? FluidRegistry.getLiquidColor(stack.getMetadata()) : 16777215;
|
||||
// }
|
||||
|
||||
@Clientside
|
||||
public String[] getTextures(String name) {
|
||||
return super.getTextures(this.recursive ? name.substring("recursive_".length()) : name);
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
if(this.recursive)
|
||||
return super.dispenseStack(world, source, position, blockpos, facing, stack);
|
||||
|
|
|
@ -15,8 +15,10 @@ import common.item.ItemStack;
|
|||
import common.item.StackSize;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.Facing;
|
||||
import common.util.ParticleType;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
@ -129,6 +131,7 @@ public class ItemDye extends Item {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public static void spawnBonemealParticles(World worldIn, BlockPos pos, int amount)
|
||||
{
|
||||
if (amount == 0)
|
||||
|
@ -171,7 +174,8 @@ public class ItemDye extends Item {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
if(this.color != DyeColor.WHITE)
|
||||
return super.dispenseStack(world, source, position, blockpos, facing, stack);
|
||||
|
@ -193,6 +197,7 @@ public class ItemDye extends Item {
|
|||
return stack;
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public int getDispenseSoundId() {
|
||||
return this.color == DyeColor.WHITE ? 0 : super.getDispenseSoundId();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import common.item.RngLoot;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.rng.Random;
|
||||
import common.util.Clientside;
|
||||
|
||||
public class ItemEnchantedBook extends Item
|
||||
{
|
||||
|
@ -45,12 +46,14 @@ public class ItemEnchantedBook extends Item
|
|||
return this.level;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
super.addInformation(stack, playerIn, tooltip);
|
||||
tooltip.add(this.enchantment.getFormattedName(this.level));
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String[] getTextures(String name) {
|
||||
return new String[] {"enchanted_book"};
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.util.Clientside;
|
||||
|
||||
public class ItemHorseArmor extends Item {
|
||||
private final ToolMaterial material;
|
||||
@Clientside
|
||||
private final String texture;
|
||||
|
||||
public ItemHorseArmor(ToolMaterial material, String texture) {
|
||||
|
@ -23,11 +25,13 @@ public class ItemHorseArmor extends Item {
|
|||
public int getArmorValue() {
|
||||
return this.material.getDamageReduction(UsageSlot.BODY);
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public String getArmorTexture() {
|
||||
return this.texture;
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public boolean hasBuiltinModel() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import common.entity.npc.EntityNPC;
|
|||
import common.init.MetalType;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.util.Clientside;
|
||||
|
||||
public class ItemMetal extends Item {
|
||||
private final MetalType metal;
|
||||
|
@ -20,7 +21,8 @@ public class ItemMetal extends Item {
|
|||
if(this.metal.isMagnetic())
|
||||
this.setMagnetic();
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
tooltip.add(this.metal.formatSymbol());
|
||||
|
|
|
@ -4,12 +4,14 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.util.Clientside;
|
||||
|
||||
public class ItemRecord extends Item {
|
||||
public ItemRecord() {
|
||||
this.setTab(CheatTab.MISC);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String[] getTextures(String name) {
|
||||
return new String[] {"record_old"};
|
||||
}
|
||||
|
|
|
@ -16,8 +16,10 @@ import common.model.ModelProvider;
|
|||
import common.model.GuiPosition;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.Facing;
|
||||
import common.util.Pair;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.World;
|
||||
|
@ -81,19 +83,23 @@ public class ItemDie extends Item
|
|||
return itemStackIn;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public Model getCustomModel(ModelProvider provider, String name) {
|
||||
return provider.getModel("items/die_d" + this.sides + "_side").add(4.8f, 4.8f, 4.8f, 11.2f, 11.2f, 11.2f).nswe().uv(0, 0, 16, 16)
|
||||
.du("items/die_d" + this.sides + "_top").uv(0, 0, 16, 16);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public GuiPosition getCustomPosition() {
|
||||
return GuiPosition.DICE;
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
return this.dispenseProjectile(world, facing, stack, new EntityDie(world, position.xCoord, position.yCoord, position.zCoord, this.sides), 0.275f, 30.0f);
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public int getDispenseSoundId() {
|
||||
return 1002;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import common.tileentity.TileEntity;
|
|||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.World;
|
||||
|
@ -40,11 +41,13 @@ public class ItemDynamite extends Item {
|
|||
world.spawnEntityInWorld(new EntityDynamite(world, player, this.power));
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
return this.dispenseProjectile(world, facing, stack, new EntityDynamite(world, position.xCoord, position.yCoord, position.zCoord, this.power));
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public int getDispenseSoundId() {
|
||||
return 1002;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import common.item.ItemStack;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.World;
|
||||
|
@ -40,11 +41,13 @@ public class ItemEgg extends Item
|
|||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
return itemStackIn;
|
||||
}
|
||||
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
return this.dispenseProjectile(world, facing, stack, new EntityEgg(world, position.xCoord, position.yCoord, position.zCoord));
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public int getDispenseSoundId() {
|
||||
return 1002;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import common.item.ItemStack;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.World;
|
||||
|
@ -41,11 +42,13 @@ public class ItemExpBottle extends Item
|
|||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
return itemStackIn;
|
||||
}
|
||||
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
return this.dispenseProjectile(world, facing, stack, new EntityXpBottle(world, position.xCoord, position.yCoord, position.zCoord), 1.375f, 3.0f);
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public int getDispenseSoundId() {
|
||||
return 1002;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import common.item.ItemStack;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.World;
|
||||
|
@ -55,7 +56,8 @@ public class ItemFireball extends Item
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
double d0 = position.xCoord + (double)((float)facing.getFrontOffsetX() * 0.3F);
|
||||
double d1 = position.yCoord + (double)((float)facing.getFrontOffsetY() * 0.3F);
|
||||
|
@ -68,6 +70,7 @@ public class ItemFireball extends Item
|
|||
return stack;
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public int getDispenseSoundId() {
|
||||
return 1009;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import common.item.ItemStack;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.World;
|
||||
|
@ -40,11 +41,13 @@ public class ItemSnowball extends Item
|
|||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
return itemStackIn;
|
||||
}
|
||||
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
return this.dispenseProjectile(world, facing, stack, new EntitySnowball(world, position.xCoord, position.yCoord, position.zCoord));
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public int getDispenseSoundId() {
|
||||
return 1002;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import common.util.BoundingBox;
|
|||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.World;
|
||||
|
@ -117,7 +118,8 @@ public class ItemBoat extends Item
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
double d0 = blockpos.getX() + 0.5 + (double)((float)facing.getFrontOffsetX() * 1.125F);
|
||||
double d1 = blockpos.getY() + 0.5 + (double)((float)facing.getFrontOffsetY() * 1.125F);
|
||||
|
|
|
@ -13,17 +13,17 @@ import common.entity.npc.CharacterInfo;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.npc.EntityNPC.CharacterTypeData;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.DimensionRegistry;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.Serverside;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -58,13 +58,15 @@ public class ItemCharTemplate extends Item
|
|||
return species + (character.isEmpty() ? "" : (" " + character));
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public int getRenderColor(ItemStack stack, int renderPass)
|
||||
{
|
||||
return renderPass == 0 ? this.spawned.color1 : this.spawned.color2;
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public void addInformation(ItemStack stack, EntityNPC player, List<String> tooltip) {
|
||||
Dimension dim = this.spawned.species.origin == null ? null : UniverseRegistry.getDimension(this.spawned.species.origin);
|
||||
Dimension dim = this.spawned.species.origin == null ? null : DimensionRegistry.getDimension(this.spawned.species.origin);
|
||||
tooltip.add(TextColor.ORANGE + "Herkunft: " + (dim == null ? "???" : dim.getDisplay()));
|
||||
}
|
||||
|
||||
|
@ -170,6 +172,7 @@ public class ItemCharTemplate extends Item
|
|||
}
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public static EntityNPC spawnNpc(World worldIn, CharacterInfo character, double x, double y, double z, boolean check)
|
||||
{
|
||||
EntityNPC entity;
|
||||
|
@ -189,6 +192,7 @@ public class ItemCharTemplate extends Item
|
|||
return entity;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String[] getTextures(String name) {
|
||||
return new String[] {"dna_sample_char", "dna_sample_char_overlay"};
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import common.item.ItemStack;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.State;
|
||||
|
@ -29,6 +30,7 @@ public class ItemMinecart extends Item
|
|||
this.setMagnetic();
|
||||
}
|
||||
|
||||
@Serverside
|
||||
private EntityCart getMinecart(World worldIn, double x, double y, double z)
|
||||
{
|
||||
return this.tnt ? new EntityTntCart(worldIn, x, y, z) : new EntityMinecart(worldIn, x, y, z);
|
||||
|
@ -82,7 +84,8 @@ public class ItemMinecart extends Item
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
double d0 = blockpos.getX() + 0.5 + (double)facing.getFrontOffsetX() * 1.125D;
|
||||
double d1 = Math.floor(blockpos.getY() + 0.5) + (double)facing.getFrontOffsetY();
|
||||
|
|
|
@ -10,18 +10,18 @@ import common.dimension.Dimension;
|
|||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.DimensionRegistry;
|
||||
import common.init.EntityInfo;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.util.Serverside;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -47,16 +47,18 @@ public class ItemMobTemplate extends Item
|
|||
return this.entityId;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public int getRenderColor(ItemStack stack, int renderPass)
|
||||
{
|
||||
EntityInfo egg = EntityRegistry.DNA.get(this.entityId);
|
||||
return egg != null ? (renderPass == 0 ? egg.color1() : egg.color2()) : 16777215;
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public void addInformation(ItemStack stack, EntityNPC player, List<String> tooltip) {
|
||||
EntityInfo egg = EntityRegistry.DNA.get(this.entityId);
|
||||
if(egg != null) {
|
||||
Dimension dim = egg.origin() == null ? null : UniverseRegistry.getDimension(egg.origin());
|
||||
Dimension dim = egg.origin() == null ? null : DimensionRegistry.getDimension(egg.origin());
|
||||
tooltip.add(TextColor.ORANGE + "Herkunft: " + (dim == null ? "???" : dim.getDisplay()));
|
||||
}
|
||||
}
|
||||
|
@ -180,6 +182,7 @@ public class ItemMobTemplate extends Item
|
|||
}
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public static EntityLiving spawnCreature(World worldIn, String entityID, double x, double y, double z, boolean check) {
|
||||
if (!EntityRegistry.DNA.containsKey(entityID))
|
||||
return null;
|
||||
|
@ -197,6 +200,7 @@ public class ItemMobTemplate extends Item
|
|||
return living;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String[] getTextures(String name) {
|
||||
return new String[] {"dna_sample", "dna_sample_overlay"};
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import common.item.ItemControl;
|
|||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemCamera extends Item {
|
||||
|
@ -29,7 +30,8 @@ public class ItemCamera extends Item {
|
|||
// public boolean ignoresBlocks() {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
|
||||
@Clientside
|
||||
public boolean canRenderHand() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import common.item.ItemStack;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
import common.world.World;
|
||||
|
@ -50,7 +51,8 @@ public class ItemFire extends Item
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
BlockPos pos = blockpos = blockpos.offset(facing);
|
||||
|
||||
|
@ -75,6 +77,7 @@ public class ItemFire extends Item
|
|||
return stack;
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public int getDispenseSoundId() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import common.item.Item;
|
|||
import common.item.ItemStack;
|
||||
import common.item.WieldType;
|
||||
import common.model.GuiPosition;
|
||||
import common.util.Clientside;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemFishingRod extends Item
|
||||
|
@ -69,11 +70,13 @@ public class ItemFishingRod extends Item
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public String[] getSprites() {
|
||||
return new String[] {"fishing_rod_cast"};
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public String getSprite(EntityNPC player, ItemStack stack) {
|
||||
return player.fishEntity != null ? "fishing_rod_cast" : null;
|
||||
}
|
||||
|
|
|
@ -7,23 +7,37 @@ import common.entity.npc.EntityNPC;
|
|||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
|
||||
public class ItemSpaceNavigator extends Item {
|
||||
@Clientside
|
||||
private String localTime = "";
|
||||
|
||||
public ItemSpaceNavigator() {
|
||||
this.setUnstackable();
|
||||
this.setColor(TextColor.DGREEN);
|
||||
this.setMagnetic();
|
||||
}
|
||||
|
||||
|
||||
public void setLocalTime(String local) {
|
||||
this.localTime = local;
|
||||
}
|
||||
|
||||
public String getLocalTime() {
|
||||
return this.localTime;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String getHotbarText(EntityNPC player, ItemStack stack) {
|
||||
BlockPos pos = player.getPosition();
|
||||
return TextColor.ORANGE + player.worldObj.formatTime(player, false) + " / " +
|
||||
return TextColor.ORANGE + this.localTime + " / " +
|
||||
String.format("%s bei %d, %d, %d", player.worldObj.dimension.getDisplay() + TextColor.ORANGE,
|
||||
pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public void addInformation(ItemStack stack, EntityNPC player, List<String> tooltip) {
|
||||
tooltip.add(TextColor.ORANGE + player.worldObj.formatTime(player, true));
|
||||
tooltip.add(TextColor.ORANGE + this.localTime);
|
||||
String[] dims = player.worldObj.dimension.getBaseNames();
|
||||
for(int z = dims.length - 1; z >= 0; z--) {
|
||||
tooltip.add(TextColor.ORANGE + dims[z]);
|
||||
|
|
|
@ -11,6 +11,7 @@ import common.item.ItemStack;
|
|||
import common.item.WieldType;
|
||||
import common.model.GuiPosition;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Clientside;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.Vec3;
|
||||
|
@ -64,7 +65,8 @@ public abstract class ItemWand extends Item {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
tooltip.add(TextColor.DGREEN + "Reichweite: " + TextColor.GREEN + this.getRange(stack, playerIn) + " Blöcke");
|
||||
|
|
|
@ -6,16 +6,19 @@ import common.item.ItemStack;
|
|||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Serverside;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class ItemArrow extends Item {
|
||||
@Serverside
|
||||
public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
EntityArrow arrow = new EntityArrow(world, position.xCoord, position.yCoord, position.zCoord);
|
||||
arrow.canBePickedUp = 1;
|
||||
return this.dispenseProjectile(world, facing, stack, arrow);
|
||||
}
|
||||
|
||||
@Serverside
|
||||
public int getDispenseSoundId() {
|
||||
return 1002;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import common.item.ItemAction;
|
|||
import common.item.ItemStack;
|
||||
import common.item.WieldType;
|
||||
import common.model.GuiPosition;
|
||||
import common.util.Clientside;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemBow extends Item
|
||||
|
@ -137,11 +138,13 @@ public class ItemBow extends Item
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public String[] getSprites() {
|
||||
return new String[] {"bow_pulling_0", "bow_pulling_1", "bow_pulling_2"};
|
||||
}
|
||||
|
||||
|
||||
@Clientside
|
||||
public String getSprite(EntityNPC player, ItemStack stack) {
|
||||
if(player.getItemInUse() != null) {
|
||||
int pull = stack.getMaxItemUseDuration() - player.getItemInUseCount();
|
||||
|
|
|
@ -13,6 +13,7 @@ import common.item.ItemStack;
|
|||
import common.item.WieldType;
|
||||
import common.model.GuiPosition;
|
||||
import common.rng.Random;
|
||||
import common.util.Clientside;
|
||||
import common.world.World;
|
||||
|
||||
public abstract class ItemGunBase extends Item
|
||||
|
@ -26,6 +27,7 @@ public abstract class ItemGunBase extends Item
|
|||
this.setTab(CheatTab.WEAPONS);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public ItemAction getItemPosition()
|
||||
{
|
||||
return ItemAction.AIM;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package common.model;
|
||||
|
||||
import common.util.Clientside;
|
||||
|
||||
@Clientside
|
||||
public enum BlockLayer {
|
||||
SOLID("Solid"),
|
||||
CUTOUT_MIPPED("Mipped Cutout"),
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package common.model;
|
||||
|
||||
import common.util.Clientside;
|
||||
|
||||
@Clientside
|
||||
public enum GuiPosition {
|
||||
NORMAL(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f),
|
||||
DICE(135.0f, -55.0f, 180.0f, 0.0f, 0.0f, 0.0f, 2.75f),
|
||||
|
|
|
@ -38,6 +38,7 @@ import common.packet.SPacketChunkData;
|
|||
import common.packet.SPacketCollectItem;
|
||||
import common.packet.SPacketDestroyEntities;
|
||||
import common.packet.SPacketDimensionName;
|
||||
import common.packet.SPacketDimensions;
|
||||
import common.packet.SPacketDisconnect;
|
||||
import common.packet.SPacketDisplayForm;
|
||||
import common.packet.SPacketEntityEquipment;
|
||||
|
@ -139,4 +140,5 @@ public interface IClientPlayer extends NetHandler {
|
|||
void handleForm(SPacketDisplayForm packet);
|
||||
void handleServerConfig(SPacketServerConfig packet);
|
||||
void handleCelestials(SPacketCelestials packet);
|
||||
void handleDimensions(SPacketDimensions packet);
|
||||
}
|
|
@ -75,6 +75,7 @@ import common.packet.SPacketChunkData;
|
|||
import common.packet.SPacketCollectItem;
|
||||
import common.packet.SPacketDestroyEntities;
|
||||
import common.packet.SPacketDimensionName;
|
||||
import common.packet.SPacketDimensions;
|
||||
import common.packet.SPacketDisconnect;
|
||||
import common.packet.SPacketDisplayForm;
|
||||
import common.packet.SPacketEntityEquipment;
|
||||
|
@ -184,6 +185,7 @@ public enum PacketRegistry {
|
|||
this.server(SPacketDisplayForm.class);
|
||||
this.server(SPacketServerConfig.class);
|
||||
this.server(SPacketCelestials.class);
|
||||
this.server(SPacketDimensions.class);
|
||||
|
||||
this.client(CPacketKeepAlive.class);
|
||||
this.client(CPacketMessage.class);
|
||||
|
|
|
@ -51,12 +51,12 @@ public class SPacketCharacterList implements Packet<IClientPlayer> {
|
|||
String info = buf.readString(IPlayer.MAX_INFO_LENGTH);
|
||||
info = info.isEmpty() ? null : info;
|
||||
Alignment align = buf.readEnumValue(Alignment.class);
|
||||
String dim = buf.readString(256);
|
||||
String dim = buf.readString(1024);
|
||||
BlockPos pos = buf.readBlockPos();
|
||||
String type = buf.readString(256);
|
||||
int level = buf.readVarInt();
|
||||
String origin = buf.readString(256);
|
||||
this.players.put(id, new PlayerCharacter(name, info, align, dim, pos, type, level, origin));
|
||||
String origin = buf.readString(1024);
|
||||
this.players.put(id, new PlayerCharacter(name, info, align, dim, pos, type, level, origin.isEmpty() ? null : origin));
|
||||
}
|
||||
this.selected = buf.readVarInt();
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class SPacketCharacterList implements Packet<IClientPlayer> {
|
|||
buf.writeBlockPos(chr.pos());
|
||||
buf.writeString(chr.type());
|
||||
buf.writeVarInt(chr.level());
|
||||
buf.writeString(chr.origin());
|
||||
buf.writeString(chr.origin() == null ? "" : chr.origin());
|
||||
}
|
||||
buf.writeVarInt(this.selected);
|
||||
}
|
||||
|
|
75
common/src/main/java/common/packet/SPacketDimensions.java
Normal file
75
common/src/main/java/common/packet/SPacketDimensions.java
Normal file
|
@ -0,0 +1,75 @@
|
|||
package common.packet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import common.collect.Lists;
|
||||
import common.dimension.DimType;
|
||||
import common.dimension.Dimension;
|
||||
import common.network.IClientPlayer;
|
||||
import common.network.Packet;
|
||||
import common.network.PacketBuffer;
|
||||
|
||||
public class SPacketDimensions implements Packet<IClientPlayer> {
|
||||
public static record DimData(int id, String name, DimType type, String display, String[] full) {
|
||||
}
|
||||
|
||||
private List<DimData> dimensions;
|
||||
|
||||
public SPacketDimensions() {
|
||||
}
|
||||
|
||||
public SPacketDimensions(int id, String name, Dimension dim) {
|
||||
this.dimensions = Lists.newArrayList(dim == null ? new DimData(id, null, null, null, null) : new DimData(id, name, dim.getType(), dim.getDisplay(), dim.getBaseNames()));
|
||||
}
|
||||
|
||||
public SPacketDimensions(List<DimData> dims) {
|
||||
this.dimensions = dims;
|
||||
}
|
||||
|
||||
public void readPacketData(PacketBuffer buf) throws IOException {
|
||||
int num = buf.readVarInt();
|
||||
this.dimensions = new ArrayList<>(num);
|
||||
for(int n = 0; n < num; n++) {
|
||||
int id = buf.readVarInt();
|
||||
String name = buf.readString(1024);
|
||||
if(name.isEmpty()) {
|
||||
this.dimensions.add(new DimData(id, null, null, null, null));
|
||||
continue;
|
||||
}
|
||||
DimType type = buf.readEnumOrNull(DimType.class);
|
||||
String display = buf.readString(1024);
|
||||
String[] full = new String[buf.readByte()];
|
||||
for(int z = 0; z < full.length; z++) {
|
||||
full[z] = buf.readString(1024);
|
||||
}
|
||||
this.dimensions.add(new DimData(id, name, type, display, full));
|
||||
}
|
||||
}
|
||||
|
||||
public void writePacketData(PacketBuffer buf) throws IOException {
|
||||
buf.writeVarInt(this.dimensions.size());
|
||||
for(DimData data : this.dimensions) {
|
||||
buf.writeVarInt(data.id());
|
||||
if(data.name() == null) {
|
||||
buf.writeString("");
|
||||
continue;
|
||||
}
|
||||
buf.writeString(data.name());
|
||||
buf.writeEnumOrNull(data.type());
|
||||
buf.writeString(data.display());
|
||||
buf.writeByte(data.full().length);
|
||||
for(int z = 0; z < data.full().length; z++) {
|
||||
buf.writeString(data.full()[z]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void processPacket(IClientPlayer handler) {
|
||||
handler.handleDimensions(this);
|
||||
}
|
||||
|
||||
public List<DimData> getDimensions() {
|
||||
return this.dimensions;
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ import java.io.IOException;
|
|||
import common.dimension.Dimension;
|
||||
import common.network.IClientPlayer;
|
||||
import common.network.PacketBuffer;
|
||||
import common.util.Serverside;
|
||||
|
||||
public class SPacketJoinGame extends SPacketRespawn {
|
||||
private int entityId;
|
||||
|
@ -12,8 +13,9 @@ public class SPacketJoinGame extends SPacketRespawn {
|
|||
public SPacketJoinGame() {
|
||||
}
|
||||
|
||||
public SPacketJoinGame(int id, Dimension dim, int type, boolean editor) {
|
||||
super(dim, type, editor);
|
||||
@Serverside
|
||||
public SPacketJoinGame(int id, Dimension dim, String name, int type, boolean editor) {
|
||||
super(dim, name, type, editor);
|
||||
this.entityId = id;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,14 +4,15 @@ import java.io.IOException;
|
|||
|
||||
import common.dimension.DimType;
|
||||
import common.dimension.Dimension;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.dimension.Space;
|
||||
import common.network.IClientPlayer;
|
||||
import common.network.Packet;
|
||||
import common.network.PacketBuffer;
|
||||
import common.tags.TagObject;
|
||||
import common.util.Clientside;
|
||||
import common.util.Serverside;
|
||||
|
||||
public class SPacketRespawn implements Packet<IClientPlayer> {
|
||||
private int dimId;
|
||||
private DimType dimType;
|
||||
private TagObject dimData;
|
||||
private String dimName;
|
||||
|
@ -25,38 +26,30 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
public SPacketRespawn() {
|
||||
}
|
||||
|
||||
public SPacketRespawn(Dimension dim, int type, boolean editor) {
|
||||
if(dim == null) {
|
||||
this.dimId = -2;
|
||||
}
|
||||
else {
|
||||
@Serverside
|
||||
public SPacketRespawn(Dimension dim, String name, int type, boolean editor) {
|
||||
if(dim != null) {
|
||||
this.dimType = dim.getType();
|
||||
this.dimData = dim.writeData();
|
||||
this.dimData = dim.writeData(true);
|
||||
if(this.dimType == DimType.PLANET || this.dimType == DimType.MOON) {
|
||||
this.sunColor = dim.getSunColor();
|
||||
this.moonColors = dim.getMoonColors();
|
||||
}
|
||||
if(dim.isCustom()) {
|
||||
this.dimName = UniverseRegistry.getName(dim);
|
||||
this.dimDisplay = dim.getDisplay();
|
||||
this.dimFull = dim.getBaseNames();
|
||||
this.dimId = -1;
|
||||
}
|
||||
else {
|
||||
this.dimId = UniverseRegistry.getId(dim);
|
||||
}
|
||||
this.dimName = name;
|
||||
this.dimDisplay = dim.getDisplay();
|
||||
this.dimFull = dim.getBaseNames();
|
||||
}
|
||||
this.type = type;
|
||||
this.editor = editor;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void processPacket(IClientPlayer handler) {
|
||||
handler.handleRespawn(this);
|
||||
}
|
||||
|
||||
public void readPacketData(PacketBuffer buf) throws IOException {
|
||||
this.dimId = buf.readVarInt();
|
||||
if(this.dimId >= -1) {
|
||||
if(buf.readBoolean()) {
|
||||
this.dimType = buf.readEnumOrNull(DimType.class);
|
||||
this.dimData = buf.readTag();
|
||||
if(this.dimType == DimType.PLANET || this.dimType == DimType.MOON) {
|
||||
|
@ -66,8 +59,6 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
this.moonColors[z] = buf.readInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.dimId == -1) {
|
||||
this.dimName = buf.readString(1024);
|
||||
this.dimDisplay = buf.readString(1024);
|
||||
this.dimFull = new String[buf.readByte()];
|
||||
|
@ -80,8 +71,8 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
}
|
||||
|
||||
public void writePacketData(PacketBuffer buf) throws IOException {
|
||||
buf.writeVarInt(this.dimId);
|
||||
if(this.dimId >= -1) {
|
||||
buf.writeBoolean(this.dimData != null);
|
||||
if(this.dimData != null) {
|
||||
buf.writeEnumOrNull(this.dimType);
|
||||
buf.writeTag(this.dimData);
|
||||
if(this.dimType == DimType.PLANET || this.dimType == DimType.MOON) {
|
||||
|
@ -91,8 +82,6 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
buf.writeInt(this.moonColors[z]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.dimId == -1) {
|
||||
buf.writeString(this.dimName);
|
||||
buf.writeString(this.dimDisplay);
|
||||
buf.writeByte(this.dimFull.length);
|
||||
|
@ -104,30 +93,32 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
|
|||
buf.writeBoolean(this.editor);
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public Dimension getDimension() {
|
||||
if(this.dimId < -1)
|
||||
if(this.dimData == null)
|
||||
return null;
|
||||
Dimension dim = this.dimId >= 0 ? UniverseRegistry.getDimension(this.dimId) : Dimension.create(this.dimType);
|
||||
Dimension dim = this.dimType == null ? Space.INSTANCE : Dimension.create(this.dimType);
|
||||
dim.readData(this.dimData);
|
||||
if(this.dimType == DimType.PLANET || this.dimType == DimType.MOON) {
|
||||
dim.setSunColor(this.sunColor);
|
||||
dim.setMoonColors(this.moonColors);
|
||||
}
|
||||
if(!dim.isCustom())
|
||||
return dim;
|
||||
dim.setDisplay(this.dimDisplay);
|
||||
dim.setBaseNames(this.dimFull);
|
||||
return dim;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public String getDimName() {
|
||||
return this.dimName;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public int getEntityType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public boolean isInEditor() {
|
||||
return this.editor;
|
||||
}
|
||||
|
|
|
@ -8,23 +8,27 @@ import common.network.PacketBuffer;
|
|||
|
||||
public class SPacketTimeUpdate implements Packet<IClientPlayer> {
|
||||
private long worldTime;
|
||||
private String localTime;
|
||||
private String serverInfo;
|
||||
|
||||
public SPacketTimeUpdate() {
|
||||
}
|
||||
|
||||
public SPacketTimeUpdate(long time, String info) {
|
||||
public SPacketTimeUpdate(long time, String local, String info) {
|
||||
this.worldTime = time;
|
||||
this.localTime = local;
|
||||
this.serverInfo = info;
|
||||
}
|
||||
|
||||
public void readPacketData(PacketBuffer buf) throws IOException {
|
||||
this.worldTime = buf.readLong();
|
||||
this.localTime = buf.readString(64);
|
||||
this.serverInfo = buf.readString(512);
|
||||
}
|
||||
|
||||
public void writePacketData(PacketBuffer buf) throws IOException {
|
||||
buf.writeLong(this.worldTime);
|
||||
buf.writeString(this.localTime);
|
||||
buf.writeString(this.serverInfo);
|
||||
}
|
||||
|
||||
|
@ -36,6 +40,10 @@ public class SPacketTimeUpdate implements Packet<IClientPlayer> {
|
|||
return this.worldTime;
|
||||
}
|
||||
|
||||
public String getLocalTime() {
|
||||
return this.localTime;
|
||||
}
|
||||
|
||||
public String getServerinfo() {
|
||||
return this.serverInfo;
|
||||
}
|
||||
|
|
15
common/src/main/java/common/util/Clientside.java
Normal file
15
common/src/main/java/common/util/Clientside.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package common.util;
|
||||
|
||||
import static java.lang.annotation.ElementType.CONSTRUCTOR;
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(SOURCE)
|
||||
@Target({TYPE, FIELD, METHOD, CONSTRUCTOR})
|
||||
public @interface Clientside {
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
package common.util;
|
||||
|
||||
import common.dimension.Dimension;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.init.DimensionRegistry;
|
||||
import common.world.World;
|
||||
|
||||
@Serverside
|
||||
public class Position extends Vec3 {
|
||||
private final float yaw;
|
||||
private final float pitch;
|
||||
|
@ -17,11 +18,11 @@ public class Position extends Vec3 {
|
|||
}
|
||||
|
||||
public Position(double x, double y, double z, float yaw, float pitch, Dimension dim) {
|
||||
this(x, y, z, yaw, pitch, UniverseRegistry.getId(dim));
|
||||
this(x, y, z, yaw, pitch, DimensionRegistry.getId(dim));
|
||||
}
|
||||
|
||||
public Position(double x, double y, double z, float yaw, float pitch, World world) {
|
||||
this(x, y, z, yaw, pitch, UniverseRegistry.getId(world.dimension));
|
||||
this(x, y, z, yaw, pitch, DimensionRegistry.getId(world.dimension));
|
||||
}
|
||||
|
||||
public double x() {
|
||||
|
@ -45,7 +46,7 @@ public class Position extends Vec3 {
|
|||
}
|
||||
|
||||
public Dimension getDimension() {
|
||||
return UniverseRegistry.getDimension(this.dim);
|
||||
return DimensionRegistry.getDimension(this.dim);
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
|
|
15
common/src/main/java/common/util/Serverside.java
Normal file
15
common/src/main/java/common/util/Serverside.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package common.util;
|
||||
|
||||
import static java.lang.annotation.ElementType.CONSTRUCTOR;
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(SOURCE)
|
||||
@Target({TYPE, FIELD, METHOD, CONSTRUCTOR})
|
||||
public @interface Serverside {
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
package common.util;
|
||||
|
||||
import common.dimension.Dimension;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.init.DimensionRegistry;
|
||||
import common.world.World;
|
||||
|
||||
@Serverside
|
||||
public class WorldPos extends BlockPos {
|
||||
private final int dim;
|
||||
|
||||
|
@ -13,23 +14,23 @@ public class WorldPos extends BlockPos {
|
|||
}
|
||||
|
||||
public WorldPos(int x, int y, int z, Dimension dim) {
|
||||
this(x, y, z, UniverseRegistry.getId(dim));
|
||||
this(x, y, z, DimensionRegistry.getId(dim));
|
||||
}
|
||||
|
||||
public WorldPos(int x, int y, int z, World world) {
|
||||
this(x, y, z, UniverseRegistry.getId(world.dimension));
|
||||
this(x, y, z, DimensionRegistry.getId(world.dimension));
|
||||
}
|
||||
|
||||
public WorldPos(BlockPos pos, Dimension dim) {
|
||||
this(pos.getX(), pos.getY(), pos.getZ(), UniverseRegistry.getId(dim));
|
||||
this(pos.getX(), pos.getY(), pos.getZ(), DimensionRegistry.getId(dim));
|
||||
}
|
||||
|
||||
public WorldPos(BlockPos pos, World world) {
|
||||
this(pos.getX(), pos.getY(), pos.getZ(), UniverseRegistry.getId(world.dimension));
|
||||
this(pos.getX(), pos.getY(), pos.getZ(), DimensionRegistry.getId(world.dimension));
|
||||
}
|
||||
|
||||
public Dimension getDimension() {
|
||||
return UniverseRegistry.getDimension(this.dim);
|
||||
return DimensionRegistry.getDimension(this.dim);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
|
|
|
@ -19,18 +19,12 @@ import common.collect.Lists;
|
|||
import common.collect.Sets;
|
||||
import common.dimension.DimType;
|
||||
import common.dimension.Dimension;
|
||||
import common.dimension.Moon;
|
||||
import common.dimension.Planet;
|
||||
import common.dimension.Sector;
|
||||
import common.dimension.Space;
|
||||
import common.dimension.Star;
|
||||
import common.entity.Entity;
|
||||
import common.entity.item.EntityExplosion;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.SoundEvent;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.item.ItemStack;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.ITickable;
|
||||
|
@ -79,15 +73,6 @@ public abstract class World implements IWorldAccess {
|
|||
protected Weather weather;
|
||||
protected long daytime;
|
||||
|
||||
// public static Calendar getCurrentDate() {
|
||||
// long curTime = System.currentTimeMillis();
|
||||
// if(curTime - lastUpdate >= 30000L) {
|
||||
// lastUpdate = curTime;
|
||||
// calendar.setTimeInMillis(curTime);
|
||||
// }
|
||||
// return calendar;
|
||||
// }
|
||||
|
||||
public boolean isBlockSolid(BlockPos pos) {
|
||||
return isSolidSurface(this.getState(pos));
|
||||
}
|
||||
|
@ -126,66 +111,6 @@ public abstract class World implements IWorldAccess {
|
|||
if(Math.abs(this.gravity) < 0.075)
|
||||
this.gravity = 0.0;
|
||||
}
|
||||
|
||||
private int getTimeQualifier(Planet homePlanet) {
|
||||
if(this.dimension == Space.INSTANCE)
|
||||
return 7;
|
||||
else if(this.dimension.getType() == DimType.SEMI)
|
||||
return 8;
|
||||
else if(this.dimension.getType() == DimType.AREA)
|
||||
return 9;
|
||||
if(this.dimension == homePlanet)
|
||||
return 0;
|
||||
Star homeStar = UniverseRegistry.getStar(homePlanet);
|
||||
if(this.dimension == homeStar)
|
||||
return 3;
|
||||
Moon moon = this.dimension.getType() == DimType.MOON ? (Moon)this.dimension : null;
|
||||
Planet planet = this.dimension.getType() == DimType.PLANET ? (Planet)this.dimension : (moon != null ? UniverseRegistry.getPlanet(moon) : null);
|
||||
if(planet == homePlanet)
|
||||
return 1;
|
||||
Star star = this.dimension.getType() == DimType.STAR ? (Star)this.dimension : (planet != null ? UniverseRegistry.getStar(planet) : null);
|
||||
if(star == homeStar)
|
||||
return 2;
|
||||
Sector homeSector = UniverseRegistry.getSector(homeStar);
|
||||
Sector sector = star != null ? UniverseRegistry.getSector(star) : null;
|
||||
if(sector == homeSector)
|
||||
return 4;
|
||||
if(sector != null && UniverseRegistry.getGalaxy(sector) == UniverseRegistry.getGalaxy(homeSector))
|
||||
return 5;
|
||||
return 6;
|
||||
}
|
||||
|
||||
public String formatTime(Dimension home, boolean days) {
|
||||
String qualifier = home != null ? (home.getType() == DimType.PLANET ? this.getTimeQualifier((Planet)home) + "." : "?.") : "";
|
||||
long time = this.daytime;
|
||||
String gtime;
|
||||
if((home == null || !home.isCelestial()) && !this.dimension.isCelestial()) {
|
||||
gtime = "???.???.M?";
|
||||
}
|
||||
else {
|
||||
long yearTime = (home != null && home.isCelestial() ? home : this.dimension).getOrbitalPeriod();
|
||||
long year = time / yearTime;
|
||||
long frac = (time * 1000L / yearTime) % 1000L;
|
||||
gtime = String.format("%03d.%03d.M%d", frac, year % 1000L, year / 1000L + 1L);
|
||||
}
|
||||
if(!days)
|
||||
return qualifier + gtime;
|
||||
String ltime;
|
||||
if(!this.dimension.isCelestial()) {
|
||||
ltime = " T???.??? D???.???.G?";
|
||||
}
|
||||
else {
|
||||
long day = time / this.dimension.getRotationalPeriod();
|
||||
time = time % this.dimension.getRotationalPeriod();
|
||||
ltime = String.format(" T%03d.%03d D%03d.%03d.G%d",
|
||||
time / 1000L, time % 1000L, (day / 1000L) % 1000L, day % 1000L, day / 1000000L);
|
||||
}
|
||||
return qualifier + gtime + ltime;
|
||||
}
|
||||
|
||||
public String formatTime(EntityNPC player, boolean days) {
|
||||
return this.formatTime(player == null ? null : player.getOrigin().getDimension(), days);
|
||||
}
|
||||
|
||||
public boolean isAirBlock(BlockPos pos) {
|
||||
return this.getState(pos).getBlock() == Blocks.air;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue