code cleanup: use records where possible
This commit is contained in:
parent
f30141c8f3
commit
8e0bbd06c2
139 changed files with 957 additions and 1777 deletions
|
@ -1125,7 +1125,7 @@ public class Client implements IThreadListener {
|
|||
this.framecode(), this.framerate < 1.0f ? 1.0f / this.framerate : this.framerate, this.framerate < 1.0f ? "SPF" : "FPS",
|
||||
this.vsync ? TextColor.DGRAY + "VSYNC" : (this.syncLimited ? TextColor.GREEN + "" + this.syncLimit : TextColor.RED + "UNL"),
|
||||
(float)PerfSection.getTotal(false) / 1000.0f, this.fb_raw_x, this.fb_raw_y,
|
||||
this.fullscreen ? " @ " + (this.vidMode == null ? "?" : this.vidMode.refresh) + " Hz" : "",
|
||||
this.fullscreen ? " @ " + (this.vidMode == null ? "?" : this.vidMode.refresh()) + " Hz" : "",
|
||||
this.tpscode(), this.tickrate < 1.0f ? 1.0f / this.tickrate : this.tickrate,
|
||||
this.tickrate < 1.0f ? "SPT" : "TPS", (float)this.tickTarget / 1000.0f,
|
||||
(float)this.tick_time / 1000.0f, this.tickTimeout,
|
||||
|
@ -2089,40 +2089,40 @@ public class Client implements IThreadListener {
|
|||
|
||||
public void poll() {
|
||||
for(WindowEvent event : Window.poll()) {
|
||||
switch(event.action) {
|
||||
switch(event.action()) {
|
||||
case BUTTON:
|
||||
if(event.param1 >= 0 && event.param1 < Button.values().length)
|
||||
button(Button.values()[event.param1], event.param2 != 0);
|
||||
if(event.param1() >= 0 && event.param1() < Button.values().length)
|
||||
button(Button.values()[event.param1()], event.param2() != 0);
|
||||
break;
|
||||
case CHARACTER:
|
||||
if(event.param1 >= (int)Log.CHR_SPC && event.param1 <= (int)Character.MAX_VALUE)
|
||||
character((char)event.param1);
|
||||
if(event.param1() >= (int)Log.CHR_SPC && event.param1() <= (int)Character.MAX_VALUE)
|
||||
character((char)event.param1());
|
||||
break;
|
||||
case CLOSED:
|
||||
closed();
|
||||
break;
|
||||
case CURSOR:
|
||||
mouse(event.param1, event.param2);
|
||||
mouse(event.param1(), event.param2());
|
||||
break;
|
||||
case FOCUS:
|
||||
focus(event.param1 != 0);
|
||||
focus(event.param1() != 0);
|
||||
break;
|
||||
case KEY:
|
||||
if(event.param1 >= 0 && event.param1 < Keysym.values().length)
|
||||
key(Keysym.values()[event.param1], KeyEvent.values()[event.param2 % KeyEvent.values().length]);
|
||||
if(event.param1() >= 0 && event.param1() < Keysym.values().length)
|
||||
key(Keysym.values()[event.param1()], KeyEvent.values()[event.param2() % KeyEvent.values().length]);
|
||||
break;
|
||||
case POSITION:
|
||||
pos(event.param1, event.param2);
|
||||
pos(event.param1(), event.param2());
|
||||
break;
|
||||
case REDRAW:
|
||||
// redraw(); disable as it is pretty useless
|
||||
break;
|
||||
case RESIZE:
|
||||
fbsize(event.param1, event.param2);
|
||||
fbsize(event.param1(), event.param2());
|
||||
break;
|
||||
case SCROLL:
|
||||
if(event.param1 != 0 || event.param2 != 0)
|
||||
scroll(event.param1, event.param2);
|
||||
if(event.param1() != 0 || event.param2() != 0)
|
||||
scroll(event.param1(), event.param2());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2138,7 +2138,7 @@ public class Client implements IThreadListener {
|
|||
public void full(boolean full) {
|
||||
if((full != fullscreen || full) && (!full || vidMode != null)) {
|
||||
if(full) {
|
||||
Window.setFullscreen(vidMode.width, vidMode.height, vidMode.refresh);
|
||||
Window.setFullscreen(vidMode.width(), vidMode.height(), vidMode.refresh());
|
||||
}
|
||||
else {
|
||||
Window.setWindowed(saved_xpos, saved_ypos, xsize, ysize);
|
||||
|
@ -2156,7 +2156,7 @@ public class Client implements IThreadListener {
|
|||
}
|
||||
else {
|
||||
DisplayMode mode = Window.getDisplayMode();
|
||||
syncLimit = mode != null ? mode.refresh : 60;
|
||||
syncLimit = mode != null ? mode.refresh() : 60;
|
||||
}
|
||||
Window.setVSync(vsync);
|
||||
}
|
||||
|
@ -3113,13 +3113,13 @@ public class Client implements IThreadListener {
|
|||
y = up ? y - Font.YGLYPH : y;
|
||||
for(Iterator<Message> iter = log.iterator(); iter.hasNext();) {
|
||||
Message msg = iter.next();
|
||||
if((this.tmr_current - msg.time) <= fade || (log == this.chat && this.chatPermanent)) {
|
||||
if((this.tmr_current - msg.time()) <= fade || (log == this.chat && this.chatPermanent)) {
|
||||
if(align > 0)
|
||||
Drawing.drawTextbox(msg.message, x, y, bg);
|
||||
Drawing.drawTextbox(msg.message(), x, y, bg);
|
||||
else if(align < 0)
|
||||
Drawing.drawTextboxRight(msg.message, x, y, bg);
|
||||
Drawing.drawTextboxRight(msg.message(), x, y, bg);
|
||||
else
|
||||
Drawing.drawTextboxCentered(msg.message, x, y, bg);
|
||||
Drawing.drawTextboxCentered(msg.message(), x, y, bg);
|
||||
y += up ? -(Font.YGLYPH) : Font.YGLYPH;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -20,7 +20,7 @@ import common.color.TextColor;
|
|||
import common.log.Log;
|
||||
import common.network.IPlayer;
|
||||
import common.util.EncryptUtil;
|
||||
import common.util.Tuple;
|
||||
import common.util.Pair;
|
||||
import common.util.Util;
|
||||
|
||||
public class GuiConnect extends GuiList<GuiConnect.ServerInfo> implements ButtonCallback {
|
||||
|
@ -225,35 +225,35 @@ public class GuiConnect extends GuiList<GuiConnect.ServerInfo> implements Button
|
|||
}
|
||||
}
|
||||
else {
|
||||
Tuple<String, String> value = Util.getKeyValue(line);
|
||||
if(value.first.equals("address"))
|
||||
address = value.second;
|
||||
else if(value.first.equals("port"))
|
||||
Pair<String, String> value = Util.getKeyValue(line);
|
||||
if(value.first().equals("address"))
|
||||
address = value.second();
|
||||
else if(value.first().equals("port"))
|
||||
try {
|
||||
port = Integer.parseInt(value.second);
|
||||
port = Integer.parseInt(value.second());
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
}
|
||||
else if(value.first.equals("user"))
|
||||
user = value.second;
|
||||
else if(value.first.equals("password"))
|
||||
password = value.second;
|
||||
else if(value.first.equals("access"))
|
||||
access = value.second;
|
||||
else if(value.first.equals("connected"))
|
||||
else if(value.first().equals("user"))
|
||||
user = value.second();
|
||||
else if(value.first().equals("password"))
|
||||
password = value.second();
|
||||
else if(value.first().equals("access"))
|
||||
access = value.second();
|
||||
else if(value.first().equals("connected"))
|
||||
try {
|
||||
time = Long.parseLong(value.second);
|
||||
time = Long.parseLong(value.second());
|
||||
}
|
||||
catch(NumberFormatException e) {
|
||||
}
|
||||
else if(value.first.equals("encryption_enforced"))
|
||||
else if(value.first().equals("encryption_enforced"))
|
||||
enforceEnc = true;
|
||||
else if(value.first.equals("serverkey"))
|
||||
serverKey = Util.fromHexString(value.second);
|
||||
else if(value.first.equals("key"))
|
||||
key = Util.fromHexString(value.second);
|
||||
else if(value.first.equals("pubkey"))
|
||||
pubkey = Util.fromHexString(value.second);
|
||||
else if(value.first().equals("serverkey"))
|
||||
serverKey = Util.fromHexString(value.second());
|
||||
else if(value.first().equals("key"))
|
||||
key = Util.fromHexString(value.second());
|
||||
else if(value.first().equals("pubkey"))
|
||||
pubkey = Util.fromHexString(value.second());
|
||||
}
|
||||
}
|
||||
Collections.sort(this.elements);
|
||||
|
|
|
@ -54,7 +54,7 @@ import common.entity.npc.EntityHuman;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.npc.SpeciesInfo;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.EntityEggInfo;
|
||||
import common.init.EntityInfo;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.SpeciesRegistry;
|
||||
import common.init.UniverseRegistry;
|
||||
|
@ -399,9 +399,9 @@ 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(UniverseRegistry.getBaseDimensions().size());
|
||||
EntityEggInfo egg = EntityRegistry.SPAWN_EGGS.get(this.gm.player == null ? EntityRegistry.getEntityString(EntityHuman.class) : EntityRegistry.getEntityString(this.gm.player));
|
||||
if(egg != null && egg.origin != null) {
|
||||
Dimension dim = UniverseRegistry.getDimension(egg.origin);
|
||||
EntityInfo egg = EntityRegistry.SPAWN_EGGS.get(this.gm.player == null ? EntityRegistry.getEntityString(EntityHuman.class) : EntityRegistry.getEntityString(this.gm.player));
|
||||
if(egg != null && egg.origin() != null) {
|
||||
Dimension dim = UniverseRegistry.getDimension(egg.origin());
|
||||
if(dim != null) {
|
||||
for(int z = 0; z < UniverseRegistry.getBaseDimensions().size(); z++) {
|
||||
if(UniverseRegistry.getBaseDimensions().get(z).getDimensionId() == dim.getDimensionId()) {
|
||||
|
|
|
@ -33,10 +33,10 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> impleme
|
|||
Drawing.drawRect(x, y, 1, 36, 0xffaf0000);
|
||||
String str = this.character == null ? TextColor.BLUE + "[" + TextColor.CYAN + "+" + TextColor.BLUE + "]" :
|
||||
String.format(TextColor.GREEN + "Level " + TextColor.DGREEN + "%d " + TextColor.YELLOW + "%s " + TextColor.VIOLET + "%s" + TextColor.GRAY + " [%s%s" + TextColor.GRAY + "]",
|
||||
character.level, character.type, character.name, character.align.color, character.align.display);
|
||||
character.level(), character.type(), character.name(), character.align().color, character.align().display);
|
||||
String pos = this.character == null ? TextColor.BROWN + "Neuen Charakter erstellen" :
|
||||
String.format(TextColor.NEON + "%s " + TextColor.GRAY + "bei " + TextColor.ACID + "%d" + TextColor.GRAY + ", " + TextColor.ACID + "%d" + TextColor.GRAY + ", " + TextColor.ACID + "%d",
|
||||
character.dim, character.pos.getX(), character.pos.getY(), character.pos.getZ());
|
||||
character.dim(), character.pos().getX(), character.pos().getY(), character.pos().getZ());
|
||||
Drawing.drawText(str, x + 3, y, 0xffffffff);
|
||||
Drawing.drawText(pos, x + 3, y + 16, 0xffffffff);
|
||||
}
|
||||
|
@ -60,7 +60,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*" : (entry.character.info == null ? "*keine Beschreibung vorhanden*" : this.getSelected().character.info)));
|
||||
this.descField.setText(entry == null ? "" : (entry.character == null ? "*neuer Charakter*" : (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 = entry != null && entry.character != null && !entry.initial;
|
||||
|
@ -74,7 +74,7 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> impleme
|
|||
if(this.gm.getNetHandler() != null) {
|
||||
int initialSelection = this.gm.getNetHandler().getSelectedCharacter();
|
||||
for(PlayerCharacter character : this.gm.getNetHandler().getCharacterList()) {
|
||||
this.elements.add(new CharacterEntry(initialSelection == this.elements.size() ? new PlayerCharacter(character.name, character.info, character.align, this.gm.player.worldObj.dimension.getFormattedName(false), this.gm.player.getPosition(), character.type, this.gm.player.experienceLevel) : character, initialSelection == this.elements.size()));
|
||||
this.elements.add(new CharacterEntry(initialSelection == this.elements.size() ? new PlayerCharacter(character.name(), character.info(), character.align(), this.gm.player.worldObj.dimension.getFormattedName(false), this.gm.player.getPosition(), character.type(), this.gm.player.experienceLevel) : character, initialSelection == this.elements.size()));
|
||||
}
|
||||
this.elements.add(new CharacterEntry(null, false));
|
||||
this.setSelected(initialSelection);
|
||||
|
@ -116,7 +116,7 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> impleme
|
|||
GuiCharacters.this.gm.getNetHandler().addToSendQueue(new CPacketAction(CPacketAction.Action.DELETE_CHARACTER, GuiCharacters.this.selectedElement));
|
||||
GuiCharacters.this.gm.displayGuiScreen(GuiCharacters.this);
|
||||
}
|
||||
}, "Möchtest du diesen Charakter wirklich löschen?", "Der Fortschritt, die Gegenstände und die Historie von \"" + entry.character.name + "\" werden für imer verloren sein!", "Löschen", "Abbrechen"));
|
||||
}, "Möchtest du diesen Charakter wirklich löschen?", "Der Fortschritt, die Gegenstände und die Historie von \"" + entry.character.name() + "\" werden für imer verloren sein!", "Löschen", "Abbrechen"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,9 +81,9 @@ public class GuiMerchant extends GuiContainer
|
|||
if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) {
|
||||
int k = this.selectedMerchantRecipe;
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
||||
ItemStack itemstack = merchantrecipe.getBuying();
|
||||
ItemStack itemstack1 = merchantrecipe.getSecondBuy();
|
||||
ItemStack itemstack2 = merchantrecipe.getSelling();
|
||||
ItemStack itemstack = merchantrecipe.first();
|
||||
ItemStack itemstack1 = merchantrecipe.second();
|
||||
ItemStack itemstack2 = merchantrecipe.result();
|
||||
this.renderItemOverlayIntoGUI(itemstack, 36, 24, null);
|
||||
if(itemstack1 != null)
|
||||
this.renderItemOverlayIntoGUI(itemstack1, 62, 24, null);
|
||||
|
@ -180,9 +180,9 @@ public class GuiMerchant extends GuiContainer
|
|||
// int j = (this.height - this.ySize) / 2;
|
||||
int k = this.selectedMerchantRecipe;
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
|
||||
ItemStack itemstack = merchantrecipe.getBuying();
|
||||
ItemStack itemstack1 = merchantrecipe.getSecondBuy();
|
||||
ItemStack itemstack2 = merchantrecipe.getSelling();
|
||||
ItemStack itemstack = merchantrecipe.first();
|
||||
ItemStack itemstack1 = merchantrecipe.second();
|
||||
ItemStack itemstack2 = merchantrecipe.result();
|
||||
GL11.glPushMatrix();
|
||||
ItemRenderer.enableGUIStandardItemLighting();
|
||||
GlState.disableLighting();
|
||||
|
|
|
@ -35,9 +35,9 @@ public class GuiForm extends Gui implements ButtonCallback {
|
|||
this.add(new Label(0, -100, 300, 20, this.title));
|
||||
for(int z = 0; z < this.inputs.length; z++) {
|
||||
final int index = z;
|
||||
final String name = this.inputData[z].first;
|
||||
Object obj = this.inputData[z].second;
|
||||
int param = this.inputData[z].third;
|
||||
final String name = this.inputData[z].first();
|
||||
Object obj = this.inputData[z].second();
|
||||
int param = this.inputData[z].third();
|
||||
if(obj instanceof Boolean) {
|
||||
this.inputs[z] = this.add(new Toggle(0, 50 * z, 300, 24, (Boolean)obj, (Boolean)obj, new ToggleCallback() {
|
||||
public void use(Toggle elem, boolean value) {
|
||||
|
@ -97,15 +97,15 @@ public class GuiForm extends Gui implements ButtonCallback {
|
|||
this.inputData = data;
|
||||
this.outputData = new Object[data.length];
|
||||
for(int z = 0; z < data.length; z++) {
|
||||
Object obj = data[z].second;
|
||||
this.outputData[z] = obj instanceof String[] ? data[z].third : obj;
|
||||
Object obj = data[z].second();
|
||||
this.outputData[z] = obj instanceof String[] ? data[z].third() : obj;
|
||||
}
|
||||
}
|
||||
|
||||
public void use(ActButton elem, PressType action) {
|
||||
for(int z = 0; z < this.inputs.length; z++) {
|
||||
if(this.inputs[z] instanceof Field) {
|
||||
int min = (this.inputData[z].third & 0x7fffffff) >> 16;
|
||||
int min = (this.inputData[z].third() & 0x7fffffff) >> 16;
|
||||
String text = this.inputs[z].getText();
|
||||
if(text.length() < min) {
|
||||
if(!GuiForm.this.labels[z].getText().startsWith("" + TextColor.RED))
|
||||
|
|
|
@ -135,7 +135,6 @@ import common.potion.PotionEffect;
|
|||
import common.rng.Random;
|
||||
import common.sound.Sound;
|
||||
import common.tileentity.IInteractionObject;
|
||||
import common.tileentity.LocalBlockIntercommunication;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityMachine;
|
||||
import common.tileentity.TileEntitySign;
|
||||
|
@ -1171,7 +1170,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
|
|||
}
|
||||
else if (!packetIn.hasSlots())
|
||||
{
|
||||
entityplayersp.displayGui(new LocalBlockIntercommunication(packetIn.getGuiId(), packetIn.getWindowTitle()));
|
||||
entityplayersp.displayGui(new DummyContainer(packetIn.getGuiId(), packetIn.getWindowTitle()));
|
||||
entityplayersp.openContainer.windowId = packetIn.getWindowId();
|
||||
}
|
||||
else
|
||||
|
|
12
client/src/main/java/client/network/DummyContainer.java
Executable file
12
client/src/main/java/client/network/DummyContainer.java
Executable file
|
@ -0,0 +1,12 @@
|
|||
package client.network;
|
||||
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.inventory.Container;
|
||||
import common.inventory.InventoryPlayer;
|
||||
import common.tileentity.IInteractionObject;
|
||||
|
||||
public record DummyContainer(String getGuiID, String getCommandName) implements IInteractionObject {
|
||||
public Container createContainer(InventoryPlayer playerInventory, EntityNPC playerIn) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
|
@ -189,7 +189,7 @@ public class BlockRenderer
|
|||
|
||||
for (Facing enumfacing : Facing.values())
|
||||
{
|
||||
List<BakedQuad> list = modelIn.getFaceQuads(enumfacing);
|
||||
List<BakedQuad> list = modelIn.getFace(enumfacing);
|
||||
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
|
@ -204,7 +204,7 @@ public class BlockRenderer
|
|||
}
|
||||
}
|
||||
|
||||
List<BakedQuad> list1 = modelIn.getGeneralQuads();
|
||||
List<BakedQuad> list1 = modelIn.getQuads();
|
||||
|
||||
if (list1.size() > 0)
|
||||
{
|
||||
|
@ -348,10 +348,10 @@ public class BlockRenderer
|
|||
{
|
||||
for (Facing enumfacing : Facing.values())
|
||||
{
|
||||
this.renderModelBrightnessColorQuads(p_178262_2_, red, green, blue, bakedModel.getFaceQuads(enumfacing));
|
||||
this.renderModelBrightnessColorQuads(p_178262_2_, red, green, blue, bakedModel.getFace(enumfacing));
|
||||
}
|
||||
|
||||
this.renderModelBrightnessColorQuads(p_178262_2_, red, green, blue, bakedModel.getGeneralQuads());
|
||||
this.renderModelBrightnessColorQuads(p_178262_2_, red, green, blue, bakedModel.getQuads());
|
||||
}
|
||||
|
||||
private void renderModelBrightness(IBakedModel model, State p_178266_2_, float brightness, boolean p_178266_4_)
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ItemModelMesher
|
|||
|
||||
public TextureAtlasSprite getParticleIcon(Item item, int meta)
|
||||
{
|
||||
return this.getItemModel(new ItemStack(item, 1, meta)).getParticleTexture();
|
||||
return this.getItemModel(new ItemStack(item, 1, meta)).getBaseTexture();
|
||||
}
|
||||
|
||||
public IBakedModel getItemModel(ItemStack stack)
|
||||
|
|
|
@ -196,7 +196,7 @@ public class RenderBuffer
|
|||
{
|
||||
int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.getOffset(this.vertexFormatIndex);
|
||||
|
||||
switch (this.vertexFormatElement.getType())
|
||||
switch (this.vertexFormatElement.type())
|
||||
{
|
||||
case FLOAT:
|
||||
this.byteBuffer.putFloat(i, (float)u);
|
||||
|
@ -229,7 +229,7 @@ public class RenderBuffer
|
|||
{
|
||||
int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.getOffset(this.vertexFormatIndex);
|
||||
|
||||
switch (this.vertexFormatElement.getType())
|
||||
switch (this.vertexFormatElement.type())
|
||||
{
|
||||
case FLOAT:
|
||||
this.byteBuffer.putFloat(i, (float)p_181671_1_);
|
||||
|
@ -381,7 +381,7 @@ public class RenderBuffer
|
|||
{
|
||||
int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.getOffset(this.vertexFormatIndex);
|
||||
|
||||
switch (this.vertexFormatElement.getType())
|
||||
switch (this.vertexFormatElement.type())
|
||||
{
|
||||
case FLOAT:
|
||||
this.byteBuffer.putFloat(i, (float)red / 255.0F);
|
||||
|
@ -447,7 +447,7 @@ public class RenderBuffer
|
|||
{
|
||||
int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.getOffset(this.vertexFormatIndex);
|
||||
|
||||
switch (this.vertexFormatElement.getType())
|
||||
switch (this.vertexFormatElement.type())
|
||||
{
|
||||
case FLOAT:
|
||||
this.byteBuffer.putFloat(i, (float)(x + this.xOffset));
|
||||
|
@ -500,7 +500,7 @@ public class RenderBuffer
|
|||
this.vertexFormatIndex %= this.vertexFormat.getElementCount();
|
||||
this.vertexFormatElement = this.vertexFormat.getElement(this.vertexFormatIndex);
|
||||
|
||||
if (this.vertexFormatElement.getUsage() == VertexFormatElement.EnumUsage.PADDING)
|
||||
if (this.vertexFormatElement.usage() == VertexFormatElement.EnumUsage.PADDING)
|
||||
{
|
||||
this.nextVertexFormatIndex();
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ public class RenderBuffer
|
|||
{
|
||||
int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.getOffset(this.vertexFormatIndex);
|
||||
|
||||
switch (this.vertexFormatElement.getType())
|
||||
switch (this.vertexFormatElement.type())
|
||||
{
|
||||
case FLOAT:
|
||||
this.byteBuffer.putFloat(i, p_181663_1_);
|
||||
|
|
|
@ -1042,8 +1042,8 @@ public class RenderGlobal
|
|||
// {
|
||||
for (VertexFormatElement vertexformatelement : DefaultVertexFormats.BLOCK.getElements())
|
||||
{
|
||||
VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage();
|
||||
int i = vertexformatelement.getIndex();
|
||||
VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.usage();
|
||||
int i = vertexformatelement.index();
|
||||
|
||||
switch (vertexformatelement$enumusage)
|
||||
{
|
||||
|
|
|
@ -28,27 +28,27 @@ public abstract class Tessellator
|
|||
for (int j = 0; j < list.size(); ++j)
|
||||
{
|
||||
VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j);
|
||||
VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage();
|
||||
int k = vertexformatelement.getType().getGlConstant();
|
||||
int l = vertexformatelement.getIndex();
|
||||
VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.usage();
|
||||
int k = vertexformatelement.type().getGlConstant();
|
||||
int l = vertexformatelement.index();
|
||||
bytebuffer.position(vertexformat.getOffset(j));
|
||||
|
||||
switch (vertexformatelement$enumusage)
|
||||
{
|
||||
case POSITION:
|
||||
GL11.glVertexPointer(vertexformatelement.getElementCount(), k, i, bytebuffer);
|
||||
GL11.glVertexPointer(vertexformatelement.count(), k, i, bytebuffer);
|
||||
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
break;
|
||||
|
||||
case UV:
|
||||
GL13.glClientActiveTexture(GL13.GL_TEXTURE0 + l);
|
||||
GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, i, bytebuffer);
|
||||
GL11.glTexCoordPointer(vertexformatelement.count(), k, i, bytebuffer);
|
||||
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||
GL13.glClientActiveTexture(GL13.GL_TEXTURE0);
|
||||
break;
|
||||
|
||||
case COLOR:
|
||||
GL11.glColorPointer(vertexformatelement.getElementCount(), k, i, bytebuffer);
|
||||
GL11.glColorPointer(vertexformatelement.count(), k, i, bytebuffer);
|
||||
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
|
||||
break;
|
||||
|
||||
|
@ -64,8 +64,8 @@ public abstract class Tessellator
|
|||
for (int j1 = list.size(); i1 < j1; ++i1)
|
||||
{
|
||||
VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1);
|
||||
VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage();
|
||||
int k1 = vertexformatelement1.getIndex();
|
||||
VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.usage();
|
||||
int k1 = vertexformatelement1.index();
|
||||
|
||||
switch (vertexformatelement$enumusage1)
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ public class VertexFormat
|
|||
|
||||
public VertexFormat addElement(VertexFormatElement element)
|
||||
{
|
||||
if (element.isPositionElement() && this.hasPosition())
|
||||
if (element.isPosition() && this.hasPosition())
|
||||
{
|
||||
Log.RENDER.warn("VertexFormat-Fehler: Versuche eine Position vom Typ VertexFormatElement hinzuzufügen, während eine bereits existiert, ignoriere.");
|
||||
return this;
|
||||
|
@ -61,7 +61,7 @@ public class VertexFormat
|
|||
this.elements.add(element);
|
||||
this.offsets.add(Integer.valueOf(this.nextOffset));
|
||||
|
||||
switch (element.getUsage())
|
||||
switch (element.usage())
|
||||
{
|
||||
case NORMAL:
|
||||
this.normalElementOffset = this.nextOffset;
|
||||
|
@ -72,10 +72,10 @@ public class VertexFormat
|
|||
break;
|
||||
|
||||
case UV:
|
||||
this.uvOffsetsById.add(element.getIndex(), Integer.valueOf(this.nextOffset));
|
||||
this.uvOffsetsById.add(element.index(), Integer.valueOf(this.nextOffset));
|
||||
}
|
||||
|
||||
this.nextOffset += element.getSize();
|
||||
this.nextOffset += element.size();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public class VertexFormat
|
|||
{
|
||||
VertexFormatElement vertexformatelement = (VertexFormatElement)this.elements.get(i);
|
||||
|
||||
if (vertexformatelement.isPositionElement())
|
||||
if (vertexformatelement.isPosition())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2,155 +2,83 @@ package client.renderer;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import common.log.Log;
|
||||
public record VertexFormatElement(int index, VertexFormatElement.EnumType type, VertexFormatElement.EnumUsage usage, int count) {
|
||||
public String toString() {
|
||||
return this.count + "," + this.usage.getName() + "," + this.type.getName();
|
||||
}
|
||||
|
||||
public class VertexFormatElement
|
||||
{
|
||||
private final VertexFormatElement.EnumType type;
|
||||
private final VertexFormatElement.EnumUsage usage;
|
||||
private int index;
|
||||
private int elementCount;
|
||||
public int size() {
|
||||
return this.type.getSize() * this.count;
|
||||
}
|
||||
|
||||
public VertexFormatElement(int indexIn, VertexFormatElement.EnumType typeIn, VertexFormatElement.EnumUsage usageIn, int count)
|
||||
{
|
||||
if (!this.isValid(indexIn, usageIn))
|
||||
{
|
||||
Log.RENDER.warn("Mehrere Vertex-Elemente des gleichen Typs außer UVs sind nicht unterstützt. Erzwinge Typ UV.");
|
||||
this.usage = VertexFormatElement.EnumUsage.UV;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.usage = usageIn;
|
||||
}
|
||||
public boolean isPosition() {
|
||||
return this.usage == VertexFormatElement.EnumUsage.POSITION;
|
||||
}
|
||||
|
||||
this.type = typeIn;
|
||||
this.index = indexIn;
|
||||
this.elementCount = count;
|
||||
}
|
||||
public boolean equals(Object other) {
|
||||
if(this == other)
|
||||
return true;
|
||||
if(!(other instanceof VertexFormatElement))
|
||||
return false;
|
||||
VertexFormatElement elem = (VertexFormatElement)other;
|
||||
return this.count == elem.count && this.index == elem.index && this.type == elem.type && this.usage == elem.usage;
|
||||
}
|
||||
|
||||
private final boolean isValid(int index, VertexFormatElement.EnumUsage usage)
|
||||
{
|
||||
return index == 0 || usage == VertexFormatElement.EnumUsage.UV;
|
||||
}
|
||||
public int hashCode() {
|
||||
int i = this.type.hashCode();
|
||||
i = 31 * i + this.usage.hashCode();
|
||||
i = 31 * i + this.index;
|
||||
i = 31 * i + this.count;
|
||||
return i;
|
||||
}
|
||||
|
||||
public final VertexFormatElement.EnumType getType()
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
public static enum EnumType {
|
||||
FLOAT(4, "Float", GL11.GL_FLOAT),
|
||||
UBYTE(1, "Unsigned Byte", GL11.GL_UNSIGNED_BYTE),
|
||||
BYTE(1, "Byte", GL11.GL_BYTE),
|
||||
USHORT(2, "Unsigned Short", GL11.GL_UNSIGNED_SHORT),
|
||||
SHORT(2, "Short", GL11.GL_SHORT),
|
||||
UINT(4, "Unsigned Int", GL11.GL_UNSIGNED_INT),
|
||||
INT(4, "Int", GL11.GL_INT);
|
||||
|
||||
public final VertexFormatElement.EnumUsage getUsage()
|
||||
{
|
||||
return this.usage;
|
||||
}
|
||||
private final int size;
|
||||
private final String name;
|
||||
private final int glConstant;
|
||||
|
||||
public final int getElementCount()
|
||||
{
|
||||
return this.elementCount;
|
||||
}
|
||||
private EnumType(int size, String name, int glConstant) {
|
||||
this.size = size;
|
||||
this.name = name;
|
||||
this.glConstant = glConstant;
|
||||
}
|
||||
|
||||
public final int getIndex()
|
||||
{
|
||||
return this.index;
|
||||
}
|
||||
public int getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return this.elementCount + "," + this.usage.getDisplayName() + "," + this.type.getDisplayName();
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public final int getSize()
|
||||
{
|
||||
return this.type.getSize() * this.elementCount;
|
||||
}
|
||||
public int getGlConstant() {
|
||||
return this.glConstant;
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean isPositionElement()
|
||||
{
|
||||
return this.usage == VertexFormatElement.EnumUsage.POSITION;
|
||||
}
|
||||
public static enum EnumUsage {
|
||||
POSITION("Position"),
|
||||
NORMAL("Normal"),
|
||||
COLOR("Vertex Color"),
|
||||
UV("UV"),
|
||||
PADDING("Padding");
|
||||
|
||||
public boolean equals(Object p_equals_1_)
|
||||
{
|
||||
if (this == p_equals_1_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass())
|
||||
{
|
||||
VertexFormatElement vertexformatelement = (VertexFormatElement)p_equals_1_;
|
||||
return this.elementCount != vertexformatelement.elementCount ? false : (this.index != vertexformatelement.index ? false : (this.type != vertexformatelement.type ? false : this.usage == vertexformatelement.usage));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private final String name;
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
int i = this.type.hashCode();
|
||||
i = 31 * i + this.usage.hashCode();
|
||||
i = 31 * i + this.index;
|
||||
i = 31 * i + this.elementCount;
|
||||
return i;
|
||||
}
|
||||
private EnumUsage(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static enum EnumType
|
||||
{
|
||||
FLOAT(4, "Float", GL11.GL_FLOAT),
|
||||
UBYTE(1, "Unsigned Byte", GL11.GL_UNSIGNED_BYTE),
|
||||
BYTE(1, "Byte", GL11.GL_BYTE),
|
||||
USHORT(2, "Unsigned Short", GL11.GL_UNSIGNED_SHORT),
|
||||
SHORT(2, "Short", GL11.GL_SHORT),
|
||||
UINT(4, "Unsigned Int", GL11.GL_UNSIGNED_INT),
|
||||
INT(4, "Int", GL11.GL_INT);
|
||||
|
||||
private final int size;
|
||||
private final String displayName;
|
||||
private final int glConstant;
|
||||
|
||||
private EnumType(int sizeIn, String displayNameIn, int glConstantIn)
|
||||
{
|
||||
this.size = sizeIn;
|
||||
this.displayName = displayNameIn;
|
||||
this.glConstant = glConstantIn;
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return this.size;
|
||||
}
|
||||
|
||||
public String getDisplayName()
|
||||
{
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
public int getGlConstant()
|
||||
{
|
||||
return this.glConstant;
|
||||
}
|
||||
}
|
||||
|
||||
public static enum EnumUsage
|
||||
{
|
||||
POSITION("Position"),
|
||||
NORMAL("Normal"),
|
||||
COLOR("Vertex Color"),
|
||||
UV("UV"),
|
||||
// MATRIX("Bone Matrix"),
|
||||
// BLEND_WEIGHT("Blend Weight"),
|
||||
PADDING("Padding");
|
||||
|
||||
private final String displayName;
|
||||
|
||||
private EnumUsage(String displayNameIn)
|
||||
{
|
||||
this.displayName = displayNameIn;
|
||||
}
|
||||
|
||||
public String getDisplayName()
|
||||
{
|
||||
return this.displayName;
|
||||
}
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,146 +8,80 @@ import common.collect.Lists;
|
|||
import common.model.Transforms;
|
||||
import common.util.Facing;
|
||||
|
||||
public class BakedModel implements IBakedModel
|
||||
{
|
||||
protected final List<BakedQuad> generalQuads;
|
||||
protected final List<List<BakedQuad>> faceQuads;
|
||||
protected final boolean ambientOcclusion;
|
||||
protected final boolean gui3d;
|
||||
protected final TextureAtlasSprite texture;
|
||||
protected final Transforms cameraTransforms;
|
||||
public record BakedModel(List<BakedQuad> getQuads, List<List<BakedQuad>> getFace, boolean isGui3d, TextureAtlasSprite getBaseTexture, Transforms getTransforms) implements IBakedModel {
|
||||
public List<BakedQuad> getFace(Facing face) {
|
||||
return this.getFace.get(face.ordinal());
|
||||
}
|
||||
|
||||
public BakedModel(List<BakedQuad> generalQuadsIn, List<List<BakedQuad>> faceQuadsIn, boolean ambientOcclusionIn, boolean gui3dIn, TextureAtlasSprite textureIn, Transforms cameraTransformsIn)
|
||||
{
|
||||
this.generalQuads = generalQuadsIn;
|
||||
this.faceQuads = faceQuadsIn;
|
||||
this.ambientOcclusion = ambientOcclusionIn;
|
||||
this.gui3d = gui3dIn;
|
||||
this.texture = textureIn;
|
||||
this.cameraTransforms = cameraTransformsIn;
|
||||
}
|
||||
public boolean isBuiltin() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<BakedQuad> getFaceQuads(Facing facing)
|
||||
{
|
||||
return this.faceQuads.get(facing.ordinal());
|
||||
}
|
||||
public static class Builder {
|
||||
private final List<BakedQuad> quads;
|
||||
private final List<List<BakedQuad>> faces;
|
||||
private TextureAtlasSprite texture;
|
||||
private boolean gui3d;
|
||||
private Transforms transforms;
|
||||
|
||||
public List<BakedQuad> getGeneralQuads()
|
||||
{
|
||||
return this.generalQuads;
|
||||
}
|
||||
public Builder(ModelBlock model) {
|
||||
this(model.isGui3d(), model.getTransform());
|
||||
}
|
||||
|
||||
public boolean isAmbientOcclusion()
|
||||
{
|
||||
return this.ambientOcclusion;
|
||||
}
|
||||
public Builder(IBakedModel model, TextureAtlasSprite texture) {
|
||||
this(model.isGui3d(), model.getTransforms());
|
||||
this.texture = model.getBaseTexture();
|
||||
|
||||
public boolean isGui3d()
|
||||
{
|
||||
return this.gui3d;
|
||||
}
|
||||
for(Facing face : Facing.values()) {
|
||||
this.addFaceBreakingFours(model, texture, face);
|
||||
}
|
||||
|
||||
public boolean isBuiltInRenderer()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.addGeneralBreakingFours(model, texture);
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getParticleTexture()
|
||||
{
|
||||
return this.texture;
|
||||
}
|
||||
private void addFaceBreakingFours(IBakedModel model, TextureAtlasSprite texture, Facing facing) {
|
||||
for(BakedQuad quad : model.getFace(facing)) {
|
||||
this.addFaceQuad(facing, new BreakingFour(quad, texture));
|
||||
}
|
||||
}
|
||||
|
||||
public Transforms getItemCameraTransforms()
|
||||
{
|
||||
return this.cameraTransforms;
|
||||
}
|
||||
private void addGeneralBreakingFours(IBakedModel model, TextureAtlasSprite texture) {
|
||||
for(BakedQuad quad : model.getQuads()) {
|
||||
this.addGeneralQuad(new BreakingFour(quad, texture));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Builder
|
||||
{
|
||||
private final List<BakedQuad> builderGeneralQuads;
|
||||
private final List<List<BakedQuad>> builderFaceQuads;
|
||||
private final boolean builderAmbientOcclusion;
|
||||
private TextureAtlasSprite builderTexture;
|
||||
private boolean builderGui3d;
|
||||
private Transforms builderCameraTransforms;
|
||||
private Builder(boolean gui3d, Transforms transforms) {
|
||||
this.quads = Lists.<BakedQuad>newArrayList();
|
||||
this.faces = new ArrayList<List<BakedQuad>>(6);
|
||||
|
||||
public Builder(ModelBlock model)
|
||||
{
|
||||
this(model.isAmbientOcclusion(), model.isGui3d(), model.getTransform());
|
||||
}
|
||||
for(Facing face : Facing.values()) {
|
||||
this.faces.add(Lists.<BakedQuad>newArrayList());
|
||||
}
|
||||
|
||||
public Builder(IBakedModel bakedModel, TextureAtlasSprite texture)
|
||||
{
|
||||
this(bakedModel.isAmbientOcclusion(), bakedModel.isGui3d(), bakedModel.getItemCameraTransforms());
|
||||
this.builderTexture = bakedModel.getParticleTexture();
|
||||
this.gui3d = gui3d;
|
||||
this.transforms = transforms;
|
||||
}
|
||||
|
||||
for (Facing enumfacing : Facing.values())
|
||||
{
|
||||
this.addFaceBreakingFours(bakedModel, texture, enumfacing);
|
||||
}
|
||||
public BakedModel.Builder addFaceQuad(Facing face, BakedQuad quad) {
|
||||
this.faces.get(face.ordinal()).add(quad);
|
||||
return this;
|
||||
}
|
||||
|
||||
this.addGeneralBreakingFours(bakedModel, texture);
|
||||
}
|
||||
public BakedModel.Builder addGeneralQuad(BakedQuad quad) {
|
||||
this.quads.add(quad);
|
||||
return this;
|
||||
}
|
||||
|
||||
private void addFaceBreakingFours(IBakedModel bakedModel, TextureAtlasSprite texture, Facing facing)
|
||||
{
|
||||
for (BakedQuad bakedquad : bakedModel.getFaceQuads(facing))
|
||||
{
|
||||
this.addFaceQuad(facing, new BreakingFour(bakedquad, texture));
|
||||
}
|
||||
}
|
||||
public BakedModel.Builder setTexture(TextureAtlasSprite texture) {
|
||||
this.texture = texture;
|
||||
return this;
|
||||
}
|
||||
|
||||
private void addGeneralBreakingFours(IBakedModel p_177647_1_, TextureAtlasSprite texture)
|
||||
{
|
||||
for (BakedQuad bakedquad : p_177647_1_.getGeneralQuads())
|
||||
{
|
||||
this.addGeneralQuad(new BreakingFour(bakedquad, texture));
|
||||
}
|
||||
}
|
||||
|
||||
private Builder(boolean ambientOcclusion, boolean gui3d, Transforms cameraTransforms)
|
||||
{
|
||||
this.builderGeneralQuads = Lists.<BakedQuad>newArrayList();
|
||||
this.builderFaceQuads = new ArrayList<List<BakedQuad>>(6);
|
||||
|
||||
for (Facing enumfacing : Facing.values())
|
||||
{
|
||||
this.builderFaceQuads.add(Lists.<BakedQuad>newArrayList());
|
||||
}
|
||||
|
||||
this.builderAmbientOcclusion = ambientOcclusion;
|
||||
this.builderGui3d = gui3d;
|
||||
this.builderCameraTransforms = cameraTransforms;
|
||||
}
|
||||
|
||||
public BakedModel.Builder addFaceQuad(Facing facing, BakedQuad quad)
|
||||
{
|
||||
((List)this.builderFaceQuads.get(facing.ordinal())).add(quad);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BakedModel.Builder addGeneralQuad(BakedQuad quad)
|
||||
{
|
||||
this.builderGeneralQuads.add(quad);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BakedModel.Builder setTexture(TextureAtlasSprite texture)
|
||||
{
|
||||
this.builderTexture = texture;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BakedModel makeBakedModel()
|
||||
{
|
||||
if (this.builderTexture == null)
|
||||
{
|
||||
throw new RuntimeException("Missing particle!");
|
||||
}
|
||||
else
|
||||
{
|
||||
return new BakedModel(this.builderGeneralQuads, this.builderFaceQuads, this.builderAmbientOcclusion, this.builderGui3d, this.builderTexture, this.builderCameraTransforms);
|
||||
}
|
||||
}
|
||||
}
|
||||
public BakedModel makeBakedModel() {
|
||||
if(this.texture == null)
|
||||
throw new RuntimeException("Fehlende Basistextur");
|
||||
return new BakedModel(this.quads, this.faces, this.gui3d, this.texture, this.transforms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,47 +6,24 @@ import client.renderer.texture.TextureAtlasSprite;
|
|||
import common.model.Transforms;
|
||||
import common.util.Facing;
|
||||
|
||||
public class BuiltInModel implements IBakedModel
|
||||
{
|
||||
private Transforms cameraTransforms;
|
||||
public record BuiltInModel(Transforms getTransforms) implements IBakedModel {
|
||||
public List<BakedQuad> getFace(Facing face) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public BuiltInModel(Transforms p_i46086_1_)
|
||||
{
|
||||
this.cameraTransforms = p_i46086_1_;
|
||||
}
|
||||
public List<BakedQuad> getQuads() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<BakedQuad> getFaceQuads(Facing facing)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public boolean isGui3d() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<BakedQuad> getGeneralQuads()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public boolean isBuiltin() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isAmbientOcclusion()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isGui3d()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isBuiltInRenderer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getParticleTexture()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Transforms getItemCameraTransforms()
|
||||
{
|
||||
return this.cameraTransforms;
|
||||
}
|
||||
public TextureAtlasSprite getBaseTexture() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,17 +8,15 @@ import common.util.Facing;
|
|||
|
||||
public interface IBakedModel
|
||||
{
|
||||
List<BakedQuad> getFaceQuads(Facing facing);
|
||||
List<BakedQuad> getFace(Facing facing);
|
||||
|
||||
List<BakedQuad> getGeneralQuads();
|
||||
|
||||
boolean isAmbientOcclusion();
|
||||
List<BakedQuad> getQuads();
|
||||
|
||||
boolean isGui3d();
|
||||
|
||||
boolean isBuiltInRenderer();
|
||||
boolean isBuiltin();
|
||||
|
||||
TextureAtlasSprite getParticleTexture();
|
||||
TextureAtlasSprite getBaseTexture();
|
||||
|
||||
Transforms getItemCameraTransforms();
|
||||
Transforms getTransforms();
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public class ModelManager
|
|||
ibakedmodel = this.defaultModel;
|
||||
}
|
||||
|
||||
return ibakedmodel.getParticleTexture();
|
||||
return ibakedmodel.getBaseTexture();
|
||||
}
|
||||
|
||||
public IBakedModel getModelForState(State state)
|
||||
|
|
|
@ -40,7 +40,7 @@ public class RenderEntityItem extends Render<EntityItem>
|
|||
int i = this.func_177078_a(itemstack);
|
||||
float f = 0.25F;
|
||||
float f1 = ExtMath.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F;
|
||||
float f2 = p_177077_9_.getItemCameraTransforms().get(Transforms.Camera.GROUND).scale.y;
|
||||
float f2 = p_177077_9_.getTransforms().get(Transforms.Camera.GROUND).scale();
|
||||
GL11.glTranslatef((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_);
|
||||
|
||||
if (flag || this.renderManager.gm != null)
|
||||
|
@ -126,20 +126,18 @@ public class RenderEntityItem extends Render<EntityItem>
|
|||
}
|
||||
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
RenderItem.apply(ibakedmodel.getItemCameraTransforms(), Transforms.Camera.GROUND);
|
||||
RenderItem.apply(ibakedmodel.getTransforms(), Transforms.Camera.GROUND);
|
||||
this.itemRenderer.renderItem(itemstack, ibakedmodel);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
RenderItem.apply(ibakedmodel.getItemCameraTransforms(), Transforms.Camera.GROUND);
|
||||
RenderItem.apply(ibakedmodel.getTransforms(), Transforms.Camera.GROUND);
|
||||
this.itemRenderer.renderItem(itemstack, ibakedmodel);
|
||||
GL11.glPopMatrix();
|
||||
float f3 = ibakedmodel.getItemCameraTransforms().ground.scale.x;
|
||||
float f4 = ibakedmodel.getItemCameraTransforms().ground.scale.y;
|
||||
float f5 = ibakedmodel.getItemCameraTransforms().ground.scale.z;
|
||||
GL11.glTranslatef(0.0F * f3, 0.0F * f4, 0.046875F * f5);
|
||||
float f3 = ibakedmodel.getTransforms().ground.scale();
|
||||
GL11.glTranslatef(0.0F, 0.0F, 0.046875F * f3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,10 +77,10 @@ public class RenderItem
|
|||
|
||||
for (Facing enumfacing : Facing.values())
|
||||
{
|
||||
this.renderQuads(worldrenderer, model.getFaceQuads(enumfacing), color, stack);
|
||||
this.renderQuads(worldrenderer, model.getFace(enumfacing), color, stack);
|
||||
}
|
||||
|
||||
this.renderQuads(worldrenderer, model.getGeneralQuads(), color, stack);
|
||||
this.renderQuads(worldrenderer, model.getQuads(), color, stack);
|
||||
Tessellator.draw();
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class RenderItem
|
|||
GL11.glPushMatrix();
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
if (model.isBuiltInRenderer())
|
||||
if (model.isBuiltin())
|
||||
{
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
|
@ -270,14 +270,9 @@ public class RenderItem
|
|||
GlState.enableBlend();
|
||||
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
|
||||
GL11.glPushMatrix();
|
||||
Transforms itemcameratransforms = model.getItemCameraTransforms();
|
||||
Transforms itemcameratransforms = model.getTransforms();
|
||||
RenderItem.apply(itemcameratransforms, cameraTransformType);
|
||||
|
||||
if (this.isThereOneNegativeScale(itemcameratransforms.get(cameraTransformType)))
|
||||
{
|
||||
GlState.cullFace(GL11.GL_FRONT);
|
||||
}
|
||||
|
||||
this.renderItem(stack, model);
|
||||
GlState.cullFace(GL11.GL_BACK);
|
||||
GL11.glPopMatrix();
|
||||
|
@ -287,16 +282,6 @@ public class RenderItem
|
|||
// this.textureManager.getTexture(TextureMap.locationBlocksTexture).restoreLastMipmap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if only one scale is negative
|
||||
*
|
||||
* @param itemTranformVec The ItemTransformVec3f instance
|
||||
*/
|
||||
private boolean isThereOneNegativeScale(Transform itemTranformVec)
|
||||
{
|
||||
return itemTranformVec.scale.x < 0.0F ^ itemTranformVec.scale.y < 0.0F ^ itemTranformVec.scale.z < 0.0F;
|
||||
}
|
||||
|
||||
private void renderItemIntoGUI(ItemStack stack, int x, int y)
|
||||
{
|
||||
IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack);
|
||||
|
@ -310,7 +295,7 @@ public class RenderItem
|
|||
GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.setupGuiTransform(x, y, ibakedmodel.isGui3d());
|
||||
RenderItem.apply(ibakedmodel.getItemCameraTransforms(), Transforms.Camera.GUI);
|
||||
RenderItem.apply(ibakedmodel.getTransforms(), Transforms.Camera.GUI);
|
||||
this.renderItem(stack, ibakedmodel);
|
||||
GlState.disableAlpha();
|
||||
GlState.disableRescaleNormal();
|
||||
|
@ -362,11 +347,11 @@ public class RenderItem
|
|||
public static void apply(Transforms trans, Transforms.Camera type) {
|
||||
Transform vec = trans.get(type);
|
||||
if(vec != Transform.IDENTITY) {
|
||||
GL11.glTranslatef(vec.translation.x, vec.translation.y, vec.translation.z);
|
||||
GL11.glRotatef(vec.rotation.y, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(vec.rotation.x, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(vec.rotation.z, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glScalef(vec.scale.x, vec.scale.y, vec.scale.z);
|
||||
GL11.glTranslatef(vec.translationX(), vec.translationY(), vec.translationZ());
|
||||
GL11.glRotatef(vec.rotationY(), 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(vec.rotationX(), 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(vec.rotationZ(), 0.0F, 0.0F, 1.0F);
|
||||
GL11.glScalef(vec.scale(), vec.scale(), vec.scale());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
package client.util;
|
||||
|
||||
public class Message {
|
||||
public final String message;
|
||||
public final long time;
|
||||
|
||||
public Message(String message, long time) {
|
||||
this.message = message;
|
||||
this.time = time;
|
||||
}
|
||||
public record Message(String message, long time) {
|
||||
}
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
package client.window;
|
||||
|
||||
public class DisplayMode {
|
||||
public final int width;
|
||||
public final int height;
|
||||
public final int refresh;
|
||||
|
||||
public DisplayMode(int width, int height, int refresh) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.refresh = refresh;
|
||||
}
|
||||
|
||||
public record DisplayMode(int width, int height, int refresh) {
|
||||
public String toString() {
|
||||
return String.format("%dx%d @ %d Hz", this.width, this.height, this.refresh);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
package client.window;
|
||||
|
||||
public class WindowEvent {
|
||||
public final WindowAction action;
|
||||
public final int param1;
|
||||
public final int param2;
|
||||
|
||||
public WindowEvent(WindowAction action, int p1, int p2) {
|
||||
this.action = action;
|
||||
this.param1 = p1;
|
||||
this.param2 = p2;
|
||||
}
|
||||
public record WindowEvent(WindowAction action, int param1, int param2) {
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue