-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Put cargo ship on hold until new gpu.
- Loading branch information
1 parent
24ac374
commit e6462a3
Showing
16 changed files
with
381 additions
and
92 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
src/main/java/cassiokf/industrialrenewal/entity/EntityContainerShip.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package cassiokf.industrialrenewal.entity; | ||
|
||
import net.minecraft.entity.item.EntityBoat; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.util.EnumHand; | ||
import net.minecraft.world.World; | ||
|
||
public class EntityContainerShip extends EntityBoat | ||
{ | ||
public EntityContainerShip(World worldIn) | ||
{ | ||
super(worldIn); | ||
} | ||
|
||
public EntityContainerShip(World worldIn, double x, double y, double z) | ||
{ | ||
super(worldIn, x, y, z); | ||
} | ||
|
||
protected void initEntityAI() | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
public boolean processInitialInteract(EntityPlayer player, EnumHand hand) | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public Item getItemBoat() | ||
{ | ||
return super.getItemBoat(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/main/java/cassiokf/industrialrenewal/entity/render/RenderBoatBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package cassiokf.industrialrenewal.entity.render; | ||
|
||
import cassiokf.industrialrenewal.entity.EntityContainerShip; | ||
import net.minecraft.client.renderer.GlStateManager; | ||
import net.minecraft.client.renderer.entity.RenderManager; | ||
import net.minecraft.util.math.MathHelper; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
import net.minecraftforge.fml.relauncher.SideOnly; | ||
|
||
@SideOnly(Side.CLIENT) | ||
public abstract class RenderBoatBase<T extends EntityContainerShip> extends RenderBase<T> | ||
{ | ||
public RenderBoatBase(RenderManager renderManagerIn) | ||
{ | ||
super(renderManagerIn); | ||
} | ||
|
||
@Override | ||
public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) | ||
{ | ||
GlStateManager.pushMatrix(); | ||
this.setupTranslation(x, y, z); | ||
this.setupRotation(entity, entityYaw, partialTicks); | ||
this.bindEntityTexture(entity); | ||
|
||
if (this.renderOutlines) | ||
{ | ||
GlStateManager.enableColorMaterial(); | ||
GlStateManager.enableOutlineMode(this.getTeamColor(entity)); | ||
} | ||
|
||
this.getModel().render(entity, partialTicks, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); | ||
|
||
if (this.renderOutlines) | ||
{ | ||
GlStateManager.disableOutlineMode(); | ||
GlStateManager.disableColorMaterial(); | ||
} | ||
|
||
GlStateManager.popMatrix(); | ||
super.doRender(entity, x, y, z, entityYaw, partialTicks); | ||
} | ||
|
||
public void setupRotation(T entityIn, float entityYaw, float partialTicks) | ||
{ | ||
GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F); | ||
float f = (float) entityIn.getTimeSinceHit() - partialTicks; | ||
float f1 = entityIn.getDamageTaken() - partialTicks; | ||
|
||
if (f1 < 0.0F) | ||
{ | ||
f1 = 0.0F; | ||
} | ||
|
||
if (f > 0.0F) | ||
{ | ||
GlStateManager.rotate(MathHelper.sin(f) * f * f1 / 10.0F * (float) entityIn.getForwardDirection(), 1.0F, 0.0F, 0.0F); | ||
} | ||
|
||
GlStateManager.scale(-1.0F, -1.0F, 1.0F); | ||
} | ||
|
||
public void setupTranslation(double x, double y, double z) | ||
{ | ||
GlStateManager.translate((float) x, (float) y + 0.375F, (float) z); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
src/main/java/cassiokf/industrialrenewal/entity/render/RenderCartsBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package cassiokf.industrialrenewal.entity.render; | ||
|
||
import net.minecraft.client.renderer.GlStateManager; | ||
import net.minecraft.client.renderer.entity.RenderManager; | ||
import net.minecraft.entity.item.EntityMinecart; | ||
import net.minecraft.util.math.MathHelper; | ||
import net.minecraft.util.math.Vec3d; | ||
|
||
public abstract class RenderCartsBase<T extends EntityMinecart> extends RenderBase<T> | ||
{ | ||
public RenderCartsBase(RenderManager renderManagerIn) | ||
{ | ||
super(renderManagerIn); | ||
} | ||
|
||
@Override | ||
public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) | ||
{ | ||
GlStateManager.pushMatrix(); | ||
this.bindEntityTexture(entity); | ||
long i = (long) entity.getEntityId() * 493286711L; | ||
i = i * i * 4392167121L + i * 98761L; | ||
float f = (((float) (i >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; | ||
float f1 = (((float) (i >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; | ||
float f2 = (((float) (i >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; | ||
GlStateManager.translate(f, f1, f2); | ||
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks; | ||
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks; | ||
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks; | ||
double d3 = 0.30000001192092896D; | ||
Vec3d vec3d = entity.getPos(d0, d1, d2); | ||
float f3 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks; | ||
|
||
if (vec3d != null) | ||
{ | ||
Vec3d vec3d1 = entity.getPosOffset(d0, d1, d2, 0.30000001192092896D); | ||
Vec3d vec3d2 = entity.getPosOffset(d0, d1, d2, -0.30000001192092896D); | ||
|
||
if (vec3d1 == null) | ||
{ | ||
vec3d1 = vec3d; | ||
} | ||
|
||
if (vec3d2 == null) | ||
{ | ||
vec3d2 = vec3d; | ||
} | ||
|
||
x += vec3d.x - d0; | ||
y += (vec3d1.y + vec3d2.y) / 2.0D - d1; | ||
z += vec3d.z - d2; | ||
Vec3d vec3d3 = vec3d2.add(-vec3d1.x, -vec3d1.y, -vec3d1.z); | ||
|
||
if (vec3d3.length() != 0.0D) | ||
{ | ||
vec3d3 = vec3d3.normalize(); | ||
entityYaw = (float) (Math.atan2(vec3d3.z, vec3d3.x) * 180.0D / Math.PI); | ||
f3 = (float) (Math.atan(vec3d3.y) * 73.0D); | ||
} | ||
} | ||
|
||
GlStateManager.translate((float) x, (float) y + 0.375F, (float) z); | ||
GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F); | ||
GlStateManager.rotate(-f3, 0.0F, 0.0F, 1.0F); | ||
float f5 = (float) entity.getRollingAmplitude() - partialTicks; | ||
float f6 = entity.getDamage() - partialTicks; | ||
|
||
if (f6 < 0.0F) | ||
{ | ||
f6 = 0.0F; | ||
} | ||
|
||
if (f5 > 0.0F) | ||
{ | ||
GlStateManager.rotate(MathHelper.sin(f5) * f5 * f6 / 10.0F * (float) entity.getRollingDirection(), 1.0F, 0.0F, 0.0F); | ||
} | ||
|
||
if (this.renderOutlines) | ||
{ | ||
GlStateManager.enableColorMaterial(); | ||
GlStateManager.enableOutlineMode(this.getTeamColor(entity)); | ||
} | ||
|
||
GlStateManager.scale(-1.0F, -1.0F, 1.0F); | ||
getModel().render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); | ||
renderExtra(entity, x, y, z, entityYaw, partialTicks, f, f1, f2); | ||
GlStateManager.popMatrix(); | ||
|
||
if (this.renderOutlines) | ||
{ | ||
GlStateManager.disableOutlineMode(); | ||
GlStateManager.disableColorMaterial(); | ||
} | ||
|
||
super.doRender(entity, x, y, z, entityYaw, partialTicks); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/cassiokf/industrialrenewal/entity/render/RenderContainerShip.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package cassiokf.industrialrenewal.entity.render; | ||
|
||
import cassiokf.industrialrenewal.References; | ||
import cassiokf.industrialrenewal.entity.EntityContainerShip; | ||
import cassiokf.industrialrenewal.model.ships.ModelContainerShip; | ||
import net.minecraft.client.model.ModelBase; | ||
import net.minecraft.client.renderer.entity.RenderManager; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
import net.minecraftforge.fml.relauncher.SideOnly; | ||
|
||
@SideOnly(Side.CLIENT) | ||
public class RenderContainerShip extends RenderBoatBase<EntityContainerShip> | ||
{ | ||
|
||
public static final ResourceLocation TEXTURES = new ResourceLocation(References.MODID + ":textures/entities/cargo_ship.png"); | ||
|
||
protected static final ModelContainerShip modelMinecart = new ModelContainerShip(); | ||
|
||
public RenderContainerShip(RenderManager renderManagerIn) | ||
{ | ||
super(renderManagerIn); | ||
} | ||
|
||
@Override | ||
public ModelBase getModel() | ||
{ | ||
return modelMinecart; | ||
} | ||
|
||
@Override | ||
protected ResourceLocation getEntityTexture(EntityContainerShip entity) | ||
{ | ||
return TEXTURES; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.