Skip to content

Commit

Permalink
port to 1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
frodare committed Jun 21, 2017
1 parent 9196619 commit bb7feff
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 19 deletions.
13 changes: 9 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,24 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'

version = "1.11.2-11"
version = "1.12-11"
group= "net.torocraft.torohealth"
archivesBaseName = "torohealth"

sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}

minecraft {
version = "1.11.2-13.20.0.2227"
version = "1.12-14.21.0.2340"
runDir = "run"
mappings = "snapshot_20161220"
mappings = "snapshot_20170617"
}

dependencies {
Expand Down
12 changes: 6 additions & 6 deletions java/net/torocraft/torohealthmod/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void setEntityInCrosshairs() {
public RayTraceResult rayTrace(Entity e, double blockReachDistance, float partialTicks) {
Vec3d vec3d = e.getPositionEyes(partialTicks);
Vec3d vec3d1 = e.getLook(partialTicks);
Vec3d vec3d2 = vec3d.addVector(vec3d1.xCoord * blockReachDistance, vec3d1.yCoord * blockReachDistance, vec3d1.zCoord * blockReachDistance);
Vec3d vec3d2 = vec3d.addVector(vec3d1.x * blockReachDistance, vec3d1.y * blockReachDistance, vec3d1.z * blockReachDistance);
return mc.world.rayTraceBlocks(vec3d, vec3d2, false, true, true);
}

Expand All @@ -127,23 +127,23 @@ public RayTraceResult getMouseOver(float partialTicks) {
}

Vec3d lookVector = observer.getLook(partialTicks);
Vec3d lookVectorFromEyePosition = observerPositionEyes.addVector(lookVector.xCoord * reachDistance, lookVector.yCoord * reachDistance,
lookVector.zCoord * reachDistance);
Vec3d lookVectorFromEyePosition = observerPositionEyes.addVector(lookVector.x * reachDistance, lookVector.y * reachDistance,
lookVector.z * reachDistance);
this.pointedEntity = null;
Vec3d hitVector = null;
List<Entity> list = this.mc.world.getEntitiesInAABBexcluding(observer,
observer.getEntityBoundingBox()
.addCoord(lookVector.xCoord * reachDistance, lookVector.yCoord * reachDistance, lookVector.zCoord * reachDistance)
.expand(lookVector.x * reachDistance, lookVector.y * reachDistance, lookVector.z * reachDistance)
.expand(1.0D, 1.0D, 1.0D),
EntitySelectors.NOT_SPECTATING);
double d2 = distance;

for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expandXyz((double) entity1.getCollisionBorderSize());
AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow((double) entity1.getCollisionBorderSize());
RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(observerPositionEyes, lookVectorFromEyePosition);

if (axisalignedbb.isVecInside(observerPositionEyes)) {
if (axisalignedbb.contains(observerPositionEyes)) {
if (d2 >= 0.0D) {
this.pointedEntity = entity1;
hitVector = raytraceresult == null ? observerPositionEyes : raytraceresult.hitVec;
Expand Down
2 changes: 1 addition & 1 deletion java/net/torocraft/torohealthmod/ToroHealthMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class ToroHealthMod {

public static final String MODID = "torohealthmod";
public static final String VERSION = "1.11.2-11";
public static final String VERSION = "1.12-11";
public static final String MODNAME = "ToroHealthMod";

@SidedProxy(clientSide = "net.torocraft.torohealthmod.ClientProxy", serverSide = "net.torocraft.torohealthmod.ServerProxy")
Expand Down
4 changes: 2 additions & 2 deletions java/net/torocraft/torohealthmod/display/BarDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public void renderBossHealth() {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(GUI_BARS_TEXTURES);
renderHealthBar();
mc.fontRendererObj.drawStringWithShadow(name, barX, y + 2, 16777215);
mc.fontRendererObj.drawStringWithShadow(health, barX, y + 20, 16777215);
mc.fontRenderer.drawStringWithShadow(name, barX, y + 2, 16777215);
mc.fontRenderer.drawStringWithShadow(health, barX, y + 20, 16777215);
}

public static enum Color {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private void resetToOrigin() {
}

private void drawName() {
gui.drawString(mc.fontRendererObj, getEntityName(), x, y, 0xFFFFFF);
gui.drawString(mc.fontRenderer, getEntityName(), x, y, 0xFFFFFF);
y += 10;
}

Expand Down
4 changes: 2 additions & 2 deletions java/net/torocraft/torohealthmod/display/NumericDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public void draw() {

String name = getEntityName();

gui.drawCenteredString(mc.fontRendererObj, name, x + nameX, y + nameY, 0xFFFFFF);
gui.drawCenteredString(mc.fontRendererObj, (int) Math.ceil(entity.getHealth()) + "/" + (int) entity.getMaxHealth(), x + healthX, y + healthY,
gui.drawCenteredString(mc.fontRenderer, name, x + nameX, y + nameY, 0xFFFFFF);
gui.drawCenteredString(mc.fontRenderer, (int) Math.ceil(entity.getHealth()) + "/" + (int) entity.getMaxHealth(), x + healthX, y + healthY,
0xFFFFFF);
}

Expand Down
10 changes: 10 additions & 0 deletions java/net/torocraft/torohealthmod/gui/GuiFactoryToroHealth.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ public void initialize(Minecraft minecraftInstance) {

}

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

@Override
public GuiScreen createConfigGui(GuiScreen parentScreen) {
return new GuiConfigToroHealth(parentScreen);
}

@Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return GuiConfigToroHealth.class;
Expand Down
6 changes: 3 additions & 3 deletions java/net/torocraft/torohealthmod/render/DamageParticle.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package net.torocraft.torohealthmod.render;

import net.minecraft.client.renderer.BufferBuilder;
import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
Expand Down Expand Up @@ -44,7 +44,7 @@ protected DamageParticle(World worldIn, double posXIn, double posYIn, double pos
}

@Override
public void renderParticle(final VertexBuffer renderer, final Entity entity, final float x, final float y,
public void renderParticle(final BufferBuilder renderer, final Entity entity, final float x, final float y,
final float z, final float dX, final float dY, final float dZ) {
float rotationYaw = (-Minecraft.getMinecraft().player.rotationYaw);
float rotationPitch = Minecraft.getMinecraft().player.rotationPitch;
Expand Down Expand Up @@ -85,7 +85,7 @@ public void renderParticle(final VertexBuffer renderer, final Entity entity, fin
color = ConfigurationHandler.healColor;
}

final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
fontRenderer.drawStringWithShadow(this.text,
-MathHelper.floor(fontRenderer.getStringWidth(this.text) / 2.0F) + 1, -MathHelper.floor(fontRenderer.FONT_HEIGHT / 2.0F) + 1, color);

Expand Down

0 comments on commit bb7feff

Please sign in to comment.