mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-16 01:55:15 +00:00
Attempt to fix pylon model rendering
This commit is contained in:
1 parent
f3f66401f7
commit
443de41647
6 files changed
+86
-142
No files matched your search
@@ -74,11 +74,8 @@ public final class LibResources {
|
||||
public static final String MODEL_SPREADER_DREAMWOOD_HALLOWEEN = PREFIX_MODEL + "spreader_dreamwood_halloween.png";
|
||||
public static final String MODEL_SPREADER_GAIA_HALLOWEEN = PREFIX_MODEL + "spreader_gaia_halloween.png";
|
||||
public static final String MODEL_PYLON_MANA = PREFIX_MODEL + "pylon_mana.png";
|
||||
public static final String MODEL_PYLON = PREFIX_MODEL + "pylon_0.png";
|
||||
public static final String MODEL_PYLON_NATURA = PREFIX_MODEL + "pylon_natura.png";
|
||||
public static final String MODEL_PYLON_GREEN = PREFIX_MODEL + "pylon_1.png";
|
||||
public static final String MODEL_PYLON_GAIA = PREFIX_MODEL + "pylon_gaia.png";
|
||||
public static final String MODEL_PYLON_PINK = PREFIX_MODEL + "pylon_2.png";
|
||||
public static final String MODEL_LEXICA_DEFAULT = PREFIX_MODEL + "lexica_default.png";
|
||||
public static final String MODEL_LEXICA_ELVEN = PREFIX_MODEL + "lexica_elven.png";
|
||||
public static final String MODEL_MANASTEEL_0 = PREFIX_MODEL + "manasteel_0.png";
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
public interface IPylonModel {
|
||||
void renderRing();
|
||||
|
||||
void renderCrystal();
|
||||
}
|
||||
@@ -10,34 +10,25 @@
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import vazkii.botania.api.state.enums.PylonVariant;
|
||||
|
||||
public class ModelPylonGaia extends ModelBase implements IModel {
|
||||
public class ModelPylonGaia extends ModelBase implements IPylonModel {
|
||||
|
||||
final ModelRenderer platef;
|
||||
final ModelRenderer plateb;
|
||||
final ModelRenderer platel;
|
||||
final ModelRenderer plater;
|
||||
private final ModelRenderer platef;
|
||||
private final ModelRenderer plateb;
|
||||
private final ModelRenderer platel;
|
||||
private final ModelRenderer plater;
|
||||
|
||||
final ModelRenderer shardlbt;
|
||||
final ModelRenderer shardrbt;
|
||||
final ModelRenderer shardlft;
|
||||
final ModelRenderer shardrft;
|
||||
private final ModelRenderer shardlbt;
|
||||
private final ModelRenderer shardrbt;
|
||||
private final ModelRenderer shardlft;
|
||||
private final ModelRenderer shardrft;
|
||||
|
||||
final ModelRenderer shardlbb;
|
||||
final ModelRenderer shardrbb;
|
||||
final ModelRenderer shardlfb;
|
||||
final ModelRenderer shardrfb;
|
||||
private final ModelRenderer shardlbb;
|
||||
private final ModelRenderer shardrbb;
|
||||
private final ModelRenderer shardlfb;
|
||||
private final ModelRenderer shardrfb;
|
||||
|
||||
public ModelPylonGaia() {
|
||||
|
||||
@@ -89,7 +80,8 @@ public class ModelPylonGaia extends ModelBase implements IModel {
|
||||
shardlfb.addBox(-5.0F, 1.0F, -5.0F, 5, 2, 3, 0.0F);
|
||||
}
|
||||
|
||||
public void renderCrystal(PylonVariant variant) {
|
||||
@Override
|
||||
public void renderCrystal() {
|
||||
float f = 1F / 16F;
|
||||
|
||||
shardrft.render(f);
|
||||
@@ -103,7 +95,8 @@ public class ModelPylonGaia extends ModelBase implements IModel {
|
||||
shardlfb.render(f);
|
||||
}
|
||||
|
||||
public void renderRing(PylonVariant variant) {
|
||||
@Override
|
||||
public void renderRing() {
|
||||
float f = 1F / 16F;
|
||||
|
||||
platef.render(f);
|
||||
@@ -118,14 +111,4 @@ public class ModelPylonGaia extends ModelBase implements IModel {
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void renderGems(PylonVariant variant) {}
|
||||
|
||||
@Override
|
||||
public IBakedModel bake(IModelState state, VertexFormat format,
|
||||
Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,29 +10,21 @@
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import vazkii.botania.api.state.enums.PylonVariant;
|
||||
|
||||
public class ModelPylonMana extends ModelBase implements IModel {
|
||||
public class ModelPylonMana extends ModelBase implements IPylonModel {
|
||||
|
||||
final ModelRenderer platef;
|
||||
final ModelRenderer plateb;
|
||||
final ModelRenderer platel;
|
||||
final ModelRenderer plater;
|
||||
private final ModelRenderer platef;
|
||||
private final ModelRenderer plateb;
|
||||
private final ModelRenderer platel;
|
||||
private final ModelRenderer plater;
|
||||
|
||||
final ModelRenderer shardlf;
|
||||
final ModelRenderer shardrf;
|
||||
final ModelRenderer shardlb;
|
||||
final ModelRenderer shardrb;
|
||||
private final ModelRenderer shardlf;
|
||||
private final ModelRenderer shardrf;
|
||||
private final ModelRenderer shardlb;
|
||||
private final ModelRenderer shardrb;
|
||||
|
||||
public ModelPylonMana() {
|
||||
|
||||
@@ -71,7 +63,8 @@ public class ModelPylonMana extends ModelBase implements IModel {
|
||||
shardrb.addBox(3.0F, -11.0F, 0.0F, 2, 16, 5, 0.0F);
|
||||
}
|
||||
|
||||
public void renderCrystal(PylonVariant variant) {
|
||||
@Override
|
||||
public void renderCrystal() {
|
||||
float f = 1F / 16F;
|
||||
|
||||
shardlf.render(f);
|
||||
@@ -80,7 +73,8 @@ public class ModelPylonMana extends ModelBase implements IModel {
|
||||
shardrb.render(f);
|
||||
}
|
||||
|
||||
public void renderRing(PylonVariant variant) {
|
||||
@Override
|
||||
public void renderRing() {
|
||||
float f = 1F / 16F;
|
||||
|
||||
platef.render(f);
|
||||
@@ -90,19 +84,8 @@ public class ModelPylonMana extends ModelBase implements IModel {
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void renderGems(PylonVariant variant) {}
|
||||
|
||||
@Override
|
||||
public IBakedModel bake(IModelState state, VertexFormat format,
|
||||
Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,34 +10,25 @@
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import vazkii.botania.api.state.enums.PylonVariant;
|
||||
|
||||
public class ModelPylonNatura extends ModelBase implements IModel {
|
||||
public class ModelPylonNatura extends ModelBase implements IPylonModel {
|
||||
|
||||
final ModelRenderer platef;
|
||||
final ModelRenderer plateb;
|
||||
final ModelRenderer platel;
|
||||
final ModelRenderer plater;
|
||||
|
||||
final ModelRenderer shardlbt;
|
||||
final ModelRenderer shardrbt;
|
||||
final ModelRenderer shardlft;
|
||||
final ModelRenderer shardrft;
|
||||
|
||||
final ModelRenderer shardlbb;
|
||||
final ModelRenderer shardrbb;
|
||||
final ModelRenderer shardlfb;
|
||||
final ModelRenderer shardrfb;
|
||||
private final ModelRenderer platef;
|
||||
private final ModelRenderer plateb;
|
||||
private final ModelRenderer platel;
|
||||
private final ModelRenderer plater;
|
||||
|
||||
private final ModelRenderer shardlbt;
|
||||
private final ModelRenderer shardrbt;
|
||||
private final ModelRenderer shardlft;
|
||||
private final ModelRenderer shardrft;
|
||||
|
||||
private final ModelRenderer shardlbb;
|
||||
private final ModelRenderer shardrbb;
|
||||
private final ModelRenderer shardlfb;
|
||||
private final ModelRenderer shardrfb;
|
||||
|
||||
public ModelPylonNatura() {
|
||||
|
||||
@@ -89,7 +80,8 @@ public class ModelPylonNatura extends ModelBase implements IModel {
|
||||
shardlfb.addBox(-5.0F, 2.0F, -5.0F, 5, 6, 3, 0.0F);
|
||||
}
|
||||
|
||||
public void renderCrystal(PylonVariant variant) {
|
||||
@Override
|
||||
public void renderCrystal() {
|
||||
float f = 1F / 16F;
|
||||
|
||||
shardrft.render(f);
|
||||
@@ -103,7 +95,8 @@ public class ModelPylonNatura extends ModelBase implements IModel {
|
||||
shardlfb.render(f);
|
||||
}
|
||||
|
||||
public void renderRing(PylonVariant variant) {
|
||||
@Override
|
||||
public void renderRing() {
|
||||
float f = 1F / 16F;
|
||||
|
||||
platef.render(f);
|
||||
@@ -118,14 +111,4 @@ public class ModelPylonNatura extends ModelBase implements IModel {
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void renderGems(PylonVariant variant) {}
|
||||
|
||||
@Override
|
||||
public IBakedModel bake(IModelState state, VertexFormat format,
|
||||
Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,11 +10,9 @@
|
||||
*/
|
||||
package vazkii.botania.client.render.tile;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -24,22 +22,25 @@ import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.handler.MultiblockRenderHandler;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.client.model.ModelPylon;
|
||||
import vazkii.botania.client.model.IPylonModel;
|
||||
import vazkii.botania.client.model.ModelPylonGaia;
|
||||
import vazkii.botania.client.model.ModelPylonMana;
|
||||
import vazkii.botania.client.model.ModelPylonNatura;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TilePylon;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class RenderTilePylon extends TileEntitySpecialRenderer<TilePylon> {
|
||||
|
||||
private static final ResourceLocation MANA_MODEL_PATH = new ResourceLocation("botania:models/block/pylon.obj");
|
||||
private static final ResourceLocation NATURA_MODEL_PATH = new ResourceLocation("botania:models/block/pylon.obj");
|
||||
private static final ResourceLocation GAIA_MODEL_PATH = new ResourceLocation("botania:models/block/pylon.obj");
|
||||
private static final ResourceLocation MANA_TEXTURE = new ResourceLocation(LibResources.MODEL_PYLON_MANA);
|
||||
private static final ResourceLocation NATURA_TEXTURE = new ResourceLocation(LibResources.MODEL_PYLON_NATURA);
|
||||
private static final ResourceLocation GAIA_TEXTURE = new ResourceLocation(LibResources.MODEL_PYLON_GAIA);
|
||||
|
||||
private Map<PylonVariant, ModelPylon> models = new EnumMap<>(PylonVariant.class);
|
||||
private final ModelPylonMana manaModel = new ModelPylonMana();
|
||||
private final ModelPylonNatura naturaModel = new ModelPylonNatura();
|
||||
private final ModelPylonGaia gaiaModel = new ModelPylonGaia();
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull TilePylon pylon, double d0, double d1, double d2, float pticks, int digProgress, float unused) {
|
||||
@@ -48,31 +49,25 @@ public class RenderTilePylon extends TileEntitySpecialRenderer<TilePylon> {
|
||||
return;
|
||||
|
||||
PylonVariant type = ModBlocks.pylon.getStateFromMeta(pylon.getBlockMetadata()).getValue(BotaniaStateProps.PYLON_VARIANT);
|
||||
ModelPylon model = models.computeIfAbsent(type, t -> {
|
||||
ResourceLocation modelPath;
|
||||
ImmutableMap<String, String> textures;
|
||||
|
||||
switch (t) {
|
||||
default:
|
||||
case MANA: {
|
||||
modelPath = MANA_MODEL_PATH;
|
||||
textures = ImmutableMap.of("#pylon", "botania:model/pylon_0");
|
||||
break;
|
||||
}
|
||||
case NATURA: {
|
||||
modelPath = NATURA_MODEL_PATH;
|
||||
textures = ImmutableMap.of("#pylon", "botania:model/pylon_1");
|
||||
break;
|
||||
}
|
||||
case GAIA: {
|
||||
modelPath = GAIA_MODEL_PATH;
|
||||
textures = ImmutableMap.of("#pylon", "botania:model/pylon_2");
|
||||
break;
|
||||
}
|
||||
IPylonModel model;
|
||||
switch(type) {
|
||||
default:
|
||||
case MANA: {
|
||||
model = manaModel;
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(MANA_TEXTURE);
|
||||
break;
|
||||
}
|
||||
|
||||
return new ModelPylon(modelPath, textures);
|
||||
});
|
||||
case NATURA: {
|
||||
model = naturaModel;
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(NATURA_TEXTURE);
|
||||
break;
|
||||
}
|
||||
case GAIA: {
|
||||
model = gaiaModel;
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(GAIA_TEXTURE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
@@ -81,8 +76,6 @@ public class RenderTilePylon extends TileEntitySpecialRenderer<TilePylon> {
|
||||
float a = MultiblockRenderHandler.rendering ? 0.6F : 1F;
|
||||
GlStateManager.color(1F, 1F, 1F, a);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
double worldTime = (double) (ClientTickHandler.ticksInGame + pticks);
|
||||
|
||||
worldTime += new Random(pylon.getPos().hashCode()).nextInt(360);
|
||||
@@ -95,11 +88,10 @@ public class RenderTilePylon extends TileEntitySpecialRenderer<TilePylon> {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0.5F, 0F, -0.5F);
|
||||
GlStateManager.rotate((float) worldTime * 1.5F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(-0.5F, 0F, 0.5F);
|
||||
//GlStateManager.translate(-0.5F, 0F, 0.5F);
|
||||
|
||||
model.renderRing();
|
||||
GlStateManager.translate(0D, Math.sin(worldTime / 20D) / 20 - 0.025, 0D);
|
||||
model.renderGems();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@@ -107,9 +99,8 @@ public class RenderTilePylon extends TileEntitySpecialRenderer<TilePylon> {
|
||||
GlStateManager.translate(0D, Math.sin(worldTime / 20D) / 17.5, 0D);
|
||||
|
||||
GlStateManager.translate(0.5F, 0F, -0.5F);
|
||||
|
||||
GlStateManager.rotate((float) -worldTime, 0F, 1F, 0F);
|
||||
GlStateManager.translate(-0.5F, 0F, 0.5F);
|
||||
//GlStateManager.translate(-0.5F, 0F, 0.5F);
|
||||
|
||||
|
||||
GlStateManager.disableCull();
|
||||
|
||||
Reference in new issue
Block a user