Any data you need from the laser would be stored on the server, and it's rendered on the client. Your best bet is to either use the DataWatcher or everybody's best friend: Packets!
Thanks for the reply. Do you know where I can find a tutorial on how to use packets or DataWatcher in this way? That would be very helpful!
While I have no modding knowledge, I think that you could have a white texture and then apply a colot to it depending on the team, so all you need to do is check the team and apply the correct color.
I have no idea if this is possible with java, oh well... D:
I have tried this (that's what the commented out part of the code in doRender does), but it does not work.
I am making a mod related to Star Wars. I am trying to make it so that the texture of the arrow you shoot (or the color, depending on which is easier to do) changes depending on what team you are on (set in NBT tags for EntityLaser). Here is my code:
package com.galgor12.starwars.render.entity;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import com.galgor12.starwars.Reference;
import com.galgor12.starwars.entity.EntityLaser;
@SideOnly(Side.CLIENT)
public class RenderLaser extends Render
{
private static final ResourceLocation[] laserTextures = new ResourceLocation[] {
new ResourceLocation("starwars:/textures/entity/laser_rebel.png"),
new ResourceLocation("starwars:/textures/entity/laser_sith.png")
};
private static final String __OBFID = "CL_00000978";
public int team = 1;
public RenderLaser(RenderManager p_i46193_1_)
{
super(p_i46193_1_);
}
public void doRender(EntityLaser p_180551_1_, double p_180551_2_, double p_180551_4_, double p_180551_6_, float p_180551_8_, float p_180551_9_)
{
this.bindEntityTexture(p_180551_1_);
/*float[][] teamColor = p_180551_1_.teamColor;
int team = p_180551_1_.getTeam();
GlStateManager.color(teamColor[team][0], teamColor[team][1], teamColor[team][2], 1.0F);*/
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.pushMatrix();
GlStateManager.translate((float)p_180551_2_, (float)p_180551_4_, (float)p_180551_6_);
GlStateManager.rotate(p_180551_1_.prevRotationYaw + (p_180551_1_.rotationYaw - p_180551_1_.prevRotationYaw) * p_180551_9_ - 90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(p_180551_1_.prevRotationPitch + (p_180551_1_.rotationPitch - p_180551_1_.prevRotationPitch) * p_180551_9_, 0.0F, 0.0F, 1.0F);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
byte b0 = 0;
float f2 = 0.0F;
float f3 = 0.5F;
float f4 = (float)(0 + b0 * 10) / 32.0F;
float f5 = (float)(5 + b0 * 10) / 32.0F;
float f6 = 0.0F;
float f7 = 0.15625F;
float f8 = (float)(5 + b0 * 10) / 32.0F;
float f9 = (float)(10 + b0 * 10) / 32.0F;
float f10 = 0.05625F;
GlStateManager.enableRescaleNormal();
float f11 = (float)p_180551_1_.laserShake - p_180551_9_;
if (f11 > 0.0F)
{
float f12 = -MathHelper.sin(f11 * 3.0F) * f11;
GlStateManager.rotate(f12, 0.0F, 0.0F, 1.0F);
}
GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(f10, f10, f10);
GlStateManager.translate(-4.0F, 0.0F, 0.0F);
GL11.glNormal3f(f10, 0.0F, 0.0F);
worldrenderer.startDrawingQuads();
worldrenderer.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8);
worldrenderer.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8);
worldrenderer.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9);
worldrenderer.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9);
tessellator.draw();
GL11.glNormal3f(-f10, 0.0F, 0.0F);
worldrenderer.startDrawingQuads();
worldrenderer.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8);
worldrenderer.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8);
worldrenderer.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9);
worldrenderer.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9);
tessellator.draw();
for (int i = 0; i < 4; ++i)
{
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
worldrenderer.startDrawingQuads();
worldrenderer.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4);
worldrenderer.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4);
worldrenderer.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5);
worldrenderer.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5);
tessellator.draw();
}
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
super.doRender(p_180551_1_, p_180551_2_, p_180551_4_, p_180551_6_, p_180551_8_, p_180551_9_);
}
protected ResourceLocation getEntityTexture(EntityLaser p_180550_1_)
{
return laserTextures[p_180550_1_.getTeam()];
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity entity)
{
return this.getEntityTexture((EntityLaser)entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doe
*/
public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTicks)
{
this.doRender((EntityLaser)entity, x, y, z, p_76986_8_, partialTicks);
}
}
This code is for the RenderLaser class. I want it so the texture changes, but it only stays the first texture (because that's what team is defaulted to). Help please!
P.S. If it helps anybody to know, this is the code copied right from the RenderArrow class, just with some stuff renamed.
Ok guys! I'm glad to let you know that 2.0 is coming out shortly. I will be working on a 1.6 version of 2.0, but for now, hold on tight! Also, don't mind posting your feelings about my mod. It will help me out a lot! Have a great day, Minecraftians!
2.0 is coming out soon guys! I'm working on a big update, including a new ore and the rest of the tools. Post what you think! BTW, if anyone actually read the README file, it states that you are allowed to request. I WILL TAKE REQUESTS, UNLESS THEY ARE TOO HARD, BEING THAT THEY MIGHT BE POSTPONED FOR A LATER UPDATE.
0
Thanks for the reply. Do you know where I can find a tutorial on how to use packets or DataWatcher in this way? That would be very helpful!
Sorry for the duplicate reply
0
I have tried this (that's what the commented out part of the code in doRender does), but it does not work.
0
Thanks for the reply. Do you know where I can find a tutorial on how to use packets in this way? That would be very helpful!
0
I am making a mod related to Star Wars. I am trying to make it so that the texture of the arrow you shoot (or the color, depending on which is easier to do) changes depending on what team you are on (set in NBT tags for EntityLaser). Here is my code:
This code is for the RenderLaser class. I want it so the texture changes, but it only stays the first texture (because that's what team is defaulted to). Help please!
P.S. If it helps anybody to know, this is the code copied right from the RenderArrow class, just with some stuff renamed.
0
This is a small mod pack that changes no features of Minecraft, making it fully multiplayer compatible.
This pack is meant to quicken the process of building.
Mods:
Not Enough Items: (ChickenBones)
http://www.minecraftforum.net/topic/909223-164-smp-chickenbones-mods/
Quick Hotbar: (Kulttuuri)
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2143847-quick-hotbar-mod
World Edit: (sk89q)
http://minecraft.curseforge.com/mc-mods/225608-worldedit
Requirements:
Minecraft Forge: http://files.minecraftforge.net/
Download:
https://www.dropbox.com/s/mmlhq137w2y4hah/Building%20Ease%20v1.0.zip?dl=0
0
As of 2/27/2014 (February 27, 2014) I AM RECONTINUING THIS MOD!!!!
CHECK OUT THE POST ON PLANETMINECRAFT:
http://www.planetminecraft.com/mod/minecraft-expanded/
0
0
if you want different textures, just change blocks to look like different blocks, you know what i mean?
no? good
if you have wool one texture, and you want it another texture, just change another block
0
0
MacBook Air
11 inch
0
Thanks!!!
EDIT: TROLLL!!!!
EDIT: Ok I admit I'm forever alone It's only me working on this project
0
0
0
0
k ill add that