Skip to content

Commit

Permalink
Remove CCL dep
Browse files Browse the repository at this point in the history
  • Loading branch information
p455w0rd committed Apr 14, 2019
1 parent caab7ec commit 203f734
Show file tree
Hide file tree
Showing 12 changed files with 359 additions and 305 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ minecraft {
version = "1.12.2-14.23.5.2768"
runDir = "run"
mappings = "snapshot_20171003"
//useDepAts = true
clientJvmArgs= ["-Dcofh.rf.crashOnOldAPI=false"]
}

Expand Down Expand Up @@ -74,7 +73,7 @@ dependencies {
deobfCompile "slimeknights:TConstruct:1.12.2-2.10.1.518"
deobfCompile "slimeknights.mantle:Mantle:1.12-1.3.2.38"
deobfCompile "immersive-engineering:ImmersiveEngineering:0.12:89"
deobfCompile "p455w0rd:p455w0rdslib:1.12.2-2.0.36"
deobfCompile "p455w0rd:p455w0rdslib:1.12.2-2.0.38"
deobfCompile "info.loenwind.autoconfig:AutoConfig:1.12.2-1.0.1"
deobfCompile "info.loenwind.autosave:AutoSave:1.12.2-1.0.8"
deobfCompile "com.enderio.core:EnderCore:1.12.2-0.5.44"
Expand Down
31 changes: 29 additions & 2 deletions src/main/java/p455w0rd/endermanevo/api/IModelHolder.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
package p455w0rd.endermanevo.api;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import p455w0rd.endermanevo.client.render.ItemLayerWrapper;

/**
* @author p455w0rd
*
*/
public interface IModelHolder {

void initModel();
// Where you would normally call ModelLoader#setCustomModelResourceLocation
default void initModel(final IModelHolder item) {
ModelLoader.setCustomModelResourceLocation((Item) item, 0, item.getModelResource((Item) item));
}

//used for TEISR rendering
default ItemLayerWrapper getWrappedModel() {
return null;
}

//used for TEISR rendering
default void setWrappedModel(final ItemLayerWrapper wrappedModel) {
}

//used for TEISR rendering
default boolean shouldUseInternalTEISR() {
return false;
}

//used for TEISR rendering (in situations where the item model uses a different registry name than the item)
default ModelResourceLocation getModelResource(final Item item) {
return new ModelResourceLocation(item.getRegistryName(), "inventory");
}

}
}
57 changes: 29 additions & 28 deletions src/main/java/p455w0rd/endermanevo/client/model/ModelSkullBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public ModelSkullBase() {
this(32);
}

protected ModelSkullBase(int height) {
protected ModelSkullBase(final int height) {
textureWidth = 64;
textureHeight = height;
renderOverlay = true;
Expand All @@ -53,11 +53,11 @@ public ResourceLocation getLightMap() {
return LIGHTMAP;
}

protected void setLightMap(ResourceLocation texture) {
protected void setLightMap(final ResourceLocation texture) {
LIGHTMAP = texture;
}

protected void setTexture(ResourceLocation texture) {
protected void setTexture(final ResourceLocation texture) {
TEXTURE = texture;
}

Expand All @@ -70,11 +70,11 @@ protected ModelSkullBase hideOverlay() {
return this;
}

public void render(float rotationX) {
public void render(final float rotationX) {
render(rotationX, 0.0F, null);
}

public void render(float rotationX, float rotationY, EntityLivingBase entity) {
public void render(final float rotationX, final float rotationY, final EntityLivingBase entity) {
/*
bipedBody.showModel = false;
bipedLeftLeg.showModel = false;
Expand All @@ -94,11 +94,11 @@ public void render(float rotationX, float rotationY, EntityLivingBase entity) {
}
head.rotateAngleY = rotationX / (180F / (float) Math.PI);
head.rotateAngleX = rotationY / (180F / (float) Math.PI);
if (entity == null || (entity != null && !entity.isInvisible())) {
if (entity == null || entity != null && !entity.isInvisible()) {
head.render(0.0625F);
}
if (renderOverlay) {
if (entity == null || (entity != null && !entity.isInvisible())) {
if (entity == null || entity != null && !entity.isInvisible()) {
renderOverlay(rotationX, rotationY);
}
}
Expand All @@ -110,19 +110,19 @@ public void render(float rotationX, float rotationY, EntityLivingBase entity) {
}
if (this instanceof Enderman2) {
GlStateManager.pushMatrix();
float oldTexX = OpenGlHelper.lastBrightnessX;
float oldTexY = OpenGlHelper.lastBrightnessY;
final float oldTexX = OpenGlHelper.lastBrightnessX;
final float oldTexY = OpenGlHelper.lastBrightnessY;
GlStateManager.depthMask(true);
bindTexture(new ResourceLocation(ModGlobals.MODID, "textures/entity/charge_nocolor.png"));
GlStateManager.matrixMode(5890);
GlStateManager.loadIdentity();
float f = Minecraft.getMinecraft().player.ticksExisted + Minecraft.getMinecraft().getRenderPartialTicks();
final float f = Minecraft.getMinecraft().player.ticksExisted + Minecraft.getMinecraft().getRenderPartialTicks();
GlStateManager.translate(f * 0.01F, f * 0.01F, 0.0F);
GlStateManager.matrixMode(5888);
GlStateManager.enableBlend();
float r = 0;
float g = 0.75F;
float b = 0;
final float r = 0;
final float g = 0.75F;
final float b = 0;
GlStateManager.color(r, g, b, 0.5F);
//GlStateManager.disableLighting();
RenderHelper.enableStandardItemLighting();
Expand All @@ -149,12 +149,12 @@ public void render(float rotationX, float rotationY, EntityLivingBase entity) {
}
}

public void bindTexture(ResourceLocation texture) {
public void bindTexture(final ResourceLocation texture) {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
}

@Override
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
public void render(final Entity entityIn, final float limbSwing, final float limbSwingAmount, final float ageInTicks, final float netHeadYaw, final float headPitch, final float scale) {
if (entityIn != null && entityIn instanceof EntityLivingBase) {
render(netHeadYaw, headPitch, (EntityLivingBase) entityIn);
}
Expand All @@ -164,35 +164,35 @@ public void render(Entity entityIn, float limbSwing, float limbSwingAmount, floa

}

public void renderOverlay(float rotationX) {
public void renderOverlay(final float rotationX) {
renderOverlay(rotationX, 0.0F);
}

public void renderOverlay(float rotationX, float rotationY) {
public void renderOverlay(final float rotationX, final float rotationY) {
overlay.rotateAngleY = rotationX / (180F / (float) Math.PI);
overlay.rotateAngleX = rotationY / (180F / (float) Math.PI);
overlay.render(0.0625F);
}

protected void setRotation(ModelRenderer model, float x, float y, float z) {
protected void setRotation(final ModelRenderer model, final float x, final float y, final float z) {
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}

public void renderLightMap(float skullRotation) {
public void renderLightMap(final float skullRotation) {
renderLightMap(skullRotation, 0.0F, null);
}

public void renderLightMap(float skullRotation, float skullPitch, EntityLivingBase entity) {
public void renderLightMap(final float skullRotation, final float skullPitch, final EntityLivingBase entity) {

GlStateManager.pushMatrix();
//GlStateManager.enableBlend();
//GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
//GlStateManager.depthMask(true);
//GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
float brightnessX = OpenGlHelper.lastBrightnessX;
float brightnessY = OpenGlHelper.lastBrightnessY;
final float brightnessX = OpenGlHelper.lastBrightnessX;
final float brightnessY = OpenGlHelper.lastBrightnessY;
//OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680f, 0f);
RenderHelper.enableStandardItemLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
Expand All @@ -207,15 +207,16 @@ public void renderLightMap(float skullRotation, float skullPitch, EntityLivingBa
//GlStateManager.disableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.popMatrix();
GlStateManager.enableBlend();
}

public void renderLightMapOnPlayerHead(World world, EntityLivingBase wearer) {
public void renderLightMapOnPlayerHead(final World world, final EntityLivingBase wearer) {
GlStateManager.pushMatrix();
//GlStateManager.enableBlend();
//GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
//GlStateManager.depthMask(true);
float brightnessX = OpenGlHelper.lastBrightnessX;
float brightnessY = OpenGlHelper.lastBrightnessY;
final float brightnessX = OpenGlHelper.lastBrightnessX;
final float brightnessY = OpenGlHelper.lastBrightnessY;
//GlStateManager.disableLighting();
RenderHelper.enableStandardItemLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
Expand All @@ -236,7 +237,7 @@ public static class Enderman extends ModelSkullBase {
public Enderman() {
setTexture(TEXTURE_ENDERMAN);
setLightMap(LIGHTMAP_ENDERMAN);
ModelEnderman model = getEndermanModelInstace();
final ModelEnderman model = getEndermanModelInstace();
head = model.bipedHead;
overlay = model.bipedHeadwear;
model.isAttacking = true;
Expand All @@ -259,7 +260,7 @@ public static class Frienderman extends ModelSkullBase {
public Frienderman() {
setTexture(TEXTURE_ENDERMAN);
setLightMap(LIGHTMAP_ENDERMAN);
ModelEnderman model = getEndermanModelInstace();
final ModelEnderman model = getEndermanModelInstace();
head = model.bipedHead;
overlay = model.bipedHeadwear;
model.isAttacking = true;
Expand All @@ -282,7 +283,7 @@ public static class Enderman2 extends ModelSkullBase {
public Enderman2() {
setTexture(TEXTURE_ENDERMAN);
setLightMap(LIGHTMAP_ENDERMAN);
ModelEnderman model = getEndermanModelInstace();
final ModelEnderman model = getEndermanModelInstace();
head = model.bipedHead;
overlay = model.bipedHeadwear;
model.isAttacking = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package p455w0rd.endermanevo.client.render;

import java.util.List;

import javax.vecmath.Matrix4f;

import org.apache.commons.lang3.tuple.Pair;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.*;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;
import p455w0rd.endermanevo.client.render.TESRBlockSkull.TEISRBlockSkull;

/**
* @author p455w0rd
*
*/
public class ItemLayerWrapper implements IBakedModel {

private IBakedModel internal;

public ItemLayerWrapper(final IBakedModel internal) {
this.internal = internal;
}

@Override
public List<BakedQuad> getQuads(final IBlockState state, final EnumFacing side, final long rand) {
return internal.getQuads(state, side, rand);
}

@Override
public boolean isAmbientOcclusion() {
return internal.isAmbientOcclusion();
}

@Override
public boolean isGui3d() {
return internal.isGui3d();
}

public IBakedModel getInternal() {
return internal;
}

public void setInternal(final IBakedModel model) {
internal = model;
}

@Override
public boolean isBuiltInRenderer() {
return true;
}

@Override
public TextureAtlasSprite getParticleTexture() {
return internal.getParticleTexture();
}

@Override
public ItemOverrideList getOverrides() {
return ItemOverrideList.NONE;
}

@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(final TransformType type) {
TEISRBlockSkull.transformType = type;
return Pair.of(this, internal.handlePerspective(type).getRight());
}

}
Loading

0 comments on commit 203f734

Please sign in to comment.