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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue