mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Big pass through render stuff
This commit is contained in:
1 parent
092442f44a
commit
a9e1615ab6
39 files changed
+468
-530
No files matched your search
@@ -10,7 +10,6 @@
|
||||
*/
|
||||
package vazkii.botania.api.boss;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -52,7 +51,7 @@ public interface IBotaniaBoss {
|
||||
* @return How tall your auxiliary renders were
|
||||
*/
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int bossBarRenderCallback(ScaledResolution res, int x, int y);
|
||||
public int bossBarRenderCallback(int x, int y);
|
||||
|
||||
/**
|
||||
* Get the serverside UUID of the {@link net.minecraft.world.BossInfoServer} instance tracking this boss
|
||||
|
||||
@@ -12,7 +12,7 @@ package vazkii.botania.api.lexicon.multiblock;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -25,7 +25,7 @@ public interface IMultiblockRenderHook {
|
||||
|
||||
public static Map<Block, IMultiblockRenderHook> renderHooks = new HashMap<>();
|
||||
|
||||
public void renderBlockForMultiblock(IBlockAccess world, Multiblock mb, IBlockState state, MultiblockComponent comp);
|
||||
public void renderBlockForMultiblock(IBlockReader world, Multiblock mb, IBlockState state, MultiblockComponent comp);
|
||||
|
||||
public boolean needsTranslate(IBlockState state);
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package vazkii.botania.api.wand;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -24,6 +23,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
public interface IWandHUD {
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos);
|
||||
public void renderHUD(Minecraft mc, World world, BlockPos pos);
|
||||
|
||||
}
|
||||
@@ -14,12 +14,14 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A block that implements this can provide a custom AABB
|
||||
* for rendering the wireframe with ITileBound.
|
||||
*/
|
||||
public interface IWireframeAABBProvider {
|
||||
|
||||
public AxisAlignedBB getWireframeAABB(World world, BlockPos pos);
|
||||
public List<AxisAlignedBB> getWireframeAABB(World world, BlockPos pos);
|
||||
|
||||
}
|
||||
@@ -34,17 +34,17 @@ public final class ModChallenges {
|
||||
challenges.put(level, new ArrayList<>());
|
||||
|
||||
addChallenge(EnumChallengeLevel.EASY, "flowerFarm", new ItemStack(ModBlocks.flower, 1, 6));
|
||||
addChallenge(EnumChallengeLevel.EASY, "recordFarm", new ItemStack(Items.RECORD_13));
|
||||
addChallenge(EnumChallengeLevel.EASY, "reedFarm", new ItemStack(Items.REEDS));
|
||||
addChallenge(EnumChallengeLevel.EASY, "recordFarm", new ItemStack(Items.MUSIC_DISC_13));
|
||||
addChallenge(EnumChallengeLevel.EASY, "reedFarm", new ItemStack(Blocks.SUGAR_CANE));
|
||||
addChallenge(EnumChallengeLevel.EASY, "cobbleGen", new ItemStack(Blocks.COBBLESTONE));
|
||||
addChallenge(EnumChallengeLevel.EASY, "pureDaisy", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY));
|
||||
addChallenge(EnumChallengeLevel.EASY, "battery", new ItemStack(ModBlocks.manaPool));
|
||||
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "apothecaryRefill", new ItemStack(ModBlocks.defaultAltar));
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "treeFarm", new ItemStack(Blocks.SAPLING));
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "treeFarm", new ItemStack(Blocks.OAK_SAPLING));
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "fullCropFarm", new ItemStack(Items.WHEAT_SEEDS));
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "animalFarm", new ItemStack(Items.LEATHER));
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "boneMealFarm", new ItemStack(Items.DYE, 1, 15));
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "boneMealFarm", new ItemStack(Items.BONE_MEAL));
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "orechid", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID));
|
||||
|
||||
addChallenge(EnumChallengeLevel.HARD, "mobTower", new ItemStack(Items.BONE));
|
||||
|
||||
@@ -22,8 +22,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.lwjgl.opengl.ARBShaderObjects;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -33,12 +33,12 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class AstrolabePreviewHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
World world = Minecraft.getMinecraft().world;
|
||||
World world = Minecraft.getInstance().world;
|
||||
List<EntityPlayer> playerEntities = world.playerEntities;
|
||||
for (EntityPlayer player : playerEntities) {
|
||||
ItemStack currentStack = player.getHeldItemMainhand();
|
||||
@@ -56,8 +56,7 @@ public final class AstrolabePreviewHandler {
|
||||
private static void renderPlayerLook(EntityPlayer player, ItemStack stack) {
|
||||
List<BlockPos> coords = ItemAstrolabe.getBlocksToPlace(stack, player);
|
||||
if (ItemAstrolabe.hasBlocks(stack, player, coords)) {
|
||||
Block block = ItemAstrolabe.getBlock(stack);
|
||||
int meta = ItemAstrolabe.getBlockMeta(stack);
|
||||
IBlockState state = ItemAstrolabe.getBlockState(stack);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -69,36 +68,34 @@ public final class AstrolabePreviewHandler {
|
||||
});
|
||||
|
||||
for(BlockPos coord : coords)
|
||||
renderBlockAt(block, meta, coord);
|
||||
renderBlockAt(state, coord);
|
||||
|
||||
ShaderHelper.releaseShader();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderBlockAt(Block block, int meta, BlockPos pos) {
|
||||
IBlockState state = block.getStateFromMeta(meta);
|
||||
|
||||
double renderPosX = Minecraft.getMinecraft().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getMinecraft().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getMinecraft().getRenderManager().renderPosZ;
|
||||
private static void renderBlockAt(IBlockState state, BlockPos pos) {
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().renderPosZ;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(-renderPosX, -renderPosY, -renderPosZ);
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.translated(-renderPosX, -renderPosY, -renderPosZ);
|
||||
GlStateManager.disableDepthTest();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
BlockRendererDispatcher brd = Minecraft.getMinecraft().getBlockRendererDispatcher();
|
||||
GlStateManager.translate(pos.getX(), pos.getY(), pos.getZ() + 1);
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
BlockRendererDispatcher brd = Minecraft.getInstance().getBlockRendererDispatcher();
|
||||
GlStateManager.translatef(pos.getX(), pos.getY(), pos.getZ() + 1);
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
brd.renderBlockBrightness(state, 1.0F);
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
GlStateManager.enableDepthTest();
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import javax.annotation.Nonnull;
|
||||
public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
public void render(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
if(!ConfigHandler.renderBaubles || player.getActivePotionEffect(MobEffects.INVISIBILITY) != null)
|
||||
return;
|
||||
|
||||
@@ -53,9 +53,9 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(yawOffset, 0, -1, 0);
|
||||
GlStateManager.rotate(yaw - 270, 0, 1, 0);
|
||||
GlStateManager.rotate(pitch, 0, 0, 1);
|
||||
GlStateManager.rotatef(yawOffset, 0, -1, 0);
|
||||
GlStateManager.rotatef(yaw - 270, 0, 1, 0);
|
||||
GlStateManager.rotatef(pitch, 0, 0, 1);
|
||||
dispatchRenders(inv, player, RenderType.HEAD, partialTicks);
|
||||
|
||||
ItemStack helm = player.inventory.armorItemInSlot(3);
|
||||
@@ -83,7 +83,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
if(!cosmetic.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255); // Some of the baubles use this so we must restore it manually as well
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
((IBaubleRender) cosmetic.getItem()).onPlayerBaubleRender(cosmetic, player, type, partialTicks);
|
||||
GlStateManager.popMatrix();
|
||||
continue;
|
||||
@@ -93,7 +93,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
if(item instanceof IBaubleRender) {
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255); // Some of the baubles use this so we must restore it manually as well
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
((IBaubleRender) stack.getItem()).onPlayerBaubleRender(stack, player, type, partialTicks);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
@@ -108,27 +108,27 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
ItemStack stack = player.inventory.getStackInSlot(i);
|
||||
if(!stack.isEmpty() && stack.getItem() == ModItems.manaTablet) {
|
||||
GlStateManager.pushMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Helper.rotateIfSneaking(player);
|
||||
boolean armor = !player.getItemStackFromSlot(EntityEquipmentSlot.LEGS).isEmpty();
|
||||
GlStateManager.rotate(90, 0, 1, 0);
|
||||
GlStateManager.rotate(180, 0, 0, 1);
|
||||
GlStateManager.translate(0, -0.6, 0);
|
||||
GlStateManager.scale(0.55, 0.55, 0.55);
|
||||
GlStateManager.rotatef(90, 0, 1, 0);
|
||||
GlStateManager.rotatef(180, 0, 0, 1);
|
||||
GlStateManager.translated(0, -0.6, 0);
|
||||
GlStateManager.scaled(0.55, 0.55, 0.55);
|
||||
|
||||
if (renderedOne)
|
||||
GlStateManager.translate(0F, 0F, armor ? 0.55F : 0.5F);
|
||||
GlStateManager.translatef(0F, 0F, armor ? 0.55F : 0.5F);
|
||||
else
|
||||
GlStateManager.translate(0F, 0F, armor ? -0.55F : -0.5F);
|
||||
GlStateManager.translatef(0F, 0F, armor ? -0.55F : -0.5F);
|
||||
|
||||
GlStateManager.scale(0.75F, 0.75F, 0.75F);
|
||||
GlStateManager.scalef(0.75F, 0.75F, 0.75F);
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
GlStateManager.color3f(1F, 1F, 1F);
|
||||
int light = 15728880;
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
|
||||
Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.NONE);
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.NONE);
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
if(renderedOne)
|
||||
|
||||
@@ -21,8 +21,8 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.subtile.ISubTileContainer;
|
||||
@@ -37,14 +37,14 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class BlockHighlightRenderHandler {
|
||||
|
||||
private BlockHighlightRenderHandler() {}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
RayTraceResult pos = mc.objectMouseOver;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -55,7 +55,7 @@ public final class BlockHighlightRenderHandler {
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
boundTile: {
|
||||
if(Botania.proxy.isClientPlayerWearingMonocle() && pos != null && pos.entityHit == null) {
|
||||
if(Botania.proxy.isClientPlayerWearingMonocle() && pos != null && pos.entity == null) {
|
||||
BlockPos bPos = pos.getBlockPos();
|
||||
|
||||
ItemStack stackHeld = PlayerHelper.getFirstHeldItem(mc.player, ModItems.twigWand);
|
||||
@@ -111,12 +111,12 @@ public final class BlockHighlightRenderHandler {
|
||||
}
|
||||
|
||||
private static void renderRectangle(AxisAlignedBB aabb, boolean inner, Color color, byte alpha) {
|
||||
double renderPosX = Minecraft.getMinecraft().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getMinecraft().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getMinecraft().getRenderManager().renderPosZ;
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().renderPosZ;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(aabb.minX - renderPosX, aabb.minY - renderPosY, aabb.minZ - renderPosZ);
|
||||
GlStateManager.translated(aabb.minX - renderPosX, aabb.minY - renderPosY, aabb.minZ - renderPosZ);
|
||||
|
||||
if(color == null)
|
||||
color = Color.getHSBColor(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
|
||||
@@ -152,15 +152,15 @@ public final class BlockHighlightRenderHandler {
|
||||
}
|
||||
|
||||
private static void renderCircle(BlockPos center, double radius) {
|
||||
double renderPosX = Minecraft.getMinecraft().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getMinecraft().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getMinecraft().getRenderManager().renderPosZ;
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().renderPosZ;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
double x = center.getX() + 0.5;
|
||||
double y = center.getY();
|
||||
double z = center.getZ() + 0.5;
|
||||
GlStateManager.translate(x - renderPosX, y - renderPosY, z - renderPosZ);
|
||||
GlStateManager.translated(x - renderPosX, y - renderPosY, z - renderPosZ);
|
||||
int color = Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
|
||||
|
||||
Color colorRGB = new Color(color);
|
||||
|
||||
@@ -14,8 +14,8 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.lwjgl.opengl.ARBShaderObjects;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -32,7 +32,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class BossBarHandler {
|
||||
|
||||
private BossBarHandler() {}
|
||||
@@ -49,11 +49,11 @@ public final class BossBarHandler {
|
||||
if(currentBoss.getBossInfoUuid().equals(infoUuid)) {
|
||||
evt.setCanceled(true);
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Rectangle bgRect = currentBoss.getBossBarTextureRect();
|
||||
Rectangle fgRect = currentBoss.getBossBarHPTextureRect();
|
||||
String name = evt.getBossInfo().getName().getFormattedText();
|
||||
int c = evt.getResolution().getScaledWidth() / 2;
|
||||
int c = Minecraft.getInstance().mainWindow.getScaledWidth() / 2;
|
||||
int x = evt.getX();
|
||||
int y = evt.getY();
|
||||
int xf = x + (bgRect.width - fgRect.width) / 2;
|
||||
@@ -61,11 +61,11 @@ public final class BossBarHandler {
|
||||
int fw = (int) ((double) fgRect.width * evt.getBossInfo().getPercent());
|
||||
int tx = c - mc.fontRenderer.getStringWidth(name) / 2;
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
int auxHeight = currentBoss.bossBarRenderCallback(evt.getResolution(), x, y);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
int auxHeight = currentBoss.bossBarRenderCallback(x, y);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
mc.renderEngine.bindTexture(currentBoss.getBossBarTexture());
|
||||
mc.textureManager.bindTexture(currentBoss.getBossBarTexture());
|
||||
drawBar(currentBoss, x, y, bgRect.x, bgRect.y, bgRect.width, bgRect.height, true);
|
||||
drawBar(currentBoss, xf, yf, fgRect.x, fgRect.y, fw, fgRect.height, false);
|
||||
mc.fontRenderer.drawStringWithShadow(name, tx, y - 10, 0xA2018C);
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
@@ -45,11 +45,11 @@ public final class BoundTileRenderer {
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.disableDepthTest();
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.enableBlend();
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
EntityPlayer player = Minecraft.getInstance().player;
|
||||
int color = Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F);
|
||||
|
||||
if(!player.getHeldItemMainhand().isEmpty() && player.getHeldItemMainhand().getItem() instanceof ICoordBoundItem) {
|
||||
@@ -83,7 +83,7 @@ public final class BoundTileRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableDepthTest();
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.disableBlend();
|
||||
GL11.glPopAttrib();
|
||||
@@ -95,38 +95,40 @@ public final class BoundTileRenderer {
|
||||
}
|
||||
|
||||
private static void renderBlockOutlineAt(BlockPos pos, int color, float thickness) {
|
||||
double renderPosX = Minecraft.getMinecraft().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getMinecraft().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getMinecraft().getRenderManager().renderPosZ;
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().renderPosZ;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(pos.getX() - renderPosX, pos.getY() - renderPosY, pos.getZ() - renderPosZ + 1);
|
||||
GlStateManager.translated(pos.getX() - renderPosX, pos.getY() - renderPosY, pos.getZ() - renderPosZ + 1);
|
||||
Color colorRGB = new Color(color);
|
||||
GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 255);
|
||||
|
||||
World world = Minecraft.getMinecraft().world;
|
||||
World world = Minecraft.getInstance().world;
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
drawWireframe : {
|
||||
if(block != null) {
|
||||
AxisAlignedBB axis;
|
||||
List<AxisAlignedBB> list;
|
||||
|
||||
if(block instanceof IWireframeAABBProvider)
|
||||
axis = ((IWireframeAABBProvider) block).getWireframeAABB(world, pos);
|
||||
else axis = state.getSelectedBoundingBox(world, pos);
|
||||
if(block instanceof IWireframeAABBProvider)
|
||||
list = ((IWireframeAABBProvider) block).getWireframeAABB(world, pos);
|
||||
else list = state.getShape(world, pos).toBoundingBoxList();
|
||||
|
||||
if(axis == null)
|
||||
break drawWireframe;
|
||||
if(list == null)
|
||||
break drawWireframe;
|
||||
|
||||
GlStateManager.scalef(1F, 1F, 1F);
|
||||
|
||||
GL11.glLineWidth(thickness);
|
||||
for(AxisAlignedBB axis : list) {
|
||||
axis = axis.offset(-pos.getX(), -pos.getY(), -(pos.getZ() + 1));
|
||||
|
||||
GlStateManager.scale(1F, 1F, 1F);
|
||||
|
||||
GL11.glLineWidth(thickness);
|
||||
renderBlockOutline(axis);
|
||||
}
|
||||
|
||||
GL11.glLineWidth(thickness + 3F);
|
||||
GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 64);
|
||||
GL11.glLineWidth(thickness + 3F);
|
||||
GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 64);
|
||||
for(AxisAlignedBB axis : list) {
|
||||
axis = axis.offset(-pos.getX(), -pos.getY(), -(pos.getZ() + 1));
|
||||
renderBlockOutline(axis);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent;
|
||||
@@ -31,7 +31,7 @@ import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class ClientTickHandler {
|
||||
|
||||
private ClientTickHandler() {}
|
||||
@@ -64,20 +64,20 @@ public final class ClientTickHandler {
|
||||
RedStringRenderer.tick();
|
||||
ItemsRemainingRenderHandler.tick();
|
||||
|
||||
if(Minecraft.getMinecraft().world == null) {
|
||||
if(Minecraft.getInstance().world == null) {
|
||||
ManaNetworkHandler.instance.clear();
|
||||
SubTileVinculotus.existingFlowers.clear();
|
||||
}
|
||||
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
GuiScreen gui = Minecraft.getInstance().currentScreen;
|
||||
if(gui == null || !gui.doesGuiPauseGame()) {
|
||||
ticksInGame++;
|
||||
partialTicks = 0;
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
EntityPlayer player = Minecraft.getInstance().player;
|
||||
if(player != null) {
|
||||
if(PlayerHelper.hasHeldItemClass(player, ModItems.twigWand)) {
|
||||
for(TileSignature sig : ImmutableList.copyOf(ManaNetworkHandler.instance.getAllCollectorsInWorld(Minecraft.getMinecraft().world))) {
|
||||
for(TileSignature sig : ImmutableList.copyOf(ManaNetworkHandler.instance.getAllCollectorsInWorld(Minecraft.getInstance().world))) {
|
||||
if(!sig.isRemote())
|
||||
continue;
|
||||
|
||||
|
||||
@@ -46,14 +46,14 @@ import java.util.Map;
|
||||
public final class ColorHandler {
|
||||
|
||||
public static void init() {
|
||||
BlockColors blocks = Minecraft.getMinecraft().getBlockColors();
|
||||
BlockColors blocks = Minecraft.getInstance().getBlockColors();
|
||||
Map<IRegistryDelegate<Block>, IBlockColor> map = ReflectionHelper.getPrivateValue(BlockColors.class, blocks, "blockColorMap");
|
||||
|
||||
// Steal vine colorer
|
||||
blocks.registerBlockColorHandler(map.get(Blocks.VINE.delegate), ModBlocks.solidVines);
|
||||
blocks.register(map.get(Blocks.VINE.delegate), ModBlocks.solidVines);
|
||||
|
||||
// Pool
|
||||
blocks.registerBlockColorHandler(
|
||||
blocks.register(
|
||||
(state, world, pos, tintIndex) -> {
|
||||
if (((BlockPool) state.getBlock()).variant == BlockPool.Variant.FABULOUS) {
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
@@ -66,7 +66,7 @@ public final class ColorHandler {
|
||||
);
|
||||
|
||||
// Spreader
|
||||
blocks.registerBlockColorHandler(
|
||||
blocks.register(
|
||||
(state, world, pos, tintIndex) -> {
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
return Color.HSBtoRGB(time * 5 % 360 / 360F, 0.4F, 0.9F);
|
||||
@@ -75,7 +75,7 @@ public final class ColorHandler {
|
||||
);
|
||||
|
||||
// Petal Block
|
||||
blocks.registerBlockColorHandler((state, world, pos, tintIndex) -> ((BlockPetalBlock) state.getBlock()).color.getColorValue(),
|
||||
blocks.register((state, world, pos, tintIndex) -> ((BlockPetalBlock) state.getBlock()).color.getColorValue(),
|
||||
ModBlocks.petalBlockWhite, ModBlocks.petalBlockOrange, ModBlocks.petalBlockMagenta, ModBlocks.petalBlockLightBlue,
|
||||
ModBlocks.petalBlockYellow, ModBlocks.petalBlockLime, ModBlocks.petalBlockPink, ModBlocks.petalBlockGray,
|
||||
ModBlocks.petalBlockSilver, ModBlocks.petalBlockCyan, ModBlocks.petalBlockPurple, ModBlocks.petalBlockBlue,
|
||||
@@ -83,7 +83,7 @@ public final class ColorHandler {
|
||||
);
|
||||
|
||||
// Platforms
|
||||
blocks.registerBlockColorHandler(
|
||||
blocks.register(
|
||||
(state, world, pos, tintIndex) -> {
|
||||
if (world != null && pos != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
@@ -93,43 +93,43 @@ public final class ColorHandler {
|
||||
if(camoState != null)
|
||||
return camoState.getBlock() instanceof BlockCamo
|
||||
? 0xFFFFFF
|
||||
: Minecraft.getMinecraft().getBlockColors().colorMultiplier(camoState, world, pos, tintIndex);
|
||||
: Minecraft.getInstance().getBlockColors().getColor(camoState, world, pos, tintIndex);
|
||||
}
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}, ModBlocks.abstrusePlatform, ModBlocks.spectralPlatform, ModBlocks.infrangiblePlatform);
|
||||
|
||||
ItemColors items = Minecraft.getMinecraft().getItemColors();
|
||||
ItemColors items = Minecraft.getInstance().getItemColors();
|
||||
|
||||
items.registerItemColorHandler((s, t) -> Color.HSBtoRGB(Botania.proxy.getWorldElapsedTicks() * 2 % 360 / 360F, 0.25F, 1F),
|
||||
items.register((s, t) -> Color.HSBtoRGB(Botania.proxy.getWorldElapsedTicks() * 2 % 360 / 360F, 0.25F, 1F),
|
||||
ModItems.lifeEssence, ModItems.gaiaIngot);
|
||||
|
||||
items.registerItemColorHandler((s, t) ->
|
||||
t == 1 ? EnumDyeColor.byMetadata(ItemTwigWand.getColor1(s)).getColorValue()
|
||||
: t == 2 ? EnumDyeColor.byMetadata(ItemTwigWand.getColor2(s)).getColorValue()
|
||||
items.register((s, t) ->
|
||||
t == 1 ? EnumDyeColor.byId(ItemTwigWand.getColor1(s)).getColorValue()
|
||||
: t == 2 ? EnumDyeColor.byId(ItemTwigWand.getColor2(s)).getColorValue()
|
||||
: -1,
|
||||
ModItems.twigWand);
|
||||
|
||||
IItemColor handler = (s, t) -> ((Item16Colors) s.getItem()).color.colorValue;
|
||||
Item[] dyes = ModItems.dyes.values().toArray(new Item[0]);
|
||||
Item[] petals = ModItems.petals.values().toArray(new Item[0]);
|
||||
items.registerItemColorHandler(handler, dyes);
|
||||
items.registerItemColorHandler(handler, petals);
|
||||
items.register(handler, dyes);
|
||||
items.register(handler, petals);
|
||||
|
||||
items.registerItemColorHandler((s, t) -> Minecraft.getMinecraft().getBlockColors().colorMultiplier(((ItemBlock)s.getItem()).getBlock().getStateFromMeta(s.getMetadata()), null, null, t),
|
||||
items.register((s, t) -> Minecraft.getInstance().getBlockColors().getColor(((ItemBlock)s.getItem()).getBlock().getDefaultState(), null, null, t),
|
||||
ModBlocks.petalBlockWhite, ModBlocks.petalBlockOrange, ModBlocks.petalBlockMagenta, ModBlocks.petalBlockLightBlue,
|
||||
ModBlocks.petalBlockYellow, ModBlocks.petalBlockLime, ModBlocks.petalBlockPink, ModBlocks.petalBlockGray,
|
||||
ModBlocks.petalBlockSilver, ModBlocks.petalBlockCyan, ModBlocks.petalBlockPurple, ModBlocks.petalBlockBlue,
|
||||
ModBlocks.petalBlockBrown, ModBlocks.petalBlockGreen, ModBlocks.petalBlockRed, ModBlocks.petalBlockBlack,
|
||||
ModBlocks.manaPool, ModBlocks.creativePool, ModBlocks.dilutedPool, ModBlocks.fabulousPool, ModBlocks.gaiaSpreader);
|
||||
|
||||
items.registerItemColorHandler((s, t) -> t == 1 ? Color.HSBtoRGB(0.528F, (float) ((ItemManaMirror) ModItems.manaMirror).getMana(s) / (float) TilePool.MAX_MANA, 1F) : -1, ModItems.manaMirror);
|
||||
items.register((s, t) -> t == 1 ? Color.HSBtoRGB(0.528F, (float) ((ItemManaMirror) ModItems.manaMirror).getMana(s) / (float) TilePool.MAX_MANA, 1F) : -1, ModItems.manaMirror);
|
||||
|
||||
items.registerItemColorHandler((s, t) -> t == 1 ? Color.HSBtoRGB(0.528F, (float) ((ItemManaTablet) ModItems.manaTablet).getMana(s) / (float) ItemManaTablet.MAX_MANA, 1F) : -1, ModItems.manaTablet);
|
||||
items.register((s, t) -> t == 1 ? Color.HSBtoRGB(0.528F, (float) ((ItemManaTablet) ModItems.manaTablet).getMana(s) / (float) ItemManaTablet.MAX_MANA, 1F) : -1, ModItems.manaTablet);
|
||||
|
||||
items.registerItemColorHandler((s, t) -> Color.HSBtoRGB(0.55F, ((float) s.getMaxDamage() - (float) s.getItemDamage()) / (float)s.getMaxDamage() * 0.5F, 1F), ModItems.spellCloth);
|
||||
items.register((s, t) -> Color.HSBtoRGB(0.55F, ((float) s.getMaxDamage() - (float) s.getDamage()) / (float)s.getMaxDamage() * 0.5F, 1F), ModItems.spellCloth);
|
||||
|
||||
items.registerItemColorHandler((s, t) -> {
|
||||
items.register((s, t) -> {
|
||||
if(t != 1)
|
||||
return -1;
|
||||
|
||||
@@ -148,13 +148,13 @@ public final class ColorHandler {
|
||||
return r << 16 | g << 8 | b;
|
||||
}, ModItems.bloodPendant, ModItems.incenseStick, ModItems.brewFlask, ModItems.brewVial);
|
||||
|
||||
items.registerItemColorHandler((s, t) -> {
|
||||
items.register((s, t) -> {
|
||||
ItemStack lens = ItemManaGun.getLens(s);
|
||||
if(!lens.isEmpty() && t == 0)
|
||||
return Minecraft.getMinecraft().getItemColors().colorMultiplier(lens, t);
|
||||
return Minecraft.getInstance().getItemColors().getColor(lens, t);
|
||||
|
||||
if(t == 2) {
|
||||
BurstProperties props = ((ItemManaGun) s.getItem()).getBurstProps(Minecraft.getMinecraft().player, s, false, EnumHand.MAIN_HAND);
|
||||
BurstProperties props = ((ItemManaGun) s.getItem()).getBurstProps(Minecraft.getInstance().player, s, false, EnumHand.MAIN_HAND);
|
||||
Color color = new Color(props.color);
|
||||
|
||||
float mul = (float) (Math.sin((double) ClientTickHandler.ticksInGame / 5) * 0.15F);
|
||||
@@ -164,15 +164,15 @@ public final class ColorHandler {
|
||||
} else return -1;
|
||||
}, ModItems.manaGun);
|
||||
|
||||
items.registerItemColorHandler((s, t) -> t == 1 ? Color.HSBtoRGB(0.75F, 1F, 1.5F - (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 100D) * 0.5 + 1.2F)) : -1, ModItems.enderDagger);
|
||||
items.register((s, t) -> t == 1 ? Color.HSBtoRGB(0.75F, 1F, 1.5F - (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 100D) * 0.5 + 1.2F)) : -1, ModItems.enderDagger);
|
||||
|
||||
items.registerItemColorHandler((s, t) -> t == 1 && ItemTerraPick.isEnabled(s) ? Color.HSBtoRGB(0.375F, (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 200D) * 0.5 + 1F), 1F) : -1, ModItems.terraPick);
|
||||
items.register((s, t) -> t == 1 && ItemTerraPick.isEnabled(s) ? Color.HSBtoRGB(0.375F, (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 200D) * 0.5 + 1F), 1F) : -1, ModItems.terraPick);
|
||||
|
||||
// todo 1.13 use tags instead of looping registry
|
||||
handler = (s, t) -> t == 0 ? ((ItemLens) s.getItem()).getLensColor(s) : -1;
|
||||
for (Item i : Item.REGISTRY) {
|
||||
if(i instanceof ItemLens && i.getRegistryName().getNamespace().equals(LibMisc.MOD_ID)) {
|
||||
items.registerItemColorHandler(handler, i);
|
||||
items.register(handler, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,17 +44,17 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
|
||||
private static boolean startedLoading = false;
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
String name = player.getDisplayName().getUnformattedText();
|
||||
public void render(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
String name = player.getDisplayName().getUnformattedComponentText();
|
||||
|
||||
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
|
||||
float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks;
|
||||
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(yawOffset, 0, -1, 0);
|
||||
GlStateManager.rotate(yaw - 270, 0, 1, 0);
|
||||
GlStateManager.rotate(pitch, 0, 0, 1);
|
||||
GlStateManager.rotatef(yawOffset, 0, -1, 0);
|
||||
GlStateManager.rotatef(yaw - 270, 0, 1, 0);
|
||||
GlStateManager.rotatef(pitch, 0, 0, 1);
|
||||
|
||||
if(name.equals("haighyorkie"))
|
||||
renderGoldfish(player);
|
||||
@@ -104,12 +104,12 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
Helper.rotateIfSneaking(player);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
GlStateManager.scale(0.4F, 0.4F, 0.4F);
|
||||
GlStateManager.translate(-0.5F, 1.6F, 0F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GlStateManager.rotatef(180F, 0F, 0F, 1F);
|
||||
GlStateManager.rotatef(90F, 0F, 1F, 0F);
|
||||
GlStateManager.scalef(0.4F, 0.4F, 0.4F);
|
||||
GlStateManager.translatef(-0.5F, 1.6F, 0F);
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, icon.getWidth(), icon.getHeight(), 1F / 16F);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@@ -117,13 +117,13 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
|
||||
private static void renderFlower(EntityPlayer player, ItemStack flower) {
|
||||
GlStateManager.pushMatrix();
|
||||
Helper.translateToHeadLevel(player);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
GlStateManager.rotate(180, 0, 0, 1);
|
||||
GlStateManager.translate(0, -0.85, 0);
|
||||
GlStateManager.rotate(-90, 0, 1, 0);
|
||||
GlStateManager.scale(0.5, 0.5, 0.5);
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
GlStateManager.rotatef(180, 0, 0, 1);
|
||||
GlStateManager.translated(0, -0.85, 0);
|
||||
GlStateManager.rotatef(-90, 0, 1, 0);
|
||||
GlStateManager.scaled(0.5, 0.5, 0.5);
|
||||
ShaderHelper.useShader(ShaderHelper.gold);
|
||||
Minecraft.getMinecraft().getRenderItem().renderItem(flower, player, ItemCameraTransforms.TransformType.NONE, false);
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(flower, player, ItemCameraTransforms.TransformType.NONE, false);
|
||||
ShaderHelper.releaseShader();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@@ -19,11 +19,9 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import vazkii.botania.api.corporea.CorporeaHelper;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
|
||||
@@ -53,12 +51,12 @@ public class CorporeaAutoCompleteHandler {
|
||||
while(iterator.hasNext()) {
|
||||
Item item = iterator.next();
|
||||
|
||||
if(item != null && item.getCreativeTab() != null) {
|
||||
if(item != null && item.getGroup() != null) {
|
||||
curList.clear();
|
||||
try {
|
||||
item.getSubItems(null, curList);
|
||||
for(ItemStack stack : curList)
|
||||
itemNames.add(CorporeaHelper.stripControlCodes(stack.getDisplayName().trim()));
|
||||
itemNames.add(CorporeaHelper.stripControlCodes(stack.getDisplayName().getUnformattedComponentText().trim()));
|
||||
}
|
||||
catch (Exception e) {}
|
||||
}
|
||||
@@ -69,7 +67,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
public void onTick(ClientTickEvent event) {
|
||||
if(event.phase != Phase.END)
|
||||
return;
|
||||
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
|
||||
GuiScreen screen = Minecraft.getInstance().currentScreen;
|
||||
if(!(screen instanceof GuiChat)) {
|
||||
isAutoCompleted = false;
|
||||
return;
|
||||
|
||||
@@ -15,11 +15,9 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import vazkii.botania.api.corporea.CorporeaHelper;
|
||||
import vazkii.botania.client.core.proxy.ClientProxy;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
|
||||
@@ -28,7 +26,7 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, value = Side.CLIENT)
|
||||
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, value = Dist.CLIENT)
|
||||
public class CorporeaInputHandler {
|
||||
|
||||
/** Replaced in JEIBotaniaPlugin when JEI's loaded to provide stacks from the JEI item panel. */
|
||||
@@ -71,7 +69,7 @@ public class CorporeaInputHandler {
|
||||
}
|
||||
|
||||
private static ItemStack getStackUnderMouse() {
|
||||
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
|
||||
GuiScreen screen = Minecraft.getInstance().currentScreen;
|
||||
if(screen instanceof GuiContainer) {
|
||||
Slot slotUnderMouse = ((GuiContainer) screen).getSlotUnderMouse();
|
||||
if(slotUnderMouse != null)
|
||||
|
||||
@@ -20,14 +20,14 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.lwjgl.opengl.ARBFragmentShader;
|
||||
import org.lwjgl.opengl.ContextCapabilities;
|
||||
import org.lwjgl.opengl.GL;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
import org.lwjgl.opengl.GLCapabilities;
|
||||
import vazkii.botania.client.fx.ParticleRenderDispatcher;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
@@ -37,7 +37,7 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class DebugHandler {
|
||||
|
||||
private DebugHandler() {}
|
||||
@@ -46,8 +46,8 @@ public final class DebugHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onDrawDebugText(RenderGameOverlayEvent.Text event) {
|
||||
World world = Minecraft.getMinecraft().world;
|
||||
if(ConfigHandler.debugInfo && Minecraft.getMinecraft().gameSettings.showDebugInfo) {
|
||||
World world = Minecraft.getInstance().world;
|
||||
if(ConfigHandler.debugInfo && Minecraft.getInstance().gameSettings.showDebugInfo) {
|
||||
event.getLeft().add("");
|
||||
String version = LibMisc.VERSION;
|
||||
if(version.contains("GRADLE"))
|
||||
@@ -56,11 +56,11 @@ public final class DebugHandler {
|
||||
event.getLeft().add(PREFIX + "pS: " + ParticleRenderDispatcher.sparkleFxCount + ", pFS: " + ParticleRenderDispatcher.fakeSparkleFxCount + ", pW: " + ParticleRenderDispatcher.wispFxCount + ", pDIW: " + ParticleRenderDispatcher.depthIgnoringWispFxCount + ", pLB: " + ParticleRenderDispatcher.lightningCount);
|
||||
event.getLeft().add(PREFIX + "(CLIENT) netColl: " + ManaNetworkHandler.instance.getAllCollectorsInWorld(world).size() + ", netPool: " + ManaNetworkHandler.instance.getAllPoolsInWorld(world).size() + ", rv: " + version);
|
||||
|
||||
if (Minecraft.getMinecraft().isSingleplayer()) {
|
||||
UUID id = Minecraft.getMinecraft().player.getUniqueID();
|
||||
Entity ent = Minecraft.getMinecraft().getIntegratedServer().getEntityFromUuid(id);
|
||||
if (Minecraft.getInstance().isSingleplayer()) {
|
||||
UUID id = Minecraft.getInstance().player.getUniqueID();
|
||||
Entity ent = Minecraft.getInstance().getIntegratedServer().getEntityFromUuid(id);
|
||||
if (ent != null) {
|
||||
World serverWorld = Minecraft.getMinecraft().getIntegratedServer().getEntityFromUuid(id).world;
|
||||
World serverWorld = ent.world;
|
||||
event.getLeft().add(PREFIX + String.format("(INTEGRATED SERVER DIM %d) netColl : %d, netPool: %d", serverWorld.provider.getDimension(), ManaNetworkHandler.instance.getAllCollectorsInWorld(serverWorld).size(), ManaNetworkHandler.instance.getAllPoolsInWorld(serverWorld).size()));
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public final class DebugHandler {
|
||||
event.getLeft().add(" shaders.enabled: " + ConfigHandler.useShaders);
|
||||
event.getLeft().add(" shaders.secondaryUnit: " + ConfigHandler.glSecondaryTextureUnit);
|
||||
|
||||
ContextCapabilities caps = GLContext.getCapabilities();
|
||||
GLCapabilities caps = GL.getCapabilities();
|
||||
event.getLeft().add(PREFIX + "OpenGL Context");
|
||||
event.getLeft().add(" GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION));
|
||||
event.getLeft().add(" GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER));
|
||||
@@ -80,11 +80,10 @@ public final class DebugHandler {
|
||||
event.getLeft().add(" GL_ARB_texture_non_power_of_two: " + caps.GL_ARB_texture_non_power_of_two);
|
||||
event.getLeft().add(" OpenGL13: " + caps.OpenGL13);
|
||||
|
||||
if (Minecraft.getMinecraft().objectMouseOver != null
|
||||
&& Minecraft.getMinecraft().objectMouseOver.getBlockPos() != null) {
|
||||
BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos();
|
||||
if (Minecraft.getInstance().objectMouseOver != null
|
||||
&& Minecraft.getInstance().objectMouseOver.getBlockPos() != null) {
|
||||
BlockPos pos = Minecraft.getInstance().objectMouseOver.getBlockPos();
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
state = state.getActualState(world, pos);
|
||||
state = state.getBlock().getExtendedState(state, world, pos);
|
||||
if (state instanceof IExtendedBlockState) {
|
||||
try {
|
||||
|
||||
@@ -12,13 +12,11 @@ package vazkii.botania.client.core.handler;
|
||||
|
||||
import baubles.api.BaublesApi;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiChat;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -31,9 +29,9 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
@@ -75,7 +73,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class HUDHandler {
|
||||
|
||||
private HUDHandler() {}
|
||||
@@ -84,7 +82,7 @@ public final class HUDHandler {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public static void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Profiler profiler = mc.profiler;
|
||||
|
||||
if(event.getType() == ElementType.HEALTH) {
|
||||
@@ -93,7 +91,7 @@ public final class HUDHandler {
|
||||
ItemStack headpiece = baublesInv.getStackInSlot(4);
|
||||
if(!headpiece.isEmpty() && headpiece.getItem() == ModItems.flightTiara) {
|
||||
profiler.startSection("flugelTiara");
|
||||
ItemFlightTiara.renderHUD(event.getResolution(), mc.player, headpiece);
|
||||
ItemFlightTiara.renderHUD(mc.player, headpiece);
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
@@ -106,7 +104,7 @@ public final class HUDHandler {
|
||||
}
|
||||
|
||||
profiler.startSection("dodgeRing");
|
||||
ItemDodgeRing.renderHUD(event.getResolution(), mc.player, ring, event.getPartialTicks());
|
||||
ItemDodgeRing.renderHUD(mc.player, ring, event.getPartialTicks());
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
@@ -116,7 +114,7 @@ public final class HUDHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Profiler profiler = mc.profiler;
|
||||
ItemStack main = mc.player.getHeldItemMainhand();
|
||||
ItemStack offhand = mc.player.getHeldItemOffhand();
|
||||
@@ -126,9 +124,9 @@ public final class HUDHandler {
|
||||
RayTraceResult pos = mc.objectMouseOver;
|
||||
|
||||
if(pos != null) {
|
||||
IBlockState state = pos.typeOfHit == RayTraceResult.Type.BLOCK ? mc.world.getBlockState(pos.getBlockPos()) : null;
|
||||
IBlockState state = pos.type == RayTraceResult.Type.BLOCK ? mc.world.getBlockState(pos.getBlockPos()) : null;
|
||||
Block block = state == null ? null : state.getBlock();
|
||||
TileEntity tile = pos.typeOfHit == RayTraceResult.Type.BLOCK ? mc.world.getTileEntity(pos.getBlockPos()) : null;
|
||||
TileEntity tile = pos.type == RayTraceResult.Type.BLOCK ? mc.world.getTileEntity(pos.getBlockPos()) : null;
|
||||
|
||||
if(PlayerHelper.hasAnyHeldItem(mc.player)) {
|
||||
if(pos != null && PlayerHelper.hasHeldItem(mc.player, ModItems.twigWand)) {
|
||||
@@ -136,50 +134,50 @@ public final class HUDHandler {
|
||||
|
||||
if(block instanceof IWandHUD) {
|
||||
profiler.startSection("wandItem");
|
||||
((IWandHUD) block).renderHUD(mc, event.getResolution(), mc.world, pos.getBlockPos());
|
||||
((IWandHUD) block).renderHUD(mc, mc.world, pos.getBlockPos());
|
||||
profiler.endSection();
|
||||
}
|
||||
} else if(block != null && PlayerHelper.hasHeldItemClass(mc.player, ILexicon.class))
|
||||
drawLexiconHUD(PlayerHelper.getFirstHeldItemClass(mc.player, ILexicon.class), state, pos, event.getResolution());
|
||||
if(tile != null && tile instanceof TilePool && !mc.player.getHeldItemMainhand().isEmpty())
|
||||
renderPoolRecipeHUD(event.getResolution(), (TilePool) tile, mc.player.getHeldItemMainhand());
|
||||
renderPoolRecipeHUD((TilePool) tile, mc.player.getHeldItemMainhand());
|
||||
}
|
||||
if(tile != null && tile instanceof TileAltar)
|
||||
((TileAltar) tile).renderHUD(mc, event.getResolution());
|
||||
((TileAltar) tile).renderHUD(mc);
|
||||
else if(tile != null && tile instanceof TileRuneAltar)
|
||||
((TileRuneAltar) tile).renderHUD(mc, event.getResolution());
|
||||
((TileRuneAltar) tile).renderHUD(mc);
|
||||
|
||||
if(tile != null && tile instanceof TileCorporeaCrystalCube)
|
||||
renderCrystalCubeHUD(event.getResolution(), (TileCorporeaCrystalCube) tile);
|
||||
renderCrystalCubeHUD((TileCorporeaCrystalCube) tile);
|
||||
}
|
||||
|
||||
TileCorporeaIndex.getInputHandler();
|
||||
if(!InputHandler.getNearbyIndexes(mc.player).isEmpty() && mc.currentScreen != null && mc.currentScreen instanceof GuiChat) {
|
||||
profiler.startSection("nearIndex");
|
||||
renderNearIndexDisplay(event.getResolution());
|
||||
renderNearIndexDisplay();
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
if(MultiblockRenderHandler.currentMultiblock != null && MultiblockRenderHandler.anchor == null) {
|
||||
profiler.startSection("multiblockRightClick");
|
||||
String s = I18n.format("botaniamisc.rightClickToAnchor");
|
||||
mc.fontRenderer.drawStringWithShadow(s, event.getResolution().getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(s) / 2, event.getResolution().getScaledHeight() / 2 - 30, 0xFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow(s, mc.mainWindow.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(s) / 2, mc.mainWindow.getScaledHeight() / 2 - 30, 0xFFFFFF);
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
if(!main.isEmpty() && main.getItem() instanceof ItemCraftingHalo) {
|
||||
profiler.startSection("craftingHalo_main");
|
||||
ItemCraftingHalo.renderHUD(event.getResolution(), mc.player, main);
|
||||
ItemCraftingHalo.renderHUD(mc.player, main);
|
||||
profiler.endSection();
|
||||
} else if(!offhand.isEmpty() && offhand.getItem() instanceof ItemCraftingHalo) {
|
||||
profiler.startSection("craftingHalo_off");
|
||||
ItemCraftingHalo.renderHUD(event.getResolution(), mc.player, offhand);
|
||||
ItemCraftingHalo.renderHUD(mc.player, offhand);
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
if(!main.isEmpty() && main.getItem() instanceof ItemSextant) {
|
||||
profiler.startSection("sextant");
|
||||
ItemSextant.renderHUD(event.getResolution(), mc.player, main);
|
||||
ItemSextant.renderHUD(mc.player, main);
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
@@ -191,7 +189,7 @@ public final class HUDHandler {
|
||||
|
||||
if(Botania.proxy.isClientPlayerWearingMonocle()) {
|
||||
profiler.startSection("monocle");
|
||||
ItemMonocle.renderHUD(event.getResolution(), mc.player);
|
||||
ItemMonocle.renderHUD(mc.player);
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
@@ -248,20 +246,20 @@ public final class HUDHandler {
|
||||
}
|
||||
|
||||
if(anyRequest)
|
||||
renderManaInvBar(event.getResolution(), creative, totalMana, totalMaxMana);
|
||||
renderManaInvBar(creative, totalMana, totalMaxMana);
|
||||
}
|
||||
|
||||
profiler.endStartSection("itemsRemaining");
|
||||
ItemsRemainingRenderHandler.render(event.getResolution(), event.getPartialTicks());
|
||||
ItemsRemainingRenderHandler.render(event.getPartialTicks());
|
||||
profiler.endSection();
|
||||
profiler.endSection();
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderWandModeDisplay(ItemStack stack, ScaledResolution res) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
private static void renderWandModeDisplay(ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Profiler profiler = mc.profiler;
|
||||
|
||||
profiler.startSection("wandMode");
|
||||
@@ -272,8 +270,8 @@ public final class HUDHandler {
|
||||
int color = 0x00CC00 + (alpha << 24);
|
||||
String disp = I18n.format(ItemTwigWand.getModeString(stack));
|
||||
|
||||
int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(disp) / 2;
|
||||
int y = res.getScaledHeight() - 70;
|
||||
int x = mc.mainWindow.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(disp) / 2;
|
||||
int y = mc.mainWindow.getScaledHeight() - 70;
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -283,11 +281,11 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private static void renderManaInvBar(ScaledResolution res, boolean hasCreative, int totalMana, int totalMaxMana) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
private static void renderManaInvBar(boolean hasCreative, int totalMana, int totalMaxMana) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
int width = 182;
|
||||
int x = res.getScaledWidth() / 2 - width / 2;
|
||||
int y = res.getScaledHeight() - ConfigHandler.manaBarHeight;
|
||||
int x = mc.mainWindow.getScaledWidth() / 2 - width / 2;
|
||||
int y = mc.mainWindow.getScaledHeight() - ConfigHandler.manaBarHeight;
|
||||
|
||||
if(!hasCreative) {
|
||||
if(totalMaxMana == 0)
|
||||
@@ -303,7 +301,7 @@ public final class HUDHandler {
|
||||
|
||||
Color color = new Color(Color.HSBtoRGB(0.55F, (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 200D) * 0.5 + 1F), 1F));
|
||||
GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) (255 - color.getRed()));
|
||||
mc.renderEngine.bindTexture(manaBar);
|
||||
mc.textureManager.bindTexture(manaBar);
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -312,15 +310,15 @@ public final class HUDHandler {
|
||||
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) 255);
|
||||
}
|
||||
|
||||
private static void renderPoolRecipeHUD(ScaledResolution res, TilePool tile, ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
private static void renderPoolRecipeHUD(TilePool tile, ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Profiler profiler = mc.profiler;
|
||||
|
||||
profiler.startSection("poolRecipe");
|
||||
RecipeManaInfusion recipe = TilePool.getMatchingRecipe(stack, tile.getWorld().getBlockState(tile.getPos().down()));
|
||||
if(recipe != null) {
|
||||
int x = res.getScaledWidth() / 2 - 11;
|
||||
int y = res.getScaledHeight() / 2 + 10;
|
||||
int x = mc.mainWindow.getScaledWidth() / 2 - 11;
|
||||
int y = mc.mainWindow.getScaledHeight() / 2 + 10;
|
||||
|
||||
int u = tile.getCurrentMana() >= recipe.getManaToConsume() ? 0 : 22;
|
||||
int v = mc.player.getName().equals("haighyorkie") && mc.player.isSneaking() ? 23 : 8;
|
||||
@@ -328,14 +326,14 @@ public final class HUDHandler {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
mc.renderEngine.bindTexture(manaBar);
|
||||
mc.textureManager.bindTexture(manaBar);
|
||||
RenderHelper.drawTexturedModalRect(x, y, 0, u, v, 22, 15);
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x - 20, y);
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(recipe.getOutput(), x + 26, y);
|
||||
mc.getRenderItem().renderItemOverlays(mc.fontRenderer, recipe.getOutput(), x + 26, y);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, x - 20, y);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(recipe.getOutput(), x + 26, y);
|
||||
mc.getItemRenderer().renderItemOverlays(mc.fontRenderer, recipe.getOutput(), x + 26, y);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
@@ -344,34 +342,34 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private static void renderCrystalCubeHUD(ScaledResolution res, TileCorporeaCrystalCube tile) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
private static void renderCrystalCubeHUD(TileCorporeaCrystalCube tile) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Profiler profiler = mc.profiler;
|
||||
|
||||
profiler.startSection("crystalCube");
|
||||
ItemStack target = tile.getRequestTarget();
|
||||
if(!target.isEmpty()) {
|
||||
String s1 = target.getDisplayName();
|
||||
String s1 = target.getDisplayName().getUnformattedComponentText();
|
||||
String s2 = tile.getItemCount() + "x";
|
||||
int strlen = Math.max(mc.fontRenderer.getStringWidth(s1), mc.fontRenderer.getStringWidth(s2));
|
||||
int w = res.getScaledWidth();
|
||||
int h = res.getScaledHeight();
|
||||
int w = mc.mainWindow.getScaledWidth();
|
||||
int h = mc.mainWindow.getScaledHeight();
|
||||
Gui.drawRect(w / 2 + 8, h / 2 - 12, w / 2 + strlen + 32, h / 2 + 10, 0x44000000);
|
||||
Gui.drawRect(w / 2 + 6, h / 2 - 14, w / 2 + strlen + 34, h / 2 + 12, 0x44000000);
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(target.getDisplayName(), w / 2 + 30, h / 2 - 10, 0x6666FF);
|
||||
mc.fontRenderer.drawStringWithShadow(s1, w / 2 + 30, h / 2 - 10, 0x6666FF);
|
||||
mc.fontRenderer.drawStringWithShadow(tile.getItemCount() + "x", w / 2 + 30, h / 2, 0xFFFFFF);
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(target, w / 2 + 10, h / 2 - 10);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(target, w / 2 + 10, h / 2 - 10);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private static void drawLexiconHUD(ItemStack stack, IBlockState state, RayTraceResult pos, ScaledResolution res) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
private static void drawLexiconHUD(ItemStack stack, IBlockState state, RayTraceResult pos) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Block block = state.getBlock();
|
||||
Profiler profiler = mc.profiler;
|
||||
|
||||
@@ -383,8 +381,8 @@ public final class HUDHandler {
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
int sx = res.getScaledWidth() / 2 - 17;
|
||||
int sy = res.getScaledHeight() / 2 + 2;
|
||||
int sx = mc.mainWindow.getScaledWidth() / 2 - 17;
|
||||
int sy = mc.mainWindow.getScaledHeight() / 2 + 2;
|
||||
|
||||
if(block instanceof ILexiconable) {
|
||||
LexiconEntry entry = ((ILexiconable) block).getEntry(mc.world, pos.getBlockPos(), mc.player, stack);
|
||||
@@ -398,7 +396,7 @@ public final class HUDHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if(!ConfigHandler.lexicaOfflineMode && !draw && pos.entityHit == null) {
|
||||
if(!ConfigHandler.lexicaOfflineMode && !draw && pos.entity == null) {
|
||||
profiler.startSection("wikiLookup");
|
||||
if(!block.isAir(state, mc.world, pos.getBlockPos()) && !(block instanceof BlockLiquid)) {
|
||||
IWikiProvider provider = WikiHooks.getWikiFor(block);
|
||||
@@ -420,38 +418,38 @@ public final class HUDHandler {
|
||||
font = mc.fontRenderer;
|
||||
}
|
||||
|
||||
mc.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.lexicon), sx, sy);
|
||||
mc.getItemRenderer().renderItemIntoGUI(new ItemStack(ModItems.lexicon), sx, sy);
|
||||
GlStateManager.disableLighting();
|
||||
font.drawStringWithShadow(drawStr, sx + 20, sy + 4, 0xFFFFFFFF);
|
||||
font.drawStringWithShadow(secondLine, sx + 20, sy + 14, 0xFFAAAAAA);
|
||||
|
||||
if(!mc.player.isSneaking()) {
|
||||
GlStateManager.scale(0.5F, 0.5F, 1F);
|
||||
GlStateManager.scalef(0.5F, 0.5F, 1F);
|
||||
mc.fontRenderer.drawStringWithShadow(TextFormatting.BOLD + mc.gameSettings.keyBindSneak.getDisplayName(), (sx + 10) * 2 - 16, (sy + 8) * 2 + 20, 0xFFFFFFFF);
|
||||
GlStateManager.scale(2F, 2F, 1F);
|
||||
GlStateManager.scalef(2F, 2F, 1F);
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private static void renderNearIndexDisplay(ScaledResolution res) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
private static void renderNearIndexDisplay() {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
String txt0 = I18n.format("botaniamisc.nearIndex0");
|
||||
String txt1 = TextFormatting.GRAY + I18n.format("botaniamisc.nearIndex1");
|
||||
String txt2 = TextFormatting.GRAY + I18n.format("botaniamisc.nearIndex2");
|
||||
|
||||
int l = Math.max(mc.fontRenderer.getStringWidth(txt0), Math.max(mc.fontRenderer.getStringWidth(txt1), mc.fontRenderer.getStringWidth(txt2))) + 20;
|
||||
int x = res.getScaledWidth() - l - 20;
|
||||
int y = res.getScaledHeight() - 60;
|
||||
int x = mc.mainWindow.getScaledWidth() - l - 20;
|
||||
int y = mc.mainWindow.getScaledHeight() - 60;
|
||||
|
||||
Gui.drawRect(x - 6, y - 6, x + l + 6, y + 37, 0x44000000);
|
||||
Gui.drawRect(x - 4, y - 4, x + l + 4, y + 35, 0x44000000);
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(new ItemStack(ModBlocks.corporeaIndex), x, y + 10);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(new ItemStack(ModBlocks.corporeaIndex), x, y + 10);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(txt0, x + 20, y, 0xFFFFFF);
|
||||
@@ -459,23 +457,23 @@ public final class HUDHandler {
|
||||
mc.fontRenderer.drawStringWithShadow(txt2, x + 20, y + 24, 0xFFFFFF);
|
||||
}
|
||||
|
||||
public static void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {
|
||||
public static void drawSimpleManaHUD(int color, int mana, int maxMana, String name) {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(name) / 2;
|
||||
int y = res.getScaledHeight() / 2 + 10;
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
int x = mc.mainWindow.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(name) / 2;
|
||||
int y = mc.mainWindow.getScaledHeight() / 2 + 10;
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(name, x, y, color);
|
||||
|
||||
x = res.getScaledWidth() / 2 - 51;
|
||||
x = mc.mainWindow.getScaledWidth() / 2 - 51;
|
||||
y += 10;
|
||||
|
||||
renderManaBar(x, y, color, mana < 0 ? 0.5F : 1F, mana, maxMana);
|
||||
|
||||
if(mana < 0) {
|
||||
String text = I18n.format("botaniamisc.statusUnknown");
|
||||
x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(text) / 2;
|
||||
x = mc.mainWindow.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(text) / 2;
|
||||
y -= 1;
|
||||
mc.fontRenderer.drawString(text, x, y, color);
|
||||
}
|
||||
@@ -483,20 +481,20 @@ public final class HUDHandler {
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
public static void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound) {
|
||||
drawSimpleManaHUD(color, mana, maxMana, name, res);
|
||||
public static void drawComplexManaHUD(int color, int mana, int maxMana, String name, ItemStack bindDisplay, boolean properlyBound) {
|
||||
drawSimpleManaHUD(color, mana, maxMana, name);
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
int x = res.getScaledWidth() / 2 + 55;
|
||||
int y = res.getScaledHeight() / 2 + 12;
|
||||
int x = mc.mainWindow.getScaledWidth() / 2 + 55;
|
||||
int y = mc.mainWindow.getScaledHeight() / 2 + 12;
|
||||
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(bindDisplay, x, y);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(bindDisplay, x, y);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.disableDepthTest();
|
||||
if(properlyBound) {
|
||||
mc.fontRenderer.drawStringWithShadow("\u2714", x + 10, y + 9, 0x004C00);
|
||||
mc.fontRenderer.drawStringWithShadow("\u2714", x + 10, y + 8, 0x0BD20D);
|
||||
@@ -504,14 +502,14 @@ public final class HUDHandler {
|
||||
mc.fontRenderer.drawStringWithShadow("\u2718", x + 10, y + 9, 0x4C0000);
|
||||
mc.fontRenderer.drawStringWithShadow("\u2718", x + 10, y + 8, 0xD2080D);
|
||||
}
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableDepthTest();
|
||||
}
|
||||
|
||||
public static void renderManaBar(int x, int y, int color, float alpha, int mana, int maxMana) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, alpha);
|
||||
mc.renderEngine.bindTexture(manaBar);
|
||||
GlStateManager.color4f(1F, 1F, 1F, alpha);
|
||||
mc.textureManager.bindTexture(manaBar);
|
||||
RenderHelper.drawTexturedModalRect(x, y, 0, 0, 0, 102, 5);
|
||||
|
||||
int manaPercentage = Math.max(0, (int) ((double) mana / (double) maxMana * 100));
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -33,38 +32,38 @@ public final class ItemsRemainingRenderHandler {
|
||||
private static int ticks, count;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void render(ScaledResolution resolution, float partTicks) {
|
||||
public static void render(float partTicks) {
|
||||
if(ticks > 0 && !stack.isEmpty()) {
|
||||
int pos = maxTicks - ticks;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
int x = resolution.getScaledWidth() / 2 + 10 + Math.max(0, pos - leaveTicks);
|
||||
int y = resolution.getScaledHeight() / 2;
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
int x = mc.mainWindow.getScaledWidth() / 2 + 10 + Math.max(0, pos - leaveTicks);
|
||||
int y = mc.mainWindow.getScaledHeight() / 2;
|
||||
|
||||
int start = maxTicks - leaveTicks;
|
||||
float alpha = ticks + partTicks > start ? 1F : (ticks + partTicks) / start;
|
||||
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, alpha);
|
||||
GlStateManager.color4f(1F, 1F, 1F, alpha);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
int xp = x + (int) (16F * (1F - alpha));
|
||||
GlStateManager.translate(xp, y, 0F);
|
||||
GlStateManager.scale(alpha, 1F, 1F);
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0);
|
||||
GlStateManager.scale(1F / alpha,1F, 1F);
|
||||
GlStateManager.translate(-xp, -y, 0F);
|
||||
GlStateManager.translatef(xp, y, 0F);
|
||||
GlStateManager.scalef(alpha, 1F, 1F);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, 0, 0);
|
||||
GlStateManager.scalef(1F / alpha,1F, 1F);
|
||||
GlStateManager.translatef(-xp, -y, 0F);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
GlStateManager.enableBlend();
|
||||
|
||||
String text = "";
|
||||
|
||||
if(customString == null) {
|
||||
if(!stack.isEmpty()) {
|
||||
text = TextFormatting.GREEN + stack.getDisplayName();
|
||||
text = TextFormatting.GREEN + stack.getDisplayName().getUnformattedComponentText();
|
||||
if(count >= 0) {
|
||||
int max = stack.getMaxStackSize();
|
||||
int stacks = count / max;
|
||||
@@ -82,7 +81,7 @@ public final class ItemsRemainingRenderHandler {
|
||||
mc.fontRenderer.drawStringWithShadow(text, x + 20, y + 6, color);
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableAlphaTest();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.client.fx.FXLightning;
|
||||
@@ -31,7 +31,7 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public class LightningHandler {
|
||||
|
||||
private LightningHandler() {}
|
||||
@@ -43,7 +43,7 @@ public class LightningHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
Profiler profiler = Minecraft.getMinecraft().profiler;
|
||||
Profiler profiler = Minecraft.getInstance().profiler;
|
||||
|
||||
profiler.startSection("botania-particles");
|
||||
ParticleRenderDispatcher.dispatch();
|
||||
@@ -52,15 +52,15 @@ public class LightningHandler {
|
||||
profiler.endStartSection("lightning");
|
||||
|
||||
float frame = event.getPartialTicks();
|
||||
Entity entity = Minecraft.getMinecraft().player;
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
Entity entity = Minecraft.getInstance().player;
|
||||
TextureManager render = Minecraft.getInstance().textureManager;
|
||||
|
||||
double interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame;
|
||||
double interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame;
|
||||
double interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(-interpPosX, -interpPosY, -interpPosZ);
|
||||
GlStateManager.translated(-interpPosX, -interpPosY, -interpPosZ);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
|
||||
@@ -103,7 +103,7 @@ public class LightningHandler {
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.depthMask(true);
|
||||
|
||||
GlStateManager.translate(interpPosX, interpPosY, interpPosZ);
|
||||
GlStateManager.translated(interpPosX, interpPosY, interpPosZ);
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
profiler.endSection();
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.client.model.FloatingFlowerModel;
|
||||
@@ -79,37 +79,37 @@ public class MiscellaneousIcons {
|
||||
public void onModelBake(ModelBakeEvent evt) {
|
||||
// Floating flowers
|
||||
FloatingFlowerModel model = new FloatingFlowerModel();
|
||||
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:miniIsland", "normal"), model);
|
||||
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:miniIsland", "inventory"), model);
|
||||
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:floatingSpecialFlower", "normal"), model);
|
||||
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:floatingSpecialFlower", "inventory"), model);
|
||||
evt.getModelRegistry().put(new ModelResourceLocation("botania:miniIsland", "normal"), model);
|
||||
evt.getModelRegistry().put(new ModelResourceLocation("botania:miniIsland", "inventory"), model);
|
||||
evt.getModelRegistry().put(new ModelResourceLocation("botania:floatingSpecialFlower", "normal"), model);
|
||||
evt.getModelRegistry().put(new ModelResourceLocation("botania:floatingSpecialFlower", "inventory"), model);
|
||||
|
||||
// Platforms
|
||||
ModelResourceLocation abstruseName = new ModelResourceLocation("botania:abstruse_platform", "normal");
|
||||
IBakedModel abstruse = evt.getModelRegistry().getObject(abstruseName);
|
||||
IBakedModel abstruse = evt.getModelRegistry().get(abstruseName);
|
||||
ModelResourceLocation spectralName = new ModelResourceLocation("botania:spectral_platform", "normal");
|
||||
IBakedModel spectral = evt.getModelRegistry().getObject(spectralName);
|
||||
IBakedModel spectral = evt.getModelRegistry().get(spectralName);
|
||||
ModelResourceLocation infrangibleName = new ModelResourceLocation("botania:infrangible_platform", "normal");
|
||||
IBakedModel infrangible = evt.getModelRegistry().getObject(infrangibleName);
|
||||
IBakedModel infrangible = evt.getModelRegistry().get(infrangibleName);
|
||||
|
||||
evt.getModelRegistry().putObject(abstruseName, new PlatformModel(abstruse));
|
||||
evt.getModelRegistry().putObject(spectralName, new PlatformModel(spectral));
|
||||
evt.getModelRegistry().putObject(infrangibleName, new PlatformModel(infrangible));
|
||||
evt.getModelRegistry().put(abstruseName, new PlatformModel(abstruse));
|
||||
evt.getModelRegistry().put(spectralName, new PlatformModel(spectral));
|
||||
evt.getModelRegistry().put(infrangibleName, new PlatformModel(infrangible));
|
||||
|
||||
// Lexicon
|
||||
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:lexicon_3d_default", "inventory"),
|
||||
evt.getModelRegistry().put(new ModelResourceLocation("botania:lexicon_3d_default", "inventory"),
|
||||
new LexiconModel(new ModelResourceLocation("botania:lexicon_default", "inventory")));
|
||||
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:lexicon_3d_elven", "inventory"),
|
||||
evt.getModelRegistry().put(new ModelResourceLocation("botania:lexicon_3d_elven", "inventory"),
|
||||
new LexiconModel(new ModelResourceLocation("botania:lexicon_elven", "inventory")));
|
||||
|
||||
// Mana Blaster
|
||||
ModelResourceLocation key = new ModelResourceLocation("botania:managun", "inventory");
|
||||
IBakedModel originalModel = evt.getModelRegistry().getObject(key);
|
||||
evt.getModelRegistry().putObject(key, new GunModel(originalModel));
|
||||
IBakedModel originalModel = evt.getModelRegistry().get(key);
|
||||
evt.getModelRegistry().put(key, new GunModel(originalModel));
|
||||
|
||||
key = new ModelResourceLocation("botania:managunclip", "inventory");
|
||||
originalModel = evt.getModelRegistry().getObject(key);
|
||||
evt.getModelRegistry().putObject(key, new GunModel(originalModel));
|
||||
originalModel = evt.getModelRegistry().get(key);
|
||||
evt.getModelRegistry().put(key, new GunModel(originalModel));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -11,16 +11,13 @@ package vazkii.botania.client.core.handler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
@@ -50,7 +47,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.IntFunction;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class ModelHandler {
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent evt) {
|
||||
|
||||
@@ -11,14 +11,12 @@
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Biomes;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Fluids;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.WorldType;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import vazkii.botania.api.lexicon.multiblock.Multiblock;
|
||||
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
|
||||
|
||||
@@ -28,10 +26,9 @@ import javax.annotation.Nonnull;
|
||||
* This class acts as a wrapper around a block access to
|
||||
* replace blocks with the blocks involved in the multiblock specified
|
||||
*/
|
||||
public class MultiblockBlockAccess implements IBlockAccess {
|
||||
public class MultiblockBlockAccess implements IBlockReader {
|
||||
|
||||
private IBlockAccess originalBlockAccess;
|
||||
private boolean hasBlockAccess = false;
|
||||
private IBlockReader compose;
|
||||
private BlockPos anchorPos;
|
||||
protected Multiblock multiblock;
|
||||
|
||||
@@ -41,72 +38,34 @@ public class MultiblockBlockAccess implements IBlockAccess {
|
||||
MultiblockComponent comp=getComponent(pos);
|
||||
if(comp != null)
|
||||
return comp.getBlockState();
|
||||
if(hasBlockAccess)
|
||||
return originalBlockAccess.getBlockState(pos);
|
||||
if(compose != null)
|
||||
return compose.getBlockState(pos);
|
||||
return Blocks.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IFluidState getFluidState(BlockPos pos) {
|
||||
return compose != null ? compose.getFluidState(pos) : Fluids.EMPTY.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(@Nonnull BlockPos pos) {
|
||||
MultiblockComponent comp=getComponent(pos);
|
||||
if(comp != null)
|
||||
return comp.getTileEntity();
|
||||
if(hasBlockAccess)
|
||||
return originalBlockAccess.getTileEntity(pos);
|
||||
if(compose != null)
|
||||
return compose.getTileEntity(pos);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCombinedLight(@Nonnull BlockPos pos, int lightValue) {
|
||||
if(hasBlockAccess)
|
||||
return originalBlockAccess.getCombinedLight(pos, lightValue);
|
||||
return 15728640;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStrongPower(@Nonnull BlockPos pos, @Nonnull EnumFacing direction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public WorldType getWorldType() {
|
||||
return WorldType.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAirBlock(@Nonnull BlockPos pos) {
|
||||
MultiblockComponent comp=getComponent(pos);
|
||||
if(comp != null)
|
||||
return false;
|
||||
if(hasBlockAccess)
|
||||
return originalBlockAccess.isAirBlock(pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Biome getBiome(@Nonnull BlockPos pos) {
|
||||
if(hasBlockAccess)
|
||||
return originalBlockAccess.getBiome(pos);
|
||||
return Biomes.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(@Nonnull BlockPos pos, @Nonnull EnumFacing side, boolean _default) {
|
||||
if(hasBlockAccess)
|
||||
return originalBlockAccess.isSideSolid(pos, side, _default);
|
||||
return _default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the block access to the new parameters
|
||||
*/
|
||||
public void update(IBlockAccess access, Multiblock mb, BlockPos anchorPos) {
|
||||
originalBlockAccess = access;
|
||||
public void update(IBlockReader access, Multiblock mb, BlockPos anchorPos) {
|
||||
compose = access;
|
||||
multiblock = mb;
|
||||
this.anchorPos = anchorPos;
|
||||
hasBlockAccess = access != null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,12 +25,11 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.lwjgl.opengl.ARBShaderObjects;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -42,7 +41,7 @@ import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class MultiblockRenderHandler {
|
||||
|
||||
private MultiblockRenderHandler() {}
|
||||
@@ -60,14 +59,14 @@ public final class MultiblockRenderHandler {
|
||||
anchor = null;
|
||||
angle = EnumFacing.SOUTH;
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if(mc.world != null)
|
||||
dimension = mc.world.provider.getDimension();
|
||||
dimension = mc.world.getDimension().getId();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if(mc.player != null && mc.objectMouseOver != null && mc.objectMouseOver.getBlockPos() != null && (!mc.player.isSneaking() || anchor != null)) {
|
||||
renderPlayerLook(mc.player, mc.objectMouseOver);
|
||||
}
|
||||
@@ -84,7 +83,7 @@ public final class MultiblockRenderHandler {
|
||||
}
|
||||
|
||||
private static void renderPlayerLook(EntityPlayer player, RayTraceResult src) {
|
||||
if(currentMultiblock != null && dimension == player.world.provider.getDimension()) {
|
||||
if(currentMultiblock != null && dimension == player.world.getDimension().getId()) {
|
||||
BlockPos anchorPos = anchor != null ? anchor : src.getBlockPos();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -122,9 +121,9 @@ public final class MultiblockRenderHandler {
|
||||
}
|
||||
|
||||
private static boolean renderComponentInWorld(World world, Multiblock mb, MultiblockComponent comp, BlockPos anchorPos) {
|
||||
double renderPosX = Minecraft.getMinecraft().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getMinecraft().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getMinecraft().getRenderManager().renderPosZ;
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().renderPosZ;
|
||||
|
||||
BlockPos pos = comp.getRelativePosition();
|
||||
BlockPos pos_ = pos.add(anchorPos);
|
||||
@@ -132,15 +131,15 @@ public final class MultiblockRenderHandler {
|
||||
return false;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(-renderPosX, -renderPosY, -renderPosZ);
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.translated(-renderPosX, -renderPosY, -renderPosZ);
|
||||
GlStateManager.disableDepthTest();
|
||||
doRenderComponent(mb, comp, pos_);
|
||||
GlStateManager.popMatrix();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void renderMultiblockOnPage(Multiblock mb) {
|
||||
GlStateManager.translate(-0.5, -0.5, -0.5);
|
||||
GlStateManager.translated(-0.5, -0.5, -0.5);
|
||||
blockAccess.update(null, mb, mb.offPos);
|
||||
for(MultiblockComponent comp : mb.getComponents()) {
|
||||
BlockPos pos = comp.getRelativePosition();
|
||||
@@ -153,25 +152,25 @@ public final class MultiblockRenderHandler {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
IBlockState state = comp.getBlockState();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
if(state == null)
|
||||
return;
|
||||
if(IMultiblockRenderHook.renderHooks.containsKey(state.getBlock())) {
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
IMultiblockRenderHook renderHook = IMultiblockRenderHook.renderHooks.get(state.getBlock());
|
||||
if(renderHook.needsTranslate(state)) {
|
||||
GlStateManager.translate(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
||||
GlStateManager.translated(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
||||
}
|
||||
renderHook.renderBlockForMultiblock(blockAccess, mb, state, comp);
|
||||
}
|
||||
else {
|
||||
BlockRendererDispatcher brd = Minecraft.getMinecraft().getBlockRendererDispatcher();
|
||||
GlStateManager.translate(pos.getX(), pos.getY(), pos.getZ() + 1);
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
BlockRendererDispatcher brd = Minecraft.getInstance().getBlockRendererDispatcher();
|
||||
GlStateManager.translated(pos.getX(), pos.getY(), pos.getZ() + 1);
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
brd.renderBlockBrightness(state, 1.0F);
|
||||
}
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
GlStateManager.enableDepthTest();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public final class PersistentVariableHelper {
|
||||
|
||||
List<GuiLexicon> bookmarks = GuiLexicon.bookmarks;
|
||||
int count = bookmarks.size();
|
||||
cmp.setInteger(TAG_BOOKMARK_COUNT, count);
|
||||
cmp.setInt(TAG_BOOKMARK_COUNT, count);
|
||||
NBTTagCompound bookmarksCmp = new NBTTagCompound();
|
||||
for(int i = 0; i < count; i++) {
|
||||
GuiLexicon lex = bookmarks.get(i);
|
||||
@@ -74,7 +74,7 @@ public final class PersistentVariableHelper {
|
||||
cmp.setBoolean(TAG_FIRST_LOAD, firstLoad);
|
||||
cmp.setBoolean(TAG_DOG, dog);
|
||||
cmp.setString(TAG_LAST_BOTANIA_VERSION, lastBotaniaVersion);
|
||||
cmp.setInteger(TAG_LEXICON_GUI_SCALE, lexiconGuiScale);
|
||||
cmp.setInt(TAG_LEXICON_GUI_SCALE, lexiconGuiScale);
|
||||
|
||||
injectNBTToFile(cmp, getCacheFile());
|
||||
}
|
||||
@@ -82,12 +82,12 @@ public final class PersistentVariableHelper {
|
||||
public static void load() throws IOException {
|
||||
NBTTagCompound cmp = getCacheCompound();
|
||||
|
||||
int count = cmp.getInteger(TAG_BOOKMARK_COUNT);
|
||||
int count = cmp.getInt(TAG_BOOKMARK_COUNT);
|
||||
GuiLexicon.bookmarks.clear();
|
||||
if(count > 0) {
|
||||
NBTTagCompound bookmarksCmp = cmp.getCompoundTag(TAG_BOOKMARKS);
|
||||
NBTTagCompound bookmarksCmp = cmp.getCompound(TAG_BOOKMARKS);
|
||||
for(int i = 0; i < count; i++) {
|
||||
NBTTagCompound bookmarkCmp = bookmarksCmp.getCompoundTag(TAG_BOOKMARK_PREFIX + i);
|
||||
NBTTagCompound bookmarkCmp = bookmarksCmp.getCompound(TAG_BOOKMARK_PREFIX + i);
|
||||
GuiLexicon gui = GuiLexicon.create(bookmarkCmp);
|
||||
if(gui != null) {
|
||||
GuiLexicon.bookmarks.add(gui);
|
||||
@@ -97,14 +97,14 @@ public final class PersistentVariableHelper {
|
||||
}
|
||||
|
||||
if(cmp.hasKey(TAG_CHALLENGES)) {
|
||||
NBTTagCompound challengesCmp = cmp.getCompoundTag(TAG_CHALLENGES);
|
||||
NBTTagCompound challengesCmp = cmp.getCompound(TAG_CHALLENGES);
|
||||
for(Challenge c : ModChallenges.challengeLookup.values())
|
||||
c.readFromNBT(challengesCmp);
|
||||
}
|
||||
|
||||
if(cmp.hasKey(TAG_LEXICON_NOTES)) {
|
||||
NBTTagCompound notesCmp = cmp.getCompoundTag(TAG_LEXICON_NOTES);
|
||||
Set<String> keys = notesCmp.getKeySet();
|
||||
NBTTagCompound notesCmp = cmp.getCompound(TAG_LEXICON_NOTES);
|
||||
Set<String> keys = notesCmp.keySet();
|
||||
GuiLexicon.notes.clear();
|
||||
for(String key : keys)
|
||||
GuiLexicon.notes.put(key, notesCmp.getString(key));
|
||||
@@ -117,7 +117,7 @@ public final class PersistentVariableHelper {
|
||||
lastBotaniaVersion = LibMisc.VERSION;
|
||||
|
||||
dog = cmp.getBoolean(TAG_DOG);
|
||||
lexiconGuiScale = cmp.getInteger(TAG_LEXICON_GUI_SCALE);
|
||||
lexiconGuiScale = cmp.getInt(TAG_LEXICON_GUI_SCALE);
|
||||
}
|
||||
|
||||
public static void saveSafe() {
|
||||
|
||||
@@ -40,7 +40,7 @@ public final class RedStringRenderer {
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color(1F, 0F, 0F, sizeAlpha);
|
||||
GlStateManager.color4f(1F, 0F, 0F, sizeAlpha);
|
||||
|
||||
TileRedString tile;
|
||||
while((tile = redStringTiles.poll()) != null)
|
||||
@@ -55,7 +55,7 @@ public final class RedStringRenderer {
|
||||
}
|
||||
|
||||
public static void tick() {
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
EntityPlayer player = Minecraft.getInstance().player;
|
||||
boolean hasWand = player != null && PlayerHelper.hasHeldItem(player, ModItems.twigWand);
|
||||
if(sizeAlpha > 0F && !hasWand)
|
||||
sizeAlpha -= 0.1F;
|
||||
@@ -64,16 +64,16 @@ public final class RedStringRenderer {
|
||||
}
|
||||
|
||||
private static void renderTile(TileRedString tile) {
|
||||
double renderPosX = Minecraft.getMinecraft().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getMinecraft().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getMinecraft().getRenderManager().renderPosZ;
|
||||
double renderPosX = Minecraft.getInstance().getRenderManager().renderPosX;
|
||||
double renderPosY = Minecraft.getInstance().getRenderManager().renderPosY;
|
||||
double renderPosZ = Minecraft.getInstance().getRenderManager().renderPosZ;
|
||||
|
||||
EnumFacing dir = tile.getOrientation();
|
||||
BlockPos bind = tile.getBinding();
|
||||
|
||||
if(bind != null) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(tile.getPos().getX() + 0.5 - renderPosX, tile.getPos().getY() + 0.5 - renderPosY, tile.getPos().getZ() + 0.5 - renderPosZ);
|
||||
GlStateManager.translated(tile.getPos().getX() + 0.5 - renderPosX, tile.getPos().getY() + 0.5 - renderPosY, tile.getPos().getZ() + 0.5 - renderPosZ);
|
||||
Vector3 vecOrig = new Vector3(bind.getX() - tile.getPos().getX(), bind.getY() - tile.getPos().getY(), bind.getZ() - tile.getPos().getZ());
|
||||
Vector3 vecNorm = vecOrig.normalize();
|
||||
Vector3 vecMag = vecNorm.multiply(0.025);
|
||||
|
||||
@@ -3,8 +3,8 @@ package vazkii.botania.client.core.handler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.model.ModelBook;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBook;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
@@ -13,8 +13,8 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.client.event.RenderSpecificHandEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
@@ -26,7 +26,7 @@ import vazkii.botania.common.lexicon.page.PageText;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
// Hacky way to render 3D lexicon, will be reevaluated in the future.
|
||||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public class RenderLexicon {
|
||||
private static final ModelBook model = new ModelBook();
|
||||
// todo 1.12 improve
|
||||
@@ -46,7 +46,7 @@ public class RenderLexicon {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void renderItem(RenderSpecificHandEvent evt) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if(!ConfigHandler.lexicon3dModel
|
||||
|| mc.gameSettings.thirdPersonView != 0
|
||||
|| mc.player.getHeldItem(evt.getHand()).isEmpty()
|
||||
@@ -70,7 +70,7 @@ public class RenderLexicon {
|
||||
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt(swingProgress) * ((float)Math.PI * 2F));
|
||||
float f2 = -0.2F * MathHelper.sin(swingProgress * (float)Math.PI);
|
||||
int i = flag1 ? 1 : -1;
|
||||
GlStateManager.translate(i * f, f1, f2);
|
||||
GlStateManager.translated(i * f, f1, f2);
|
||||
transformSideFirstPerson(enumhandside, equipProgress);
|
||||
transformFirstPerson(enumhandside, swingProgress);
|
||||
doRender(enumhandside, partialTicks, stack);
|
||||
@@ -78,24 +78,24 @@ public class RenderLexicon {
|
||||
}
|
||||
|
||||
private static void doRender(EnumHandSide side, float partialTicks, ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(((ItemLexicon) ModItems.lexicon).isElvenItem(stack) ? elvenTexture : texture);
|
||||
GlStateManager.color3f(1F, 1F, 1F);
|
||||
mc.textureManager.bindTexture(((ItemLexicon) ModItems.lexicon).isElvenItem(stack) ? elvenTexture : texture);
|
||||
float opening;
|
||||
float pageFlip;
|
||||
|
||||
float ticks = ClientTickHandler.ticksWithLexicaOpen;
|
||||
if(ticks > 0 && ticks < 10) {
|
||||
if(Minecraft.getMinecraft().currentScreen instanceof GuiLexicon)
|
||||
if(Minecraft.getInstance().currentScreen instanceof GuiLexicon)
|
||||
ticks += partialTicks;
|
||||
else ticks -= partialTicks;
|
||||
}
|
||||
|
||||
GlStateManager.translate(0.3F + 0.02F * ticks, 0.475F + 0.01F * ticks, -0.2F - (side == EnumHandSide.RIGHT ? 0.035F : 0.01F) * ticks);
|
||||
GlStateManager.rotate(87.5F + ticks * (side == EnumHandSide.RIGHT ? 8 : 12), 0F, 1F, 0F);
|
||||
GlStateManager.rotate(ticks * 2.85F, 0F, 0F, 1F);
|
||||
GlStateManager.translated(0.3F + 0.02F * ticks, 0.475F + 0.01F * ticks, -0.2F - (side == EnumHandSide.RIGHT ? 0.035F : 0.01F) * ticks);
|
||||
GlStateManager.rotatef(87.5F + ticks * (side == EnumHandSide.RIGHT ? 8 : 12), 0F, 1F, 0F);
|
||||
GlStateManager.rotatef(ticks * 2.85F, 0F, 0F, 1F);
|
||||
opening = ticks / 12F;
|
||||
|
||||
float pageFlipTicks = ClientTickHandler.pageFlipTicks;
|
||||
@@ -106,18 +106,18 @@ public class RenderLexicon {
|
||||
|
||||
model.render(null, 0F, 0F, pageFlip, opening, 0F, 1F / 16F);
|
||||
if(ticks < 3) {
|
||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.translate(-0.30F, -0.24F, -0.07F);
|
||||
GlStateManager.scale(0.0030F, 0.0030F, -0.0030F);
|
||||
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||
GlStateManager.rotatef(180F, 0F, 0F, 1F);
|
||||
GlStateManager.translatef(-0.30F, -0.24F, -0.07F);
|
||||
GlStateManager.scalef(0.0030F, 0.0030F, -0.0030F);
|
||||
|
||||
|
||||
String title = ItemLexicon.getTitle(stack);
|
||||
|
||||
font.drawString(font.trimStringToWidth(title, 80), 0, 0, 0xD69700);
|
||||
|
||||
GlStateManager.translate(0F, 10F, 0F);
|
||||
GlStateManager.scale(0.6F, 0.6F, 0.6F);
|
||||
GlStateManager.translatef(0F, 10F, 0F);
|
||||
GlStateManager.scalef(0.6F, 0.6F, 0.6F);
|
||||
font.drawString(TextFormatting.ITALIC + "" + TextFormatting.BOLD + I18n.format("botaniamisc.edition", ItemLexicon.getEdition()), 0, 0, 0xA07100);
|
||||
|
||||
if(quote == -1)
|
||||
@@ -125,17 +125,17 @@ public class RenderLexicon {
|
||||
|
||||
String quoteStr = QUOTES[quote];
|
||||
|
||||
GlStateManager.translate(-5F, 15F, 0F);
|
||||
GlStateManager.translatef(-5F, 15F, 0F);
|
||||
PageText.renderText(0, 0, 140, 100, 0, false, 0x79ff92, quoteStr);
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
GlStateManager.color3f(1F, 1F, 1F);
|
||||
|
||||
GlStateManager.translate(8F, 110F, 0F);
|
||||
GlStateManager.translatef(8F, 110F, 0F);
|
||||
font.drawString(I18n.format("botaniamisc.lexiconcover0"), 0, 0, 0x79ff92);
|
||||
|
||||
GlStateManager.translate(0F, 10F, 0F);
|
||||
GlStateManager.translatef(0F, 10F, 0F);
|
||||
font.drawString(TextFormatting.UNDERLINE + "" + TextFormatting.ITALIC + I18n.format("botaniamisc.lexiconcover1"), 0, 0, 0x79ff92);
|
||||
|
||||
GlStateManager.translate(0F, -30F, 0F);
|
||||
GlStateManager.translatef(0F, -30F, 0F);
|
||||
|
||||
String authorTitle = I18n.format("botaniamisc.lexiconcover2");
|
||||
int len = font.getStringWidth(authorTitle);
|
||||
@@ -150,7 +150,7 @@ public class RenderLexicon {
|
||||
private static void transformSideFirstPerson(EnumHandSide p_187459_1_, float p_187459_2_)
|
||||
{
|
||||
int i = p_187459_1_ == EnumHandSide.RIGHT ? 1 : -1;
|
||||
GlStateManager.translate(i * 0.56F, -0.44F + p_187459_2_ * -0.8F, -0.72F);
|
||||
GlStateManager.translatef(i * 0.56F, -0.44F + p_187459_2_ * -0.8F, -0.72F);
|
||||
}
|
||||
|
||||
// Copy with modification - ItemRenderer.transformFirstPerson
|
||||
@@ -159,16 +159,16 @@ public class RenderLexicon {
|
||||
{
|
||||
int i = p_187453_1_ == EnumHandSide.RIGHT ? 1 : -1;
|
||||
// Botania - added
|
||||
GlStateManager.translate(p_187453_1_ == EnumHandSide.RIGHT ? 0.2F : 0.52F, -0.125F, p_187453_1_ == EnumHandSide.RIGHT ? 0.6F : 0.25F);
|
||||
GlStateManager.rotate(p_187453_1_ == EnumHandSide.RIGHT ? 60F : 120F, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(30F, 0F, 0F, -1F);
|
||||
GlStateManager.translatef(p_187453_1_ == EnumHandSide.RIGHT ? 0.2F : 0.52F, -0.125F, p_187453_1_ == EnumHandSide.RIGHT ? 0.6F : 0.25F);
|
||||
GlStateManager.rotatef(p_187453_1_ == EnumHandSide.RIGHT ? 60F : 120F, 0F, 1F, 0F);
|
||||
GlStateManager.rotatef(30F, 0F, 0F, -1F);
|
||||
// End add
|
||||
float f = MathHelper.sin(p_187453_2_ * p_187453_2_ * (float)Math.PI);
|
||||
GlStateManager.rotate(i * (45.0F + f * -20.0F), 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotatef(i * (45.0F + f * -20.0F), 0.0F, 1.0F, 0.0F);
|
||||
float f1 = MathHelper.sin(MathHelper.sqrt(p_187453_2_) * (float)Math.PI);
|
||||
GlStateManager.rotate(i * f1 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.rotate(f1 * -80.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(i * -45.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotatef(i * f1 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.rotatef(f1 * -80.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotatef(i * -45.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
}
|
||||
+11
-11
@@ -23,8 +23,8 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.client.event.RenderTooltipEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.lexicon.ILexicon;
|
||||
@@ -40,7 +40,7 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class TooltipAdditionDisplayHandler {
|
||||
|
||||
private static float lexiconLookupTime = 0F;
|
||||
@@ -51,7 +51,7 @@ public final class TooltipAdditionDisplayHandler {
|
||||
return;
|
||||
|
||||
ItemStack stack = evt.getStack();
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
int width = evt.getWidth();
|
||||
int height = 3;
|
||||
int tooltipX = evt.getX();
|
||||
@@ -79,7 +79,7 @@ public final class TooltipAdditionDisplayHandler {
|
||||
|
||||
if(lexSlot > -1) {
|
||||
int x = tooltipX - 34;
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.disableDepthTest();
|
||||
|
||||
Gui.drawRect(x - 4, tooltipY - 4, x + 20, tooltipY + 26, 0x44000000);
|
||||
Gui.drawRect(x - 6, tooltipY - 6, x + 22, tooltipY + 28, 0x44000000);
|
||||
@@ -127,18 +127,18 @@ public final class TooltipAdditionDisplayHandler {
|
||||
}
|
||||
} else lexiconLookupTime = 0F;
|
||||
|
||||
mc.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.lexicon), x, tooltipY);
|
||||
mc.getItemRenderer().renderItemIntoGUI(new ItemStack(ModItems.lexicon), x, tooltipY);
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
font.drawStringWithShadow("?", x + 10, tooltipY + 8, 0xFFFFFFFF);
|
||||
GlStateManager.scale(0.5F, 0.5F, 1F);
|
||||
GlStateManager.scalef(0.5F, 0.5F, 1F);
|
||||
boolean mac = Minecraft.IS_RUNNING_ON_MAC;
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(TextFormatting.BOLD + (ConfigHandler.useShiftForQuickLookup ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (tooltipY + 8) * 2 + 20, 0xFFFFFFFF);
|
||||
GlStateManager.scale(2F, 2F, 1F);
|
||||
GlStateManager.scalef(2F, 2F, 1F);
|
||||
|
||||
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableDepthTest();
|
||||
} else lexiconLookupTime = 0F;
|
||||
} else lexiconLookupTime = 0F;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public final class TooltipAdditionDisplayHandler {
|
||||
float huePer = width == 0 ? 0F : 1F / width;
|
||||
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
|
||||
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.disableDepthTest();
|
||||
Gui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
|
||||
for(int i = 0; i < rainbowWidth; i++)
|
||||
Gui.drawRect(mouseX + i, mouseY - height, mouseX + i + 1, mouseY, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
|
||||
@@ -169,7 +169,7 @@ public final class TooltipAdditionDisplayHandler {
|
||||
font.drawStringWithShadow(rank, mouseX + width - font.getStringWidth(rank), mouseY - 12, 0xFFFFFF);
|
||||
}
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableDepthTest();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public final class TooltipAdditionDisplayHandler {
|
||||
float fraction = display.getManaFractionForDisplay(stack);
|
||||
int manaBarWidth = (int) Math.ceil(width * fraction);
|
||||
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.disableDepthTest();
|
||||
Gui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
|
||||
Gui.drawRect(mouseX, mouseY - height, mouseX + manaBarWidth, mouseY, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
|
||||
Gui.drawRect(mouseX + manaBarWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
|
||||
|
||||
@@ -10,23 +10,23 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.item.ItemKeepIvy;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Side.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class TooltipHandler {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public static void onTooltipEvent(ItemTooltipEvent event) {
|
||||
if(event.getItemStack().hasTagCompound() && ItemNBTHelper.getBoolean(event.getItemStack(), ItemKeepIvy.TAG_KEEP, false))
|
||||
event.getToolTip().add(I18n.format("botaniamisc.hasKeepIvy"));
|
||||
if(event.getItemStack().hasTag() && ItemNBTHelper.getBoolean(event.getItemStack(), ItemKeepIvy.TAG_KEEP, false))
|
||||
event.getToolTip().add(new TextComponentTranslation("botaniamisc.hasKeepIvy"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public final class RenderHelper {
|
||||
int var5 = 0;
|
||||
int var6;
|
||||
int var7;
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
|
||||
for (var6 = 0; var6 < tooltipData.size(); ++var6) {
|
||||
var7 = fontRenderer.getStringWidth(tooltipData.get(var6));
|
||||
if (var7 > var5)
|
||||
@@ -81,7 +81,7 @@ public final class RenderHelper {
|
||||
drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 - 3 + 1, color, color);
|
||||
drawGradientRect(var6 - 3, var7 + var9 + 2, z, var6 + var5 + 3, var7 + var9 + 3, var12, var12);
|
||||
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.disableDepthTest();
|
||||
for (int var13 = 0; var13 < tooltipData.size(); ++var13) {
|
||||
String var14 = tooltipData.get(var13);
|
||||
fontRenderer.drawStringWithShadow(var14, var6, var7, -1);
|
||||
@@ -89,11 +89,11 @@ public final class RenderHelper {
|
||||
var7 += 2;
|
||||
var7 += 10;
|
||||
}
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableDepthTest();
|
||||
}
|
||||
if(!lighting)
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
|
||||
public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) {
|
||||
@@ -107,7 +107,7 @@ public final class RenderHelper {
|
||||
float var14 = (par6 & 255) / 255F;
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||
Tessellator var15 = Tessellator.getInstance();
|
||||
@@ -119,7 +119,7 @@ public final class RenderHelper {
|
||||
var15.draw();
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.enableTexture2D();
|
||||
}
|
||||
|
||||
@@ -155,18 +155,18 @@ public final class RenderHelper {
|
||||
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.depthMask(false);
|
||||
GlStateManager.scale(xScale, yScale, zScale);
|
||||
GlStateManager.scalef(xScale, yScale, zScale);
|
||||
|
||||
for (int i = 0; i < (f1 + f1 * f1) / 2F * 90F + 30F; i++) {
|
||||
GlStateManager.rotate(random.nextFloat() * 360F, 1F, 0F, 0F);
|
||||
GlStateManager.rotate(random.nextFloat() * 360F, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(random.nextFloat() * 360F, 0F, 0F, 1F);
|
||||
GlStateManager.rotate(random.nextFloat() * 360F, 1F, 0F, 0F);
|
||||
GlStateManager.rotate(random.nextFloat() * 360F, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(random.nextFloat() * 360F + f1 * 90F, 0F, 0F, 1F);
|
||||
GlStateManager.rotatef(random.nextFloat() * 360F, 1F, 0F, 0F);
|
||||
GlStateManager.rotatef(random.nextFloat() * 360F, 0F, 1F, 0F);
|
||||
GlStateManager.rotatef(random.nextFloat() * 360F, 0F, 0F, 1F);
|
||||
GlStateManager.rotatef(random.nextFloat() * 360F, 1F, 0F, 0F);
|
||||
GlStateManager.rotatef(random.nextFloat() * 360F, 0F, 1F, 0F);
|
||||
GlStateManager.rotatef(random.nextFloat() * 360F + f1 * 90F, 0F, 0F, 1F);
|
||||
tessellator.getBuffer().begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
|
||||
float f3 = random.nextFloat() * 20F + 5F + f2 * 10F;
|
||||
float f4 = random.nextFloat() * 2F + 1F + f2 * 2F;
|
||||
@@ -185,15 +185,15 @@ public final class RenderHelper {
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public static void renderProgressPie(int x, int y, float progress, ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x, y);
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, x, y);
|
||||
|
||||
GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
GL11.glEnable(GL11.GL_STENCIL_TEST);
|
||||
@@ -202,9 +202,9 @@ public final class RenderHelper {
|
||||
GL11.glStencilFunc(GL11.GL_NEVER, 1, 0xFF);
|
||||
GL11.glStencilOp(GL11.GL_REPLACE, GL11.GL_KEEP, GL11.GL_KEEP);
|
||||
GL11.glStencilMask(0xFF);
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x, y);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, x, y);
|
||||
|
||||
mc.renderEngine.bindTexture(new ResourceLocation(LibResources.GUI_MANA_HUD));
|
||||
mc.textureManager.bindTexture(new ResourceLocation(LibResources.GUI_MANA_HUD));
|
||||
int r = 10;
|
||||
int centerX = x + 8;
|
||||
int centerY = y + 8;
|
||||
@@ -241,7 +241,7 @@ public final class RenderHelper {
|
||||
|
||||
public static String getKeyDisplayString(String keyName) {
|
||||
String key = null;
|
||||
KeyBinding[] keys = Minecraft.getMinecraft().gameSettings.keyBindings;
|
||||
KeyBinding[] keys = Minecraft.getInstance().gameSettings.keyBindings;
|
||||
for(KeyBinding otherKey : keys)
|
||||
if(otherKey.getKeyDescription().equals(keyName)) {
|
||||
key = otherKey.getDisplayName();
|
||||
|
||||
@@ -13,9 +13,9 @@ package vazkii.botania.client.core.helper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
||||
import net.minecraft.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import org.lwjgl.opengl.ARBFragmentShader;
|
||||
import org.lwjgl.opengl.ARBShaderObjects;
|
||||
import org.lwjgl.opengl.ARBVertexShader;
|
||||
@@ -59,8 +59,8 @@ public final class ShaderHelper {
|
||||
}
|
||||
|
||||
public static void initShaders() {
|
||||
if (Minecraft.getMinecraft().getResourceManager() instanceof SimpleReloadableResourceManager) {
|
||||
((SimpleReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(manager -> {
|
||||
if (Minecraft.getInstance().getResourceManager() instanceof SimpleReloadableResourceManager) {
|
||||
((SimpleReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addReloadListener(manager -> {
|
||||
deleteShader(pylonGlow); pylonGlow = 0;
|
||||
deleteShader(enchanterRune); enchanterRune = 0;
|
||||
deleteShader(manaPool); manaPool = 0;
|
||||
@@ -129,7 +129,7 @@ public final class ShaderHelper {
|
||||
|
||||
private static boolean checkIncompatibleMods() {
|
||||
if(!checkedIncompatibility) {
|
||||
hasIncompatibleMods = Loader.isModLoaded("optifine");
|
||||
hasIncompatibleMods = ModList.get().isLoaded("optifine");
|
||||
checkedIncompatibility = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -333,9 +333,9 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
int xc = res.getScaledWidth() / 2;
|
||||
int yc = res.getScaledHeight() / 2;
|
||||
public void renderHUD(Minecraft mc) {
|
||||
int xc = mc.mainWindow.getScaledWidth() / 2;
|
||||
int yc = mc.mainWindow.getScaledHeight() / 2;
|
||||
|
||||
float angle = -90;
|
||||
int radius = 24;
|
||||
|
||||
@@ -338,9 +338,9 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
|
||||
return !isFull();
|
||||
}
|
||||
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
int xc = res.getScaledWidth() / 2;
|
||||
int yc = res.getScaledHeight() / 2;
|
||||
public void renderHUD(Minecraft mc) {
|
||||
int xc = mc.mainWindow.getScaledWidth() / 2;
|
||||
int yc = mc.mainWindow.getScaledHeight() / 2;
|
||||
|
||||
float angle = -90;
|
||||
int radius = 24;
|
||||
|
||||
@@ -971,7 +971,7 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int bossBarRenderCallback(ScaledResolution res, int x, int y) {
|
||||
public int bossBarRenderCallback(int x, int y) {
|
||||
GlStateManager.pushMatrix();
|
||||
int px = x + 160;
|
||||
int py = y + 12;
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -45,8 +46,7 @@ import java.util.List;
|
||||
|
||||
public class ItemAstrolabe extends ItemMod {
|
||||
|
||||
private static final String TAG_BLOCK_NAME = "blockName";
|
||||
private static final String TAG_BLOCK_META = "blockMeta";
|
||||
private static final String TAG_BLOCKSTATE = "blockstate";
|
||||
private static final String TAG_SIZE = "size";
|
||||
|
||||
public ItemAstrolabe() {
|
||||
@@ -242,10 +242,9 @@ public class ItemAstrolabe extends ItemMod {
|
||||
ItemsRemainingRenderHandler.set(new ItemStack(block, 1, meta), count);
|
||||
}
|
||||
|
||||
private boolean setBlock(ItemStack stack, Block block, int meta) {
|
||||
if(Item.getItemFromBlock(block) != Items.AIR) {
|
||||
ItemNBTHelper.setString(stack, TAG_BLOCK_NAME, Block.REGISTRY.getNameForObject(block).toString());
|
||||
ItemNBTHelper.setInt(stack, TAG_BLOCK_META, meta);
|
||||
private boolean setBlock(ItemStack stack, IBlockState state) {
|
||||
if(!state.isAir()) {
|
||||
ItemNBTHelper.setCompound(stack, TAG_BLOCKSTATE, NBTUtil.writeBlockState(state));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -260,19 +259,11 @@ public class ItemAstrolabe extends ItemMod {
|
||||
}
|
||||
|
||||
public static Block getBlock(ItemStack stack) {
|
||||
Block block = Block.getBlockFromName(getBlockName(stack));
|
||||
if(block == null)
|
||||
return Blocks.AIR;
|
||||
|
||||
return block;
|
||||
return getBlockState(stack).getBlock();
|
||||
}
|
||||
|
||||
public static String getBlockName(ItemStack stack) {
|
||||
return ItemNBTHelper.getString(stack, TAG_BLOCK_NAME, "");
|
||||
}
|
||||
|
||||
public static int getBlockMeta(ItemStack stack) {
|
||||
return ItemNBTHelper.getInt(stack, TAG_BLOCK_META, 0);
|
||||
public static IBlockState getBlockState(ItemStack stack) {
|
||||
return NBTUtil.readBlockState(ItemNBTHelper.getCompound(stack, TAG_BLOCKSTATE, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -513,23 +513,23 @@ public class ItemCraftingHalo extends ItemMod {
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderHUD(ScaledResolution resolution, EntityPlayer player, ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
public static void renderHUD(EntityPlayer player, ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
int slot = getSegmentLookedAt(stack, player);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if(slot == 0) {
|
||||
String name = craftingTable.getDisplayName();
|
||||
String name = craftingTable.getDisplayName().getUnformattedComponentText();
|
||||
int l = mc.fontRenderer.getStringWidth(name);
|
||||
int x = resolution.getScaledWidth() / 2 - l / 2;
|
||||
int y = resolution.getScaledHeight() / 2 - 65;
|
||||
int x = mc.mainWindow.getScaledWidth() / 2 - l / 2;
|
||||
int y = mc.mainWindow.getScaledHeight() / 2 - 65;
|
||||
|
||||
Gui.drawRect(x - 6, y - 6, x + l + 6, y + 37, 0x22000000);
|
||||
Gui.drawRect(x - 4, y - 4, x + l + 4, y + 35, 0x22000000);
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(craftingTable, resolution.getScaledWidth() / 2 - 8, resolution.getScaledHeight() / 2 - 52);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(craftingTable, mc.mainWindow.getScaledWidth() / 2 - 8, mc.mainWindow.getScaledHeight() / 2 - 52);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(name, x, y, 0xFFFFFF);
|
||||
@@ -545,17 +545,17 @@ public class ItemCraftingHalo extends ItemMod {
|
||||
setRecipe = true;
|
||||
}
|
||||
|
||||
renderRecipe(resolution, label, recipe, player, setRecipe);
|
||||
renderRecipe(label, recipe, player, setRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderRecipe(ScaledResolution resolution, String label, ItemStack[] recipe, EntityPlayer player, boolean setRecipe) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
public static void renderRecipe(String label, ItemStack[] recipe, EntityPlayer player, boolean setRecipe) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
|
||||
if(!recipe[9].isEmpty()) {
|
||||
int x = resolution.getScaledWidth() / 2 - 45;
|
||||
int y = resolution.getScaledHeight() / 2 - 90;
|
||||
int x = mc.mainWindow.getScaledWidth() / 2 - 45;
|
||||
int y = mc.mainWindow.getScaledHeight() / 2 - 90;
|
||||
|
||||
Gui.drawRect(x - 6, y - 6, x + 90 + 6, y + 60, 0x22000000);
|
||||
Gui.drawRect(x - 4, y - 4, x + 90 + 4, y + 58, 0x22000000);
|
||||
@@ -572,12 +572,12 @@ public class ItemCraftingHalo extends ItemMod {
|
||||
int ypos = y + i / 3 * 18;
|
||||
Gui.drawRect(xpos, ypos, xpos + 16, ypos + 16, 0x22000000);
|
||||
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, xpos, ypos);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, xpos, ypos);
|
||||
}
|
||||
}
|
||||
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(recipe[9], x + 72, y + 18);
|
||||
mc.getRenderItem().renderItemOverlays(mc.fontRenderer, recipe[9], x + 72, y + 18);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(recipe[9], x + 72, y + 18);
|
||||
mc.getItemRenderer().renderItemOverlays(mc.fontRenderer, recipe[9], x + 72, y + 18);
|
||||
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
@@ -585,10 +585,10 @@ public class ItemCraftingHalo extends ItemMod {
|
||||
int yoff = 110;
|
||||
if(setRecipe && !canCraft(recipe, getFakeInv(player))) {
|
||||
String warning = TextFormatting.RED + I18n.format("botaniamisc.cantCraft");
|
||||
mc.fontRenderer.drawStringWithShadow(warning, resolution.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(warning) / 2, resolution.getScaledHeight() / 2 - yoff, 0xFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow(warning, mc.mainWindow.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(warning) / 2, mc.mainWindow.getScaledHeight() / 2 - yoff, 0xFFFFFF);
|
||||
yoff += 12;
|
||||
}
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(label, resolution.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(label) / 2, resolution.getScaledHeight() / 2 - yoff, 0xFFFFFF);
|
||||
mc.fontRenderer.drawStringWithShadow(label, mc.mainWindow.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(label) / 2, mc.mainWindow.getScaledHeight() / 2 - yoff, 0xFFFFFF);
|
||||
}
|
||||
}
|
||||
@@ -146,15 +146,15 @@ public class ItemSextant extends ItemMod {
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderHUD(ScaledResolution resolution, EntityPlayer player, ItemStack stack) {
|
||||
public static void renderHUD(EntityPlayer player, ItemStack stack) {
|
||||
ItemStack onUse = player.getActiveItemStack();
|
||||
int time = player.getItemInUseCount();
|
||||
|
||||
if(onUse == stack && stack.getItem().getUseDuration(stack) - time >= 10) {
|
||||
double radius = calculateRadius(stack, player);
|
||||
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||
int x = resolution.getScaledWidth() / 2 + 30;
|
||||
int y = resolution.getScaledHeight() / 2;
|
||||
int x = Minecraft.getInstance().mainWindow.getScaledWidth() / 2 + 30;
|
||||
int y = Minecraft.getInstance().mainWindow.getScaledHeight() / 2;
|
||||
|
||||
String s = Integer.toString((int) radius);
|
||||
boolean inRange = 0 < radius && radius <= MAX_RADIUS;
|
||||
|
||||
@@ -109,22 +109,22 @@ public class ItemDodgeRing extends ItemBauble {
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderHUD(ScaledResolution resolution, EntityPlayer player, ItemStack stack, float pticks) {
|
||||
int xo = resolution.getScaledWidth() / 2 - 20;
|
||||
int y = resolution.getScaledHeight() / 2 + 20;
|
||||
public static void renderHUD(EntityPlayer player, ItemStack stack, float pticks) {
|
||||
int xo = Minecraft.getInstance().mainWindow.getScaledWidth() / 2 - 20;
|
||||
int y = Minecraft.getInstance().mainWindow.getScaledHeight() / 2 + 20;
|
||||
|
||||
if(!player.capabilities.isFlying) {
|
||||
if(!player.abilities.isFlying) {
|
||||
int cd = ItemNBTHelper.getInt(stack, TAG_DODGE_COOLDOWN, 0);
|
||||
int width = Math.min((int) ((cd - pticks) * 2), 40);
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
if(width > 0) {
|
||||
Gui.drawRect(xo, y - 2, xo + 40, y - 1, 0x88000000);
|
||||
Gui.drawRect(xo, y - 2, xo + width, y - 1, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -469,17 +469,17 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderHUD(ScaledResolution resolution, EntityPlayer player, ItemStack stack) {
|
||||
public static void renderHUD(EntityPlayer player, ItemStack stack) {
|
||||
int u = Math.max(1, stack.getItemDamage()) * 9 - 9;
|
||||
int v = 0;
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
mc.renderEngine.bindTexture(textureHud);
|
||||
int xo = resolution.getScaledWidth() / 2 + 10;
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
mc.textureManager.bindTexture(textureHud);
|
||||
int xo = mc.mainWindow.getScaledWidth() / 2 + 10;
|
||||
int x = xo;
|
||||
int y = resolution.getScaledHeight() - ConfigHandler.flightBarHeight;
|
||||
int y = mc.mainWindow.getScaledHeight() - ConfigHandler.flightBarHeight;
|
||||
if(player.isInsideOfMaterial(Material.WATER))
|
||||
y = resolution.getScaledHeight() - ConfigHandler.flightBarBreathHeight;
|
||||
y = mc.mainWindow.getScaledHeight() - ConfigHandler.flightBarBreathHeight;
|
||||
|
||||
int left = ItemNBTHelper.getInt(stack, TAG_TIME_LEFT, MAX_FLY_TIME);
|
||||
|
||||
@@ -493,25 +493,25 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
|
||||
trans = (float) last / (float) segTime;
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableAlphaTest();
|
||||
}
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, trans);
|
||||
GlStateManager.color4f(1F, 1F, 1F, trans);
|
||||
RenderHelper.drawTexturedModalRect(x, y, 0, u, v, 9, 9);
|
||||
x += 8;
|
||||
}
|
||||
|
||||
if(player.capabilities.isFlying) {
|
||||
if(player.abilities.isFlying) {
|
||||
int width = ItemNBTHelper.getInt(stack, TAG_DASH_COOLDOWN, 0);
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
if(width > 0)
|
||||
Gui.drawRect(xo, y - 2, xo + 80, y - 1, 0x88000000);
|
||||
Gui.drawRect(xo, y - 2, xo + width, y - 1, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(Gui.ICONS);
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
mc.textureManager.bindTexture(Gui.ICONS);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.properties.ComparatorMode;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -66,8 +67,8 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderHUD(ScaledResolution resolution, EntityPlayer player) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
public static void renderHUD(EntityPlayer player) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
RayTraceResult pos = mc.objectMouseOver;
|
||||
if(pos == null || pos.getBlockPos() == null)
|
||||
return;
|
||||
@@ -80,23 +81,23 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
|
||||
|
||||
if(block == Blocks.REDSTONE_WIRE) {
|
||||
dispStack = new ItemStack(Items.REDSTONE);
|
||||
text = TextFormatting.RED + "" + state.getValue(BlockRedstoneWire.POWER);
|
||||
} else if(block == Blocks.UNPOWERED_REPEATER || block == Blocks.POWERED_REPEATER) {
|
||||
dispStack = new ItemStack(Items.REPEATER);
|
||||
text = "" + state.getValue(BlockRedstoneRepeater.DELAY);
|
||||
} else if(block == Blocks.UNPOWERED_COMPARATOR || block == Blocks.POWERED_COMPARATOR) {
|
||||
dispStack = new ItemStack(Items.COMPARATOR);
|
||||
text = state.getValue(BlockRedstoneComparator.MODE) == BlockRedstoneComparator.Mode.SUBTRACT ? "-" : "+";
|
||||
text = TextFormatting.RED + "" + state.get(BlockRedstoneWire.POWER);
|
||||
} else if(block == Blocks.REPEATER) {
|
||||
dispStack = new ItemStack(Blocks.REPEATER);
|
||||
text = "" + state.get(BlockRedstoneRepeater.DELAY);
|
||||
} else if(block == Blocks.COMPARATOR) {
|
||||
dispStack = new ItemStack(Blocks.COMPARATOR);
|
||||
text = state.get(BlockRedstoneComparator.MODE) == ComparatorMode.SUBTRACT ? "-" : "+";
|
||||
}
|
||||
|
||||
if(dispStack.isEmpty())
|
||||
return;
|
||||
|
||||
int x = resolution.getScaledWidth() / 2 + 15;
|
||||
int y = resolution.getScaledHeight() / 2 - 8;
|
||||
int x = mc.mainWindow.getScaledWidth() / 2 + 15;
|
||||
int y = mc.mainWindow.getScaledHeight() / 2 - 8;
|
||||
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(dispStack, x, y);
|
||||
mc.getItemRenderer().renderItemAndEffectIntoGUI(dispStack, x, y);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(text, x + 20, y + 4, 0xFFFFFF);
|
||||
|
||||
Reference in new issue
Block a user