make dimension registry server side
This commit is contained in:
parent
b9d62c2253
commit
4de4f41a5d
98 changed files with 1008 additions and 608 deletions
|
@ -51,6 +51,7 @@ import client.gui.container.GuiInventory;
|
|||
import client.gui.element.Area;
|
||||
import client.gui.ingame.GuiGameOver;
|
||||
import client.gui.ingame.GuiRename;
|
||||
import client.init.DimensionMapping;
|
||||
import client.network.ClientLoginHandler;
|
||||
import client.network.ClientPlayer;
|
||||
import client.network.DummyConnection;
|
||||
|
@ -125,7 +126,6 @@ import common.init.ItemRegistry;
|
|||
import common.init.Items;
|
||||
import common.init.Registry;
|
||||
import common.init.SoundEvent;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.item.Item;
|
||||
import common.item.ItemControl;
|
||||
|
@ -706,6 +706,8 @@ public class Client implements IThreadListener {
|
|||
ClientPlayer player = new ClientPlayer(this, new DummyConnection());
|
||||
this.debugWorld = true;
|
||||
this.charEditor = false;
|
||||
this.dimensionName = "debug";
|
||||
Space.INSTANCE.setDisplay("Debug-Welt");
|
||||
this.controller = new PlayerController(this, player);
|
||||
this.loadWorld(Space.INSTANCE, EntityRegistry.getEntityID(EntityCpu.class));
|
||||
this.player.setId(0);
|
||||
|
@ -720,6 +722,10 @@ public class Client implements IThreadListener {
|
|||
ClientPlayer netHandler = this.getNetHandler();
|
||||
if(netHandler != null)
|
||||
netHandler.cleanup();
|
||||
EntityTexManager.clearTextures();
|
||||
DimensionMapping.clear();
|
||||
this.dimensionName = null;
|
||||
Space.INSTANCE.setDisplay(null);
|
||||
this.debugWorld = false;
|
||||
this.charEditor = false;
|
||||
this.viewEntity = null;
|
||||
|
@ -1853,7 +1859,7 @@ public class Client implements IThreadListener {
|
|||
ExtMath.wrapf(this.viewEntity.rotYaw), ExtMath.wrapf(this.viewEntity.rotPitch)) + "\n" +
|
||||
String.format("Biom: %.2f K, N: %.2f K, D: %s (%s)", chunk.getTemperature(pos), chunk.getOffset(pos),
|
||||
TextColor.stripCodes(this.world.dimension.getDisplay()),
|
||||
this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName) + "\n" +
|
||||
this.dimensionName) + "\n" +
|
||||
"Licht: " + chunk.getLightSub(pos, 0) + " (" + chunk.getLight(LightType.SKY, pos) + " Himmel, "
|
||||
+ chunk.getLight(LightType.BLOCK, pos) + " Blöcke, " + String.format(
|
||||
"%.1f", this.entityRenderer.getSunBrightness(1.0f) * 15.0f) + " Welt), A: "
|
||||
|
|
|
@ -30,6 +30,7 @@ import client.gui.element.NavButton;
|
|||
import client.gui.element.PressType;
|
||||
import client.gui.element.Slider;
|
||||
import client.gui.element.SliderCallback;
|
||||
import client.init.DimensionMapping;
|
||||
import client.gui.element.FieldAction;
|
||||
import client.gui.element.Area;
|
||||
import client.gui.element.ButtonCallback;
|
||||
|
@ -50,6 +51,7 @@ import client.window.Button;
|
|||
import common.collect.Lists;
|
||||
import common.dimension.DimType;
|
||||
import common.dimension.Dimension;
|
||||
import common.dimension.Space;
|
||||
import common.entity.npc.Alignment;
|
||||
import common.entity.npc.CharacterInfo;
|
||||
import common.entity.npc.EntityHuman;
|
||||
|
@ -59,7 +61,6 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.EntityInfo;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.SpeciesRegistry;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.init.SpeciesRegistry.ModelType;
|
||||
import common.log.Log;
|
||||
import common.network.IPlayer;
|
||||
|
@ -250,7 +251,8 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
|
||||
public static final GuiChar INSTANCE = new GuiChar();
|
||||
private static final File TEXTURE_FOLDER = new File("skins");
|
||||
private static final List<Dimension> DIMENSIONS = Lists.newArrayList();
|
||||
|
||||
private final List<Dimension> dimensions = Lists.newArrayList();
|
||||
|
||||
private ActButton templateButton;
|
||||
private DragAdjust adjust;
|
||||
|
@ -266,19 +268,16 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
@Variable(name = "char_filter_species", category = CVarCategory.GUI, display = "Filtern", callback = FilterFunction.class, switched = true)
|
||||
private FilterType filterSpecies = FilterType.ALL;
|
||||
|
||||
static {
|
||||
for(Dimension dim : UniverseRegistry.getDimensions()) {
|
||||
if(dim.getType() == DimType.PLANET || dim.getType() == DimType.MOON || dim.getType() == DimType.AREA || dim.getType() == DimType.SEMI)
|
||||
DIMENSIONS.add(dim);
|
||||
}
|
||||
}
|
||||
|
||||
private GuiChar() {
|
||||
}
|
||||
|
||||
public void init(int width, int height)
|
||||
{
|
||||
super.init(width, height);
|
||||
this.dimensions.clear();
|
||||
for(Dimension dim : DimensionMapping.getDimensions()) {
|
||||
this.dimensions.add(dim);
|
||||
}
|
||||
this.waiting = true;
|
||||
this.setDimensions(390, height, 32, height - 32);
|
||||
if(this.gm.getRenderManager().gm == null) {
|
||||
|
@ -392,9 +391,9 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
public void use(ActButton elem, PressType action) {
|
||||
if(GuiChar.this.gm.player != null) {
|
||||
GuiChar.this.gm.show(GuiLoading.makeWaitTask("Lade Welt ..."));
|
||||
Dimension dim = DIMENSIONS.get(GuiChar.this.dimension);
|
||||
Dimension dim = GuiChar.this.dimensions.get(GuiChar.this.dimension);
|
||||
GuiChar.this.gm.player.client.addToSendQueue(new CPacketMessage(CPacketMessage.Type.INFO, descField.getText()));
|
||||
GuiChar.this.gm.player.client.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR, UniverseRegistry.getId(dim)));
|
||||
GuiChar.this.gm.player.client.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR, DimensionMapping.getId(dim)));
|
||||
}
|
||||
}
|
||||
}, "Charakter erstellen"));
|
||||
|
@ -419,13 +418,13 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
}, IPlayer.VALID_NICK, this.gm.player == null ? "" : this.gm.player.getCustomNameTag()));
|
||||
this.templateButton.enabled = false;
|
||||
this.dimension = new Random().zrange(DIMENSIONS.size());
|
||||
this.dimension = new Random().zrange(this.dimensions.size());
|
||||
EntityInfo info = EntityRegistry.DNA.get(this.gm.player == null ? EntityRegistry.getEntityString(EntityHuman.class) : EntityRegistry.getEntityString(this.gm.player));
|
||||
if(info != null && info.origin() != null) {
|
||||
Dimension dim = UniverseRegistry.getDimension(info.origin());
|
||||
Dimension dim = DimensionMapping.getDimension(info.origin());
|
||||
if(dim != null) {
|
||||
for(int z = 0; z < DIMENSIONS.size(); z++) {
|
||||
if(DIMENSIONS.get(z) == dim) {
|
||||
for(int z = 0; z < this.dimensions.size(); z++) {
|
||||
if(this.dimensions.get(z) == dim) {
|
||||
this.dimension = z;
|
||||
break;
|
||||
}
|
||||
|
@ -435,14 +434,14 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
this.dimButton = this.add(new ActButton(width - 390, height - 156, 388, 0, new ButtonCallback() {
|
||||
public void use(ActButton elem, PressType mode) {
|
||||
if(mode == PressType.TERTIARY) {
|
||||
GuiChar.this.dimension = new Random().zrange(DIMENSIONS.size());
|
||||
GuiChar.this.dimension = new Random().zrange(GuiChar.this.dimensions.size());
|
||||
}
|
||||
else if(mode == PressType.SECONDARY) {
|
||||
if(--GuiChar.this.dimension < 0)
|
||||
GuiChar.this.dimension = DIMENSIONS.size() - 1;
|
||||
GuiChar.this.dimension = GuiChar.this.dimensions.size() - 1;
|
||||
}
|
||||
else {
|
||||
if(++GuiChar.this.dimension >= DIMENSIONS.size())
|
||||
if(++GuiChar.this.dimension >= GuiChar.this.dimensions.size())
|
||||
GuiChar.this.dimension = 0;
|
||||
}
|
||||
GuiChar.this.setDimButton();
|
||||
|
@ -453,8 +452,8 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
|
||||
private void setDimButton() {
|
||||
Dimension dim = DIMENSIONS.get(this.dimension);
|
||||
this.dimButton.setText((dim.getType() == DimType.PLANET ? "Heimplanet" : "Heimdimension") + ": " + dim.getDisplay());
|
||||
Dimension dim = this.dimensions.get(this.dimension);
|
||||
this.dimButton.setText((dim.getType() == DimType.PLANET ? "Heimplanet" : (dim.getType() == DimType.MOON ? "Heimmond" : (dim.getType() == DimType.STAR ? "Heimstern" : "Heimdimension"))) + ": " + (dim == Space.INSTANCE ? "*unbekannt*" : dim.getDisplay()));
|
||||
this.descLines.setText(Util.buildLines(dim.getBaseNames()));
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import client.gui.element.PressType;
|
|||
import client.renderer.Drawing;
|
||||
import common.color.TextColor;
|
||||
import common.entity.npc.PlayerCharacter;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.packet.CPacketAction;
|
||||
import common.packet.CPacketAction.Action;
|
||||
import common.util.ExtMath;
|
||||
|
@ -64,7 +63,7 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> impleme
|
|||
|
||||
private void updateButtons() {
|
||||
CharacterEntry entry = this.getSelected();
|
||||
this.descField.setText(entry == null ? "" : (entry.character == null ? "*neuer Charakter*" : String.format(TextColor.GRAY + "[%s%s" + TextColor.GRAY + "]\n" + TextColor.RESET + "%s", entry.character.align().color, entry.character.align().display, entry.character.info() == null ? "*keine Beschreibung vorhanden*" : this.getSelected().character.info())));
|
||||
this.descField.setText(entry == null ? "" : (entry.character == null ? "*neuer Charakter*" : String.format(TextColor.GRAY + "[%s%s" + TextColor.GRAY + "]\n" + TextColor.LYELLOW + "Herkunft" + TextColor.LGRAY + ": " + TextColor.LBROWN + "%s\n" + TextColor.RESET + "%s", entry.character.align().color, entry.character.align().display, entry.character.origin() == null ? TextColor.DGRAY + "*unbekannt*" : entry.character.origin(), entry.character.info() == null ? "*keine Beschreibung vorhanden*" : this.getSelected().character.info())));
|
||||
this.actionButtom.setText(entry != null && entry.character == null ? "Charakter erstellen" : "Charakter spielen");
|
||||
this.actionButtom.enabled = entry != null && !entry.initial;
|
||||
this.deleteButtom.enabled = !this.gm.charEditor && entry != null && entry.character != null && !entry.initial;
|
||||
|
@ -77,7 +76,7 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> impleme
|
|||
this.elements.clear();
|
||||
int selected = this.gm.selectedCharacter;
|
||||
for(PlayerCharacter character : this.gm.characterList) {
|
||||
this.elements.add(new CharacterEntry(selected == this.elements.size() ? new PlayerCharacter(character.name(), character.info(), character.align(), this.gm.player.worldObj.dimension.getDisplay(), this.gm.player.getPosition(), character.type(), this.gm.player.experienceLevel, UniverseRegistry.getName(this.gm.player.getOrigin().getDimension())) : character, selected == this.elements.size()));
|
||||
this.elements.add(new CharacterEntry(selected == this.elements.size() ? new PlayerCharacter(character.name(), character.info(), character.align(), this.gm.player.worldObj.dimension.getDisplay(), this.gm.player.getPosition(), character.type(), this.gm.player.experienceLevel, character.origin()) : character, selected == this.elements.size()));
|
||||
}
|
||||
if(!this.gm.charEditor)
|
||||
this.elements.add(new CharacterEntry(null, false));
|
||||
|
|
|
@ -3,84 +3,78 @@ package client.gui.ingame;
|
|||
import java.util.List;
|
||||
|
||||
import client.gui.Gui;
|
||||
import common.block.foliage.LeavesType;
|
||||
import common.collect.Lists;
|
||||
import common.dimension.Dimension;
|
||||
import common.dimension.Dimension.GeneratorType;
|
||||
import common.dimension.Dimension.ReplacerType;
|
||||
import common.init.Blocks;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.tags.TagObject;
|
||||
|
||||
public class GuiCreateDimension extends Gui {
|
||||
public static final GuiCreateDimension INSTANCE = new GuiCreateDimension();
|
||||
private static final List<Dimension> PRESETS = Lists.newArrayList();
|
||||
|
||||
private static Dimension addPreset(String display, String base, String data) {
|
||||
Dimension dim = UniverseRegistry.getDimension(base).makeCustomCopy();
|
||||
TagObject ptag;
|
||||
try {
|
||||
ptag = TagObject.parse("{" + data + "}");
|
||||
}
|
||||
catch(IllegalArgumentException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
TagObject dtag = new TagObject();
|
||||
dim.toTags(dtag);
|
||||
if(ptag.getBool("ClearGenerator")) {
|
||||
ptag.remove("ClearGenerator");
|
||||
dtag.remove("FloorBlock");
|
||||
dtag.remove("CeilingBlock");
|
||||
dtag.remove("Layers");
|
||||
dtag.remove("AddBiomes");
|
||||
dtag.remove("FrostBiomes");
|
||||
dtag.remove("ColdBiomes");
|
||||
dtag.remove("MediumBiomes");
|
||||
dtag.remove("HotBiomes");
|
||||
dtag.remove("Ores");
|
||||
dtag.remove("Lakes");
|
||||
dtag.remove("Liquids");
|
||||
dtag.setString("Generator", GeneratorType.FLAT.getName());
|
||||
dtag.setString("Replacer", ReplacerType.NONE.getName());
|
||||
// dtag.setBoolean("MobGen", false);
|
||||
// dtag.setBoolean("SnowGen", false);
|
||||
dtag.setBool("Caves", false);
|
||||
dtag.setBool("Ravines", false);
|
||||
dtag.setBool("AltCaves", false);
|
||||
dtag.setBool("Strongholds", false);
|
||||
dtag.setBool("Villages", false);
|
||||
dtag.setBool("Mineshafts", false);
|
||||
dtag.setBool("Scattered", false);
|
||||
dtag.setBool("Fortresses", false);
|
||||
dtag.setInt("Dungeons", 0);
|
||||
dtag.setInt("BiomeSize", 0);
|
||||
dtag.setInt("RiverSize", 4);
|
||||
dtag.setInt("SnowRarity", 6);
|
||||
dtag.setInt("SeaRarity", 50);
|
||||
dtag.setInt("AddRarity", 50);
|
||||
dtag.setInt("SeaLevel", 0);
|
||||
// dtag.setString("DefaultBiome", Biome.NONE.name.toLowerCase()); // TODO fix everything
|
||||
dtag.setBool("SemiFixed", false);
|
||||
// dtag.setString("DefaultWeather", Weather.CLEAR.getName());
|
||||
dtag.setString("DefaultLeaves", LeavesType.SPRING.getName());
|
||||
Dimension.writeState(dtag, "FillerBlock", Blocks.air.getState());
|
||||
Dimension.writeState(dtag, "TopBlock", Blocks.air.getState());
|
||||
Dimension.writeState(dtag, "SurfaceBlock", Blocks.air.getState());
|
||||
Dimension.writeState(dtag, "AltBlock1", Blocks.air.getState());
|
||||
Dimension.writeState(dtag, "AltBlock2", Blocks.air.getState());
|
||||
Dimension.writeState(dtag, "LiquidBlock", Blocks.air.getState());
|
||||
Dimension.writeState(dtag, "CaveFillBlock", Blocks.air.getState());
|
||||
}
|
||||
dtag.merge(ptag);
|
||||
dim.fromTags(dtag);
|
||||
dim.setDisplay(display);
|
||||
PRESETS.add(dim);
|
||||
return dim;
|
||||
}
|
||||
|
||||
private static Dimension addPreset(String display, String data) {
|
||||
return addPreset(display, "terra", data);
|
||||
}
|
||||
// private static Dimension addPreset(String display, String base, String data) {
|
||||
// Dimension dim = UniverseRegistry.getDimension(base).makeCustomCopy();
|
||||
// TagObject ptag;
|
||||
// try {
|
||||
// ptag = TagObject.parse("{" + data + "}");
|
||||
// }
|
||||
// catch(IllegalArgumentException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// TagObject dtag = new TagObject();
|
||||
// dim.toTags(dtag);
|
||||
// if(ptag.getBool("ClearGenerator")) {
|
||||
// ptag.remove("ClearGenerator");
|
||||
// dtag.remove("FloorBlock");
|
||||
// dtag.remove("CeilingBlock");
|
||||
// dtag.remove("Layers");
|
||||
// dtag.remove("AddBiomes");
|
||||
// dtag.remove("FrostBiomes");
|
||||
// dtag.remove("ColdBiomes");
|
||||
// dtag.remove("MediumBiomes");
|
||||
// dtag.remove("HotBiomes");
|
||||
// dtag.remove("Ores");
|
||||
// dtag.remove("Lakes");
|
||||
// dtag.remove("Liquids");
|
||||
// dtag.setString("Generator", GeneratorType.FLAT.getName());
|
||||
// dtag.setString("Replacer", ReplacerType.NONE.getName());
|
||||
//// dtag.setBoolean("MobGen", false);
|
||||
//// dtag.setBoolean("SnowGen", false);
|
||||
// dtag.setBool("Caves", false);
|
||||
// dtag.setBool("Ravines", false);
|
||||
// dtag.setBool("AltCaves", false);
|
||||
// dtag.setBool("Strongholds", false);
|
||||
// dtag.setBool("Villages", false);
|
||||
// dtag.setBool("Mineshafts", false);
|
||||
// dtag.setBool("Scattered", false);
|
||||
// dtag.setBool("Fortresses", false);
|
||||
// dtag.setInt("Dungeons", 0);
|
||||
// dtag.setInt("BiomeSize", 0);
|
||||
// dtag.setInt("RiverSize", 4);
|
||||
// dtag.setInt("SnowRarity", 6);
|
||||
// dtag.setInt("SeaRarity", 50);
|
||||
// dtag.setInt("AddRarity", 50);
|
||||
// dtag.setInt("SeaLevel", 0);
|
||||
//// dtag.setString("DefaultBiome", Biome.NONE.name.toLowerCase()); // TODO fix everything
|
||||
// dtag.setBool("SemiFixed", false);
|
||||
//// dtag.setString("DefaultWeather", Weather.CLEAR.getName());
|
||||
// dtag.setString("DefaultLeaves", LeavesType.SPRING.getName());
|
||||
// Dimension.writeState(dtag, "FillerBlock", Blocks.air.getState());
|
||||
// Dimension.writeState(dtag, "TopBlock", Blocks.air.getState());
|
||||
// Dimension.writeState(dtag, "SurfaceBlock", Blocks.air.getState());
|
||||
// Dimension.writeState(dtag, "AltBlock1", Blocks.air.getState());
|
||||
// Dimension.writeState(dtag, "AltBlock2", Blocks.air.getState());
|
||||
// Dimension.writeState(dtag, "LiquidBlock", Blocks.air.getState());
|
||||
// Dimension.writeState(dtag, "CaveFillBlock", Blocks.air.getState());
|
||||
// }
|
||||
// dtag.merge(ptag);
|
||||
// dim.fromTags(dtag);
|
||||
// dim.setDisplay(display);
|
||||
// PRESETS.add(dim);
|
||||
// return dim;
|
||||
// }
|
||||
//
|
||||
// private static Dimension addPreset(String display, String data) {
|
||||
// return addPreset(display, "terra", data);
|
||||
// }
|
||||
|
||||
// private static Dimension addFlatPreset(String display, Biome biome, boolean populate, State main, Object ... layers) {
|
||||
// return addFlatPreset(display, "terra", biome, populate, main, layers);
|
||||
|
@ -96,18 +90,18 @@ public class GuiCreateDimension extends Gui {
|
|||
|
||||
static
|
||||
{
|
||||
addPreset("Standard", "");
|
||||
addPreset("Doppelte Höhe (128)", "BaseSize:17.0,Stretch:24.0,ScaleY:80.0,SeaLevel:127");
|
||||
addPreset("Große Biome", "BiomeSize:6");
|
||||
addPreset("Überdreht", "Amplification:2.0");
|
||||
addPreset("Wasserwelt", "ScaleX:5000.0,ScaleY:1000.0,ScaleZ:5000.0,Stretch:8.0,BDepthWeight:2.0,BDepthOffset:0.5,BScaleWeight:2.0,BScaleOffset:0.375,SeaLevel:511");
|
||||
addPreset("Inselland", "CoordScale:3000.0,HeightScale:6000.0,UpperLmtScale:250.0,Stretch:10.0");
|
||||
addPreset("Favorit des Gräbers", "ScaleX:5000.0,ScaleY:1000.0,ScaleZ:5000.0,Stretch:5.0,BDepthWeight:2.0,BDepthOffset:1.0,BScaleWeight:4.0,BScaleOffset:1.0");
|
||||
addPreset("Verrückte Berge", "CoordScale:738.41864,HeightScale:157.69133,UpperLmtScale:801.4267,LowerLmtScale:1254.1643,DepthScaleX:374.93652,DepthScaleZ:288.65228,"
|
||||
+ "ScaleX:1355.9908,ScaleY:745.5343,ScaleZ:1183.464,BaseSize:1.8758626,Stretch:1.7137525,BDepthWeight:1.7553768,BDepthOffset:3.4701107,BScaleOffset:2.535211");
|
||||
addPreset("Trockenheit", "ScaleX:1000.0,ScaleY:3000.0,ScaleZ:1000.0,Stretch:10.0,SeaLevel:20");
|
||||
addPreset("Chaotische Höhlen", "UpperLmtScale:2.0,LowerLmtScale:64.0,SeaLevel:6");
|
||||
addPreset("Viel Glück", "LiquidBlock:lava,SeaLevel:40");
|
||||
// addPreset("Standard", "");
|
||||
// addPreset("Doppelte Höhe (128)", "BaseSize:17.0,Stretch:24.0,ScaleY:80.0,SeaLevel:127");
|
||||
// addPreset("Große Biome", "BiomeSize:6");
|
||||
// addPreset("Überdreht", "Amplification:2.0");
|
||||
// addPreset("Wasserwelt", "ScaleX:5000.0,ScaleY:1000.0,ScaleZ:5000.0,Stretch:8.0,BDepthWeight:2.0,BDepthOffset:0.5,BScaleWeight:2.0,BScaleOffset:0.375,SeaLevel:511");
|
||||
// addPreset("Inselland", "CoordScale:3000.0,HeightScale:6000.0,UpperLmtScale:250.0,Stretch:10.0");
|
||||
// addPreset("Favorit des Gräbers", "ScaleX:5000.0,ScaleY:1000.0,ScaleZ:5000.0,Stretch:5.0,BDepthWeight:2.0,BDepthOffset:1.0,BScaleWeight:4.0,BScaleOffset:1.0");
|
||||
// addPreset("Verrückte Berge", "CoordScale:738.41864,HeightScale:157.69133,UpperLmtScale:801.4267,LowerLmtScale:1254.1643,DepthScaleX:374.93652,DepthScaleZ:288.65228,"
|
||||
// + "ScaleX:1355.9908,ScaleY:745.5343,ScaleZ:1183.464,BaseSize:1.8758626,Stretch:1.7137525,BDepthWeight:1.7553768,BDepthOffset:3.4701107,BScaleOffset:2.535211");
|
||||
// addPreset("Trockenheit", "ScaleX:1000.0,ScaleY:3000.0,ScaleZ:1000.0,Stretch:10.0,SeaLevel:20");
|
||||
// addPreset("Chaotische Höhlen", "UpperLmtScale:2.0,LowerLmtScale:64.0,SeaLevel:6");
|
||||
// addPreset("Viel Glück", "LiquidBlock:lava,SeaLevel:40");
|
||||
|
||||
// addFlatPreset("Klassisch", Biome.PLAIN, false, Blocks.dirt.getState(), Blocks.bedrock.getState(), 2, Blocks.dirt.getState(),
|
||||
// Blocks.grass.getState()).enableVillages();
|
||||
|
@ -138,8 +132,8 @@ public class GuiCreateDimension extends Gui {
|
|||
// addFlatPreset("Sandsteinwelt", Biome.DESERT, false, Blocks.sandstone.getState(), Blocks.bedrock.getState(), 3, Blocks.stone.getState(),
|
||||
// 52, Blocks.sandstone.getState());
|
||||
|
||||
addPreset("Leer", "ClearGenerator:1b");
|
||||
addPreset("Alpha 1.2", "Strongholds:0b,Villages:0b,MineShafts:0b,Scattered:0b,Generator:simple,Replacer:simple,Ravines:0b,SeaLevel:64,AltBlock2:sand");
|
||||
// addPreset("Leer", "ClearGenerator:1b");
|
||||
// addPreset("Alpha 1.2", "Strongholds:0b,Villages:0b,MineShafts:0b,Scattered:0b,Generator:simple,Replacer:simple,Ravines:0b,SeaLevel:64,AltBlock2:sand");
|
||||
}
|
||||
|
||||
private GuiCreateDimension() {
|
||||
|
|
31
client/src/main/java/client/init/DimensionMapping.java
Normal file
31
client/src/main/java/client/init/DimensionMapping.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
package client.init;
|
||||
|
||||
import common.dimension.Dimension;
|
||||
import common.init.DimensionRegistry;
|
||||
|
||||
public class DimensionMapping extends DimensionRegistry {
|
||||
public static void put(String name, int id, Dimension dim) {
|
||||
NAME_MAP.put(name, dim);
|
||||
NAMES.put(dim, name);
|
||||
ID_MAP.put(id, dim);
|
||||
IDS.put(dim, id);
|
||||
DIMENSIONS.add(dim);
|
||||
}
|
||||
|
||||
public static void remove(int id) {
|
||||
Dimension dim = ID_MAP.remove(id);
|
||||
if(dim != null) {
|
||||
IDS.remove(dim);
|
||||
NAME_MAP.remove(NAMES.remove(dim));
|
||||
DIMENSIONS.remove(dim);
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
NAME_MAP.clear();
|
||||
NAMES.clear();
|
||||
ID_MAP.clear();
|
||||
IDS.clear();
|
||||
DIMENSIONS.clear();
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@ import client.gui.container.GuiDevice;
|
|||
import client.gui.container.GuiMerchant;
|
||||
import client.gui.container.GuiRepair;
|
||||
import client.gui.ingame.GuiSign;
|
||||
import client.init.DimensionMapping;
|
||||
import client.gui.ingame.GuiForm;
|
||||
import client.renderer.texture.EntityTexManager;
|
||||
import client.util.PlayerController;
|
||||
|
@ -49,7 +50,6 @@ import common.init.EntityRegistry;
|
|||
import common.init.ItemRegistry;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.inventory.Container;
|
||||
import common.inventory.InventoryBasic;
|
||||
import common.inventory.InventoryPlayer;
|
||||
|
@ -101,6 +101,8 @@ import common.packet.SPacketChunkData;
|
|||
import common.packet.SPacketCollectItem;
|
||||
import common.packet.SPacketDestroyEntities;
|
||||
import common.packet.SPacketDimensionName;
|
||||
import common.packet.SPacketDimensions;
|
||||
import common.packet.SPacketDimensions.DimData;
|
||||
import common.packet.SPacketDisconnect;
|
||||
import common.packet.SPacketDisplayForm;
|
||||
import common.packet.SPacketEntityEquipment;
|
||||
|
@ -136,7 +138,6 @@ import common.tileentity.TileEntitySign;
|
|||
import common.util.BlockPos;
|
||||
import common.util.Pair;
|
||||
import common.util.ParticleType;
|
||||
import common.util.WorldPos;
|
||||
import common.util.BlockPos.MutableBlockPos;
|
||||
import common.village.MerchantRecipeList;
|
||||
import common.world.Explosion;
|
||||
|
@ -218,17 +219,9 @@ public class ClientPlayer implements IClientPlayer
|
|||
this.connection.sendPacket(p_147297_1_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the WorldClient instance associated with this NetHandlerPlayClient
|
||||
*/
|
||||
public void cleanup()
|
||||
{
|
||||
this.world = null;
|
||||
// for(String user : this.playerInfoMap.keySet()) {
|
||||
// DefaultPlayerSkin.setTexture(user, null);
|
||||
// }
|
||||
EntityTexManager.clearTextures();
|
||||
// this.gameController.confirmSkin(false);
|
||||
}
|
||||
|
||||
public void handleServerConfig(SPacketServerConfig packet) {
|
||||
|
@ -974,6 +967,7 @@ public class ClientPlayer implements IClientPlayer
|
|||
// this.gameController.theWorld.getWorldInfo().setTime(packetIn.getTotalWorldTime());
|
||||
this.gm.world.setDayTime(packetIn.getWorldTime());
|
||||
this.gm.setTicked(packetIn.getServerinfo());
|
||||
Items.navigator.setLocalTime(packetIn.getLocalTime());
|
||||
}
|
||||
|
||||
public void handleServerTick(SPacketServerTick packet)
|
||||
|
@ -1796,10 +1790,6 @@ public class ClientPlayer implements IClientPlayer
|
|||
else if(this.gm.open instanceof GuiChar guichar) {
|
||||
guichar.setCharsAvailable();
|
||||
}
|
||||
if(!this.gm.charEditor && this.gm.player != null && this.gm.selectedCharacter >= 0 && this.gm.selectedCharacter < this.gm.characterList.size()) {
|
||||
Dimension dim = UniverseRegistry.getDimension(this.gm.characterList.get(this.gm.selectedCharacter).origin());
|
||||
this.gm.player.setOrigin(new WorldPos(0, 0, 0, dim == null ? Space.INSTANCE : dim));
|
||||
}
|
||||
}
|
||||
|
||||
public void handleKeepAlive(SPacketKeepAlive packetIn)
|
||||
|
@ -2056,9 +2046,12 @@ public class ClientPlayer implements IClientPlayer
|
|||
|
||||
public void handleDimName(SPacketDimensionName packet) {
|
||||
NetHandler.checkThread(packet, this, this.gm, this.world);
|
||||
if(this.world.dimension.isCustom()) {
|
||||
this.world.dimension.setDisplay(packet.getCustomName());
|
||||
this.world.dimension.setBaseNames(packet.getFullName());
|
||||
this.world.dimension.setDisplay(packet.getCustomName());
|
||||
this.world.dimension.setBaseNames(packet.getFullName());
|
||||
Dimension dim = DimensionMapping.getDimension(this.gm.dimensionName);
|
||||
if(dim != null) {
|
||||
dim.setDisplay(packet.getCustomName());
|
||||
dim.setBaseNames(packet.getFullName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2070,4 +2063,20 @@ public class ClientPlayer implements IClientPlayer
|
|||
this.world.dimension.setMoonColors(packet.getMoonColors());
|
||||
}
|
||||
}
|
||||
|
||||
public void handleDimensions(SPacketDimensions packet)
|
||||
{
|
||||
NetHandler.checkThread(packet, this, this.gm);
|
||||
for(DimData data : packet.getDimensions()) {
|
||||
if(data.name() == null) {
|
||||
DimensionMapping.remove(data.id());
|
||||
}
|
||||
else {
|
||||
Dimension dim = data.type() == null ? Space.INSTANCE : Dimension.create(data.type());
|
||||
dim.setDisplay(data.display());
|
||||
dim.setBaseNames(data.full());
|
||||
DimensionMapping.put(data.name(), data.id(), dim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public class RenderHumanoid extends RenderNpc
|
|||
if (npc.isUsingItem())
|
||||
{
|
||||
ItemAction enumaction = itemstack.getItemUseAction();
|
||||
enumaction = enumaction == ItemAction.NONE ? itemstack.getItemPosition() : enumaction;
|
||||
enumaction = enumaction == ItemAction.NONE ? itemstack.getItem().getItemPosition() : enumaction;
|
||||
|
||||
if (enumaction == ItemAction.BLOCK)
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ public class RenderHumanoid extends RenderNpc
|
|||
}
|
||||
}
|
||||
else {
|
||||
ItemAction enumaction = itemstack.getItemPosition();
|
||||
ItemAction enumaction = itemstack.getItem().getItemPosition();
|
||||
|
||||
if(enumaction == ItemAction.AIM) {
|
||||
modelplayer.aimedBow = true;
|
||||
|
|
|
@ -98,7 +98,7 @@ public class RenderItem
|
|||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
this.renderModel(model, stack);
|
||||
|
||||
if (stack.isGleaming())
|
||||
if (stack.getItem().isGleaming(stack))
|
||||
{
|
||||
this.renderEffect(model);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class RenderSpaceMarine extends RenderNpc
|
|||
if (npc.isUsingItem())
|
||||
{
|
||||
ItemAction enumaction = itemstack.getItemUseAction();
|
||||
enumaction = enumaction == ItemAction.NONE ? itemstack.getItemPosition() : enumaction;
|
||||
enumaction = enumaction == ItemAction.NONE ? itemstack.getItem().getItemPosition() : enumaction;
|
||||
|
||||
if (enumaction == ItemAction.BLOCK)
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ public class RenderSpaceMarine extends RenderNpc
|
|||
}
|
||||
}
|
||||
else {
|
||||
ItemAction enumaction = itemstack.getItemPosition();
|
||||
ItemAction enumaction = itemstack.getItem().getItemPosition();
|
||||
|
||||
if(enumaction == ItemAction.AIM) {
|
||||
modelplayer.aimedBow = true;
|
||||
|
|
|
@ -3,14 +3,11 @@ package client.util;
|
|||
import client.Client;
|
||||
import client.network.ClientPlayer;
|
||||
import common.block.Block;
|
||||
import common.dimension.Dimension;
|
||||
import common.dimension.Space;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.item.ItemControl;
|
||||
import common.item.ItemStack;
|
||||
import common.packet.CPacketAction;
|
||||
|
@ -21,7 +18,6 @@ import common.sound.PositionedSound;
|
|||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Vec3;
|
||||
import common.util.WorldPos;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -281,10 +277,6 @@ public class PlayerController {
|
|||
public EntityNPC createPlayerEntity(World world, int type) {
|
||||
EntityNPC player = (EntityNPC)EntityRegistry.createEntityByID(type, world);
|
||||
player.setClientPlayer(this.handler);
|
||||
if(!this.gm.charEditor && this.gm.selectedCharacter >= 0 && this.gm.selectedCharacter < this.gm.characterList.size()) {
|
||||
Dimension dim = UniverseRegistry.getDimension(this.gm.characterList.get(this.gm.selectedCharacter).origin());
|
||||
player.setOrigin(new WorldPos(0, 0, 0, dim == null ? Space.INSTANCE : dim));
|
||||
}
|
||||
return player;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -45,7 +45,6 @@ import common.entity.npc.EntityHuman;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.Registry;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.log.Log;
|
||||
import common.net.bootstrap.ServerBootstrap;
|
||||
import common.net.channel.Channel;
|
||||
|
@ -73,6 +72,7 @@ import common.packet.RPacketEnableCompression;
|
|||
import common.packet.RPacketLoginSuccess;
|
||||
import common.packet.SPacketEntityEffect;
|
||||
import common.packet.SPacketChangeGameState;
|
||||
import common.packet.SPacketDimensions;
|
||||
import common.packet.SPacketPlayerListItem;
|
||||
import common.packet.SPacketPlayerAbilities;
|
||||
import common.packet.SPacketDisconnect;
|
||||
|
@ -83,6 +83,7 @@ import common.packet.SPacketServerConfig;
|
|||
import common.packet.SPacketSetExperience;
|
||||
import common.packet.SPacketSkin;
|
||||
import common.packet.SPacketTimeUpdate;
|
||||
import common.rng.Random;
|
||||
import common.tags.TagObject;
|
||||
import common.util.BlockPos;
|
||||
import common.util.EncryptUtil;
|
||||
|
@ -100,7 +101,9 @@ import server.clipboard.ReorderRegistry;
|
|||
import server.clipboard.RotationRegistry;
|
||||
import server.command.CommandEnvironment;
|
||||
import server.command.Executor;
|
||||
import server.dimension.Dimensions;
|
||||
import server.init.TeleportRegistry;
|
||||
import server.init.UniverseRegistry;
|
||||
import server.network.HandshakeHandler;
|
||||
import server.network.Player;
|
||||
import server.network.User;
|
||||
|
@ -164,6 +167,7 @@ public final class Server implements IThreadListener, Executor {
|
|||
if(Util.DEVMODE)
|
||||
Log.SYSTEM.warn("Entwicklungsmodus aktiv - Debugging-Features sind verfügbar");
|
||||
Registry.register();
|
||||
UniverseRegistry.register();
|
||||
TeleportRegistry.register();
|
||||
RotationRegistry.register();
|
||||
ReorderRegistry.register();
|
||||
|
@ -421,12 +425,17 @@ public final class Server implements IThreadListener, Executor {
|
|||
}
|
||||
}
|
||||
dim.readData(tag == null ? new TagObject() : tag);
|
||||
if(tag == null || !tag.hasLong("Seed"))
|
||||
if(tag == null || !tag.hasLong("Seed")) {
|
||||
Random rand = new Random();
|
||||
if(!Vars.seed.isEmpty())
|
||||
rand.setSeed((long)Vars.seed.hashCode() ^ ~((long)UniverseRegistry.getName(dim).hashCode()));
|
||||
dim.setSeed(rand.longv());
|
||||
Log.TICK.info("Startwert für %s: %d" + (Vars.seed.isEmpty() ? "" : " von Basiswert '%s'"), dim.getDisplay(), dim.getSeed(), Vars.seed);
|
||||
}
|
||||
}
|
||||
|
||||
private void saveDimension(Dimension dim) {
|
||||
TagObject tag = dim.writeData();
|
||||
TagObject tag = dim.writeData(false);
|
||||
File file = new File(new File(new File("chunk"), UniverseRegistry.getName(dim)), "data.cdt");
|
||||
try {
|
||||
file.getParentFile().mkdirs();
|
||||
|
@ -586,6 +595,7 @@ public final class Server implements IThreadListener, Executor {
|
|||
for(Dimension dim : UniverseRegistry.getDimensions()) {
|
||||
this.loadDimension(dim);
|
||||
}
|
||||
Dimensions.updateDimensions();
|
||||
if(this.keyPair == null) {
|
||||
Log.SYSTEM.info("Generiere neues Schlüsselpaar");
|
||||
this.keyPair = EncryptUtil.createKeypair();
|
||||
|
@ -711,7 +721,9 @@ public final class Server implements IThreadListener, Executor {
|
|||
}
|
||||
}
|
||||
if(++this.syncTimer == 20) {
|
||||
this.sendPacket(new SPacketTimeUpdate(this.space.getDayTime(), this.getInfo()));
|
||||
for(Player conn : this.players) {
|
||||
this.sendPacket(new SPacketTimeUpdate(this.space.getDayTime(), Dimensions.formatTime(conn.getPresentEntity() == null ? this.space : (WorldServer)conn.getPresentEntity().worldObj, conn.getPresentEntity(), true), this.getInfo()));
|
||||
}
|
||||
this.syncTimer = 0;
|
||||
}
|
||||
this.ticked.clear();
|
||||
|
@ -916,7 +928,8 @@ public final class Server implements IThreadListener, Executor {
|
|||
vars.add(new Pair(var.getKey(), var.getValue().getRaw()));
|
||||
}
|
||||
conn.sendPacket(new SPacketServerConfig(vars));
|
||||
conn.sendPacket(new SPacketJoinGame(player.getId(), world.dimension, EntityRegistry.getEntityID(player), tag == null));
|
||||
conn.sendPacket(new SPacketDimensions(Dimensions.getDimensionData()));
|
||||
conn.sendPacket(new SPacketJoinGame(player.getId(), world.dimension, UniverseRegistry.getName(world.dimension), EntityRegistry.getEntityID(player), tag == null));
|
||||
conn.sendPacket(new SPacketHeldItemChange(player.inventory.currentItem));
|
||||
this.sendPacket(new SPacketPlayerListItem(false, conn));
|
||||
|
||||
|
@ -1051,7 +1064,7 @@ public final class Server implements IThreadListener, Executor {
|
|||
nplayer.setPosition(nplayer.posX, nplayer.posY + 1.0D, nplayer.posZ);
|
||||
}
|
||||
}
|
||||
conn.sendPacket(new SPacketRespawn(world.dimension != oldWorld.dimension ? world.dimension : null, EntityRegistry.getEntityID(nplayer), conn.isInEditor()));
|
||||
conn.sendPacket(new SPacketRespawn(world.dimension != oldWorld.dimension ? world.dimension : null, world.dimension != oldWorld.dimension ? UniverseRegistry.getName(world.dimension) : null, EntityRegistry.getEntityID(nplayer), conn.isInEditor()));
|
||||
conn.setPlayerLocation(nplayer.posX, nplayer.posY, nplayer.posZ, nplayer.rotYaw, nplayer.rotPitch);
|
||||
conn.sendPacket(new SPacketSetExperience(nplayer.experience, nplayer.experienceTotal, nplayer.experienceLevel));
|
||||
this.updateTimeAndWeatherForPlayer(conn, world);
|
||||
|
@ -1093,7 +1106,7 @@ public final class Server implements IThreadListener, Executor {
|
|||
world.loadChunk((int)nplayer.posX >> 4, (int)nplayer.posZ >> 4);
|
||||
world.addPlayer(nplayer);
|
||||
world.spawnEntityInWorld(nplayer);
|
||||
conn.sendPacket(new SPacketRespawn(world.dimension != oldWorld.dimension ? world.dimension : null, EntityRegistry.getEntityID(nplayer), conn.isInEditor()));
|
||||
conn.sendPacket(new SPacketRespawn(world.dimension != oldWorld.dimension ? world.dimension : null, world.dimension != oldWorld.dimension ? UniverseRegistry.getName(world.dimension) : null, EntityRegistry.getEntityID(nplayer), conn.isInEditor()));
|
||||
conn.sendPacket(new SPacketSkin(nplayer.getId(), nplayer.getSkin())); // , nplayer.getModel()));
|
||||
conn.setPlayerLocation(nplayer.posX, nplayer.posY, nplayer.posZ, nplayer.rotYaw, nplayer.rotPitch);
|
||||
conn.sendPacket(new SPacketSetExperience(nplayer.experience, nplayer.experienceTotal, nplayer.experienceLevel));
|
||||
|
@ -1111,7 +1124,7 @@ public final class Server implements IThreadListener, Executor {
|
|||
public void transferToDimension(EntityNPC player, Dimension dimension, BlockPos pos, float yaw, float pitch, PortalType portal) {
|
||||
WorldServer oldWorld = (WorldServer)player.getServerWorld(); // this.getWorld(player.dimension);
|
||||
WorldServer newWorld = this.getWorld(dimension);
|
||||
player.connection.sendPacket(new SPacketRespawn(newWorld.dimension, EntityRegistry.getEntityID(player), player.connection.isInEditor()));
|
||||
player.connection.sendPacket(new SPacketRespawn(newWorld.dimension, UniverseRegistry.getName(newWorld.dimension), EntityRegistry.getEntityID(player), player.connection.isInEditor()));
|
||||
oldWorld.removePlayerEntityDangerously(player);
|
||||
player.dead = false;
|
||||
this.placeInDimension(player, oldWorld, newWorld, pos, portal);
|
||||
|
@ -1182,7 +1195,7 @@ public final class Server implements IThreadListener, Executor {
|
|||
}
|
||||
|
||||
private void updateTimeAndWeatherForPlayer(Player conn, WorldServer world) {
|
||||
conn.sendPacket(new SPacketTimeUpdate(world.getDayTime(), this.getInfo()));
|
||||
conn.sendPacket(new SPacketTimeUpdate(world.getDayTime(), Dimensions.formatTime(world, conn.getPresentEntity(), true), this.getInfo()));
|
||||
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.SET_WEATHER, world.getWeather().ordinal()));
|
||||
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.RAIN_STRENGTH, world.getRainStrength()));
|
||||
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.DARKNESS, world.getDarkness()));
|
||||
|
|
|
@ -3,8 +3,8 @@ package server.command;
|
|||
import java.util.Collection;
|
||||
|
||||
import common.dimension.Dimension;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.util.Position;
|
||||
import server.init.UniverseRegistry;
|
||||
|
||||
public class DimensionParser extends CompletingParser {
|
||||
private final boolean useSender;
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
|||
|
||||
import common.collect.Lists;
|
||||
import common.dimension.Dimension;
|
||||
import common.init.UniverseRegistry;
|
||||
import server.init.UniverseRegistry;
|
||||
import server.world.WorldServer;
|
||||
|
||||
public class WorldParser extends DimensionParser {
|
||||
|
|
|
@ -12,13 +12,16 @@ import common.dimension.Dimension;
|
|||
import common.dimension.Planet;
|
||||
import common.dimension.Star;
|
||||
import common.init.NameRegistry;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.packet.SPacketDimensions;
|
||||
import common.rng.Random;
|
||||
import server.Server;
|
||||
import server.command.ArgumentParser;
|
||||
import server.command.Command;
|
||||
import server.command.CommandEnvironment;
|
||||
import server.command.Executor;
|
||||
import server.command.RunException;
|
||||
import server.dimension.Dimensions;
|
||||
import server.init.UniverseRegistry;
|
||||
import server.network.Player;
|
||||
import server.world.Converter;
|
||||
|
||||
|
@ -27,13 +30,16 @@ public class CommandLoad extends Command {
|
|||
|
||||
private String loadingDim;
|
||||
|
||||
public static Planet registerPlanet(String star, String name, String custom, int sky, int fog, int clouds, long orbit, long rotation,
|
||||
public static Planet registerPlanet(Server server, String star, String name, String custom, int sky, int fog, int clouds, long orbit, long rotation,
|
||||
float offset, float gravity, float temperature, int brightness) {
|
||||
star = star == null ? UniverseRegistry.getName(new Random().pick(Lists.newArrayList(UniverseRegistry.getStars()))) : star;
|
||||
if(!UniverseRegistry.isType(star, DimType.STAR) || UniverseRegistry.isRegistered(name))
|
||||
return null;
|
||||
Planet dim = new Planet(sky, fog, clouds, 17000000, orbit, rotation, offset, gravity, temperature, brightness);
|
||||
return UniverseRegistry.registerCustomPlanet(name, custom, dim, star);
|
||||
Planet planet = UniverseRegistry.registerCustomPlanet(name, custom, dim, star);
|
||||
Dimensions.updateDimensions();
|
||||
server.sendPacket(new SPacketDimensions(UniverseRegistry.getId(planet), UniverseRegistry.getName(planet), planet));
|
||||
return planet;
|
||||
}
|
||||
|
||||
public static void registerPreset(Dimension preset) {
|
||||
|
@ -117,7 +123,7 @@ public class CommandLoad extends Command {
|
|||
}
|
||||
this.loadingDim = name;
|
||||
if(Converter.convert(dir, name, pos -> env.getServer().schedule(() -> {
|
||||
Planet planet = registerPlanet(star, name, display, sky, fog, clouds, orbit, rotation, (float)offset, (float)gravity, (float)temperature, brightness);
|
||||
Planet planet = registerPlanet(env.getServer(), star, name, display, sky, fog, clouds, orbit, rotation, (float)offset, (float)gravity, (float)temperature, brightness);
|
||||
this.loadingDim = null;
|
||||
exec.log(TextColor.GREEN + "Welt %s wurde erfolgreich in Dimension '%s' konvertiert", dir, display);
|
||||
if(teleport && pos != null) {
|
||||
|
@ -134,7 +140,7 @@ public class CommandLoad extends Command {
|
|||
}
|
||||
return;
|
||||
}
|
||||
Planet planet = registerPlanet(star, name, display, sky, fog, clouds, orbit, rotation, (float)offset, (float)gravity, (float)temperature, brightness);
|
||||
Planet planet = registerPlanet(env.getServer(), star, name, display, sky, fog, clouds, orbit, rotation, (float)offset, (float)gravity, (float)temperature, brightness);
|
||||
exec.log(TextColor.GREEN + "Dimension '%s' wurde registriert", display);
|
||||
if(teleport && ((Player)exec).getPresentEntity() != null)
|
||||
((Player)exec).getPresentEntity().teleport(CommandWorld.adjust(env.getServer().getWorld(planet), ((Player)exec).getPresentEntity().getPosition()), planet);
|
||||
|
|
|
@ -6,6 +6,7 @@ import server.command.Command;
|
|||
import server.command.CommandEnvironment;
|
||||
import server.command.Executor;
|
||||
import server.command.RunException;
|
||||
import server.dimension.Dimensions;
|
||||
import server.network.Player;
|
||||
import server.world.WorldServer;
|
||||
|
||||
|
@ -90,7 +91,7 @@ public class CommandTime extends Command {
|
|||
dim.setDayTime(time);
|
||||
dim.resetWeather();
|
||||
}
|
||||
exec.log("Zeit auf %s gesetzt", world.formatTime(exec.isPlayer() ? ((Player)exec).getPresentEntity() : null, false));
|
||||
exec.log("Zeit auf %s gesetzt", Dimensions.formatTime(world, exec.isPlayer() ? ((Player)exec).getPresentEntity() : null, false));
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
|
160
server/src/main/java/server/dimension/Dimensions.java
Normal file
160
server/src/main/java/server/dimension/Dimensions.java
Normal file
|
@ -0,0 +1,160 @@
|
|||
package server.dimension;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.collect.Lists;
|
||||
import common.dimension.Area;
|
||||
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.npc.EntityNPC;
|
||||
import common.packet.SPacketDimensions.DimData;
|
||||
import server.init.UniverseRegistry;
|
||||
import server.world.WorldServer;
|
||||
|
||||
public abstract class Dimensions {
|
||||
public static int calcSunColor(Dimension dim) {
|
||||
if(dim.getType() == DimType.MOON) {
|
||||
Planet planet = UniverseRegistry.getPlanet((Moon)dim);
|
||||
Star star = UniverseRegistry.getStar(planet);
|
||||
return (star.getSkyColor() & 0xffffff) | (star.isExterminated() ? 0x80000000 : 0);
|
||||
}
|
||||
else if(dim.getType() == DimType.PLANET) {
|
||||
Star star = UniverseRegistry.getStar((Planet)dim);
|
||||
return (star.getSkyColor() & 0xffffff) | (star.isExterminated() ? 0x80000000 : 0);
|
||||
}
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
public static int[] calcMoonColors(Dimension dim) {
|
||||
if(dim.getType() == DimType.MOON) {
|
||||
Planet planet = UniverseRegistry.getPlanet((Moon)dim);
|
||||
return new int[] {(planet.getSkyColor() & 0xffffff) | (planet.isExterminated() ? 0x80000000 : 0)};
|
||||
}
|
||||
else if(dim.getType() == DimType.PLANET) {
|
||||
List<Moon> moons = UniverseRegistry.getMoons((Planet)dim);
|
||||
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;
|
||||
}
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
public static String[] getBaseNames(Dimension dim) {
|
||||
if(dim == Space.INSTANCE)
|
||||
return new String[0];
|
||||
String planet = null;
|
||||
String star = null;
|
||||
switch(dim.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 int getTimeQualifier(Dimension dim, Dimension home) {
|
||||
if(home == null || home.getType() != DimType.PLANET)
|
||||
return -1;
|
||||
Planet homePlanet = (Planet)home;
|
||||
if(dim == Space.INSTANCE)
|
||||
return 7;
|
||||
else if(dim.getType() == DimType.SEMI)
|
||||
return 8;
|
||||
else if(dim.getType() == DimType.AREA)
|
||||
return 9;
|
||||
if(dim == homePlanet)
|
||||
return 0;
|
||||
Star homeStar = UniverseRegistry.getStar(homePlanet);
|
||||
if(dim == homeStar)
|
||||
return 3;
|
||||
Moon moon = dim.getType() == DimType.MOON ? (Moon)dim : null;
|
||||
Planet planet = dim.getType() == DimType.PLANET ? (Planet)dim : (moon != null ? UniverseRegistry.getPlanet(moon) : null);
|
||||
if(planet == homePlanet)
|
||||
return 1;
|
||||
Star star = dim.getType() == DimType.STAR ? (Star)dim : (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 static String formatTime(WorldServer world, Dimension home, int category, boolean days) {
|
||||
String qualifier = home != null ? (category >= 0 ? category + "." : "?.") : "";
|
||||
long time = world.getDayTime();
|
||||
String gtime;
|
||||
if((home == null || !home.isCelestial()) && !world.dimension.isCelestial()) {
|
||||
gtime = "???.???.M?";
|
||||
}
|
||||
else {
|
||||
long yearTime = (home != null && home.isCelestial() ? home : world.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(!world.dimension.isCelestial()) {
|
||||
ltime = " T???.??? D???.???.G?";
|
||||
}
|
||||
else {
|
||||
long day = time / world.dimension.getRotationalPeriod();
|
||||
time = time % world.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 static String formatTime(WorldServer world, EntityNPC player, boolean days) {
|
||||
return formatTime(world, player == null ? null : player.getOrigin().getDimension(), player == null ? -1 : getTimeQualifier(world.dimension, player.getOrigin().getDimension()), days);
|
||||
}
|
||||
|
||||
public static void updateDimensions() {
|
||||
for(Dimension dim : UniverseRegistry.getDimensions()) {
|
||||
if(dim == Space.INSTANCE)
|
||||
continue;
|
||||
if(dim.getType() == DimType.PLANET || dim.getType() == DimType.MOON) {
|
||||
dim.setSunColor(calcSunColor(dim));
|
||||
dim.setMoonColors(calcMoonColors(dim));
|
||||
}
|
||||
dim.setBaseNames(getBaseNames(dim));
|
||||
}
|
||||
}
|
||||
|
||||
public static List<DimData> getDimensionData() {
|
||||
List<DimData> list = Lists.newArrayList();
|
||||
for(Dimension dim : UniverseRegistry.getDimensions()) {
|
||||
list.add(new DimData(UniverseRegistry.getId(dim), UniverseRegistry.getName(dim), dim.getType(), dim.getDisplay(), dim.getBaseNames()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@ package server.init;
|
|||
import java.util.Map;
|
||||
import common.collect.Maps;
|
||||
import common.dimension.Dimension;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.util.PortalType;
|
||||
|
||||
public abstract class TeleportRegistry {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package common.init;
|
||||
package server.init;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import common.biome.Biome;
|
||||
|
@ -51,17 +50,16 @@ import common.entity.npc.EntityUndead;
|
|||
import common.entity.npc.EntityWoodElf;
|
||||
import common.entity.npc.EntityZombie;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.DimensionRegistry;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.MetalType;
|
||||
import common.world.Weather;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class UniverseRegistry {
|
||||
public abstract class UniverseRegistry extends DimensionRegistry {
|
||||
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();
|
||||
|
@ -76,10 +74,6 @@ public abstract class UniverseRegistry {
|
|||
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;
|
||||
}
|
||||
|
@ -156,25 +150,6 @@ public abstract class UniverseRegistry {
|
|||
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);
|
||||
}
|
||||
|
@ -482,7 +457,7 @@ public abstract class UniverseRegistry {
|
|||
// 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)
|
||||
public 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", () -> {
|
|
@ -15,6 +15,7 @@ import common.block.tech.InteractionObject;
|
|||
import common.collect.Lists;
|
||||
import common.color.TextColor;
|
||||
import common.dimension.Dimension;
|
||||
import common.dimension.Space;
|
||||
import common.effect.Effect;
|
||||
import common.effect.StatusEffect;
|
||||
import common.entity.Entity;
|
||||
|
@ -32,7 +33,6 @@ import common.init.Blocks;
|
|||
import common.init.EntityRegistry;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.inventory.Container;
|
||||
import common.inventory.ContainerChest;
|
||||
import common.inventory.ContainerEnchantment;
|
||||
|
@ -131,6 +131,7 @@ import server.clipboard.ClipboardPlacer;
|
|||
import server.clipboard.RotationRegistry;
|
||||
import server.clipboard.RotationValue;
|
||||
import server.command.Executor;
|
||||
import server.init.UniverseRegistry;
|
||||
import server.util.Form;
|
||||
import server.vars.SVars;
|
||||
import server.world.ChunkServer;
|
||||
|
@ -1592,7 +1593,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
String type = EntityRegistry.getEntityName(tag.getString("id"));
|
||||
int level = tag.getInt("XpLevel");
|
||||
Dimension origin = UniverseRegistry.getDimension(tag.getString("OriginDim"));
|
||||
return new PlayerCharacter(name, info, align, dim, pos, type, level, origin == null ? null : UniverseRegistry.getName(origin));
|
||||
return new PlayerCharacter(name, info, align, dim, pos, type, level, origin == null || origin == Space.INSTANCE ? null : origin.getDisplay());
|
||||
}
|
||||
|
||||
public void onConnect() {
|
||||
|
@ -2460,7 +2461,7 @@ public class Player extends User implements Executor, IPlayer
|
|||
Position pos = this.server.getRandomSpawnPosition(origin);
|
||||
this.entity.teleport(pos);
|
||||
this.teleportPos = this.deathPos = null;
|
||||
this.sendPacket(new SPacketCharacterList(this.selected, this.selected, new PlayerCharacter(this.entity.getCustomNameTag(), this.entity.getDescription(), this.entity.getAlignment(), this.entity.worldObj.dimension.getDisplay(), this.entity.getPosition(), EntityRegistry.getEntityName(EntityRegistry.getEntityString(this.entity)), this.entity.experienceLevel, UniverseRegistry.getName(world.dimension))));
|
||||
this.sendPacket(new SPacketCharacterList(this.selected, this.selected, new PlayerCharacter(this.entity.getCustomNameTag(), this.entity.getDescription(), this.entity.getAlignment(), this.entity.worldObj.dimension.getDisplay(), this.entity.getPosition(), EntityRegistry.getEntityName(EntityRegistry.getEntityString(this.entity)), this.entity.experienceLevel, world.dimension == Space.INSTANCE ? null : world.dimension.getDisplay())));
|
||||
// if(this.local)
|
||||
// this.server.setDone();
|
||||
break;
|
||||
|
|
|
@ -25,6 +25,7 @@ import common.block.natural.BlockSnow;
|
|||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.collect.Sets;
|
||||
import common.dimension.DimType;
|
||||
import common.dimension.Dimension;
|
||||
import common.dimension.Dimension.GeneratorType;
|
||||
import common.dimension.Lake;
|
||||
|
@ -39,7 +40,6 @@ import common.entity.npc.EntityNPC;
|
|||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.SoundEvent;
|
||||
import common.init.UniverseRegistry;
|
||||
import common.init.WoodType;
|
||||
import common.log.Log;
|
||||
import common.network.IPlayer;
|
||||
|
@ -82,7 +82,9 @@ import common.world.Weather;
|
|||
import common.world.World;
|
||||
import server.Server;
|
||||
import server.clipboard.ClipboardBlock;
|
||||
import server.dimension.Dimensions;
|
||||
import server.init.TeleportRegistry;
|
||||
import server.init.UniverseRegistry;
|
||||
import server.network.Player;
|
||||
import server.vars.SVars;
|
||||
import server.village.VillageCollection;
|
||||
|
@ -1504,7 +1506,7 @@ public final class WorldServer extends AWorldServer {
|
|||
if(this.dimension.isExterminated())
|
||||
return false;
|
||||
this.resetData(true);
|
||||
this.reloadChunks();
|
||||
// this.reloadChunks(); //TODO: why was this here?
|
||||
for(EntityNPC player : this.players) {
|
||||
player.attackEntityFrom(DamageSource.causeExterminatusDamage(null), 5000);
|
||||
Packet packet = new SPacketEffect(1025, new BlockPos(player.posX, (double)this.getSeaLevel() + 4.0, player.posZ), 0);
|
||||
|
@ -1541,11 +1543,16 @@ public final class WorldServer extends AWorldServer {
|
|||
this.dimension.setExterminated(exterminated);
|
||||
this.initGenerator(exterminated);
|
||||
this.reloadChunks();
|
||||
if(updated)
|
||||
if(updated) {
|
||||
Dimensions.updateDimensions();
|
||||
for(Player player : this.server.getPlayers()) {
|
||||
if(player.getEntity() != null)
|
||||
player.sendPacket(new SPacketCelestials(player.getEntity().worldObj.dimension));
|
||||
if(player.getEntity() != null) {
|
||||
Dimension dim = player.getEntity().worldObj.dimension;
|
||||
if(dim.getType() == DimType.PLANET || dim.getType() == DimType.MOON)
|
||||
player.sendPacket(new SPacketCelestials(dim));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void insertChunk(int x, int z) {
|
||||
|
|
|
@ -57,13 +57,14 @@ public class BiomeGenerator {
|
|||
|
||||
public BiomeGenerator(long seed, Biome def, boolean fixed, int biomeSize, int riverSize, int snowRarity, int seaRarity,
|
||||
Biome[] add, int addRarity, Biome[] hot, Biome[] medium, Biome[] cold, Biome[] frost) {
|
||||
this.biomes = new Biome[5 + hot.length + medium.length + cold.length + frost.length + add.length];
|
||||
this.defBiome = this.biomes[GenLayer.NONE] = def;
|
||||
this.biomes = new Biome[6 + hot.length + medium.length + cold.length + frost.length + add.length];
|
||||
this.biomes[GenLayer.NONE] = new Biome(def.temperature, def.humidity, def.depth, def.scale);
|
||||
this.biomes[GenLayer.RIVER] = new Biome(0.0f, 50.0f, Scaling.SEA_SHALLOW);
|
||||
this.biomes[GenLayer.SEA] = new Biome(0.0f, 50.0f, Scaling.SEA_MEDIUM);
|
||||
this.biomes[GenLayer.ICE_RIVER] = new Biome(-20.0f, 50.0f, Scaling.SEA_SHALLOW);
|
||||
this.biomes[GenLayer.ICE_SEA] = new Biome(-20.0f, 50.0f, Scaling.SEA_MEDIUM);
|
||||
int n = 5;
|
||||
this.defBiome = this.biomes[GenLayer.DEFAULT] = def;
|
||||
int n = 6;
|
||||
for(Biome biome : frost) {
|
||||
this.biomes[n++] = biome;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ public abstract class GenLayer {
|
|||
public static final int SEA = 2;
|
||||
public static final int ICE_RIVER = 3;
|
||||
public static final int ICE_SEA = 4;
|
||||
public static final int DEFAULT = 5;
|
||||
|
||||
private long worldGenSeed;
|
||||
private long chunkSeed;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue