remove banners
|
@ -1,142 +0,0 @@
|
|||
package client.renderer.tileentity;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import client.Client;
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.model.ModelBanner;
|
||||
import client.renderer.texture.LayeredColorMaskTexture;
|
||||
import common.block.tile.BlockBannerStanding;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.color.DyeColor;
|
||||
import common.init.Blocks;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
|
||||
public class TileEntityBannerRenderer extends TileEntitySpecialRenderer<TileEntityBanner> {
|
||||
private static class TimedTexture {
|
||||
public long time;
|
||||
public String texture;
|
||||
|
||||
private TimedTexture() {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<String, TimedTexture> DESIGNS = Maps.<String, TimedTexture>newHashMap();
|
||||
private static final String BANNERTEXTURES = "textures/blocks/banner.png";
|
||||
private ModelBanner bannerModel = new ModelBanner();
|
||||
|
||||
public void renderTileEntityAt(TileEntityBanner te, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
boolean flag = te.getWorld() != null;
|
||||
boolean flag1 = !flag || te.getBlockType() == Blocks.banner;
|
||||
int i = 0;
|
||||
if(flag) {
|
||||
State state = te.getBlockState();
|
||||
if(state.getBlock() == Blocks.banner)
|
||||
i = state.getValue(BlockBannerStanding.ROTATION);
|
||||
}
|
||||
// long j = flag ? te.getWorld().getTime() : 0L;
|
||||
double j = flag ? (double)(System.nanoTime() / 1000L) / 50000.0 /* te.getWorld().getTime() */ : (double)partialTicks;
|
||||
GL11.glPushMatrix();
|
||||
float f = 0.6666667F;
|
||||
|
||||
if(flag1) {
|
||||
GL11.glTranslatef((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F);
|
||||
float f1 = (float)(i * 360) / 16.0F;
|
||||
GL11.glRotatef(-f1, 0.0F, 1.0F, 0.0F);
|
||||
this.bannerModel.bannerStand.showModel = true;
|
||||
}
|
||||
else {
|
||||
float f2 = 0.0F;
|
||||
|
||||
if(i == 2) {
|
||||
f2 = 180.0F;
|
||||
}
|
||||
|
||||
if(i == 4) {
|
||||
f2 = 90.0F;
|
||||
}
|
||||
|
||||
if(i == 5) {
|
||||
f2 = -90.0F;
|
||||
}
|
||||
|
||||
GL11.glTranslatef((float)x + 0.5F, (float)y - 0.25F * f, (float)z + 0.5F);
|
||||
GL11.glRotatef(-f2, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.3125F, -0.4375F);
|
||||
this.bannerModel.bannerStand.showModel = false;
|
||||
}
|
||||
|
||||
BlockPos blockpos = te.getPos();
|
||||
float f3 = (float)(blockpos.getX() * 7 + blockpos.getY() * 9 + blockpos.getZ() * 13) + (float)j; // + partialTicks;
|
||||
this.bannerModel.bannerSlate.rotateAngleX = (-0.0125F + 0.01F * ExtMath.cos(f3 * (float)Math.PI * 0.02F)) * (float)Math.PI;
|
||||
GlState.enableRescaleNormal();
|
||||
String resourcelocation = this.getTexture(te);
|
||||
|
||||
if(resourcelocation != null) {
|
||||
this.bindTexture(resourcelocation);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(f, -f, -f);
|
||||
this.bannerModel.renderBanner();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private String getTexture(TileEntityBanner te) {
|
||||
String s = te.getPatternResourceLocation();
|
||||
|
||||
if(s.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
TimedTexture tex = (TimedTexture)DESIGNS.get(s);
|
||||
|
||||
if(tex == null) {
|
||||
if(DESIGNS.size() >= 256) {
|
||||
long i = System.currentTimeMillis();
|
||||
Iterator<String> iterator = DESIGNS.keySet().iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
String s1 = (String)iterator.next();
|
||||
TimedTexture tileentitybannerrenderer$timedbannertexture1 = (TimedTexture)DESIGNS.get(s1);
|
||||
|
||||
if(i - tileentitybannerrenderer$timedbannertexture1.time > 60000L) {
|
||||
Client.CLIENT.getTextureManager().deleteTexture(tileentitybannerrenderer$timedbannertexture1.texture);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if(DESIGNS.size() >= 256) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
List<TileEntityBanner.EnumBannerPattern> list1 = te.getPatternList();
|
||||
List<DyeColor> list = te.getColorList();
|
||||
List<String> list2 = Lists.<String>newArrayList();
|
||||
|
||||
for(TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern : list1) {
|
||||
list2.add("textures/blocks/banner_" + tileentitybanner$enumbannerpattern.getPatternName() + ".png");
|
||||
}
|
||||
|
||||
tex = new TimedTexture();
|
||||
tex.texture = s;
|
||||
Client.CLIENT.getTextureManager().loadTexture(tex.texture, new LayeredColorMaskTexture(BANNERTEXTURES, list2, list));
|
||||
DESIGNS.put(s, tex);
|
||||
}
|
||||
|
||||
tex.time = System.currentTimeMillis();
|
||||
return tex.texture;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ package client.renderer.tileentity;
|
|||
|
||||
import common.init.Items;
|
||||
import common.item.ItemStack;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.tileentity.TileEntityChest;
|
||||
|
||||
public class TileEntityItemStackRenderer {
|
||||
|
@ -10,14 +9,9 @@ public class TileEntityItemStackRenderer {
|
|||
|
||||
private final TileEntityChest chest = new TileEntityChest(0);
|
||||
private final TileEntityChest trapChest = new TileEntityChest(1);
|
||||
private final TileEntityBanner banner = new TileEntityBanner();
|
||||
|
||||
public void renderByItem(ItemStack stack) {
|
||||
if(stack.getItem() == Items.banner) {
|
||||
this.banner.setItemValues(stack);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
}
|
||||
else if(stack.getItem() == Items.trapped_chest) {
|
||||
if(stack.getItem() == Items.trapped_chest) {
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.trapChest, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
}
|
||||
else if(stack.getItem() == Items.chest) {
|
||||
|
|
|
@ -9,7 +9,6 @@ import client.renderer.texture.TextureManager;
|
|||
import common.collect.Maps;
|
||||
import common.entity.Entity;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.tileentity.TileEntityChest;
|
||||
import common.tileentity.TileEntityDisplay;
|
||||
import common.tileentity.TileEntityPiston;
|
||||
|
@ -50,7 +49,6 @@ public class TileEntityRendererDispatcher
|
|||
this.mapSpecialRenderers.put(TileEntityDisplay.class, new TileEntityDisplayRenderer());
|
||||
this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
|
||||
this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
|
||||
this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
|
||||
|
||||
for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
|
||||
{
|
||||
|
|
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 852 B |
Before Width: | Height: | Size: 903 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 956 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 996 B |
Before Width: | Height: | Size: 1,020 B |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1,014 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 873 B |
Before Width: | Height: | Size: 931 B |
Before Width: | Height: | Size: 880 B |
Before Width: | Height: | Size: 904 B |
Before Width: | Height: | Size: 983 B |
Before Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 888 B |
Before Width: | Height: | Size: 907 B |
Before Width: | Height: | Size: 898 B |
Before Width: | Height: | Size: 892 B |
Before Width: | Height: | Size: 895 B |
Before Width: | Height: | Size: 961 B |
Before Width: | Height: | Size: 882 B |
Before Width: | Height: | Size: 890 B |
Before Width: | Height: | Size: 1,017 B |
Before Width: | Height: | Size: 1,020 B |
Before Width: | Height: | Size: 883 B |
Before Width: | Height: | Size: 878 B |
Before Width: | Height: | Size: 883 B |
Before Width: | Height: | Size: 873 B |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 980 B |
Before Width: | Height: | Size: 996 B |
Before Width: | Height: | Size: 978 B |