mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 08:24:46 +00:00
Updated Banners
This commit is contained in:
1 parent
2f5d5f84c2
commit
4d2ced4528
25 files changed
+314
-85
No files matched your search
@@ -11,6 +11,7 @@ import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
@@ -255,11 +256,23 @@ public class ServerEventsHandler {
|
||||
}
|
||||
|
||||
if(!player.worldObj.isRemote){
|
||||
if(block == CustomItems.banner || block == CustomItems.wallBanner){
|
||||
// If sneaking and using shear
|
||||
if(player.isSneaking() && item.getItem() == Items.shears){
|
||||
int currentVariantIndex = tile.variant.ordinal();
|
||||
int nextVariantIndex = (currentVariantIndex + 1) % EnumBannerVariant.values().length;
|
||||
tile.variant = EnumBannerVariant.values()[nextVariantIndex];
|
||||
|
||||
player.worldObj.markBlockForUpdate(event.x, y, event.z);
|
||||
event.setCanceled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
tile.icon = item.copy();
|
||||
player.worldObj.markBlockForUpdate(event.x, y, event.z);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,29 +3,39 @@ package noppes.npcs.blocks.tiles;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import noppes.npcs.constants.EnumBannerVariant;
|
||||
|
||||
public class TileBanner extends TileColorable {
|
||||
|
||||
|
||||
public ItemStack icon;
|
||||
public EnumBannerVariant variant = EnumBannerVariant.Normal;
|
||||
public long time = 0;
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
icon = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("BannerIcon"));
|
||||
|
||||
int variantIndex = compound.getInteger("BannerVariant");
|
||||
if (variantIndex >= 0 && variantIndex < EnumBannerVariant.values().length) {
|
||||
variant = EnumBannerVariant.values()[variantIndex];
|
||||
} else {
|
||||
variant = EnumBannerVariant.Normal;
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
if(icon != null)
|
||||
compound.setTag("BannerIcon", icon.writeToNBT(new NBTTagCompound()));
|
||||
compound.setInteger("BannerVariant", variant.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox(){
|
||||
return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 2, zCoord + 1);
|
||||
}
|
||||
|
||||
|
||||
public boolean canEdit(){
|
||||
return System.currentTimeMillis() - time < 10000;
|
||||
return System.currentTimeMillis() - time < 20000;
|
||||
}
|
||||
}
|
||||
@@ -9,21 +9,20 @@ public class ModelStool extends ModelBase {
|
||||
private final ModelRenderer stool;
|
||||
|
||||
public ModelStool() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
|
||||
stool = new ModelRenderer(this);
|
||||
stool.setRotationPoint(0.0F, 24.0F, 0.0F);
|
||||
stool.cubeList.add(new ModelBox(stool, 0, 0, -5.0F, -9.0F, -5.0F, 10, 2, 10, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 0, 12, 2.0F, -7.0F, -4.0F, 2, 7, 2, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 8, 8, 3.0F, -5.0F, -2.0F, 0, 2, 4, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 8, 12, -2.0F, -5.0F, -3.0F, 4, 2, 0, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 0, 12, -4.0F, -7.0F, -4.0F, 2, 7, 2, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 0, 12, -4.0F, -7.0F, 2.0F, 2, 7, 2, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 8, 8, -3.0F, -5.0F, -2.0F, 0, 2, 4, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 0, 12, 2.0F, -7.0F, 2.0F, 2, 7, 2, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 8, 12, -2.0F, -5.0F, 3.0F, 4, 2, 0, 0.0F));
|
||||
}
|
||||
stool = new ModelRenderer(this);
|
||||
stool.setRotationPoint(0.0F, 24.0F, 0.0F);
|
||||
stool.cubeList.add(new ModelBox(stool, 0, 0, -5.0F, -9.0F, -5.0F, 10, 2, 10, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 0, 12, 2.0F, -7.0F, -4.0F, 2, 7, 2, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 8, 8, 3.0F, -5.0F, -2.0F, 0, 2, 4, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 8, 12, -2.0F, -5.0F, -3.0F, 4, 2, 0, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 0, 12, -4.0F, -7.0F, -4.0F, 2, 7, 2, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 0, 12, -4.0F, -7.0F, 2.0F, 2, 7, 2, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 8, 8, -3.0F, -5.0F, -2.0F, 0, 2, 4, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 0, 12, 2.0F, -7.0F, 2.0F, 2, 7, 2, 0.0F));
|
||||
stool.cubeList.add(new ModelBox(stool, 8, 12, -2.0F, -5.0F, 3.0F, 4, 2, 0, 0.0F)); }
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
|
||||
@@ -6,25 +6,26 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelBannerFloorFlag extends ModelBase {
|
||||
private final ModelRenderer BannerFlag;
|
||||
public final ModelRenderer BannerFlag;
|
||||
|
||||
public ModelBannerFloorFlag() {
|
||||
textureWidth = 32;
|
||||
textureHeight = 32;
|
||||
public ModelBannerFloorFlag() {
|
||||
textureWidth = 32;
|
||||
textureHeight = 32;
|
||||
|
||||
BannerFlag = new ModelRenderer(this);
|
||||
BannerFlag.setRotationPoint(0.0F, -8.0F, 5.0F);
|
||||
BannerFlag.cubeList.add(new ModelBox(BannerFlag, 0, 0, -8.0F, 0.0F, -6.05F, 16, 32, 0, 0.0F));
|
||||
}
|
||||
BannerFlag = new ModelRenderer(this);
|
||||
BannerFlag.setRotationPoint(0.0F, -8.0F, 5.0F);
|
||||
BannerFlag.cubeList.add(new ModelBox(BannerFlag, 2, 0, -7.0F, 0.4F, -6.05F, 14, 29, 0, 0.0F));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
BannerFlag.render(f5);
|
||||
}
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
// Render the flag
|
||||
BannerFlag.render(f5);
|
||||
}
|
||||
|
||||
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
}
|
||||
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package noppes.npcs.client.model.blocks.banner;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelBox;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelBannerWall extends ModelBase {
|
||||
private final ModelRenderer bb_main;
|
||||
private final ModelRenderer cube_r1;
|
||||
|
||||
public ModelBannerWall() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
bb_main = new ModelRenderer(this);
|
||||
bb_main.setRotationPoint(0.0F, 24.0F, 0.0F);
|
||||
bb_main.cubeList.add(new ModelBox(bb_main, 0, 0, -8.0F, -32.0F, 5.0F, 16, 3, 3, 0.0F));
|
||||
bb_main.cubeList.add(new ModelBox(bb_main, 0, 8, -6.0F, -36.0F, 6.5F, 4, 4, 0, 0.0F));
|
||||
|
||||
cube_r1 = new ModelRenderer(this);
|
||||
cube_r1.setRotationPoint(4.0F, -34.0F, 6.5F);
|
||||
bb_main.addChild(cube_r1);
|
||||
setRotationAngle(cube_r1, 0.0F, 3.1416F, 0.0F);
|
||||
cube_r1.cubeList.add(new ModelBox(cube_r1, 0, 8, -2.0F, -2.0F, 0.0F, 4, 4, 0, 0.0F));}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
bb_main.render(f5);
|
||||
}
|
||||
|
||||
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package noppes.npcs.client.model.blocks.banner;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelBox;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelBannerWallFlag extends ModelBase {
|
||||
public final ModelRenderer BannerFlag;
|
||||
|
||||
public ModelBannerWallFlag() {
|
||||
textureWidth = 32;
|
||||
textureHeight = 32;
|
||||
|
||||
BannerFlag = new ModelRenderer(this);
|
||||
BannerFlag.setRotationPoint(0.0F, -8.0F, 5.0F);
|
||||
BannerFlag.cubeList.add(new ModelBox(BannerFlag, 2, 0, -7.0F, 0.4F, -0.05F, 14, 29, 0, 0.0F));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
// Render the flag
|
||||
BannerFlag.render(f5);
|
||||
}
|
||||
|
||||
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,3 @@
|
||||
// Date: 21-2-2014 11:50:33
|
||||
// Template version 1.1
|
||||
// Java generated by Techne
|
||||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
package noppes.npcs.client.model.blocks.legacy;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.blocks.BlockBanner;
|
||||
@@ -19,6 +20,7 @@ import noppes.npcs.client.model.blocks.banner.ModelBannerFloorFlag;
|
||||
import noppes.npcs.client.model.blocks.legacy.ModelLegacyBanner;
|
||||
import noppes.npcs.client.model.blocks.legacy.ModelLegacyBannerFlag;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.constants.EnumBannerVariant;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
@@ -30,9 +32,13 @@ public class BlockBannerRenderer extends BlockRendererInterface{
|
||||
private final ModelBannerFloor banner = new ModelBannerFloor();
|
||||
private final ModelBannerFloorFlag flag = new ModelBannerFloorFlag();
|
||||
|
||||
|
||||
public static final ResourceLocation legacyFlagResource = new ResourceLocation("customnpcs","textures/models/BannerFlag.png");
|
||||
public static final ResourceLocation flagResource = new ResourceLocation("customnpcs","textures/models/banner/flag/BannerFlag1.png");
|
||||
|
||||
public static final ResourceLocation normalFlag = new ResourceLocation("customnpcs","textures/models/banner/flag/normal.png");
|
||||
public static final ResourceLocation pointyFlag = new ResourceLocation("customnpcs","textures/models/banner/flag/pointy.png");
|
||||
public static final ResourceLocation triangleFlag = new ResourceLocation("customnpcs","textures/models/banner/flag/triangle.png");
|
||||
public static final ResourceLocation tornFlag = new ResourceLocation("customnpcs","textures/models/banner/flag/torn.png");
|
||||
public static final ResourceLocation curvedFlag = new ResourceLocation("customnpcs","textures/models/banner/flag/curved.png");
|
||||
|
||||
protected static final ResourceLocation BannerWood = new ResourceLocation("customnpcs","textures/models/banner/BannerFloorWood.png");
|
||||
protected static final ResourceLocation BannerStone = new ResourceLocation("customnpcs","textures/models/banner/BannerFloorStone.png");
|
||||
@@ -66,31 +72,56 @@ public class BlockBannerRenderer extends BlockRendererInterface{
|
||||
float[] color = colorTable[tile.color];
|
||||
GL11.glColor3f(color[0], color[1], color[2]);
|
||||
legacyFlag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
if(tile.icon != null && !this.playerTooFar(tile)){
|
||||
doRender(var2, var4, var6, tile.rotation, tile.icon, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
long worldTime = tile.getWorldObj() != null ? tile.getWorldObj().getTotalWorldTime() : 0;
|
||||
// 100 is one full revolution, so we can just mod by 100 without affecting the result
|
||||
int animationProgress100 = (((tile.xCoord % 100) * 7 + (tile.yCoord % 100) * 9 + (tile.zCoord % 100) * 13) + (int) (worldTime % 100)) % 100;
|
||||
float f3 = (float) animationProgress100 + var8;
|
||||
float angle_x = (-0.0125F + 0.01F * MathHelper.cos(f3 * 0.01F * 2F * (float) Math.PI)) * (float) Math.PI;
|
||||
flag.BannerFlag.rotateAngleX = angle_x;
|
||||
|
||||
setBannerMaterial(var1.getBlockMetadata());
|
||||
banner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
|
||||
this.bindTexture(flagResource);
|
||||
setFlagType(tile.variant);
|
||||
float[] color = colorTable[tile.color];
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor3f(color[0], color[1], color[2]);
|
||||
flag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
flag.render(null, 0, 0, 0, f3, 0.0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
if(tile.icon != null && !this.playerTooFar(tile)){
|
||||
doRender(var2, var4, var6, tile.rotation, tile.icon);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
if(tile.icon != null && !this.playerTooFar(tile)){
|
||||
doRender(var2, var4, var6, tile.rotation, tile.icon, angle_x);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void doRender(double par2, double par4, double par6, int meta, ItemStack iicon)
|
||||
public void doRender(double par2, double par4, double par6, int meta, ItemStack iicon, float rotate)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
bindTexture(TextureMap.locationItemsTexture);
|
||||
GL11.glTranslatef((float)par2 + 0.5f, (float)par4 +1.3f, (float)par6 + 0.5f);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(90 * meta, 0, 1, 0);
|
||||
GL11.glTranslatef(0, 0, -0.14f);
|
||||
if(ConfigClient.LegacyBanner){
|
||||
GL11.glTranslatef(0, 0, -0.14f);
|
||||
}
|
||||
else {
|
||||
GL11.glTranslatef(0, 0, -0.075f);
|
||||
|
||||
GL11.glTranslatef(0, -0.6f, 0); // Translate to pivot point
|
||||
GL11.glRotatef((float) Math.toDegrees(rotate), 1, 0, 0); // Apply sway rotation
|
||||
GL11.glTranslatef(0, 0.6f, 0); // Translate back after rotation
|
||||
}
|
||||
|
||||
GL11.glDepthMask(false);
|
||||
float f2 = 0.05f;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
@@ -156,14 +187,26 @@ public class BlockBannerRenderer extends BlockRendererInterface{
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
|
||||
setMaterialTexture(metadata);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
legacyBanner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
if(ConfigClient.LegacyBanner){
|
||||
setMaterialTexture(metadata);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
legacyBanner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
|
||||
this.bindTexture(legacyFlagResource);
|
||||
float[] color = colorTable[15 - metadata];
|
||||
GL11.glColor3f(color[0], color[1], color[2]);
|
||||
legacyFlag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
else {
|
||||
setBannerMaterial(metadata);
|
||||
banner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
|
||||
this.bindTexture(normalFlag);
|
||||
float[] color = colorTable[15 - metadata];
|
||||
GL11.glColor3f(color[0], color[1], color[2]);
|
||||
flag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
|
||||
this.bindTexture(legacyFlagResource);
|
||||
float[] color = colorTable[15 - metadata];
|
||||
GL11.glColor3f(color[0], color[1], color[2]);
|
||||
legacyFlag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -176,7 +219,7 @@ public class BlockBannerRenderer extends BlockRendererInterface{
|
||||
return 26;
|
||||
}
|
||||
|
||||
public void setBannerMaterial(int meta){
|
||||
public static void setBannerMaterial(int meta){
|
||||
TextureManager manager = Minecraft.getMinecraft().getTextureManager();
|
||||
if(meta == 1)
|
||||
manager.bindTexture(BannerStone);
|
||||
@@ -189,4 +232,25 @@ public class BlockBannerRenderer extends BlockRendererInterface{
|
||||
else
|
||||
manager.bindTexture(BannerWood);
|
||||
}
|
||||
|
||||
public static void setFlagType(EnumBannerVariant variant){
|
||||
TextureManager manager = Minecraft.getMinecraft().getTextureManager();
|
||||
switch (variant){
|
||||
case Pointy:
|
||||
manager.bindTexture(pointyFlag);
|
||||
break;
|
||||
case Triangle:
|
||||
manager.bindTexture(triangleFlag);
|
||||
break;
|
||||
case Torn:
|
||||
manager.bindTexture(tornFlag);
|
||||
break;
|
||||
case Curved:
|
||||
manager.bindTexture(curvedFlag);
|
||||
break;
|
||||
default:
|
||||
manager.bindTexture(normalFlag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,9 +40,11 @@ public class BlockCarpentryBenchRenderer extends TileEntitySpecialRenderer imple
|
||||
this.bindTexture(anvilTexture);
|
||||
anvil.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
this.bindTexture(carpentryBench);
|
||||
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -34,11 +34,13 @@ public class BlockChairRenderer extends BlockRendererInterface{
|
||||
GL11.glRotatef(90 * tile.rotation, 0, 1, 0);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
setWoodTexture(var1.getBlockMetadata());
|
||||
if(ConfigClient.LegacyChair)
|
||||
legacyModel.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
else
|
||||
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -38,14 +38,22 @@ public class BlockStoolRenderer extends BlockRendererInterface{
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
|
||||
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
if(ConfigClient.LegacyStool){
|
||||
setWoodTexture(var1.getBlockMetadata());
|
||||
legacyStool.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
else {
|
||||
setStoolTexture(var1.getBlockMetadata());
|
||||
if(ConfigClient.WoodTextures) {
|
||||
setWoodTexture(var1.getBlockMetadata());
|
||||
}
|
||||
else {
|
||||
setStoolTexture(var1.getBlockMetadata());
|
||||
}
|
||||
stool.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,19 +11,26 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.blocks.BlockWallBanner;
|
||||
import noppes.npcs.blocks.tiles.TileWallBanner;
|
||||
import noppes.npcs.client.model.blocks.banner.ModelBannerWall;
|
||||
import noppes.npcs.client.model.blocks.banner.ModelBannerWallFlag;
|
||||
import noppes.npcs.client.model.blocks.legacy.ModelLegacyWallBanner;
|
||||
import noppes.npcs.client.model.blocks.legacy.ModelLegacyWallBannerFlag;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class BlockWallBannerRenderer extends BlockRendererInterface{
|
||||
|
||||
private final ModelLegacyWallBanner model = new ModelLegacyWallBanner();
|
||||
private final ModelLegacyWallBannerFlag flag = new ModelLegacyWallBannerFlag();
|
||||
private final ModelLegacyWallBanner modelLegacyWallBanner = new ModelLegacyWallBanner();
|
||||
private final ModelLegacyWallBannerFlag modelLegacyWallBannerFlag = new ModelLegacyWallBannerFlag();
|
||||
|
||||
private final ModelBannerWall model = new ModelBannerWall();
|
||||
private final ModelBannerWallFlag flag = new ModelBannerWallFlag();
|
||||
|
||||
public BlockWallBannerRenderer(){
|
||||
((BlockWallBanner)CustomItems.wallBanner).renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
@@ -42,29 +49,66 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(90 * tile.rotation, 0, 1, 0);
|
||||
|
||||
setMaterialTexture(var1.getBlockMetadata());
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
if(ConfigClient.LegacyBanner){
|
||||
setMaterialTexture(var1.getBlockMetadata());
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
modelLegacyWallBanner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
|
||||
this.bindTexture(BlockBannerRenderer.legacyFlagResource);
|
||||
float[] color = BlockBannerRenderer.colorTable[tile.color];
|
||||
GL11.glColor3f(color[0], color[1], color[2]);
|
||||
flag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
this.bindTexture(BlockBannerRenderer.legacyFlagResource);
|
||||
float[] color = BlockBannerRenderer.colorTable[tile.color];
|
||||
GL11.glColor3f(color[0], color[1], color[2]);
|
||||
modelLegacyWallBannerFlag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
if(tile.icon != null && !this.playerTooFar(tile)){
|
||||
doRender(var2, var4, var6, tile.rotation, tile.icon);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
if(tile.icon != null && !this.playerTooFar(tile)){
|
||||
doRender(var2, var4, var6, tile.rotation, tile.icon, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
long worldTime = tile.getWorldObj() != null ? tile.getWorldObj().getTotalWorldTime() : 0;
|
||||
// 100 is one full revolution, so we can just mod by 100 without affecting the result
|
||||
int animationProgress100 = (((tile.xCoord % 100) * 7 + (tile.yCoord % 100) * 9 + (tile.zCoord % 100) * 13) + (int) (worldTime % 100)) % 100;
|
||||
float f3 = (float) animationProgress100 + var8;
|
||||
float angle_x = (-0.0125F + 0.01F * MathHelper.cos(f3 * 0.01F * 2F * (float) Math.PI)) * (float) Math.PI;
|
||||
flag.BannerFlag.rotateAngleX = angle_x;
|
||||
|
||||
BlockBannerRenderer.setBannerMaterial(var1.getBlockMetadata());
|
||||
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
|
||||
BlockBannerRenderer.setFlagType(tile.variant);
|
||||
float[] color = colorTable[tile.color];
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor3f(color[0], color[1], color[2]);
|
||||
flag.render(null, 0, 0, 0, f3, 0.0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
if(tile.icon != null && !this.playerTooFar(tile)){
|
||||
doRender(var2, var4, var6, tile.rotation, tile.icon, angle_x);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void doRender(double par2, double par4, double par6, int meta, ItemStack iicon)
|
||||
public void doRender(double par2, double par4, double par6, int meta, ItemStack iicon, float rotate)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
bindTexture(TextureMap.locationItemsTexture);
|
||||
GL11.glTranslatef((float)par2 + 0.5f, (float)par4 +0.2f, (float)par6 + 0.5f);
|
||||
GL11.glTranslatef((float)par2 + 0.5f, (float)par4 + 0.2f, (float)par6 + 0.5f);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(90 * meta, 0, 1, 0);
|
||||
GL11.glTranslatef(0, 0, 0.26f);
|
||||
|
||||
if(ConfigClient.LegacyBanner){
|
||||
GL11.glTranslatef(0, 0, 0.26f);
|
||||
}
|
||||
else {
|
||||
GL11.glTranslatef(0, 0, 0.3f);
|
||||
|
||||
GL11.glTranslatef(0, -0.6f, 0); // Translate to pivot point
|
||||
GL11.glRotatef((float) Math.toDegrees(rotate), 1, 0, 0); // Apply sway rotation
|
||||
GL11.glTranslatef(0, 0.6f, 0); // Translate to pivot point
|
||||
}
|
||||
|
||||
GL11.glDepthMask(false);
|
||||
float f2 = 0.05f;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
@@ -148,14 +192,25 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(180, 0, 1, 0);
|
||||
|
||||
setMaterialTexture(metadata);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
if(ConfigClient.LegacyBanner){
|
||||
setMaterialTexture(metadata);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
modelLegacyWallBanner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
|
||||
this.bindTexture(BlockBannerRenderer.legacyFlagResource);
|
||||
float[] color = BlockBannerRenderer.colorTable[15 - metadata];
|
||||
GL11.glColor3f(color[0], color[1], color[2]);
|
||||
flag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
this.bindTexture(BlockBannerRenderer.legacyFlagResource);
|
||||
float[] color = BlockBannerRenderer.colorTable[15 - metadata];
|
||||
GL11.glColor3f(color[0], color[1], color[2]);
|
||||
modelLegacyWallBannerFlag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
else {
|
||||
BlockBannerRenderer.setBannerMaterial(metadata);
|
||||
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
|
||||
this.bindTexture(BlockBannerRenderer.normalFlag);
|
||||
float[] color = colorTable[15 - metadata];
|
||||
GL11.glColor3f(color[0], color[1], color[2]);
|
||||
flag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ public class ConfigClient
|
||||
public final static String VISUAL = "Visual";
|
||||
public final static String QUESTING = "Questing";
|
||||
public final static String MODEL = "Model";
|
||||
public final static String TEXTURE = "Texture";
|
||||
|
||||
|
||||
/**
|
||||
@@ -73,6 +74,11 @@ public class ConfigClient
|
||||
public static Property BannerAlertsProperty;
|
||||
public static boolean BannerAlerts = true;
|
||||
|
||||
/**
|
||||
* Texture Properties
|
||||
**/
|
||||
public static boolean WoodTextures = false;
|
||||
|
||||
/**
|
||||
* Model Properties
|
||||
**/
|
||||
@@ -139,6 +145,8 @@ public class ConfigClient
|
||||
BannerAlertsProperty = config.get(VISUAL, "All Banner Alerts", true, "Universal enable/disable for Banner Alerts");
|
||||
BannerAlerts = BannerAlertsProperty.getBoolean(true);
|
||||
|
||||
WoodTextures = config.get(TEXTURE, "Wood Textures", false, "Models like Chairs and Stools will use default MC Wood Textures").getBoolean(false);
|
||||
|
||||
LegacyCampfire = config.get(MODEL, "Legacy Campfire Model", false).getBoolean(false);
|
||||
LegacyBanner = config.get(MODEL, "Legacy Banner Model", false).getBoolean(false);
|
||||
LegacyBarrel = config.get(MODEL, "Legacy Barrel Model", false).getBoolean(false);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package noppes.npcs.constants;
|
||||
|
||||
public enum EnumBannerVariant {
|
||||
Normal, Curved, Pointy, Triangle, Torn
|
||||
}
|
||||
Reference in new issue
Block a user