Вопрос в том как сделать этот обычный дождь?)wilah написал(а):Да фигня, делаешь обычный дождь, который рисуется на клиенте, а на сервре дамажишь, если над игроком нет блока. А самое трудное, по-моему, здесь - рендер дождя. Но его можно спиворовать
То есть не надо регистрировать новое явление?wilah написал(а):Помнится, я как-то копался по файлам игры, видел. Попробуй в RenderGlobal, EntityRenderer
Спасибо, буду пробовать сделать. Завтра отпишусьwilah написал(а):Наверно нет.
Это 1.7.10? Я на 1.6.4wilah написал(а):public void renderRainSnow(float p_78474_1_)
{
IRenderHandler renderer = null;
if ((renderer = this.mc.theWorld.provider.getWeatherRenderer()) != null)
{
renderer.render(p_78474_1_, this.mc.theWorld, mc);
return;
}
float f1 = this.mc.theWorld.getRainStrength(p_78474_1_);
if (f1 > 0.0F)
{
this.enableLightmap((double)p_78474_1_);
if (this.rainXCoords == null)
{
this.rainXCoords = new float[1024];
this.rainYCoords = new float[1024];
for (int i = 0; i < 32; ++i)
{
for (int j = 0; j < 32; ++j)
{
float f2 = (float)(j - 16);
float f3 = (float)(i - 16);
float f4 = MathHelper.sqrt_float(f2 * f2 + f3 * f3);
this.rainXCoords[i << 5 | j] = -f3 / f4;
this.rainYCoords[i << 5 | j] = f2 / f4;
}
}
}
EntityLivingBase entitylivingbase = this.mc.renderViewEntity;
WorldClient worldclient = this.mc.theWorld;
int k2 = MathHelper.floor_double(entitylivingbase.posX);
int l2 = MathHelper.floor_double(entitylivingbase.posY);
int i3 = MathHelper.floor_double(entitylivingbase.posZ);
Tessellator tessellator = Tessellator.instance;
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
double d0 = entitylivingbase.lastTickPosX + (entitylivingbase.posX - entitylivingbase.lastTickPosX) * (double)p_78474_1_;
double d1 = entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double)p_78474_1_;
double d2 = entitylivingbase.lastTickPosZ + (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * (double)p_78474_1_;
int k = MathHelper.floor_double(d1);
byte b0 = 5;
if (this.mc.gameSettings.fancyGraphics)
{
b0 = 10;
}
boolean flag = false;
byte b1 = -1;
float f5 = (float)this.rendererUpdateCount + p_78474_1_;
if (this.mc.gameSettings.fancyGraphics)
{
b0 = 10;
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
flag = false;
for (int l = i3 - b0; l <= i3 + b0; ++l)
{
for (int i1 = k2 - b0; i1 <= k2 + b0; ++i1)
{
int j1 = (l - i3 + 16) * 32 + i1 - k2 + 16;
float f6 = this.rainXCoords[j1] * 0.5F;
float f7 = this.rainYCoords[j1] * 0.5F;
BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(i1, l);
if (biomegenbase.canSpawnLightningBolt() || biomegenbase.getEnableSnow())
{
int k1 = worldclient.getPrecipitationHeight(i1, l);
int l1 = l2 - b0;
int i2 = l2 + b0;
if (l1 < k1)
{
l1 = k1;
}
if (i2 < k1)
{
i2 = k1;
}
float f8 = 1.0F;
int j2 = k1;
if (k1 < k)
{
j2 = k;
}
if (l1 != i2)
{
this.random.setSeed((long)(i1 * i1 * 3121 + i1 * 45238971 ^ l * l * 418711 + l * 13761));
float f9 = biomegenbase.getFloatTemperature(i1, l1, l);
float f10;
double d4;
if (worldclient.getWorldChunkManager().getTemperatureAtHeight(f9, k1) >= 0.15F)
{
if (b1 != 0)
{
if (b1 >= 0)
{
tessellator.draw();
}
b1 = 0;
this.mc.getTextureManager().bindTexture(locationRainPng);
tessellator.startDrawingQuads();
}
f10 = ((float)(this.rendererUpdateCount + i1 * i1 * 3121 + i1 * 45238971 + l * l * 418711 + l * 13761 & 31) + p_78474_1_) / 32.0F * (3.0F + this.random.nextFloat());
double d3 = (double)((float)i1 + 0.5F) - entitylivingbase.posX;
d4 = (double)((float)l + 0.5F) - entitylivingbase.posZ;
float f12 = MathHelper.sqrt_double(d3 * d3 + d4 * d4) / (float)b0;
float f13 = 1.0F;
tessellator.setBrightness(worldclient.getLightBrightnessForSkyBlocks(i1, j2, l, 0));
tessellator.setColorRGBA_F(f13, f13, f13, ((1.0F - f12 * f12) * 0.5F + 0.5F) * f1);
tessellator.setTranslation(-d0 * 1.0D, -d1 * 1.0D, -d2 * 1.0D);
tessellator.addVertexWithUV((double)((float)i1 - f6) + 0.5D, (double)l1, (double)((float)l - f7) + 0.5D, (double)(0.0F * f8), (double)((float)l1 * f8 / 4.0F + f10 * f8));
tessellator.addVertexWithUV((double)((float)i1 + f6) + 0.5D, (double)l1, (double)((float)l + f7) + 0.5D, (double)(1.0F * f8), (double)((float)l1 * f8 / 4.0F + f10 * f8));
tessellator.addVertexWithUV((double)((float)i1 + f6) + 0.5D, (double)i2, (double)((float)l + f7) + 0.5D, (double)(1.0F * f8), (double)((float)i2 * f8 / 4.0F + f10 * f8));
tessellator.addVertexWithUV((double)((float)i1 - f6) + 0.5D, (double)i2, (double)((float)l - f7) + 0.5D, (double)(0.0F * f8), (double)((float)i2 * f8 / 4.0F + f10 * f8));
tessellator.setTranslation(0.0D, 0.0D, 0.0D);
}
else
{
if (b1 != 1)
{
if (b1 >= 0)
{
tessellator.draw();
}
b1 = 1;
this.mc.getTextureManager().bindTexture(locationSnowPng);
tessellator.startDrawingQuads();
}
f10 = ((float)(this.rendererUpdateCount & 511) + p_78474_1_) / 512.0F;
float f16 = this.random.nextFloat() + f5 * 0.01F * (float)this.random.nextGaussian();
float f11 = this.random.nextFloat() + f5 * (float)this.random.nextGaussian() * 0.001F;
d4 = (double)((float)i1 + 0.5F) - entitylivingbase.posX;
double d5 = (double)((float)l + 0.5F) - entitylivingbase.posZ;
float f14 = MathHelper.sqrt_double(d4 * d4 + d5 * d5) / (float)b0;
float f15 = 1.0F;
tessellator.setBrightness((worldclient.getLightBrightnessForSkyBlocks(i1, j2, l, 0) * 3 + 15728880) / 4);
tessellator.setColorRGBA_F(f15, f15, f15, ((1.0F - f14 * f14) * 0.3F + 0.5F) * f1);
tessellator.setTranslation(-d0 * 1.0D, -d1 * 1.0D, -d2 * 1.0D);
tessellator.addVertexWithUV((double)((float)i1 - f6) + 0.5D, (double)l1, (double)((float)l - f7) + 0.5D, (double)(0.0F * f8 + f16), (double)((float)l1 * f8 / 4.0F + f10 * f8 + f11));
tessellator.addVertexWithUV((double)((float)i1 + f6) + 0.5D, (double)l1, (double)((float)l + f7) + 0.5D, (double)(1.0F * f8 + f16), (double)((float)l1 * f8 / 4.0F + f10 * f8 + f11));
tessellator.addVertexWithUV((double)((float)i1 + f6) + 0.5D, (double)i2, (double)((float)l + f7) + 0.5D, (double)(1.0F * f8 + f16), (double)((float)i2 * f8 / 4.0F + f10 * f8 + f11));
tessellator.addVertexWithUV((double)((float)i1 - f6) + 0.5D, (double)i2, (double)((float)l - f7) + 0.5D, (double)(0.0F * f8 + f16), (double)((float)i2 * f8 / 4.0F + f10 * f8 + f11));
tessellator.setTranslation(0.0D, 0.0D, 0.0D);
}
}
}
}
}
if (b1 >= 0)
{
tessellator.draw();
}
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
this.disableLightmap((double)p_78474_1_);
}
}
wilah написал(а):EntityRenderer смотри
public void renderRainSnow(float par1)
{
float f1 = this.mc.theWorld.getRainStrength(par1);
if (f1 > 0.0F)
{
this.enableLightmap((double)par1);
if (this.rainXCoords == null)
{
this.rainXCoords = new float[1024];
this.rainYCoords = new float[1024];
for (int i = 0; i < 32; ++i)
{
for (int j = 0; j < 32; ++j)
{
float f2 = (float)(j - 16);
float f3 = (float)(i - 16);
float f4 = MathHelper.sqrt_float(f2 * f2 + f3 * f3);
this.rainXCoords[i << 5 | j] = -f3 / f4;
this.rainYCoords[i << 5 | j] = f2 / f4;
}
}
}
EntityLivingBase entitylivingbase = this.mc.renderViewEntity;
WorldClient worldclient = this.mc.theWorld;
int k = MathHelper.floor_double(entitylivingbase.posX);
int l = MathHelper.floor_double(entitylivingbase.posY);
int i1 = MathHelper.floor_double(entitylivingbase.posZ);
Tessellator tessellator = Tessellator.instance;
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.01F);
this.mc.getTextureManager().bindTexture(locationSnowPng);
double d0 = entitylivingbase.lastTickPosX + (entitylivingbase.posX - entitylivingbase.lastTickPosX) * (double)par1;
double d1 = entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double)par1;
double d2 = entitylivingbase.lastTickPosZ + (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * (double)par1;
int j1 = MathHelper.floor_double(d1);
byte b0 = 5;
if (this.mc.gameSettings.fancyGraphics)
{
b0 = 10;
}
boolean flag = false;
byte b1 = -1;
float f5 = (float)this.rendererUpdateCount + par1;
if (this.mc.gameSettings.fancyGraphics)
{
b0 = 10;
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
flag = false;
for (int k1 = i1 - b0; k1 <= i1 + b0; ++k1)
{
for (int l1 = k - b0; l1 <= k + b0; ++l1)
{
int i2 = (k1 - i1 + 16) * 32 + l1 - k + 16;
float f6 = this.rainXCoords[i2] * 0.5F;
float f7 = this.rainYCoords[i2] * 0.5F;
BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(l1, k1);
if (biomegenbase.canSpawnLightningBolt() || biomegenbase.getEnableSnow())
{
int j2 = worldclient.getPrecipitationHeight(l1, k1);
int k2 = l - b0;
int l2 = l + b0;
if (k2 < j2)
{
k2 = j2;
}
if (l2 < j2)
{
l2 = j2;
}
float f8 = 1.0F;
int i3 = j2;
if (j2 < j1)
{
i3 = j1;
}
if (k2 != l2)
{
this.random.setSeed((long)(l1 * l1 * 3121 + l1 * 45238971 ^ k1 * k1 * 418711 + k1 * 13761));
float f9 = biomegenbase.getFloatTemperature();
double d3;
float f10;
if (worldclient.getWorldChunkManager().getTemperatureAtHeight(f9, j2) >= 0.15F)
{
if (b1 != 0)
{
if (b1 >= 0)
{
tessellator.draw();
}
b1 = 0;
this.mc.getTextureManager().bindTexture(locationRainPng);
tessellator.startDrawingQuads();
}
f10 = ((float)(this.rendererUpdateCount + l1 * l1 * 3121 + l1 * 45238971 + k1 * k1 * 418711 + k1 * 13761 & 31) + par1) / 32.0F * (3.0F + this.random.nextFloat());
double d4 = (double)((float)l1 + 0.5F) - entitylivingbase.posX;
d3 = (double)((float)k1 + 0.5F) - entitylivingbase.posZ;
float f11 = MathHelper.sqrt_double(d4 * d4 + d3 * d3) / (float)b0;
float f12 = 1.0F;
tessellator.setBrightness(worldclient.getLightBrightnessForSkyBlocks(l1, i3, k1, 0));
tessellator.setColorRGBA_F(f12, f12, f12, ((1.0F - f11 * f11) * 0.5F + 0.5F) * f1);
tessellator.setTranslation(-d0 * 1.0D, -d1 * 1.0D, -d2 * 1.0D);
tessellator.addVertexWithUV((double)((float)l1 - f6) + 0.5D, (double)k2, (double)((float)k1 - f7) + 0.5D, (double)(0.0F * f8), (double)((float)k2 * f8 / 4.0F + f10 * f8));
tessellator.addVertexWithUV((double)((float)l1 + f6) + 0.5D, (double)k2, (double)((float)k1 + f7) + 0.5D, (double)(1.0F * f8), (double)((float)k2 * f8 / 4.0F + f10 * f8));
tessellator.addVertexWithUV((double)((float)l1 + f6) + 0.5D, (double)l2, (double)((float)k1 + f7) + 0.5D, (double)(1.0F * f8), (double)((float)l2 * f8 / 4.0F + f10 * f8));
tessellator.addVertexWithUV((double)((float)l1 - f6) + 0.5D, (double)l2, (double)((float)k1 - f7) + 0.5D, (double)(0.0F * f8), (double)((float)l2 * f8 / 4.0F + f10 * f8));
tessellator.setTranslation(0.0D, 0.0D, 0.0D);
}
else
{
if (b1 != 1)
{
if (b1 >= 0)
{
tessellator.draw();
}
b1 = 1;
this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/environment/snow.png"));
tessellator.startDrawingQuads();
}
f10 = ((float)(this.rendererUpdateCount & 511) + par1) / 512.0F;
float f13 = this.random.nextFloat() + f5 * 0.01F * (float)this.random.nextGaussian();
float f14 = this.random.nextFloat() + f5 * (float)this.random.nextGaussian() * 0.001F;
d3 = (double)((float)l1 + 0.5F) - entitylivingbase.posX;
double d5 = (double)((float)k1 + 0.5F) - entitylivingbase.posZ;
float f15 = MathHelper.sqrt_double(d3 * d3 + d5 * d5) / (float)b0;
float f16 = 1.0F;
tessellator.setBrightness((worldclient.getLightBrightnessForSkyBlocks(l1, i3, k1, 0) * 3 + 15728880) / 4);
tessellator.setColorRGBA_F(f16, f16, f16, ((1.0F - f15 * f15) * 0.3F + 0.5F) * f1);
tessellator.setTranslation(-d0 * 1.0D, -d1 * 1.0D, -d2 * 1.0D);
tessellator.addVertexWithUV((double)((float)l1 - f6) + 0.5D, (double)k2, (double)((float)k1 - f7) + 0.5D, (double)(0.0F * f8 + f13), (double)((float)k2 * f8 / 4.0F + f10 * f8 + f14));
tessellator.addVertexWithUV((double)((float)l1 + f6) + 0.5D, (double)k2, (double)((float)k1 + f7) + 0.5D, (double)(1.0F * f8 + f13), (double)((float)k2 * f8 / 4.0F + f10 * f8 + f14));
tessellator.addVertexWithUV((double)((float)l1 + f6) + 0.5D, (double)l2, (double)((float)k1 + f7) + 0.5D, (double)(1.0F * f8 + f13), (double)((float)l2 * f8 / 4.0F + f10 * f8 + f14));
tessellator.addVertexWithUV((double)((float)l1 - f6) + 0.5D, (double)l2, (double)((float)k1 - f7) + 0.5D, (double)(0.0F * f8 + f13), (double)((float)l2 * f8 / 4.0F + f10 * f8 + f14));
tessellator.setTranslation(0.0D, 0.0D, 0.0D);
}
}
}
}
}
if (b1 >= 0)
{
tessellator.draw();
}
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
this.disableLightmap((double)par1);
}
}