Compare commits

...
13 Commits
28 changed files with 298 additions and 146 deletions

No files matched your search

+8 -9
View File
@@ -1,20 +1,19 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.14-GTNH:dev')
api('com.github.GTNewHorizons:GTNHLib:0.11.30:dev')
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.21-GTNH:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.11.35:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.60:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.10:dev') {transitive=false}
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.96-GTNH:dev')
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.26:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.20-GTNH:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.11:dev') {transitive=false}
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.118-GTNH:dev')
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.30:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.26-GTNH:api') {transitive=false}
compileOnly('curse.maven:cofh-lib-220333:2388748')
compileOnly('curse.maven:minefactory-reloaded-66672:2366150')
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
compileOnly("com.github.GTNewHorizons:StructureLib:1.4.34:dev")
compileOnly("com.github.GTNewHorizons:StructureLib:1.4.42:dev")
}
+10 -10
View File
@@ -1,12 +1,12 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d76df094a9cbbabd3b08251f9e61444a/redirect
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1df82b76031285ef2e6a4f59ffe9299d/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/c7d5be6a02945ac2e045048ee54a7d32/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/643f404f769811f5f265fd66f7af5d89/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/38256085a73e137cb4937ea9c4807fec/redirect
toolchainVersion=25
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.27'
}
@@ -32,7 +32,9 @@ import vazkii.botania.common.core.helper.MathHelper;
public final class BossBarHandler {
public static final ResourceLocation defaultBossBar = new ResourceLocation(LibResources.GUI_BOSS_BAR);
static IBotaniaBoss currentBoss;
private static IBotaniaBoss currentBoss;
private static Entity lastBossEntity;
private static String lastBossName;
private static final BarCallback barUniformCallback = new BarCallback();
@@ -47,7 +49,13 @@ public final class BossBarHandler {
Minecraft mc = Minecraft.getMinecraft();
Rectangle bgRect = currentBoss.getBossBarTextureRect();
Rectangle fgRect = currentBoss.getBossBarHPTextureRect();
String name = currentBoss.func_145748_c_().getFormattedText();
Entity e = (Entity) currentBoss;
String name;
if(lastBossEntity != e) {
name = currentBoss.func_145748_c_().getFormattedText();
lastBossEntity = e;
lastBossName = name;
} else name = lastBossName;
int c = res.getScaledWidth() / 2;
int x = c - bgRect.width / 2;
int y = 20;
@@ -66,7 +74,6 @@ public final class BossBarHandler {
mc.fontRenderer.drawStringWithShadow(name, tx, y - 10, 0xA2018C);
GL11.glEnable(GL11.GL_BLEND);
Entity e = (Entity) currentBoss;
EntityPlayer p = mc.thePlayer;
if(e.isDead || !p.worldObj.loadedEntityList.contains(e) || MathHelper.pointDistanceSpace(e.posX, e.posY, e.posZ, p.posX, p.posY, p.posZ) > 32)
currentBoss = null;
@@ -51,7 +51,6 @@ import vazkii.botania.api.wiki.IWikiProvider;
import vazkii.botania.api.wiki.WikiHooks;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileAltar;
import vazkii.botania.common.block.tile.TileRuneAltar;
@@ -67,6 +66,7 @@ import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
import vazkii.botania.common.lib.LibObfuscation;
import vazkii.botania.utils.ReflectionUtils;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -131,7 +131,7 @@ public final class HUDHandler {
renderCrystalCubeHUD(event.resolution, (TileCorporeaCrystalCube) tile);
}
if(!TileCorporeaIndex.InputHandler.getNearbyIndexes(mc.thePlayer).isEmpty() && mc.currentScreen != null && mc.currentScreen instanceof GuiChat) {
if(mc.currentScreen != null && mc.currentScreen instanceof GuiChat && TileCorporeaIndex.InputHandler.hasNearbyIndexes(mc.thePlayer)) {
profiler.startSection("nearIndex");
renderNearIndexDisplay(event.resolution);
profiler.endSection();
@@ -162,21 +162,23 @@ public final class HUDHandler {
profiler.endSection();
}*/
if(Botania.proxy.isClientPlayerWearingMonocle()) {
EntityPlayer player = mc.thePlayer;
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
if(ItemMonocle.hasMonocle(baubles)) {
profiler.startSection("monocle");
ItemMonocle.renderHUD(event.resolution, mc.thePlayer);
ItemMonocle.renderHUD(event.resolution, player);
profiler.endSection();
}
profiler.startSection("manaBar");
EntityPlayer player = mc.thePlayer;
int totalMana = 0;
int totalMaxMana = 0;
boolean anyRequest = false;
boolean creative = false;
IInventory mainInv = player.inventory;
IInventory baublesInv = PlayerHandler.getPlayerBaubles(player);
IInventory baublesInv = baubles;
int invSize = mainInv.getSizeInventory();
int size = invSize;
@@ -260,8 +262,8 @@ public final class HUDHandler {
else return;
}
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()));
int rgb = Color.HSBtoRGB(0.55F, (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 200D) * 0.5 + 1F), 1F);
GL11.glColor4ub((byte) (rgb >> 16), (byte) (rgb >> 8), (byte) rgb, (byte) (255 - (rgb >> 16)));
mc.renderEngine.bindTexture(manaBar);
GL11.glEnable(GL11.GL_BLEND);
@@ -483,8 +485,7 @@ public final class HUDHandler {
RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, 100, 3);
Color color_ = new Color(color);
GL11.glColor4ub((byte) color_.getRed(), (byte) color_.getGreen(),(byte) color_.getBlue(), (byte) (255F * alpha));
GL11.glColor4ub((byte) (color >> 16), (byte) (color >> 8), (byte) color, (byte) (255F * alpha));
RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, Math.min(100, manaPercentage), 3);
}
}
@@ -33,6 +33,7 @@ public final class ItemsRemainingRenderHandler {
private static ItemStack stack;
private static int ticks, count;
private static String cachedText;
@SideOnly(Side.CLIENT)
public static void render(ScaledResolution resolution, float partTicks) {
@@ -62,17 +63,7 @@ public final class ItemsRemainingRenderHandler {
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glEnable(GL11.GL_BLEND);
String text = EnumChatFormatting.GREEN + stack.getDisplayName();
if(count >= 0) {
int max = stack.getMaxStackSize();
int stacks = count / max;
int rem = count % max;
if(stacks == 0)
text = "" + count;
else text = count + " (" + EnumChatFormatting.AQUA + stacks + EnumChatFormatting.RESET + "*" + EnumChatFormatting.GRAY + max + EnumChatFormatting.RESET + "+" + EnumChatFormatting.YELLOW + rem + EnumChatFormatting.RESET + ")";
} else if(count == -1)
text = "\u221E";
String text = cachedText;
int color = 0x00FFFFFF | (int) (alpha * 0xFF) << 24;
mc.fontRenderer.drawStringWithShadow(text, x + 20, y + 6, color);
@@ -92,6 +83,22 @@ public final class ItemsRemainingRenderHandler {
ItemsRemainingRenderHandler.stack = stack;
ItemsRemainingRenderHandler.count = count;
ticks = stack == null ? 0 : maxTicks;
cachedText = "";
if(stack != null) {
String text = EnumChatFormatting.GREEN + stack.getDisplayName();
if(count >= 0) {
int max = stack.getMaxStackSize();
int stacks = count / max;
int rem = count % max;
if(stacks == 0)
text = "" + count;
else text = count + " (" + EnumChatFormatting.AQUA + stacks + EnumChatFormatting.RESET + "*" + EnumChatFormatting.GRAY + max + EnumChatFormatting.RESET + "+" + EnumChatFormatting.YELLOW + rem + EnumChatFormatting.RESET + ")";
} else if(count == -1)
text = "\u221E";
cachedText = text;
}
}
public static void set(EntityPlayer player, ItemStack displayStack, Pattern pattern) {
@@ -2,15 +2,14 @@
* This class was created by <Vazkii/ChickenBones>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
*
* File Created @ [Feb 3, 2014, 9:05:38 PM (GMT)]
*/
package vazkii.botania.client.core.handler;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -51,10 +50,11 @@ public class LightningHandler {
static double interpPosY;
static double interpPosZ;
private static Vector3 getRelativeViewVector(Vector3 pos) {
Entity renderEntity = Minecraft.getMinecraft().renderViewEntity;
return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z);
}
private final Vector3 scratchView = new Vector3();
private final Vector3 scratchPoint = new Vector3();
private final Vector3 scratchDiff1 = new Vector3();
private final Vector3 scratchDiff2 = new Vector3();
private final Vector3 scratchRound = new Vector3();
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event) {
@@ -67,12 +67,14 @@ public class LightningHandler {
profiler.endStartSection("lightning");
float frame = event.partialTicks;
Entity entity = Minecraft.getMinecraft().thePlayer;
TextureManager render = Minecraft.getMinecraft().renderEngine;
interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame;
interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame;
interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame;
Entity viewEntity = Minecraft.getMinecraft().renderViewEntity;
interpPosX = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * frame;
interpPosY = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * frame;
interpPosZ = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * frame;
scratchView.set(viewEntity.posX, viewEntity.posY + viewEntity.getEyeHeight(), viewEntity.posZ);
GL11.glPushMatrix();
GL11.glTranslated(-interpPosX, -interpPosY, -interpPosZ);
@@ -130,22 +132,23 @@ public class LightningHandler {
int renderstart = (int) ((expandTime / 2 - bolt.particleMaxAge + bolt.particleAge) / (float) (expandTime / 2) * bolt.numsegments0);
int renderend = (int) ((bolt.particleAge + expandTime) / (float) expandTime * bolt.numsegments0);
for(Segment rendersegment : bolt.segments) {
for(int i = 0; i < bolt.segments.size(); i++) {
Segment rendersegment = bolt.segments.get(i);
if(rendersegment.segmentno < renderstart || rendersegment.segmentno > renderend)
continue;
Vector3 playervec = getRelativeViewVector(rendersegment.startpoint.point).multiply(-1);
Vector3 playervec = scratchPoint.set(rendersegment.startpoint.point).subtract(scratchView);
double width = 0.025F * (playervec.mag() / 5 + 1) * (1 + rendersegment.light) * 0.5F;
Vector3 diff1 = playervec.copy().crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev);
Vector3 diff2 = playervec.copy().crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext);
Vector3 diff1 = scratchDiff1.set(playervec).crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev);
Vector3 diff2 = scratchDiff2.set(playervec).crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext);
Vector3 startvec = rendersegment.startpoint.point;
Vector3 endvec = rendersegment.endpoint.point;
int color = inner ? bolt.colorInner : bolt.colorOuter;
tessellator.setColorRGBA_I(color, (int) (mainalpha * rendersegment.light * new Color(color).getAlpha()));
tessellator.setColorRGBA_I(color, (int) (mainalpha * rendersegment.light * 255));
tessellator.addVertexWithUV(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z, 0.5, 0);
tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0);
@@ -153,7 +156,7 @@ public class LightningHandler {
tessellator.addVertexWithUV(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z, 0.5, 1);
if(rendersegment.next == null) {
Vector3 roundend = rendersegment.endpoint.point.copy().add(rendersegment.diff.copy().normalize().multiply(width));
Vector3 roundend = scratchRound.set(rendersegment.diff).normalize().multiply(width).add(rendersegment.endpoint.point);
tessellator.addVertexWithUV(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z, 0, 0);
tessellator.addVertexWithUV(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z, 0.5, 0);
@@ -162,7 +165,7 @@ public class LightningHandler {
}
if(rendersegment.prev == null) {
Vector3 roundend = rendersegment.startpoint.point.copy().subtract(rendersegment.diff.copy().normalize().multiply(width));
Vector3 roundend = scratchRound.set(rendersegment.diff).normalize().multiply(width).multiply(-1).add(rendersegment.startpoint.point);
tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0);
tessellator.addVertexWithUV(roundend.x - diff1.x, roundend.y - diff1.y, roundend.z - diff1.z, 0, 0);
@@ -223,9 +226,9 @@ public class LightningHandler {
@Override
public int compare(Segment o1, Segment o2) {
int comp = Integer.valueOf(o1.splitno).compareTo(o2.splitno);
int comp = o1.splitno - o2.splitno;
if(comp == 0)
return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno);
return o1.segmentno - o2.segmentno;
else return comp;
}
}
@@ -497,4 +500,4 @@ public class LightningHandler {
}
}
}
}
}
@@ -381,24 +381,38 @@ public class ClientProxy extends CommonProxy {
@Override
public void setExtraReach(EntityLivingBase entity, float reach) {
super.setExtraReach(entity, reach);
IExtendedPlayerController controller = getReachController(entity);
if(controller != null)
controller.setReachDistanceExtension(Math.max(0, controller.getReachDistanceExtension() + reach));
}
@Override
public void setClientExtraReach(EntityLivingBase entity, float reach) {
IExtendedPlayerController controller = getReachController(entity);
if(controller != null)
controller.setReachDistanceExtension(Math.max(0, reach));
}
private IExtendedPlayerController getReachController(EntityLivingBase entity) {
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
// Player object might have changed, need to check the UUID.
if(entity.worldObj.isRemote && entity.getUniqueID().equals(player.getUniqueID())) {
if(!(mc.playerController instanceof IExtendedPlayerController)) {
GameType type = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.CURRENT_GAME_TYPE);
NetHandlerPlayClient net = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.NET_CLIENT_HANDLER);
BotaniaPlayerController controller = new BotaniaPlayerController(mc, net);
boolean isFlying = player.capabilities.isFlying;
boolean allowFlying = player.capabilities.allowFlying;
controller.setGameType(type);
player.capabilities.isFlying = isFlying;
player.capabilities.allowFlying = allowFlying;
mc.playerController = controller;
}
if(!entity.worldObj.isRemote || !entity.getUniqueID().equals(player.getUniqueID()))
return null;
((IExtendedPlayerController) mc.playerController).setReachDistanceExtension(Math.max(0, ((IExtendedPlayerController) mc.playerController).getReachDistanceExtension() + reach));
if(!(mc.playerController instanceof IExtendedPlayerController)) {
GameType type = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.CURRENT_GAME_TYPE);
NetHandlerPlayClient net = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.NET_CLIENT_HANDLER);
BotaniaPlayerController controller = new BotaniaPlayerController(mc, net);
boolean isFlying = player.capabilities.isFlying;
boolean allowFlying = player.capabilities.allowFlying;
controller.setGameType(type);
player.capabilities.isFlying = isFlying;
player.capabilities.allowFlying = allowFlying;
mc.playerController = controller;
}
return (IExtendedPlayerController) mc.playerController;
}
@Override
@@ -68,16 +68,20 @@ public class FXSparkle extends EntityFX {
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.matrixMode ? ObfuscationHelper.getParticleTexture() : particles);
tessellator.startDrawingQuads();
for(FXSparkle sparkle : queuedRenders)
sparkle.renderQueued(tessellator);
if(!queuedRenders.isEmpty()) {
for(FXSparkle sparkle : queuedRenders)
sparkle.renderQueued(tessellator);
}
tessellator.draw();
ShaderHelper.useShader(ShaderHelper.filmGrain);
tessellator.startDrawingQuads();
for(FXSparkle sparkle : queuedCorruptRenders)
sparkle.renderQueued(tessellator);
tessellator.draw();
ShaderHelper.releaseShader();
if(!queuedCorruptRenders.isEmpty()) {
ShaderHelper.useShader(ShaderHelper.filmGrain);
tessellator.startDrawingQuads();
for(FXSparkle sparkle : queuedCorruptRenders)
sparkle.renderQueued(tessellator);
tessellator.draw();
ShaderHelper.releaseShader();
}
queuedRenders.clear();
queuedCorruptRenders.clear();
@@ -28,6 +28,14 @@ public final class ParticleRenderDispatcher {
// Called from LightningHandler.onRenderWorldLast since that was
// already registered. /shrug
public static void dispatch() {
if(FXSparkle.queuedRenders.isEmpty() && FXSparkle.queuedCorruptRenders.isEmpty() && FXWisp.queuedRenders.isEmpty() && FXWisp.queuedDepthIgnoringRenders.isEmpty()) {
sparkleFxCount = 0;
fakeSparkleFxCount = 0;
wispFxCount = 0;
depthIgnoringWispFxCount = 0;
return;
}
Tessellator tessellator = Tessellator.instance;
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
@@ -26,7 +26,7 @@ public class NEIInputHandler implements IContainerInputHandler {
@Override
public boolean keyTyped(GuiContainer gui, char c, int i) {
Minecraft mc = Minecraft.getMinecraft();
if(TileCorporeaIndex.InputHandler.getNearbyIndexes(mc.thePlayer).isEmpty())
if(!TileCorporeaIndex.InputHandler.hasNearbyIndexes(mc.thePlayer))
return false;
int bind = NEIClientConfig.getKeyBinding(NEIBotaniaConfig.CORPOREA_KEY);
@@ -137,7 +137,7 @@ public class RecipeHandlerBrewery extends TemplateRecipeHandler {
for (ItemStack emptyContainer : BrewHelper.getBrewContainers()) {
final ItemStack filledContainer = recipe.getOutput(emptyContainer);
if (result.isItemEqual(filledContainer) && Objects.equals(result.stackTagCompound, filledContainer.stackTagCompound)) {
if (filledContainer != null && result.isItemEqual(filledContainer) && Objects.equals(result.stackTagCompound, filledContainer.stackTagCompound)) {
arecipes.add(new CachedBreweryRecipe(recipe, emptyContainer));
}
}
@@ -40,6 +40,13 @@ public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler {
output = new PositionedStack(recipe.getOutput(), 111, 21);
}
// Kept for Alfheim, which calls super(recipe, false) from its NEI handler.
@Deprecated
@SuppressWarnings("unused")
public CachedPetalApothecaryRecipe(RecipePetals recipe, boolean addCenterItem) {
this(recipe);
}
public void setIngredients(List<Object> inputs) {
float degreePerInput = 360F / inputs.size();
float currentDegree = -90F;
@@ -74,10 +81,10 @@ public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler {
@Override
public String getOverlayIdentifier() {
return "botania.petalApothecary";
return getRecipeID();
}
// Used by the Alfheim addon, identical to getOverlayIdentifier()
// Kept for Alfheim, which overrides this instead of getOverlayIdentifier().
@Deprecated
public String getRecipeID() {
return "botania.petalApothecary";
@@ -36,11 +36,11 @@ public class RenderSpecialFlower implements ISimpleBlockRenderingHandler, IMulti
@Override
public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return renderCrossedSquares(blockAccess, block, x, y, z, renderer);
return renderCrossedSquares(blockAccess, block, x, y, z, 1.0F, true, renderer);
}
// Copied from RenderBlocks
public static boolean renderCrossedSquares(IBlockAccess blockAccess, Block block, int x, int y, int z, RenderBlocks render) {
public static boolean renderCrossedSquares(IBlockAccess blockAccess, Block block, int x, int y, int z, float scale, boolean doRandomShift, RenderBlocks render) {
Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(blockAccess, x, y, z));
float f = 1.0F;
@@ -64,16 +64,17 @@ public class RenderSpecialFlower implements ISimpleBlockRenderingHandler, IMulti
double d0 = z;
long sh;
sh = x * 3129871 ^ z * 116129781L ^ y;
sh = sh * sh * 42317861L + sh * 11L;
d1 += ((sh >> 16 & 15L) / 15.0F - 0.5D) * 0.3D;
d2 += (sh >> 32 & 15L) / 15.0F * -0.15D;
d0 += ((sh >> 24 & 15L) / 15.0F - 0.5D) * 0.3D;
if (doRandomShift) {
sh = x * 3129871 ^ z * 116129781L ^ y;
sh = sh * sh * 42317861L + sh * 11L;
d1 += ((sh >> 16 & 15L) / 15.0F - 0.5D) * 0.3D;
d2 += (sh >> 32 & 15L) / 15.0F * -0.15D;
d0 += ((sh >> 24 & 15L) / 15.0F - 0.5D) * 0.3D;
}
// Only change here, to use xyz rather than side/meta
IIcon icon = render.getBlockIcon(block, blockAccess, x, y, z, 0);
drawCrossedSquares(blockAccess, block, icon, x, y, z, d1, d2, d0, 1.0F, render);
drawCrossedSquares(blockAccess, block, icon, x, y, z, d1, d2, d0, scale, render);
return true;
}
@@ -33,7 +33,8 @@ public class RenderTileCocoon extends TileEntitySpecialRenderer {
float rot = 0F;
float modval = 60F - (float) cocoon.timePassed / (float) TileCocoon.TOTAL_TIME * 30F;
if(cocoon.timePassed % modval < 10) {
// At timePassed 0 with partialTicks 0 (inventory/NEI render), log(0) makes rot NaN and the model disappears.
if(cocoon.timePassed > 0 && cocoon.timePassed % modval < 10) {
float mod = (cocoon.timePassed + partialTicks) % modval;
float v = mod / 5 * (float) Math.PI * 2;
rot = (float) Math.sin(v) * (float) Math.log(cocoon.timePassed + partialTicks);
@@ -19,6 +19,7 @@ import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
@@ -49,6 +50,15 @@ public class SkyblockSkyRenderer extends IRenderHandler {
private static final Field GL_SKY_LIST = ReflectionUtils.findField(RenderGlobal.class, LibObfuscation.GL_SKY_LIST);
private static final Field STAR_GL_CALL_LIST = ReflectionUtils.findField(RenderGlobal.class, LibObfuscation.STAR_GL_CALL_LIST);
// rainbow angles are deterministic per in-game day
private static int lastRainbowDay = -1;
private static float rainbowAngle1, rainbowAngle2;
// sky color samples, interpolated across ticks by partialTicks
private static int lastSkySampleTick = -1;
private static float skyRed0, skyGreen0, skyBlue0;
private static float skyRed1, skyGreen1, skyBlue1;
@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
@@ -56,15 +66,29 @@ public class SkyblockSkyRenderer extends IRenderHandler {
int starGLCallList = ReflectionUtils.getInt(STAR_GL_CALL_LIST, mc.renderGlobal);
GL11.glDisable(GL11.GL_TEXTURE_2D);
Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks);
float f1 = (float)vec3.xCoord;
float f2 = (float)vec3.yCoord;
float f3 = (float)vec3.zCoord;
Entity viewEntity = mc.renderViewEntity;
int tick = ClientTickHandler.ticksInGame;
if(tick != lastSkySampleTick) {
if(lastSkySampleTick != -1) {
skyRed0 = skyRed1;
skyGreen0 = skyGreen1;
skyBlue0 = skyBlue1;
}
Vec3 sample = world.getSkyColor(viewEntity, 1.0F);
skyRed1 = (float) sample.xCoord;
skyGreen1 = (float) sample.yCoord;
skyBlue1 = (float) sample.zCoord;
lastSkySampleTick = tick;
}
float frac = Math.min(1F, Math.max(0F, partialTicks));
float f1 = skyRed0 + (skyRed1 - skyRed0) * frac;
float f2 = skyGreen0 + (skyGreen1 - skyGreen0) * frac;
float f3 = skyBlue0 + (skyBlue1 - skyBlue0) * frac;
float f6;
float insideVoid = 0;
if(mc.thePlayer.posY <= -2)
insideVoid = (float) Math.min(1F, -(mc.thePlayer.posY + 2) / 30F);
if(viewEntity.posY <= -2)
insideVoid = (float) Math.min(1F, -(viewEntity.posY + 2) / 30F);
f1 = Math.max(0F, f1 - insideVoid);
f2 = Math.max(0F, f2 - insideVoid);
@@ -245,9 +269,14 @@ public class SkyblockSkyRenderer extends IRenderHandler {
long time = world.getWorldTime() + 1000;
int day = (int) (time / 24000L);
Random rand = new Random(day * 0xFF);
float angle1 = rand.nextFloat() * 360F;
float angle2 = rand.nextFloat() * 360F;
if(lastRainbowDay != day) {
Random rand = new Random(day * 0xFF);
rainbowAngle1 = rand.nextFloat() * 360F;
rainbowAngle2 = rand.nextFloat() * 360F;
lastRainbowDay = day;
}
float angle1 = rainbowAngle1;
float angle2 = rainbowAngle2;
GL11.glColor4f(1F, 1F, 1F, effCelAng1 * (1F - insideVoid));
GL11.glRotatef(angle1, 0F, 1F, 0F);
GL11.glRotatef(angle2, 0F, 0F, 1F);
@@ -62,10 +62,13 @@ public class BlockAlfPortal extends BlockModContainer<TileAlfPortal> implements
@Override
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
boolean did = ((TileAlfPortal) world.getTileEntity(x, y, z)).onWanded();
if(did && player != null)
player.addStat(ModAchievements.elfPortalOpen, 1);
return did;
if(!world.isRemote) {
boolean did = ((TileAlfPortal) world.getTileEntity(x, y, z)).onWanded();
if(did && player != null)
player.addStat(ModAchievements.elfPortalOpen, 1);
return did;
}
return true;
}
@Override
@@ -10,12 +10,16 @@
*/
package vazkii.botania.common.block;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.gtnewhorizon.gtnhlib.api.IFlowerPottable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.IGrowable;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
@@ -23,13 +27,16 @@ import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.Achievement;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.client.render.block.RenderSpecialFlower;
import vazkii.botania.common.Botania;
import vazkii.botania.common.achievement.IPickupAchievement;
import vazkii.botania.common.achievement.ModAchievements;
@@ -42,7 +49,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement, IGrowable {
public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement, IGrowable, IFlowerPottable {
public static IIcon[] icons;
public static IIcon[] iconsAlt;
@@ -156,4 +163,12 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
world.setBlock(x, y + 1, z, flower, placeMeta | 8, flags);
}
@Override
public boolean renderFlowerPot(NBTTagCompound compound, IBlockAccess blockAccess, Block block, int x, int y, int z, RenderBlocks render) {
Tessellator tess = Tessellator.instance;
tess.addTranslation(0, 4F / 16F, 0);
boolean b = RenderSpecialFlower.renderCrossedSquares(blockAccess, block, x, y, z, 0.75F, false, render);
tess.addTranslation(0, -4F / 16F, 0);
return b;
}
}
@@ -13,6 +13,7 @@ package vazkii.botania.common.block.decor;
import java.util.List;
import java.util.Random;
import com.gtnewhorizon.gtnhlib.api.IFlowerPottable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockMushroom;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -44,7 +45,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.crafting.IInfusionStabiliser", striprefs = true)
public class BlockModMushroom extends BlockMushroom implements IInfusionStabiliser, IHornHarvestable, ILexiconable {
public class BlockModMushroom extends BlockMushroom implements IInfusionStabiliser, IHornHarvestable, ILexiconable, IFlowerPottable {
public static IIcon[] icons;
public int originalLight;
@@ -101,6 +101,7 @@ public class SubTileEntropinnyum extends SubTileGenerating {
if (world.isRemote || mana != 0 || !(Math.abs(supertile.xCoord - posX) <= RANGE && Math.abs(supertile.yCoord - posY) <= RANGE && Math.abs(supertile.zCoord - posZ) <= RANGE)) {
return false;
}
if (explosionSource == null) return false;
explosionSource.setDead();
mana += getMaxMana();
@@ -167,7 +167,8 @@ public class TileAlfPortal extends TileMod {
} else closeNow = false;
if(closeNow) {
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 1 | 2);
if(!worldObj.isRemote)
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 1 | 2);
for(int i = 0; i < 36; i++)
blockParticle(meta);
closeNow = false;
@@ -175,7 +176,8 @@ public class TileAlfPortal extends TileMod {
if(newMeta == 0)
for(int i = 0; i < 36; i++)
blockParticle(meta);
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, newMeta, 1 | 2);
if(!worldObj.isRemote)
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, newMeta, 1 | 2);
} else if(explode) {
worldObj.createExplosion(null, xCoord + .5, yCoord + 2.0, zCoord + .5, 3f, true);
explode = false;
@@ -285,6 +285,13 @@ public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequ
}
}
public static boolean hasNearbyIndexes(EntityPlayer player) {
for(TileCorporeaIndex index : indexes)
if(isInRangeOfIndex(player, index) && index.worldObj.isRemote == player.worldObj.isRemote)
return true;
return false;
}
public static List<TileCorporeaIndex> getNearbyIndexes(EntityPlayer player) {
List<TileCorporeaIndex> indexList = new ArrayList<>();
for(TileCorporeaIndex index : indexes)
@@ -296,7 +303,7 @@ public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequ
@Override
@SideOnly(Side.CLIENT)
public boolean shouldAutoComplete() {
return !getNearbyIndexes(Minecraft.getMinecraft().thePlayer).isEmpty();
return hasNearbyIndexes(Minecraft.getMinecraft().thePlayer);
}
}
@@ -302,7 +302,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
long least = compound.getLong(TAG_UUID_LEAST);
UUID identity = getIdentifierUnsafe();
if(identity == null || most != identity.getMostSignificantBits() || least != identity.getLeastSignificantBits())
identity = new UUID(most, least);
this.identity = new UUID(most, least);
} else getIdentifier();
mana = compound.getInteger(TAG_MANA);
@@ -464,8 +464,6 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
}
public EntityManaBurst getBurst(boolean fake) {
EntityManaBurst burst = new EntityManaBurst(this, fake);
boolean dreamwood = isDreamwood();
boolean ultra = isULTRA_SPREADER();
int maxMana = ultra ? 640 : dreamwood ? 240 : 160;
@@ -480,29 +478,31 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
if(lens != null && lens.getItem() instanceof ILensEffect)
((ILensEffect) lens.getItem()).apply(lens, props);
burst.setSourceLens(lens);
if(getCurrentMana() >= props.maxMana || fake) {
if(mapmakerOverride) {
burst.setColor(mmForcedColor);
burst.setMana(mmForcedManaPayload);
burst.setStartingMana(mmForcedManaPayload);
burst.setMinManaLoss(mmForcedTicksBeforeManaLoss);
burst.setManaLossPerTick(mmForcedManaLossPerTick);
burst.setGravity(mmForcedGravity);
burst.setMotion(burst.motionX * mmForcedVelocityMultiplier, burst.motionY * mmForcedVelocityMultiplier, burst.motionZ * mmForcedVelocityMultiplier);
} else {
burst.setColor(props.color);
burst.setMana(props.maxMana);
burst.setStartingMana(props.maxMana);
burst.setMinManaLoss(props.ticksBeforeManaLoss);
burst.setManaLossPerTick(props.manaLossPerTick);
burst.setGravity(props.gravity);
burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier);
}
if(getCurrentMana() < props.maxMana && !fake)
return null;
return burst;
// Construct the entity only after the mana check, every new Entity takes a global entity ID
EntityManaBurst burst = new EntityManaBurst(this, fake);
burst.setSourceLens(lens);
if(mapmakerOverride) {
burst.setColor(mmForcedColor);
burst.setMana(mmForcedManaPayload);
burst.setStartingMana(mmForcedManaPayload);
burst.setMinManaLoss(mmForcedTicksBeforeManaLoss);
burst.setManaLossPerTick(mmForcedManaLossPerTick);
burst.setGravity(mmForcedGravity);
burst.setMotion(burst.motionX * mmForcedVelocityMultiplier, burst.motionY * mmForcedVelocityMultiplier, burst.motionZ * mmForcedVelocityMultiplier);
} else {
burst.setColor(props.color);
burst.setMana(props.maxMana);
burst.setStartingMana(props.maxMana);
burst.setMinManaLoss(props.ticksBeforeManaLoss);
burst.setManaLossPerTick(props.manaLossPerTick);
burst.setGravity(props.gravity);
burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier);
}
return null;
return burst;
}
public ILensControl getLensController(ItemStack stack) {
@@ -256,6 +256,13 @@ public class CommonProxy {
((EntityPlayerMP) entity).theItemInWorldManager.setBlockReachDistance(Math.max(5, ((EntityPlayerMP) entity).theItemInWorldManager.getBlockReachDistance() + reach));
}
/**
* Sets (instead of adds to) the extra reach of the client player. No-op on the server.
*/
public void setClientExtraReach(EntityLivingBase entity, float reach) {
// NO-OP
}
public boolean openWikiPage(World world, Block block, MovingObjectPosition pos) {
return false;
}
@@ -869,6 +869,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
private static Rectangle barRect;
@SideOnly(Side.CLIENT)
private static Rectangle hpBarRect;
private static ItemStack skullStack;
@Override
@SideOnly(Side.CLIENT)
@@ -894,11 +895,12 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
int py = y + 12;
Minecraft mc = Minecraft.getMinecraft();
ItemStack stack = new ItemStack(Items.skull, 1, 3);
if(skullStack == null)
skullStack = new ItemStack(Items.skull, 1, 3);
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, stack, px, py);
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, skullStack, px, py);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
boolean unicode = mc.fontRenderer.getUnicodeFlag();
@@ -21,14 +21,16 @@ import vazkii.botania.common.core.handler.ConfigHandler;
import java.util.List;
public class ItemBlockModSlab extends ItemSlab {
private final String unlocalizedName;
public ItemBlockModSlab(Block blockSlab) {
super(blockSlab, ((BlockModSlab)blockSlab).getSingleBlock(), ((BlockModSlab)blockSlab).getFullBlock(), false);
unlocalizedName = blockSlab.getUnlocalizedName().replace("tile.", "tile.botania:");
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return field_150939_a.getUnlocalizedName().replaceAll("tile.", "tile.botania:");
return unlocalizedName;
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> infoList, boolean advanced) {
@@ -33,6 +33,7 @@ import vazkii.botania.api.item.ICosmeticAttachable;
import vazkii.botania.api.item.ICosmeticBauble;
import vazkii.botania.common.lib.LibItemNames;
import baubles.api.BaubleType;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -104,8 +105,12 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
}
public static boolean hasMonocle(EntityPlayer player) {
return hasMonocle(PlayerHandler.getPlayerBaubles(player));
}
public static boolean hasMonocle(InventoryBaubles inv) {
for(int i = 0; i < 4; i++) {
ItemStack stack = PlayerHandler.getPlayerBaubles(player).getStackInSlot(i);
ItemStack stack = inv.getStackInSlot(i);
if(stack != null) {
Item item = stack.getItem();
if(item instanceof IBurstViewerBauble)
@@ -11,10 +11,13 @@
package vazkii.botania.common.item.equipment.bauble;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lib.LibItemNames;
import baubles.api.BaubleType;
import baubles.api.BaublesApi;
public class ItemReachRing extends ItemBauble {
@@ -27,6 +30,29 @@ public class ItemReachRing extends ItemBauble {
Botania.proxy.setExtraReach(player, 3.5F);
}
@Override
public void onPlayerLoad(ItemStack stack, EntityLivingBase player) {
if(player.worldObj.isRemote) {
// Baubles resends all baubles to the client on login and on every dimension change and calls this for each
// of them, but the client keeps its reach extension across dimension changes. Set it instead of adding to it.
Botania.proxy.setClientExtraReach(player, 3.5F * countWornRings(player));
} else super.onPlayerLoad(stack, player);
}
private static int countWornRings(EntityLivingBase player) {
if(!(player instanceof EntityPlayer))
return 0;
int count = 0;
IInventory baubles = BaublesApi.getBaubles((EntityPlayer) player);
for(int i = 0; i < baubles.getSizeInventory(); i++) {
ItemStack bauble = baubles.getStackInSlot(i);
if(bauble != null && bauble.getItem() instanceof ItemReachRing)
count++;
}
return count;
}
@Override
public void onUnequipped(ItemStack stack, EntityLivingBase player) {
Botania.proxy.setExtraReach(player, -3.5F);