Skip to content

Commit

Permalink
Start code cleanup..will finish later
Browse files Browse the repository at this point in the history
  • Loading branch information
p455w0rd committed Apr 14, 2019
1 parent 203f734 commit a39e1d6
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 445 deletions.
16 changes: 0 additions & 16 deletions src/main/java/p455w0rd/endermanevo/blocks/BlockEnderFlower.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,6 @@ public static IBlockState[] getGrowthStates() {
public boolean onBlockActivated(final World world, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final EnumFacing facing, final float hitX, final float hitY, final float hitZ) {
if (!world.isRemote) {
if (getAge(state) == getMaxAge() && hand == EnumHand.MAIN_HAND) {
/*
int fortune = 0;
ItemStack heldStack = player.getHeldItemMainhand();
if (!heldStack.isEmpty()) {
Map<Enchantment, Integer> enchantments = EnchantmentHelper.getEnchantments(heldStack);
if (!enchantments.isEmpty()) {
if (enchantments.containsKey(Enchantments.FORTUNE)) {
fortune = enchantments.get(Enchantments.FORTUNE);
}
}
}
*/
dropBlockAsItem(world, pos, state, -1);
if (!player.capabilities.isCreativeMode) {
world.setBlockState(pos, getDefaultState().withProperty(STAGE, Integer.valueOf(0)), 3);
Expand Down Expand Up @@ -290,10 +278,6 @@ public void grow(final World world, final Random rand, final BlockPos pos, final

public static boolean tryBonemeal(final ItemStack stack, final World world, final BlockPos target, final EntityPlayer player, @Nullable final EnumHand hand) {
final IBlockState iblockstate = world.getBlockState(target);
//int hook = net.minecraftforge.event.ForgeEventFactory.onApplyBonemeal(player, world, target, iblockstate, stack, hand);
//if (hook != 0) {
// return hook > 0;
//}
if (iblockstate.getBlock() instanceof BlockEnderFlower) {
final BlockEnderFlower flower = (BlockEnderFlower) iblockstate.getBlock();
if (flower.canGrow(world, target, iblockstate, world.isRemote)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class TileBlockSkull extends TileEntitySkull {
public TileBlockSkull() {
}

public TileBlockSkull(String name) {
public TileBlockSkull(final String name) {
entity = name;
}

Expand All @@ -36,7 +36,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
}

@Override
public void readFromNBT(NBTTagCompound nbt) {
public void readFromNBT(final NBTTagCompound nbt) {
super.readFromNBT(nbt);
entity = nbt.getString(ENTITY_TAG);
}
Expand All @@ -46,13 +46,6 @@ public boolean canRenderBreaking() {
return true;
}

/*
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox() {
return new AxisAlignedBB(getPos().add(-1, -1, -1), getPos().add(2, 2, 2));
}
*/
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
Expand All @@ -73,7 +66,7 @@ public ModelSkullBase getModel() {
return getModels().get(entity);
}

public static ModelSkullBase getModel(String name) {
public static ModelSkullBase getModel(final String name) {
return getModels().get(name);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class ModelEndermanBase extends ModelBiped {
public boolean isAttacking;
public boolean isPartying;

public ModelEndermanBase(float scale) {
public ModelEndermanBase(final float scale) {
super(0.0F, -14.0F, 64, 32);
bipedHeadwear = new ModelRenderer(this, 0, 16);
bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, scale - 0.5F);
Expand Down Expand Up @@ -66,7 +66,7 @@ public ModelEndermanBase(float scale) {
* "far" arms and legs can swing at most.
*/
@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
public void setRotationAngles(final float limbSwing, final float limbSwingAmount, final float ageInTicks, final float netHeadYaw, final float headPitch, final float scaleFactor, final Entity entityIn) {
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
bipedHead.showModel = true;
bipedBody.rotateAngleX = 0.0F;
Expand Down Expand Up @@ -129,17 +129,8 @@ public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageI
if (isPartying) {
bipedHead.rotateAngleY = ageInTicks;
if (!isCarrying) {
//this.tail.rotateAngleX = 1.5388988F;
//this.tail.rotationPointY = 22.97F;
//bipedBody.rotationPointY = -18.4F;
bipedLeftArm.rotateAngleX = ageInTicks;
//bipedLeftArm.rotationPointY = 18.84F;
bipedRightArm.rotateAngleX = -ageInTicks;
//bipedRightArm.rotationPointY = 18.84F;
//++bipedLeftLeg.rotationPointY;
//++bipedRightLeg.rotationPointY;
//++bipedLeftLeg.rotateAngleX;
//++bipedRightLeg.rotateAngleX;
}
}

Expand All @@ -164,7 +155,7 @@ public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageI
}

@Override
public void setLivingAnimations(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTickTime) {
public void setLivingAnimations(final EntityLivingBase entity, final float limbSwing, final float limbSwingAmount, final float partialTickTime) {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@ public void render(final float rotationX) {
}

public void render(final float rotationX, final float rotationY, final EntityLivingBase entity) {
/*
bipedBody.showModel = false;
bipedLeftLeg.showModel = false;
bipedRightLeg.showModel = false;
bipedLeftArm.showModel = false;
bipedRightArm.showModel = false;
bipedHead.showModel = true;
bipedHeadwear.showModel = true;
bipedHead = head;
bipedHeadwear = overlay;
*/
if (entity != null && entity.isSneaking()) {
GlStateManager.translate(0.0F, 0.25F, 0.0F);
}
Expand Down Expand Up @@ -124,13 +113,10 @@ public void render(final float rotationX, final float rotationY, final EntityLiv
final float g = 0.75F;
final float b = 0;
GlStateManager.color(r, g, b, 0.5F);
//GlStateManager.disableLighting();
RenderHelper.enableStandardItemLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 260.0F, 260.0F);
GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
//GlStateManager.translate(0.5F, 0.1F, 0.5F);
GlStateManager.scale(1.1F, 1.1F, 1.1F);
//modelbase.render(rot);

head.render(0.0625F);

Expand All @@ -141,7 +127,6 @@ public void render(final float rotationX, final float rotationY, final EntityLiv
GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.DestFactor.DST_ALPHA);
GlStateManager.enableLighting();
GlStateManager.disableBlend();
//GlStateManager.disableAlpha();
GlStateManager.depthMask(true);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, oldTexX, oldTexY);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0F);
Expand Down Expand Up @@ -187,13 +172,8 @@ public void renderLightMap(final float skullRotation) {
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);
final float brightnessX = OpenGlHelper.lastBrightnessX;
final float brightnessY = OpenGlHelper.lastBrightnessY;
//OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680f, 0f);
RenderHelper.enableStandardItemLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
if (entity != null && entity instanceof EntityLivingBase) {
Expand All @@ -204,26 +184,19 @@ public void renderLightMap(final float skullRotation, final float skullPitch, fi
}

OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightnessX, brightnessY);
//GlStateManager.disableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.popMatrix();
GlStateManager.enableBlend();
}

public void renderLightMapOnPlayerHead(final World world, final EntityLivingBase wearer) {
GlStateManager.pushMatrix();
//GlStateManager.enableBlend();
//GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
//GlStateManager.depthMask(true);
final float brightnessX = OpenGlHelper.lastBrightnessX;
final float brightnessY = OpenGlHelper.lastBrightnessY;
//GlStateManager.disableLighting();
RenderHelper.enableStandardItemLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
//head.render(0.01F);
render(wearer.getRotationYawHead(), wearer.rotationPitch, wearer);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightnessX, brightnessY);
//GlStateManager.disableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.popMatrix();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public class LayerEntityCharge<T extends EntityLivingBase> implements LayerRende
private final RenderLivingBase<T> entityRenderer;
private final ModelBase entityModel;

public LayerEntityCharge(RenderLivingBase<T> rendererIn, ModelBase modelIn) {
public LayerEntityCharge(final RenderLivingBase<T> rendererIn, final ModelBase modelIn) {
entityRenderer = rendererIn;
entityModel = modelIn;
}

@Override
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
boolean flag = !entitylivingbaseIn.isInvisible();
public void doRenderLayer(final EntityLivingBase entitylivingbaseIn, final float limbSwing, final float limbSwingAmount, final float partialTicks, final float ageInTicks, final float netHeadYaw, final float headPitch, final float scale) {
final boolean flag = !entitylivingbaseIn.isInvisible();
EntityEvolvedEnderman enderman = null;
if (entitylivingbaseIn instanceof EntityEvolvedEnderman) {
enderman = (EntityEvolvedEnderman) entitylivingbaseIn;
Expand All @@ -40,27 +40,21 @@ public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing,
entityRenderer.bindTexture(LIGHTNING_TEXTURE);
GlStateManager.matrixMode(5890);
GlStateManager.loadIdentity();
float f = entitylivingbaseIn.ticksExisted + partialTicks;
final float f = entitylivingbaseIn.ticksExisted + partialTicks;
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;
if (enderman != null) {
if (enderman.isAggro()) {
g = 0;
r = 0.75F;
}
else {
//System.out.println("");
}
final float b = 0;
if (enderman != null && enderman.isAggro()) {
g = 0;
r = 0.75F;
}
GlStateManager.color(r, g, b, 0.5F);
RenderHelper.enableStandardItemLighting();
float oldTexX = OpenGlHelper.lastBrightnessX;
float oldTexY = OpenGlHelper.lastBrightnessY;
//OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680.0F, 0.0F);
final float oldTexX = OpenGlHelper.lastBrightnessX;
final float oldTexY = OpenGlHelper.lastBrightnessY;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 260.0F, 260.0F);
GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
if (entitylivingbaseIn instanceof EntitySlime) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,9 @@ public class CustomChestRenderer {
public static final ModelChest CHEST_MODEL = new ModelChest();
public static final ModelShulker SHULKER_BOX_MODEL = new ModelShulker();

//private ChestType type;
/*
public CustomChestRenderer(ChestType typeIn) {
type=typeIn;
Calendar calendar = Calendar.getInstance();
if (calendar.get(2) + 1 == 12 && calendar.get(5) >= 24 && calendar.get(5) <= 26 && type==ChestType.NORMAL) {
type=ChestType.CHRISTMAS;
}
}
*/
public static void renderChest(ChestType typeIn, float lidAngle) {
public static void renderChest(final ChestType typeIn, final float lidAngle) {
ChestType type = typeIn;
Calendar calendar = Calendar.getInstance();
final Calendar calendar = Calendar.getInstance();
if (calendar.get(2) + 1 == 12 && calendar.get(5) >= 24 && calendar.get(5) <= 26 && type == ChestType.NORMAL) {
type = ChestType.CHRISTMAS;
}
Expand All @@ -49,7 +39,7 @@ public static void renderChest(ChestType typeIn, float lidAngle) {
GlStateManager.popMatrix();
}

public static void renderShulkerBox(int color, float lidProgress) {
public static void renderShulkerBox(final int color, final float lidProgress) {
GlStateManager.enableDepth();
GlStateManager.depthFunc(515);
GlStateManager.depthMask(true);
Expand Down Expand Up @@ -80,7 +70,7 @@ public static enum ChestType {

ResourceLocation texture;

ChestType(ResourceLocation textureIn) {
ChestType(final ResourceLocation textureIn) {
texture = textureIn;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
public class ParticleRenderer {

ArrayList<Particle> particles = new ArrayList<Particle>();
ArrayList<Particle> particles = new ArrayList<>();

private static ParticleRenderer INSTANCE;

Expand All @@ -30,58 +30,51 @@ public static ParticleRenderer getInstance() {
}

public void updateParticles() {
boolean[] particleIndexes = new boolean[particles.size()];
final boolean[] particleIndexes = new boolean[particles.size()];
for (int i = 0; i < particles.size(); i++) {//must do this way to prevent CME
if (particleIndexes[i]) {
particles.remove(i);
}
}
}

public void renderParticles(EntityPlayer dumbplayer, float partialTicks) {
public void renderParticles(final EntityPlayer dumbplayer, final float partialTicks) {
if (Minecraft.getMinecraft().gameSettings.particleSetting == 2) {
return;
}
float f = ActiveRenderInfo.getRotationX();
float f1 = ActiveRenderInfo.getRotationZ();
float f2 = ActiveRenderInfo.getRotationYZ();
float f3 = ActiveRenderInfo.getRotationXY();
float f4 = ActiveRenderInfo.getRotationXZ();
EntityPlayer player = EasyMappings.player();
final float f = ActiveRenderInfo.getRotationX();
final float f1 = ActiveRenderInfo.getRotationZ();
final float f2 = ActiveRenderInfo.getRotationYZ();
final float f3 = ActiveRenderInfo.getRotationXY();
final float f4 = ActiveRenderInfo.getRotationXZ();
final EntityPlayer player = EasyMappings.player();
if (player != null) {
Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;

Particle.cameraViewDir = player.getLook(partialTicks);
//GlStateManager.glTexParameterf(3553, 10242, 10497.0F);
//GlStateManager.glTexParameterf(3553, 10243, 10497.0F);
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
//GlStateManager.alphaFunc(GL11.GL_GREATER, 0F);
GlStateManager.disableCull();

GlStateManager.depthMask(false);

Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Tessellator tess = Tessellator.getInstance();
BufferBuilder buffer = tess.getBuffer();
final Tessellator tess = Tessellator.getInstance();
final BufferBuilder buffer = tess.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
for (int i = 0; i < particles.size(); i++) {
particles.get(i).renderParticle(buffer, player, partialTicks, f, f4, f1, f2, f3);
}
tess.draw();

GlStateManager.enableCull();
GlStateManager.depthMask(true);
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager.disableBlend();
//GlStateManager.alphaFunc(516, 0.1F);
}
}

public void addParticle(Particle particle) {
public void addParticle(final Particle particle) {
particles.add(particle);
}

}
Loading

0 comments on commit a39e1d6

Please sign in to comment.