Skip to content

Commit

Permalink
fix biome window
Browse files Browse the repository at this point in the history
  • Loading branch information
tCInUBkXfaMY committed Feb 17, 2018
1 parent 57169ad commit bafbaaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/main/java/com/pikachu/uhcessentials/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.util.MathHelper;

import java.awt.Color;
import java.io.File;
Expand Down Expand Up @@ -57,11 +57,9 @@ public static void drawItemStack(ItemStack stack, int x, int y, String altText)
itemRender.renderItemIntoGUI(stack, x, y);
}

public static String getBiomeAt(BlockPos pos, World world) {
if (world != null && pos != null) {
return world.getWorldChunkManager().getBiomeGenerator(pos).biomeName;
}
return null;
public static String getBiomeAt(double x, double z) {
return mc.theWorld.getBiomeGenForCoords(new BlockPos(MathHelper.floor_double(mc.thePlayer.posX), 64,
MathHelper.floor_double(mc.thePlayer.posZ))).biomeName;
}

public static <T> List<T> reverse(final List<T> list) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.pikachu.uhcessentials.gui.base.MovableWindow;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.Gui;
import net.minecraft.util.BlockPos;
import net.minecraftforge.client.event.RenderGameOverlayEvent;

public class Biome extends MovableWindow {
Expand Down Expand Up @@ -43,7 +42,7 @@ public String getName() {

public void render(RenderGameOverlayEvent.Text event) {
EntityPlayerSP player = mc.thePlayer;
biome = Util.getBiomeAt(new BlockPos(player.posX, player.posY, player.posZ), mc.theWorld);
biome = Util.getBiomeAt(player.posX, player.posZ);
Gui.drawRect(getX() - PADDING, getY(), getX() + getWidth() + PADDING, getY() + getHeight(), getColor());
fontRenderer.drawStringWithShadow(biome, getX(), getY(), Util.WHITE);
}
Expand Down

0 comments on commit bafbaaf

Please sign in to comment.