Texture Update!

This commit is contained in:
brandon3055 committed 2015-11-05 20:18:47 +11:00
1 parent 39602a3288
commit a1f94155fb
321 files changed
+55697 -1592

No files matched your search

@@ -21,7 +21,7 @@ import java.util.Arrays;
"after:NotEnoughItems;" +
"after:ThermalExpansion;" +
"after:ThermalFoundation;" +
"required-after:BrandonsCore@[1.0.0.6,);")
"required-after:BrandonsCore@[1.0.0.8,);")
public class DraconicEvolution {
@Mod.Instance(References.MODID)
@@ -7,14 +7,11 @@ import com.brandon3055.draconicevolution.client.handler.ParticleHandler;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.keybinding.KeyBindings;
import com.brandon3055.draconicevolution.client.keybinding.KeyInputHandler;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.client.render.block.*;
import com.brandon3055.draconicevolution.client.render.entity.RenderChaosCrystal;
import com.brandon3055.draconicevolution.client.render.entity.RenderDragon;
import com.brandon3055.draconicevolution.client.render.entity.RenderDragonHeart;
import com.brandon3055.draconicevolution.client.render.entity.RenderDragonProjectile;
import com.brandon3055.draconicevolution.client.render.item.RenderArmor;
import com.brandon3055.draconicevolution.client.render.item.RenderBow;
import com.brandon3055.draconicevolution.client.render.item.RenderMobSoul;
import com.brandon3055.draconicevolution.client.render.entity.*;
import com.brandon3055.draconicevolution.client.render.item.*;
import com.brandon3055.draconicevolution.client.render.item.RenderTool;
import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBeam;
import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField;
import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam;
@@ -44,6 +41,7 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
@@ -140,6 +138,9 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernBow, new RenderBow());
MinecraftForgeClient.registerItemRenderer(ModItems.draconicBow, new RenderBow());
MinecraftForgeClient.registerItemRenderer(ModItems.mobSoul, new RenderMobSoul());
MinecraftForgeClient.registerItemRenderer(ModItems.chaosShard, new RenderChaosShard());
MinecraftForgeClient.registerItemRenderer(ModItems.reactorStabilizerParts, new RenderStabilizerPart());
MinecraftForgeClient.registerItemRenderer(ModItems.chaosFragment, new RenderChaosFragment());
if (!ConfigHandler.useOldArmorModel)
{
@@ -153,6 +154,16 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.draconicBoots, new RenderArmor(ModItems.draconicBoots));
}
MinecraftForgeClient.registerItemRenderer(ModItems.draconicSword, new RenderTool("models/tools/DraconicSword.obj", "textures/models/tools/DraconicSword.png", (IRenderTweak)ModItems.draconicSword));
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernPickaxe, new RenderTool("models/tools/Pickaxe.obj", "textures/models/tools/Pickaxe.png", (IRenderTweak)ModItems.wyvernPickaxe));
MinecraftForgeClient.registerItemRenderer(ModItems.draconicPickaxe, new RenderTool("models/tools/DraconicPickaxe.obj", "textures/models/tools/DraconicPickaxe.png", (IRenderTweak)ModItems.draconicPickaxe));
MinecraftForgeClient.registerItemRenderer(ModItems.draconicAxe, new RenderTool("models/tools/DraconicLumberAxe.obj", "textures/models/tools/DraconicLumberAxe.png", (IRenderTweak)ModItems.draconicAxe));
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernShovel, new RenderTool("models/tools/Shovel.obj", "textures/models/tools/Shovel.png", (IRenderTweak)ModItems.wyvernShovel));
MinecraftForgeClient.registerItemRenderer(ModItems.draconicShovel, new RenderTool("models/tools/DraconicShovel.obj", "textures/models/tools/DraconicShovel.png", (IRenderTweak)ModItems.draconicShovel));
MinecraftForgeClient.registerItemRenderer(ModItems.wyvernSword, new RenderTool("models/tools/Sword.obj", "textures/models/tools/Sword.png", (IRenderTweak)ModItems.wyvernSword));
MinecraftForgeClient.registerItemRenderer(ModItems.draconicDestructionStaff, new RenderTool("models/tools/DraconicStaffOfPower.obj", "textures/models/tools/DraconicStaffOfPower.png", (IRenderTweak)ModItems.draconicDestructionStaff));
MinecraftForgeClient.registerItemRenderer(ModItems.draconicHoe, new RenderTool("models/tools/DraconicHoe.obj", "textures/models/tools/DraconicHoe.png", (IRenderTweak)ModItems.draconicHoe));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.draconiumChest), new RenderDraconiumChest());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.particleGenerator), new RenderParticleGen());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyInfuser), new RenderEnergyInfuser());
@@ -160,6 +171,7 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorStabilizer), new RenderReactorStabilizer());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorEnergyInjector), new RenderReactorEnergyInjector());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.reactorCore), new RenderReactorCore());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.chaosCrystal), new RenderChaosShard());
//ISimpleBlockRendering
RenderingRegistry.registerBlockHandler(new RenderTeleporterStand());
@@ -182,6 +194,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileReactorCore.class, new RenderTileReactorCore());
ClientRegistry.bindTileEntitySpecialRenderer(TileReactorStabilizer.class, new RenderTileReactorStabilizer());
ClientRegistry.bindTileEntitySpecialRenderer(TileReactorEnergyInjector.class, new RenderTileReactorEnergyInjector());
ClientRegistry.bindTileEntitySpecialRenderer(TileChaosShard.class, new RenderTileChaosShard());
//Entitys
RenderingRegistry.registerEntityRenderingHandler(EntityCustomDragon.class, new RenderDragon());
@@ -189,6 +202,7 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityDragonHeart.class, new RenderDragonHeart());
RenderingRegistry.registerEntityRenderingHandler(EntityDragonProjectile.class, new RenderDragonProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntityChaosCrystal.class, new RenderChaosCrystal());
RenderingRegistry.registerEntityRenderingHandler(EntityChaosVortex.class, new RenderEntityChaosVortex());
}
public void registerRenderIDs (){
@@ -288,5 +302,9 @@ public class ClientProxy extends CommonProxy {
if (particle instanceof EntityFX && ((EntityFX)particle).worldObj.isRemote) ParticleHandler.spawnCustomParticle((EntityFX)particle, range);
}
@Override
public ISound playISound(ISound sound) {
FMLClientHandler.instance().getClient().getSoundHandler().playSound(sound);
return sound;
}
}
@@ -0,0 +1,53 @@
package com.brandon3055.draconicevolution.client;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import net.minecraft.client.audio.ITickableSound;
import net.minecraft.client.audio.PositionedSound;
import net.minecraft.util.ResourceLocation;
/**
* Created by brandon3055 on 4/10/2015.
*/
public class ReactorSound extends PositionedSound implements ITickableSound {
private static ResourceLocation sound = new ResourceLocation(References.RESOURCESPREFIX + "coreSound");
public boolean donePlaying = false;
private TileReactorCore tile;
public ReactorSound(TileReactorCore tile) {
super(sound);
this.tile = tile;
this.xPosF = (float)tile.xCoord + 0.5F;
this.yPosF = (float)tile.yCoord + 0.5F;
this.zPosF = (float)tile.zCoord + 0.5F;
this.repeat = true;
this.volume = 1.5F;
}
@Override
public boolean isDonePlaying() {
return donePlaying;
}
@Override
public void update() {
volume = (tile.renderSpeed-0.5F) * 2F;
if (tile.reactionTemperature > 8000){
volume += (float)((tile.reactionTemperature-8000D) / 1000D);
}
if (tile.reactionTemperature > 2000 && tile.maxFieldCharge > 0 && tile.fieldCharge < (tile.maxFieldCharge * 0.2D)){
volume += 2D - ((tile.fieldCharge / tile.maxFieldCharge) * 10D);
}
if (tile.reactionTemperature > 2000 && tile.reactorFuel + tile.convertedFuel > 0 && tile.reactorFuel < (double)(tile.reactorFuel + tile.convertedFuel) * 0.2D){
volume += 2D - ((tile.reactorFuel / (tile.reactorFuel + tile.convertedFuel)) * 10D);
}
field_147663_c = 0.5F + volume/2F;
if (tile.isInvalid() || !tile.getWorldObj().getChunkFromBlockCoords(tile.xCoord, tile.zCoord).isChunkLoaded){// || player == null || tile.getDistanceFrom(player.posX, player.posY, player.posZ) > 512){
donePlaying = true;
repeat = false;
}
}
}
@@ -29,6 +29,7 @@ public class GUIFlowGate extends GuiScreen {
int guiLeft = (width / 2) - (197 / 2);
int guiTop = (height / 2) - (88 / 2);
buttonList.clear();
if (tile.flowOverridden) return;
buttonList.add(new GuiTextureButton(0, guiLeft + 20, guiTop + 20, 0, 108, 18, 18, ""));
buttonList.add(new GuiTextureButton(1, guiLeft + 159, guiTop + 20, 0, 54, 18, 18, ""));
@@ -47,35 +48,54 @@ public class GUIFlowGate extends GuiScreen {
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 197, 88);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.flowGate.name"), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGate.name")) / 2), guiTop+5, 0x2c2c2c);
String flowRSLow = tile.getFlowSetting(0);
String flowRSHeigh = tile.getFlowSetting(1);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.flowGateRSHigh.name"), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGateRSHigh.name")) / 2), guiTop+20, 0xff0000);
fontRendererObj.drawString(flowRSHeigh, guiCrt - (fontRendererObj.getStringWidth(flowRSHeigh) / 2), guiTop+31, 0x2c2c2c);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.flowGateRSLow.name"), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGateRSLow.name")) / 2), guiTop+50, 0x660000);
fontRendererObj.drawString(flowRSLow, guiCrt - (fontRendererObj.getStringWidth(flowRSLow) / 2), guiTop+61, 0x2c2c2c);
if (!tile.flowOverridden)
{
String flowRSLow = tile.getFlowSetting(0);
String flowRSHeigh = tile.getFlowSetting(1);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.flowGateRSHigh.name"), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGateRSHigh.name")) / 2), guiTop + 20, 0xff0000);
fontRendererObj.drawString(flowRSHeigh, guiCrt - (fontRendererObj.getStringWidth(flowRSHeigh) / 2), guiTop + 31, 0x2c2c2c);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.flowGateRSLow.name"), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGateRSLow.name")) / 2), guiTop + 50, 0x660000);
fontRendererObj.drawString(flowRSLow, guiCrt - (fontRendererObj.getStringWidth(flowRSLow) / 2), guiTop + 61, 0x2c2c2c);
}else drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.flowGateOverridden.txt"), width / 2, height / 2 - 30, 0x00FF00);
String flow = StatCollector.translateToLocal("gui.de.flowGateCurrentFlow.name") + ": " + Utills.addCommas(tile.getActualFlow());
fontRendererObj.drawString(flow, guiCrt - (fontRendererObj.getStringWidth(flow) / 2), guiTop+76, 0x2c2c2c);
fontRendererObj.drawString(flow, guiCrt - (fontRendererObj.getStringWidth(flow) / 2), guiTop + 76, 0x2c2c2c);
fontRendererObj.drawSplitString(StatCollector.translateToLocal("gui.de.flowGatePartialSignal.name"), guiLeft + 5, guiTop + 90, 197, 0xFFFFFF);
fontRendererObj.drawSplitString(StatCollector.translateToLocal("gui.de.ctrlAndShift.name"), guiLeft + 200, guiTop + 5, 100, 0xFFFFFF);
if (!tile.flowOverridden)
{
fontRendererObj.drawSplitString(StatCollector.translateToLocal("gui.de.flowGatePartialSignal.name"), guiLeft + 5, guiTop + 90, 197, 0xFFFFFF);
fontRendererObj.drawSplitString(StatCollector.translateToLocal("gui.de.ctrlAndShift.name"), guiLeft + 200, guiTop + 5, 100, 0xFFFFFF);
ResourceHandler.bindResource("textures/gui/Widgets.png");
super.drawScreen(x, y, pt);
ResourceHandler.bindResource("textures/gui/Widgets.png");
super.drawScreen(x, y, pt);
List<String> hoverText = new ArrayList<String>();
boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
boolean ctrl = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
List<String> hoverText = new ArrayList<String>();
boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
boolean ctrl = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
if (GuiHelper.isInRect(guiLeft + 20, guiTop + 20, 18, 18, x, y)){ hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(1, shift, ctrl)); }
if (GuiHelper.isInRect(guiLeft + 159, guiTop + 20, 18, 18, x, y)){ hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " + tile.getToolTip(1, shift, ctrl)); }
if (GuiHelper.isInRect(guiLeft + 20, guiTop + 20, 18, 18, x, y))
{
hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(1, shift, ctrl));
}
if (GuiHelper.isInRect(guiLeft + 159, guiTop + 20, 18, 18, x, y))
{
hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " + tile.getToolTip(1, shift, ctrl));
}
if (GuiHelper.isInRect(guiLeft + 20, guiTop + 50, 18, 18, x, y)){ hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(0, shift, ctrl)); }
if (GuiHelper.isInRect(guiLeft + 159, guiTop + 50, 18, 18, x, y)){ hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " + tile.getToolTip(0, shift, ctrl)); }
if (GuiHelper.isInRect(guiLeft + 20, guiTop + 50, 18, 18, x, y))
{
hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(0, shift, ctrl));
}
if (GuiHelper.isInRect(guiLeft + 159, guiTop + 50, 18, 18, x, y))
{
hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " + tile.getToolTip(0, shift, ctrl));
}
if (!hoverText.isEmpty()) {
hoverText.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("gui.de.pressOrScroll.name"));
drawHoveringText(hoverText, x - (x < width / 2 ? fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(1, shift, ctrl)) + 25: 0), y, fontRendererObj);
if (!hoverText.isEmpty())
{
hoverText.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("gui.de.pressOrScroll.name"));
drawHoveringText(hoverText, x - (x < width / 2 ? fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(1, shift, ctrl)) + 25 : 0), y, fontRendererObj);
}
}
}
@@ -43,11 +43,13 @@ public class GUIManual extends GUIScrollingBase {
@Override
public void initGui() {
super.initGui();
pageList.clear();
loadPages();//todo remove
}
public static final String GR_BACKGROUND = "BACKGROUND";
public static final String GR_INTRO = "INTRO";
public static final String GR_SUPPORTERS = "SUPPORTERS";
public static final String GR_INDEX = "INDEX";
public static final String GR_PAGE = "PAGE";
@@ -61,6 +63,9 @@ public class GUIManual extends GUIScrollingBase {
collection.addComponent(new ComponentTexturedRect(7, 100, 0, 0, 255, 255, ResourceHandler.getResource("textures/gui/images/debanner.png"), true)).setGroup(GR_INTRO).setName("BANNER");
collection.addComponent(new ComponentButton(75, 260, 100, 20, 0, this, StatCollector.translateToLocal("info.de.manual.indexButton.txt"), StatCollector.translateToLocal("info.de.manual.indexButtonTip.txt"))).setGroup(GR_INTRO);
//TODO Localize
collection.addComponent(new ComponentButton(75, 285, 100, 20, 2, this, StatCollector.translateToLocal("info.de.manual.contributors.txt"), StatCollector.translateToLocal("info.de.manual.contributorsButtonInfo.txt"))).setGroup(GR_INTRO);
for (int i = 0; i < pageList.size(); i++)
{
@@ -88,12 +93,12 @@ public class GUIManual extends GUIScrollingBase {
int posX = (this.width - xSize) / 2;
int posY = (this.height - ySize) / 2;
if (collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled()) fontRendererObj.drawSplitString(StatCollector.translateToLocal("info.de.manual.introTxt.txt"), posX + 20, posY + 190, 150, 0x000000);
if (collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled()) {
GL11.glPushMatrix();
GL11.glScalef(0.8F, 0.8F, 0.8F);
fontRendererObj.drawSplitString("I am still in the process of adding documentation to this manual. There is also some fine tuning that i still need to do.", posX + 110, posY + 380, 280, 0xFF0000);
GL11.glPopMatrix();
}
// if (collection.getComponent("BANNER") != null && collection.getComponent("BANNER").isEnabled()) {
// GL11.glPushMatrix();
// GL11.glScalef(0.8F, 0.8F, 0.8F);
// fontRendererObj.drawSplitString("I am still in the process of adding documentation to this manual. There is also some fine tuning that i still need to do.", posX + 110, posY + 380, 280, 0xFF0000);
// GL11.glPopMatrix();
// }
}
@Override
@@ -2,10 +2,7 @@ package com.brandon3055.draconicevolution.client.gui.componentguis;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentCollection;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentTextureButton;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentTexturedRect;
import com.brandon3055.draconicevolution.client.gui.guicomponents.GUIBase;
import com.brandon3055.draconicevolution.client.gui.guicomponents.*;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.container.ContainerReactor;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
@@ -25,6 +22,7 @@ import java.util.List;
public class GUIReactor extends GUIBase {
private TileReactorCore reactor;
private ContainerReactor container;
private static boolean showStats = false;
public GUIReactor(EntityPlayer player, TileReactorCore reactor, ContainerReactor container) {
super(container, 248, 222);
@@ -39,6 +37,7 @@ public class GUIReactor extends GUIBase {
collection.addComponent(new ComponentTextureButton(14, 190, 18, 162, 18, 18, 0, this, "", StatCollector.translateToLocal("button.de.reactorCharge.txt"), ResourceHandler.getResource("textures/gui/Widgets.png"))).setName("CHARGE");
collection.addComponent(new ComponentTextureButton(14, 190, 18, 54, 18, 18, 1, this, "", StatCollector.translateToLocal("button.de.reactorStart.txt"), ResourceHandler.getResource("textures/gui/Widgets.png"))).setName("ACTIVATE");
collection.addComponent(new ComponentTextureButton(216, 190, 18, 108, 18, 18, 2, this, "", StatCollector.translateToLocal("button.de.reactorStop.txt"), ResourceHandler.getResource("textures/gui/Widgets.png"))).setName("DEACTIVATE");
collection.addComponent(new ComponentButton(9, 120, 43, 15, 3, this, StatCollector.translateToLocal("button.de.stats.txt"), StatCollector.translateToLocal("button.de.statsShow.txt"))).setName("STATS");
return collection;
}
@@ -83,24 +82,31 @@ public class GUIReactor extends GUIBase {
pixOffset = (int)(value * 108);
drawTexturedModalRect(223, 112 - pixOffset, 0, 222, 14, 5);
double fuelM2 = Math.round(((double)(reactor.reactorFuel + reactor.convertedFuel) + reactor.conversionUnit) / 1296D * 1000D) / 1000D;
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.coreMass.txt") + ": " + fuelM2 + "m³", 5, 130, 0);
GL11.glColor4f(1F, 1F, 1F, 1F);
if (!showStats)
{
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GL11.glTranslated(124, 71, 100);
double scale = 100 / (reactor.getCoreDiameter());
GL11.glScaled(scale, scale, scale);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_CULL_FACE);
TileEntityRendererDispatcher.instance.renderTileEntityAt(reactor, -0.5D, -0.5D, -0.5D, 0.0F);
GL11.glPopAttrib();
GL11.glPopMatrix();
}else {
ResourceHandler.bindResource("textures/gui/Reactor.png");
for (int i = 1; i <= 10; i++) drawTexturedModalRect(63, i * 12, 0, 240, 122, 16);
drawStats();
}
String status = StatCollector.translateToLocal("gui.de.status.txt")+": " + (reactor.reactorState == 0 ? EnumChatFormatting.DARK_GRAY : reactor.reactorState == 1 ? EnumChatFormatting.RED : reactor.reactorState == 2 ? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.RED) + StatCollector.translateToLocal("gui.de.status"+reactor.reactorState+".txt");
if (reactor.reactorState == 1 && reactor.canStart()) status = StatCollector.translateToLocal("gui.de.status.txt")+": " + EnumChatFormatting.DARK_GREEN + StatCollector.translateToLocal("gui.de.status1_5.txt");
fontRendererObj.drawString(status, xSize - 5 - fontRendererObj.getStringWidth(status), 130, 0);
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GL11.glTranslated(124, 71, 100);
double scale = 100 / (reactor.getCoreDiameter());
GL11.glScaled(scale, scale, scale);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_CULL_FACE);
TileEntityRendererDispatcher.instance.renderTileEntityAt(reactor, -0.5D, -0.5D, -0.5D, 0.0F);
GL11.glPopAttrib();
GL11.glPopMatrix();
if (!showStats) fontRendererObj.drawString(status, xSize - 5 - fontRendererObj.getStringWidth(status), 125, 0);
}
@Override
@@ -132,21 +138,49 @@ public class GUIReactor extends GUIBase {
}
}
private void drawStats(){
/*
* Values To Add
* -tempDrainFactor (Temperature load factor?)
* -mass
* -generation rate
* -field drain rate
* -fuel conversion rate
* */
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.tempLoad.name"), 55, 16, 0x0000FF);
fontRendererObj.drawString(""+reactor.tempDrainFactor, 60, 2 + 24, 0);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.mass.name"), 55, 16 + 24, 0x0000FF);
fontRendererObj.drawString(Utills.round((reactor.reactorFuel + reactor.convertedFuel)/1296D, 100)+"m³", 60, 2 + 2 * 24, 0);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.genRate.name"), 55, 16 + 2 * 24, 0x0000FF);
fontRendererObj.drawString(Utills.addCommas((int)reactor.generationRate)+"RF/t", 60, 2 + 3 * 24, 0);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.fieldDrainRate.name"), 55, 16 + 3 * 24, 0x0000FF);
fontRendererObj.drawString(Utills.addCommas(reactor.fieldDrain)+"RF/t", 60, 2 + 4 * 24, 0);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.fuelConversion.name"), 55, 16 + 4 * 24, 0x0000FF);
fontRendererObj.drawString(Utills.addCommas((int)Math.round(reactor.fuelUseRate * 1000000D)) + "nb/t", 60, 2 + 5 * 24, 0);
}
@Override
public void updateScreen() {
if (reactor.reactorState == TileReactorCore.STATE_INVALID || reactor.reactorState == TileReactorCore.STATE_OFFLINE || reactor.reactorState == TileReactorCore.STATE_STOP) collection.getComponent("DEACTIVATE").setEnabled(false);
else collection.getComponent("DEACTIVATE").setEnabled(true);
if ((reactor.reactorState == TileReactorCore.STATE_OFFLINE || (reactor.reactorState == TileReactorCore.STATE_STOP && !reactor.canStart())) && reactor.reactorFuel > 0) collection.getComponent("CHARGE").setEnabled(true);
if ((reactor.reactorState == TileReactorCore.STATE_OFFLINE || (reactor.reactorState == TileReactorCore.STATE_STOP && !reactor.canStart())) && reactor.canCharge()) collection.getComponent("CHARGE").setEnabled(true);
else collection.getComponent("CHARGE").setEnabled(false);
if ((reactor.reactorState == TileReactorCore.STATE_START || reactor.reactorState == TileReactorCore.STATE_STOP) && reactor.canStart()) collection.getComponent("ACTIVATE").setEnabled(true);
else collection.getComponent("ACTIVATE").setEnabled(false);
super.updateScreen();
}
@Override
public void buttonClicked(int id, int button) {
container.sendObjectToServer(null, 20, id);
super.buttonClicked(id, button);
if (id < 3) container.sendObjectToServer(null, 20, id);
else if (id == 3){
showStats = !showStats;
((ComponentButton)collection.getComponent("STATS")).hoverText = showStats ? StatCollector.translateToLocal("button.de.statsHide.txt") : StatCollector.translateToLocal("button.de.statsShow.txt");
}
}
}
@@ -1,97 +0,0 @@
package com.brandon3055.draconicevolution.client.gui.manual;
import com.brandon3055.draconicevolution.common.lib.References;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
/**
* Created by Brandon on 16/09/2014.
*/
public class BasePage extends GuiScreen {
/**Name used to reference the page*/
private String REFERENCE_NAME;
/**Name Displayed in the index page*/
public String INDEX_NAME;
public boolean hasIndexButton = false;
public static final ResourceLocation PAGE_TEXTURE = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/InfoGui.png");
private final int xSize = 256;
private final int ySize = 202;
protected PageCollection collection;
public BasePage(){}
public BasePage(String referenceName, PageCollection collection) {
this.REFERENCE_NAME = referenceName;
this.mc = Minecraft.getMinecraft();
this.collection = collection;
initGui();
}
public BasePage(String referenceName, boolean showInMenue, PageCollection collection) {
this(referenceName, collection);
this.hasIndexButton = showInMenue;
}
public int getXMin(){
return (this.width - xSize) / 2;
}
public int getYMin(){
return (this.height - ySize) / 2;
}
public void setXMin(int x){
this.width = x;
}
public void setYMin(int y){
this.height = y;
}
/**Unlocalized Index Page Name*/
public BasePage setIndexName(String unlocalizedName){
this.INDEX_NAME = ttl(unlocalizedName);
return this;
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
buttonList.add(new GuiButtonAHeight(0, getXMin()+88, getYMin()+181, 80, 16, ttl("button.de.backToIndex.txt")));
}
public void setReferenceName(String name){
REFERENCE_NAME = name;}
public String getReferenceName(){ return REFERENCE_NAME;}
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(PAGE_TEXTURE);
drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize);
}
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
}
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(mouseX+offsetX, mouseY+offsetY, 0);
renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0)collection.changeActivePage("INDEX");
}
@Override
public void mouseMovedOrUp(int par1, int par2, int par3){super.mouseMovedOrUp(par1, par2, par3);}
@Override
public void mouseClicked(int par1, int par2, int par3){super.mouseClicked(par1, par2, par3);}
/**Translate To Local*/
public String ttl(String unlocalizedName){return StatCollector.translateToLocal(unlocalizedName);}
}
@@ -1,277 +0,0 @@
package com.brandon3055.draconicevolution.client.gui.manual;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.*;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.lwjgl.opengl.GL11;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Created by Brandon on 18/09/2014.
*/
public class CraftingInfoPage extends TitledPage {
protected static RenderItem itemRenderer = new RenderItem();
public ItemStack result;
private boolean isSmelting = false;
private ItemStack[] recipe = new ItemStack[9];
private boolean hasRecipe = false;
private String rawDescription;
private List<String> formattedDescription;
private float descriptionScale = 0.66f;
public CraftingInfoPage(String name, PageCollection collection, ItemStack itemStack, String unlocalizedDescription) {
super(name, true, collection, itemStack.getUnlocalizedName()+".name", 0x00ff00);
this.result = itemStack;
this.recipe = getFirstRecipeForItem(itemStack);
for (ItemStack stack : recipe) if (stack != null) hasRecipe = true;
if (unlocalizedDescription == "") rawDescription = ttl(itemStack.getUnlocalizedName()+".description");
else rawDescription = ttl(unlocalizedDescription);
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
GL11.glPushMatrix();
if (isSmelting){
drawTexturedModalRect(offsetX + 87, offsetY + 15, 116, 202, 82, 54);
}else {
if (hasRecipe) drawTexturedModalRect(offsetX + 70, offsetY + 15, 0, 202, 116, 54);
else {
drawTexturedModalRect(offsetX + 119, offsetY + 17, 0, 202, 18, 18);
drawString(fontRendererObj, "No Crafting Recipe", offsetX + 145, offsetY + 17, 0xff0000);
}
}
GL11.glPopMatrix();
}
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
int relativeMouseX = mouseX + offsetX;
int relativeMouseY = mouseY + offsetY;
int gridOffsetX = isSmelting ? 88 : 71;
int gridOffsetY = 16;
int itemBoxSize = 18;
addDescription(minecraft, offsetX, offsetY);
ItemStack tooltip = null;
int i = 0;
for (ItemStack input : recipe) {
if (input != null) {
int row = (i % 3);
int column = i / 3;
int itemX = offsetX + gridOffsetX + (row * itemBoxSize);
int itemY = offsetY + gridOffsetY + (column * itemBoxSize);
drawItemStack(input, itemX, itemY, "");
if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize &&
relativeMouseY > itemY - 2 && relativeMouseY < itemY - 2 + itemBoxSize) {
tooltip = input;
}
}
i++;
}
int itemX = offsetX + (isSmelting ? 148 : 165);
int itemY = offsetY + 34;
if (!hasRecipe){
itemX = offsetX+120;
itemY = offsetY+18;
}
drawItemStack(result, itemX, itemY, "");
if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize &&
relativeMouseY > itemY - 2 && relativeMouseY < itemY - 2 + itemBoxSize) {
tooltip = result;
}
if (tooltip != null) {
drawItemStackTooltip(tooltip, relativeMouseX, relativeMouseY);
}
}
public void addDescription(Minecraft minecraft, int offsetX, int offsetY){
GL11.glPushMatrix();
if (hasRecipe) GL11.glTranslated(offsetX+5, offsetY+75, 1);
else GL11.glTranslated(offsetX+5, offsetY+40, 1);
GL11.glScalef(descriptionScale, descriptionScale, descriptionScale);
int offset = 0;
for (String s : getFormattedText(fontRendererObj)) {
if (s == null) break;
if (s.contains("\\%") && s.substring(0,2).equals("\\%")){
s = s.substring(2);
offset += fontRendererObj.FONT_HEIGHT/2;
}
fontRendererObj.drawString(s, 0, offset, 0x000000);
offset += fontRendererObj.FONT_HEIGHT;
}
GL11.glPopMatrix();
}
@SuppressWarnings("unchecked")
public List<String> getFormattedText(FontRenderer fr) {
if (formattedDescription == null) {
formattedDescription = new ArrayList<String>();
if (Strings.isNullOrEmpty(rawDescription)) {
formattedDescription = ImmutableList.of();
return formattedDescription;
}
if (!rawDescription.contains("\\n")) {
formattedDescription = ImmutableList.copyOf(fr.listFormattedStringToWidth(rawDescription, 370));
return formattedDescription;
}
List<String> segments = new ArrayList(); //Each separate string that is separated by a \n
String raw = rawDescription;
int escape = 0;
while (raw.contains("\\n")) {
segments.add(raw.substring(0, raw.indexOf("\\n")));
raw = raw.substring(raw.indexOf("\\n") + 2);
if (!raw.contains("\\n")) segments.add(raw);
escape++;
if (escape > 100) {
LogHelper.error("Bailing Out!");
break;
}
}
for (String s : segments)
formattedDescription.addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370)));
}
return formattedDescription;
}
protected void drawItemStackTooltip(ItemStack stack, int x, int y) {
final Minecraft mc = Minecraft.getMinecraft();
FontRenderer font = Objects.firstNonNull(stack.getItem().getFontRenderer(stack), mc.fontRenderer);
@SuppressWarnings("unchecked")
List<String> list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
List<String> colored = Lists.newArrayListWithCapacity(list.size());
colored.add(stack.getRarity().rarityColor + list.get(0));
for (String line : list)
colored.add(EnumChatFormatting.GRAY + line);
if (colored.size() >= 2) colored.remove(1);
drawHoveringText(colored, x, y, font);
}
private void drawItemStack(ItemStack par1ItemStack, int par2, int par3, String par4Str) {
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
this.zLevel = 200.0F;
itemRenderer.zLevel = 200.0F;
RenderHelper.enableGUIStandardItemLighting();
GL11.glColor3f(1f, 1f, 1f);
GL11.glEnable(GL11.GL_NORMALIZE);
FontRenderer font = null;
if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack);
if (font == null) font = Minecraft.getMinecraft().fontRenderer;
itemRenderer.renderItemAndEffectIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3);
itemRenderer.renderItemOverlayIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3, par4Str);
this.zLevel = 0.0F;
itemRenderer.zLevel = 0.0F;
}
@SuppressWarnings("unchecked")
private ItemStack[] getFirstRecipeForItem(ItemStack resultingItem) {
ItemStack[] recipeItems = new ItemStack[9];
for (IRecipe recipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
if (recipe == null) continue;
ItemStack result = recipe.getRecipeOutput();
if (result == null || !result.isItemEqual(resultingItem)) continue;
Object[] input = getRecipeInput(recipe);
if (input == null) continue;
for (int i = 0; i < input.length; i++)
recipeItems[i] = convertToStack(input[i]);
break;
}
Iterator iterator = FurnaceRecipes.smelting().getSmeltingList().entrySet().iterator();
Map.Entry entry;
while (iterator.hasNext()){
entry = (Map.Entry)iterator.next();
if (entry.getKey() instanceof ItemStack && ((ItemStack)entry.getValue()).isItemEqual(result)){
isSmelting = true;
recipeItems[0] = (ItemStack)entry.getKey();
}
}
return recipeItems;
}
protected ItemStack convertToStack(Object obj) {
ItemStack entry = null;
if (obj instanceof ItemStack) {
entry = (ItemStack)obj;
} else if (obj instanceof List) {
@SuppressWarnings("unchecked")
List<ItemStack> list = (List<ItemStack>)obj;
if (list.size() > 0) entry = list.get(0);
}
if (entry == null) return null;
entry = entry.copy();
if (entry.getItemDamage() == OreDictionary.WILDCARD_VALUE) entry.setItemDamage(0);
return entry;
}
@SuppressWarnings("unchecked")
private Object[] getRecipeInput(IRecipe recipe) {
if (recipe instanceof ShapelessOreRecipe) return ((ShapelessOreRecipe)recipe).getInput().toArray();
else if (recipe instanceof ShapedOreRecipe) return getShapedOreRecipe((ShapedOreRecipe)recipe);
else if (recipe instanceof ShapedRecipes) return ((ShapedRecipes)recipe).recipeItems;
else if (recipe instanceof ShapelessRecipes) return ((ShapelessRecipes)recipe).recipeItems.toArray(new ItemStack[0]);
return null;
}
private Object[] getShapedOreRecipe(ShapedOreRecipe recipe) {
try {
Field field = ShapedOreRecipe.class.getDeclaredField("width");
if (field != null) {
field.setAccessible(true);
int width = field.getInt(recipe);
Object[] input = recipe.getInput();
Object[] grid = new Object[9];
for (int i = 0, offset = 0, y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++, i++) {
if (x < width && offset < input.length) {
grid[i] = input[offset];
offset++;
} else {
grid[i] = null;
}
}
}
return grid;
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
@@ -1,28 +0,0 @@
package com.brandon3055.draconicevolution.client.gui.manual;
import net.minecraft.client.Minecraft;
import java.util.List;
/**
* Created by Brandon on 20/09/2014.
*/
public class DescriptionPage extends TutorialPage {
private String rawDescription;
public DescriptionPage(String name, PageCollection collection, String unlocalizedDescription) {
super(name, collection, null);
this.rawDescription = unlocalizedDescription;
this.formattedDescription = new List[1];
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
addDescription(minecraft, offsetX, offsetY-50, getFormattedText(fontRendererObj, ttl(rawDescription), 0));
}
}
@@ -1,57 +0,0 @@
package com.brandon3055.draconicevolution.client.gui.manual;
import com.brandon3055.draconicevolution.common.lib.References;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import java.util.List;
/**
* Created by Brandon on 20/09/2014.
*/
public class EnderResurrectionTutorialPage extends TutorialPage {
public static final ResourceLocation image = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Ritual_of_ender_Resurrection.png");
public EnderResurrectionTutorialPage(String name, PageCollection collection) {
super(name, collection, StatCollector.translateToLocal("manual.de.roerth.txt"));
this.lastPage = 1;
this.formattedDescription = new List[6];
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
GL11.glColor4f(1f, 1f, 1f, 1f);
switch (page) {
case 0:
page0(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
case 1:
page1(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
}
}
private void page0(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(image);
GL11.glPushMatrix();
GL11.glScalef(0.5f, 0.5f, 1f);
drawTexturedModalRect((offsetX+64)*2, (offsetY+14)*2, 0, 0, 256, 256);
GL11.glPopMatrix();
addDescription(minecraft, offsetX, offsetY+38, getFormattedText(fontRendererObj, ttl("manual.de.roertpage0a.txt"), 0));
addDescription(minecraft, offsetX, offsetY+94, getFormattedText(fontRendererObj, ttl("manual.de.roertpage0b.txt"), 1));
}
private void page1(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
addDescription(minecraft, offsetX, offsetY-50, getFormattedText(fontRendererObj, ttl("manual.de.roertpage1a.txt"), 2));
addDescription(minecraft, offsetX, offsetY-28, getFormattedText(fontRendererObj, ttl("manual.de.roertpage1b.txt"), 3));
addDescription(minecraft, offsetX, offsetY-6, getFormattedText(fontRendererObj, ttl("manual.de.roertpage1c.txt"), 4));
addDescription(minecraft, offsetX, offsetY+23, getFormattedText(fontRendererObj, ttl("manual.de.roertpage1d.txt"), 5));
}
}
@@ -1,231 +0,0 @@
package com.brandon3055.draconicevolution.client.gui.manual;
import com.brandon3055.draconicevolution.common.lib.References;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import java.util.List;
/**
* Created by Brandon on 20/09/2014.
*/
public class EnergyCoreTutorialPage extends TutorialPage {
public static final ResourceLocation Energy_Core = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/T5_Energy_Core.png");
public static final ResourceLocation Stabilizer_Placement = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Stabilizer_Placement.png");
public static final ResourceLocation Core_Tiers = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Core_Tiers.png");
public static final ResourceLocation Pylon = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Energy_Pylon.png");
public static final ResourceLocation Pylon_Particles = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Energy_Pylon_Particles.png");
public static final ResourceLocation Pylon_Particles_2 = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Energy_Pylon_Particles_2.png");
public static final ResourceLocation Pylon_y_Placement = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Pylon_y_Placement.png");
@SuppressWarnings("unchecked")
public EnergyCoreTutorialPage(String name, PageCollection collection) {
super(name, collection, StatCollector.translateToLocal("manual.de.ecth.txt"));
this.lastPage = 11;
this.formattedDescription = new List[15];
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
GL11.glColor4f(1f, 1f, 1f, 1f);
switch (page){
case 0:
page0(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
case 1:
page1(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
case 2:
page2(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
case 3:
page3(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
case 4:
page4(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
case 5:
page5(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
case 6:
page6(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
case 7:
page7(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
case 8:
page8(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
case 9:
page9(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
case 10:
page10(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
case 11:
page11(minecraft, offsetX, offsetY, mouseX, mouseY);
break;
}
}
private void page0(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(Energy_Core);
GL11.glPushMatrix();
GL11.glScalef(0.5f, 0.5f, 1f);
drawTexturedModalRect((offsetX+64)*2, (offsetY+35)*2, 0, 0, 256, 256);
GL11.glPopMatrix();
addDescription(minecraft, offsetX, offsetY-60, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage0a.txt"), 0));
addDescription(minecraft, offsetX, offsetY+55, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage0b.txt"), 1));
}
private void page1(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(Stabilizer_Placement);
GL11.glPushMatrix();
double imageScale = 0.75 ;
GL11.glScaled(imageScale, imageScale, 1D);
double scaleMult = 1.125;
drawTexturedModalRect((int)((offsetX+64)*scaleMult), (int)((offsetY+40)*scaleMult), 0, 0, 256, 256);
GL11.glPopMatrix();
addDescription(minecraft, offsetX, offsetY-60, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage1a.txt"), 2));
addDescription(minecraft, offsetX, offsetY+45, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage1b.txt"), 3));
}
private void page2(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(Core_Tiers);
GL11.glPushMatrix();
double imageScale = 5 ;
GL11.glScaled(imageScale, imageScale, 1D);
double scaleMult = 0.21;
int yOffset = (int)((Minecraft.getSystemTime()/2000 % 2)*22);
drawTexturedModalRect((int)((offsetX+49)*scaleMult), (int)((offsetY+15)*scaleMult), 180, yOffset, 30, 20);
GL11.glPopMatrix();
drawCenteredString(fontRendererObj, "Tier 1", offsetX+128, offsetY+107, 0xff0000);
addDescription(minecraft, offsetX, offsetY+45, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage2.txt"), 4));
}
private void page3(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(Core_Tiers);
GL11.glPushMatrix();
double imageScale = 5 ;
GL11.glScaled(imageScale, imageScale, 1D);
double scaleMult = 0.21;
int yOffset = (int)((minecraft.getSystemTime()/2000 % 2)*22);
drawTexturedModalRect((int)((offsetX+54)*scaleMult), (int)((offsetY+15)*scaleMult), 151, 0+yOffset, 28, 20);
GL11.glPopMatrix();
drawCenteredString(fontRendererObj, "Tier 2", offsetX+128, offsetY+107, 0xff0000);
addDescription(minecraft, offsetX, offsetY+45, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage3.txt"), 5));
}
private void page4(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(Core_Tiers);
GL11.glPushMatrix();
double imageScale = 5 ;
GL11.glScaled(imageScale, imageScale, 1D);
double scaleMult = 0.21;
int yOffset = (int)((minecraft.getSystemTime()/2000 % 3)*22);
drawTexturedModalRect((int)((offsetX+54)*scaleMult), (int)((offsetY+15)*scaleMult), 123, 0+yOffset, 28, 20);
GL11.glPopMatrix();
drawCenteredString(fontRendererObj, "Tier 3", offsetX+128, offsetY+107, 0xff0000);
addDescription(minecraft, offsetX, offsetY+45, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage4.txt"), 6));
}
private void page5(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(Core_Tiers);
GL11.glPushMatrix();
double imageScale = 5 ;
GL11.glScaled(imageScale, imageScale, 1D);
double scaleMult = 0.21;
int yOffset = (int)((minecraft.getSystemTime()/2000 % 4)*22);
drawTexturedModalRect((int)((offsetX+60)*scaleMult), (int)((offsetY+15)*scaleMult), 98, 0+yOffset, 25, 20);
GL11.glPopMatrix();
drawCenteredString(fontRendererObj, "Tier 4", offsetX+128, offsetY+107, 0xff0000);
addDescription(minecraft, offsetX, offsetY+45, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage5.txt"), 7));
}
private void page6(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(Core_Tiers);
GL11.glPushMatrix();
double imageScale = 3 ;
GL11.glScaled(imageScale, imageScale, 1D);
double scaleMult = 0.338;
int yOffset = (int)((minecraft.getSystemTime()/2000 % 5)*43 );
drawTexturedModalRect((int)((offsetX+60)*scaleMult), (int)((offsetY+15)*scaleMult), 53, 0+yOffset, 44, 41);
GL11.glPopMatrix();
drawCenteredString(fontRendererObj, "Tier 5", offsetX+128, offsetY+130, 0xff0000);
addDescription(minecraft, offsetX, offsetY+65, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage6.txt"), 8));
}
private void page7(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(Core_Tiers);
GL11.glPushMatrix();
double imageScale = 3 ;
GL11.glScaled(imageScale, imageScale, 1D);
double scaleMult = 0.338;
int yOffset = (int)((minecraft.getSystemTime()/2000 % 6)*43 );
drawTexturedModalRect((int)((offsetX+49)*scaleMult), (int)((offsetY+15)*scaleMult), 0, 0+yOffset, 52, 41);
GL11.glPopMatrix();
drawCenteredString(fontRendererObj, "Tier 6", offsetX+128, offsetY+130, 0xff0000);
addDescription(minecraft, offsetX, offsetY+65, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage7.txt"), 9));
}
private void page8(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(Pylon);
GL11.glPushMatrix();
double imageScale = 0.75 ;
GL11.glScaled(imageScale, imageScale, 1D);
double scaleMult = 1.34;
drawTexturedModalRect((int)((offsetX+32)*scaleMult), (int)((offsetY+15)*scaleMult), 0, 20, 256, 127);
GL11.glPopMatrix();
addDescription(minecraft, offsetX, offsetY+35, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage8a.txt"), 10));
addDescription(minecraft, offsetX, offsetY+75, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage8b.txt"), 11));
}
private void page9(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(Pylon_Particles);
GL11.glPushMatrix();
double imageScale = 0.75 ;
GL11.glScaled(imageScale, imageScale, 1D);
double scaleMult = 1.34;
drawTexturedModalRect((int)((offsetX+32)*scaleMult), (int)((offsetY+15)*scaleMult), 0, 30, 256, 177);
GL11.glPopMatrix();
addDescription(minecraft, offsetX, offsetY+45, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage9a.txt"), 11));
addDescription(minecraft, offsetX, offsetY+75, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage9b.txt"), 12));
}
private void page10(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(Pylon_Particles_2);
GL11.glPushMatrix();
double imageScale = 0.75 ;
GL11.glScaled(imageScale, imageScale, 1D);
double scaleMult = 1.34;
drawTexturedModalRect((int)((offsetX+32)*scaleMult), (int)((offsetY+15)*scaleMult), 0, 0, 256, 167);
GL11.glPopMatrix();
addDescription(minecraft, offsetX, offsetY+75, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage10.txt"), 13));
}
private void page11(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(Pylon_y_Placement);
GL11.glPushMatrix();
double imageScale = 0.75 ;
GL11.glScaled(imageScale, imageScale, 1D);
double scaleMult = 1.34;
drawTexturedModalRect((int)((offsetX+32)*scaleMult), (int)((offsetY+15)*scaleMult), 0, 4, 256, 197);
GL11.glPopMatrix();
addDescription(minecraft, offsetX, offsetY+90, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage11.txt"), 14));
}
}
@@ -1,197 +0,0 @@
package com.brandon3055.draconicevolution.client.gui.manual;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
/**
* Created by Brandon on 16/09/2014.
*/
@SideOnly(Side.CLIENT)
public class GuiManual extends GuiScreen {
protected final PageCollection root;
protected int pageIndex = 0;
protected int xSize = 0;
protected int ySize = 0;
public Container inventorySlots;
protected int guiLeft;
protected int guiTop;
public GuiManual() {
this.xSize = 256;
this.ySize = 202;
root = createRoot();
}
protected PageCollection createRoot() {
ItemStack mobSoul = new ItemStack(ModItems.mobSoul);
ItemNBTHelper.setString(mobSoul, "Name", "Any");
pageIndex = 0;
final PageCollection pageCollection = new PageCollection();
pageCollection.addPage(new IntroPage("INTRO", pageCollection));
//pageCollection.addPage(new TitledPage("TITLED_PAGE_1", true, pageCollection, "manual.de.Page Title.txt", 0xff0000).setIndexName("manual.de.TitledPage.txt"));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconiumOre), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconiumDust), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconiumBlend), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconiumIngot, 2), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicCore), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernCore), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.dragonHeart), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.awakenedCore), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, ModItems.wyvernEnergyCore, ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, ModItems.draconicEnergyCore, ""));
// pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.sunFocus), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernPickaxe), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernShovel), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernSword), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernBow), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, ModItems.wyvernFluxCapacitor, ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicPickaxe), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicShovel), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicHoe), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicAxe), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicSword), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicBow), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicDestructionStaff), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, ModItems.draconicFluxCapacitor, ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernHelm), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernChest), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernLeggs), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernBoots), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicHelm), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicChest), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicLeggs), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicBoots), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.teleporterMKI), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.teleporterMKII), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.enderArrow), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.safetyMatch), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, mobSoul, ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.weatherController), ""));
//if (ConfigHandler.disableSunDial != 2) pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.sunDial), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.playerDetector), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.playerDetectorAdvanced), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.grinder, 1, 3), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.energyInfuser), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.customSpawner), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.generator, 1, 3), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.dissEnchanter), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.teleporterStand), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconiumChest), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.particleGenerator), ""));
// if (ConfigHandler.disableXrayBlock != 2) pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.xRayBlock), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.potentiometer), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.rainSensor), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconiumBlock), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconicBlock), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.energyStorageCore), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.energyPylon), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconiumBlock, 1, 1), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconiumBlock, 1, 2), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.longRangeDislocator, 1, 1), ""));
pageCollection.addPage(new EnergyCoreTutorialPage("TUTORIAL."+getNextPageIndex(), pageCollection).setIndexName(StatCollector.translateToLocal("manual.de.ecth.txt")));
pageCollection.addPage(new EnderResurrectionTutorialPage("TUTORIAL."+getNextPageIndex(), pageCollection).setIndexName("manual.de.roerth.txt"));
pageCollection.addPage(new DescriptionPage("INFO."+getNextPageIndex(), pageCollection, "manual.de.endercomet.description").setIndexName("manual.de.endercomet.txt"));
pageCollection.addPage(new DescriptionPage("INFO."+getNextPageIndex(), pageCollection, "manual.de.chaosisland.description").setIndexName("manual.de.enderisland.txt"));
pageCollection.addPage(new DescriptionPage("INFO."+getNextPageIndex(), pageCollection, "manual.de.placeditems.description").setIndexName("manual.de.placeditems.txt"));
pageCollection.addPage(new DescriptionPage("INFO."+getNextPageIndex(), pageCollection, "manual.de.pigmenBloodRage.description").setIndexName("manual.de.pigmenBloodRage.txt"));
pageCollection.addPage(new IndexPage("INDEX", pageCollection));
return pageCollection;
}
private int getNextPageIndex(){
int i = pageIndex;
pageIndex++;
return i;
}
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
drawGuiBackgroundLayer(par3, mouseX, mouseY);
super.drawScreen(mouseX, mouseY, par3);
prepareRenderState();
GL11.glPushMatrix();
root.drawScreen(this.mc, this.guiLeft, this.guiTop, mouseX - this.guiLeft, mouseY - this.guiTop);
GL11.glPopMatrix();
restoreRenderState();
}
protected void prepareRenderState() {
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
}
protected void restoreRenderState() {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
RenderHelper.enableStandardItemLighting();
}
protected void drawGuiBackgroundLayer(float p_146976_1_, int mouseX, int mouseY) {
GL11.glPushMatrix();
GL11.glTranslated(this.guiLeft, this.guiTop, 0);
root.renderBackgroundLayer(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop);
GL11.glPopMatrix();
}
@Override
public void setWorldAndResolution(Minecraft minecraft, int x, int y) {
super.setWorldAndResolution(minecraft, x, y);
root.setWorldAndResolution(minecraft, x, y);
}
@Override
public void actionPerformed(GuiButton button) {
root.actionPerformed(button);
}
@Override
public void mouseMovedOrUp(int par1, int par2, int par3){
root.mouseMovedOrUp(par1, par2, par3);
}
@Override
public void mouseClicked(int par1, int par2, int par3){
root.mouseClicked(par1, par2, par3);
}
@Override
public void handleInput() {
super.handleInput();
}
@Override
public void initGui() {
super.initGui();
this.guiLeft = (this.width - this.xSize) / 2;
this.guiTop = (this.height - this.ySize) / 2;
}
}
@@ -1,74 +0,0 @@
package com.brandon3055.draconicevolution.client.gui.manual;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
/**
* Created by Brandon on 17/09/2014.
*/
public class IndexPage extends TitledPage {
private int itemPageColour = 0xab373f;
private int blockPageColour = 0x7729a7;
private int tutorialPageColour = 0x000080;
private int otherPageColour = 0x228B22;
public IndexPage(String name, PageCollection collection) {
super(name, false, collection, "manual.de.indexTitle.txt", 0xffa600);
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
buttonList.add(new GuiButtonAHeight(0, getXMin() + 88, getYMin() + 181, 80, 16, ttl("button.de.back.txt")));
int row = 0;
int collum = 0;
for (BasePage page : collection.pages){
if (page.hasIndexButton){
String indexName = page.INDEX_NAME;
if (indexName==null && page instanceof CraftingInfoPage) indexName = ttl(((CraftingInfoPage)page).result.getUnlocalizedName()+".name");
else if (indexName==null) indexName = page.getReferenceName();
int colour = otherPageColour;
if (page.getReferenceName() != null && page.getReferenceName().contains("ITEM_PAGE")) colour = itemPageColour;
if (page.getReferenceName() != null && page.getReferenceName().contains("BLOCK_PAGE")) colour = blockPageColour;
if (page.getReferenceName() != null && page.getReferenceName().contains("TUTORIAL")) colour = tutorialPageColour;
buttonList.add(new GuiButtonTextOnly(999, getXMin()+5+collum*81, getYMin()+20+(row*7), 82, 7, indexName, page.getReferenceName(), colour));
row++;
if (row > 21){
row = 0;
collum++;
}
}
}
}
@Override
public void actionPerformed(GuiButton button) {
switch (button.id) {
case 0: collection.changeActivePage("INTRO"); break;
}
if (button instanceof GuiButtonTextOnly)
collection.changeActivePage(((GuiButtonTextOnly)button).LINKED_PAGE);
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
fontRendererObj.drawString("Items", offsetX+10, offsetY+179, itemPageColour);
fontRendererObj.drawString("Blocks", offsetX+10, offsetY+189, blockPageColour);
fontRendererObj.drawString("Tutorials", offsetX+200, offsetY+179, tutorialPageColour);
fontRendererObj.drawString("Other", offsetX+200, offsetY+189, otherPageColour);
}
@Override
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
for (int k = 0; k < this.buttonList.size(); ++k)
{
if (buttonList.get(k) instanceof GuiButtonTextOnly && ((GuiButtonTextOnly) buttonList.get(k)).getIsHovering()) {
((GuiButtonTextOnly) this.buttonList.get(k)).drawButton(this.mc, mouseX + offsetX, mouseY + offsetY);
}
}
}
}
@@ -1,53 +0,0 @@
package com.brandon3055.draconicevolution.client.gui.manual;
import com.brandon3055.draconicevolution.common.lib.References;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
/**
* Created by Brandon on 17/09/2014.
*/
public class IntroPage extends BasePage {
public static final ResourceLocation logo = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/ManualIntro.png");
public IntroPage(String name, PageCollection collection) {
super(name, collection);
}
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
//ResourceLocation logo = new ResourceLocation(References.RESOURCESPREFIX +"oHRx1.png");
minecraft.renderEngine.bindTexture(logo);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glScalef(1F, 0.5F, 1F);
drawTexturedModalRect(offsetX + 1, offsetY + 10, 0, 0, 256, 256);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(2.5F, 2.5F, 1F);
drawCenteredString(fontRendererObj, ttl("manual.de.userGuide.txt"), (int) ((offsetX + 128) / 2.5), (int) ((offsetY + 128) / 2.5), 0x00b400);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(0.5F, 0.5F, 0.5F);
fontRendererObj.drawString("This gui is a work in progress", (offsetX + 4)*2, (offsetY + 194)*2, 0x000000);
GL11.glPopMatrix();
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
buttonList.add(new GuiButtonAHeight(0, getXMin()+88, getYMin()+181, 80, 16, ttl("button.de.goToIndex.txt")));
}
}
@@ -1,85 +0,0 @@
package com.brandon3055.draconicevolution.client.gui.manual;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import java.util.List;
/**
* Created by Brandon on 16/09/2014.
*/
public class PageCollection extends Gui {
protected final List<BasePage> pages = Lists.newArrayList();
private String ACTIVE_PAGE = "INTRO";
protected int x;
protected int y;
public PageCollection() {
this.x = 0;
this.y = 0;
}
public void addPage(BasePage page) {
pages.add(page);
}
public BasePage getPageByName(String name){
for (BasePage component : pages) {
if (component.getReferenceName().equals(ACTIVE_PAGE)) {
return component;
}
}
return null;
}
public BasePage getActivePage(){
for (BasePage component : pages) {
if (component.getReferenceName().equals(ACTIVE_PAGE)) {
return component;
}
}
return null;
}
public final void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (getActivePage() == null) return;
getActivePage().drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public final void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (getActivePage() == null) return;
getActivePage().renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public void changeActivePage(String newPage){
ACTIVE_PAGE = newPage;
if (getActivePage() == null) return;
getActivePage().setWorldAndResolution(Minecraft.getMinecraft(), x, y);
}
public void setWorldAndResolution(Minecraft minecraft, int x, int y) {
if (getActivePage() == null) return;
getActivePage().setWorldAndResolution(minecraft, x, y);
this.x = x;
this.y = y;
}
protected void actionPerformed(GuiButton button) {
if (getActivePage() == null) return;
getActivePage().actionPerformed(button);
}
protected void mouseMovedOrUp(int par1, int par2, int par3){
if (getActivePage() == null) return;
getActivePage().mouseMovedOrUp(par1, par2, par3);
}
protected void mouseClicked(int par1, int par2, int par3){
if (getActivePage() == null) return;
getActivePage().mouseClicked(par1, par2, par3);
}
}
@@ -1,24 +0,0 @@
package com.brandon3055.draconicevolution.client.gui.manual;
import net.minecraft.client.Minecraft;
/**
* Created by Brandon on 17/09/2014.
*/
public class TitledPage extends BasePage {
private String title;
public boolean drawTitle = true;
private int colour;
public TitledPage(String name, boolean showInMenue, PageCollection collection, String unlocalizedTitle, int colour) {
super(name, showInMenue, collection);
this.title = unlocalizedTitle;
this.colour = colour;
}
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (title == null) title = INDEX_NAME;
if (drawTitle)drawCenteredString(minecraft.fontRenderer, ttl(title), offsetX + 128, offsetY + 5, colour);
}
}
@@ -1,112 +0,0 @@
package com.brandon3055.draconicevolution.client.gui.manual;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Brandon on 18/09/2014.
*/
public class TutorialPage extends TitledPage {
private float descriptionScale = 0.66f;
public String[] rawDescription;
public List<String>[] formattedDescription;
public int page = 0;
public int lastPage = 0;
public TutorialPage(String name, PageCollection collection, String title) {
super(name, true, collection, title, 0x00ff00);
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
if (lastPage == 0) return;
String s = "page " + page + "/" + lastPage;
fontRendererObj.drawString(s, offsetX+195, offsetY+185, 0x000000);
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
if (lastPage == 0) return;
buttonList.add(new GuiButtonAHeight(1, getXMin()+62, getYMin()+181, 25, 16, ttl("button.de.previous.txt")));
buttonList.add(new GuiButtonAHeight(2, getXMin()+170, getYMin()+181, 25, 16, ttl("button.de.next.txt")));
if (buttonList.get(1) instanceof GuiButton) ((GuiButton)buttonList.get(1)).enabled = !(page == 0);
if (buttonList.get(2) instanceof GuiButton) ((GuiButton)buttonList.get(2)).enabled = !(page == lastPage);
}
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public void addDescription(Minecraft minecraft, int offsetX, int offsetY, List<String> description){
GL11.glPushMatrix();
GL11.glTranslated(offsetX+5, offsetY+75, 1);
GL11.glScalef(descriptionScale, descriptionScale, descriptionScale);
int offset = 0;
for (String s : description) {
if (s == null) break;
fontRendererObj.drawString(s, 0, offset, 0x000000);
offset += fontRendererObj.FONT_HEIGHT;
}
GL11.glPopMatrix();
}
@SuppressWarnings("unchecked")
public List<String> getFormattedText(FontRenderer fr, String rawDescription, int descriptionIndex) {
if (formattedDescription[descriptionIndex] == null) {
formattedDescription[descriptionIndex] = new ArrayList<String>();
if (Strings.isNullOrEmpty(rawDescription)) {
formattedDescription[descriptionIndex] = ImmutableList.of();
return formattedDescription[descriptionIndex];
}
if (!rawDescription.contains("\\n")) {
formattedDescription[descriptionIndex] = ImmutableList.copyOf(fr.listFormattedStringToWidth(rawDescription, 370));
return formattedDescription[descriptionIndex];
}
List<String> segments = new ArrayList(); //Each separate string that is separated by a \n
String raw = rawDescription;
int escape = 0;
while (raw.contains("\\n")) {
segments.add(raw.substring(0, raw.indexOf("\\n")));
raw = raw.substring(raw.indexOf("\\n") + 2);
if (!raw.contains("\\n")) segments.add(raw);
escape++;
if (escape > 100) {
LogHelper.error("Bailing Out!");
break;
}
}
for (String s : segments)
formattedDescription[descriptionIndex].addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370)));
}
return formattedDescription[descriptionIndex];
}
@Override
public void actionPerformed(GuiButton button) {
super.actionPerformed(button);
if (lastPage == 0) return;
if (button.id == 1) page = Math.max(0, page-1);
if (button.id == 2) page = Math.min(lastPage, page+1);
if (buttonList.get(1) instanceof GuiButton) ((GuiButton)buttonList.get(1)).enabled = !(page == 0);
if (buttonList.get(2) instanceof GuiButton) ((GuiButton)buttonList.get(2)).enabled = !(page == lastPage);
}
}
@@ -1,89 +0,0 @@
package com.brandon3055.draconicevolution.client.model;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelArmorOBJTest extends ModelBiped {
public ModelRenderer head;
public ModelRenderer body;
public ModelRenderer rightArm;
public ModelRenderer leftArm;
public ModelRenderer rightLeg;
public ModelRenderer leftLeg;
public ModelRenderer rightBoot;
public ModelRenderer leftBoot;
public ModelArmorOBJTest(float f, boolean isHelmet, boolean isChestPiece, boolean isLeggings, boolean isdBoots, boolean isDraconic) {
super(f, 0.0f, 128, 128);
this.bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F);
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F);
this.head = new ModelRenderOBJ(this, null, null);
this.bipedBody = new ModelRenderer(this, 16, 16);
this.bipedBody.setRotationPoint(0.0F, 0.0F, 0.0F);
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.0F);
this.head = new ModelRenderOBJ(this, null, null);
this.bipedLeftArm = new ModelRenderer(this, 40, 16);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F);
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F);
this.head = new ModelRenderOBJ(this, null, null);
this.bipedRightArm = new ModelRenderer(this, 40, 16);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F);
this.head = new ModelRenderOBJ(this, null, null);
this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F, 0.0F);
this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
this.head = new ModelRenderOBJ(this, null, null);
this.bipedRightLeg = new ModelRenderer(this, 0, 16);
this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F, 0.0F);
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
this.head = new ModelRenderOBJ(this, null, null);
this.bipedHead.cubeList.clear();
this.bipedHeadwear.cubeList.clear();
this.bipedBody.cubeList.clear();
this.bipedRightArm.cubeList.clear();
this.bipedLeftArm.cubeList.clear();
this.bipedLeftLeg.cubeList.clear();
this.bipedRightLeg.cubeList.clear();
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
this.bipedRightLeg.render(f5);
this.bipedBody.render(f5*1.05F);// * 1.1F);
this.bipedLeftArm.render(f5);
this.bipedRightArm.render(f5);
this.bipedLeftLeg.render(f5);
this.bipedHead.render(f5*1.05F);
}
/**
* This is a helper function from Tabula to set the rotation of model parts
*/
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -0,0 +1,184 @@
package com.brandon3055.draconicevolution.client.model;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelDraconicArmorOBJ extends ModelBiped {
public ModelRenderOBJ head;
public ModelRenderOBJ body;
public ModelRenderOBJ rightArm;
public ModelRenderOBJ leftArm;
public ModelRenderOBJ belt;
public ModelRenderOBJ rightLeg;
public ModelRenderOBJ leftLeg;
public ModelRenderOBJ rightBoot;
public ModelRenderOBJ leftBoot;
public ModelDraconicArmorOBJ(float f, boolean isHelmet, boolean isChestPiece, boolean isLeggings, boolean isdBoots) {
super(f, 0.0f, 128, 128);
this.bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F);
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F);
this.bipedBody = new ModelRenderer(this, 16, 16);
this.bipedBody.setRotationPoint(0.0F, 0.0F, 0.0F);
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.0F);
this.bipedLeftArm = new ModelRenderer(this, 40, 16);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F);
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F);
this.bipedRightArm = new ModelRenderer(this, 40, 16);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F);
this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F, 0.0F);
this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
this.bipedRightLeg = new ModelRenderer(this, 0, 16);
this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F, 0.0F);
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
this.head = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicHelmet.obj"), ResourceHandler.getResource("textures/models/armor/DraconicHelmet.png"));
this.body = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicBody.obj"), ResourceHandler.getResource("textures/models/armor/DraconicBody.png"));
this.rightArm = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicRightArm.obj"), ResourceHandler.getResource("textures/models/armor/DraconicRightArm.png"));
this.leftArm = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicLeftArm.obj"), ResourceHandler.getResource("textures/models/armor/DraconicLeftArm.png"));
this.belt = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicBelt.obj"), ResourceHandler.getResource("textures/models/armor/DraconicBelt.png"));
this.rightLeg = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicRightLeg.obj"), ResourceHandler.getResource("textures/models/armor/DraconicRightLeg.png"));
this.leftLeg = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicLeftLeg.obj"), ResourceHandler.getResource("textures/models/armor/DraconicLeftLeg.png"));
this.rightBoot = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicRightBoot.obj"), ResourceHandler.getResource("textures/models/armor/DraconicRightBoot.png"));
this.leftBoot = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/DraconicLeftBoot.obj"), ResourceHandler.getResource("textures/models/armor/DraconicLeftBoot.png"));
this.bipedHead.cubeList.clear();
this.bipedHeadwear.cubeList.clear();
this.bipedBody.cubeList.clear();
this.bipedRightArm.cubeList.clear();
this.bipedLeftArm.cubeList.clear();
this.bipedLeftLeg.cubeList.clear();
this.bipedRightLeg.cubeList.clear();
body.offsetY = 0.755F;
rightArm.offsetY = 0.755F;
leftArm.offsetY = 0.755F;
head.offsetY = -0.1F;
head.offsetX = -0.033F;
head.offsetZ = 0.1F;
body.offsetY = 0.755F;
body.offsetZ = -0.03F;
rightArm.offsetY = 0.72F;
rightArm.offsetX = -0.18F;
rightArm.offsetZ = -0.05F;
leftArm.offsetY = 0.72F;
leftArm.offsetX = 0.18F;
leftArm.offsetZ = -0.06F;
belt.offsetY = 0.756F;
belt.offsetZ = -0.04F;
rightLeg.offsetY = 0.6F;
rightLeg.offsetX = -0.05F;
leftLeg.offsetY = 0.6F;
leftLeg.offsetX = 0.06F;
rightBoot.offsetY = 0.76F;
rightBoot.offsetX = -0.03F;
leftBoot.offsetY = 0.76F;
leftBoot.offsetX = 0.03F;
leftLeg.scale = 1F / 15F;
rightLeg.scale = 1F / 15F;
leftBoot.scale = 1F / 15F;
rightBoot.scale = 1F / 15F;
if (isHelmet) {
this.bipedHead.addChild(head);
}
if (isChestPiece) {
this.bipedBody.addChild(body);
this.bipedLeftArm.addChild(leftArm);
this.bipedRightArm.addChild(rightArm);
}
if (isLeggings) {
this.bipedLeftLeg.addChild(leftLeg);
this.bipedRightLeg.addChild(rightLeg);
this.bipedBody.addChild(belt);
}
if (isdBoots) {
this.bipedLeftLeg.addChild(leftBoot);
this.bipedRightLeg.addChild(rightBoot);
}
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
if (entity == null){
isSneak = false;
isRiding = false;
isChild = false;
aimedBow = false;
this.bipedRightArm.rotateAngleX = 0F;
this.bipedRightArm.rotateAngleY = 0F;
this.bipedRightArm.rotateAngleZ = 0F;
this.bipedLeftArm.rotateAngleX = 0F;
this.bipedLeftArm.rotateAngleY = 0F;
this.bipedLeftArm.rotateAngleZ = 0F;
bipedBody.rotateAngleX = 0F;
bipedBody.rotateAngleY = 0F;
bipedBody.rotateAngleZ = 0F;
bipedHead.rotateAngleX = 0F;
bipedHead.rotateAngleY = 0F;
bipedHead.rotateAngleZ = 0F;
bipedLeftLeg.rotateAngleX = 0F;
bipedLeftLeg.rotateAngleY = 0F;
bipedLeftLeg.rotateAngleZ = 0F;
bipedRightLeg.rotateAngleX = 0F;
bipedRightLeg.rotateAngleY = 0F;
bipedRightLeg.rotateAngleZ = 0F;
setRotationAngles(0, 0, 0, 0, 0, 0, null);
}
else super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
this.bipedHead.render(1F/13F);
this.bipedRightArm.render(1F/15F);
this.bipedLeftArm.render(1F/15F);
this.bipedBody.render(1F/15F);
this.bipedRightLeg.render(1F/16F);
this.bipedLeftLeg.render(1F/16F);
}
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_)
{
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotationPointZ = 0.0F;
this.bipedLeftArm.rotationPointZ = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
this.bipedRightArm.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedBody.rotateAngleX = 0.0F;
this.bipedRightLeg.rotationPointZ = 0.1F;
this.bipedLeftLeg.rotationPointZ = 0.1F;
this.bipedRightLeg.rotationPointY = 12.0F;
this.bipedLeftLeg.rotationPointY = 12.0F;
this.bipedHead.rotationPointY = 0.0F;
this.bipedHeadwear.rotationPointY = 0.0F;
this.leftLeg.rotationPointZ = 0F;
this.rightLeg.rotationPointZ = 0F;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
}
}
@@ -1,7 +1,9 @@
package com.brandon3055.draconicevolution.client.model;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
@@ -13,7 +15,9 @@ import org.lwjgl.opengl.GL11;
public class ModelRenderOBJ extends ModelRenderer {
private IModelCustom model;
private ResourceLocation texture;
private int displayList;
private boolean compiled = false;
public float scale = 0;
public ModelRenderOBJ(ModelBase baseModel, ResourceLocation customModel, ResourceLocation texture) {
super(baseModel);
@@ -24,29 +28,18 @@ public class ModelRenderOBJ extends ModelRenderer {
@Override
public void render(float scale) {
if(!this.isHidden && this.showModel) {
// if(!this.compiled) {
// this.compileDisplayList(scale);
// }
if(!this.compiled) {
this.compileDisplayList(scale);
}
GL11.glTranslatef(this.offsetX, this.offsetY, this.offsetZ);
int i;
if(this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) {
if(this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) {
// GL11.glCallList(this.displayList);
// if(this.childModels != null) {
// for(i = 0; i < this.childModels.size(); ++i) {
// ((ModelRenderer)this.childModels.get(i)).render(scale);
// }
// }
GL11.glCallList(this.displayList);
} else {
GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale);
// GL11.glCallList(this.displayList);
// if(this.childModels != null) {
// for(i = 0; i < this.childModels.size(); ++i) {
// ((ModelRenderer)this.childModels.get(i)).render(scale);
// }
// }
GL11.glCallList(this.displayList);
GL11.glTranslatef(-this.rotationPointX * scale, -this.rotationPointY * scale, -this.rotationPointZ * scale);
}
} else {
@@ -64,15 +57,7 @@ public class ModelRenderOBJ extends ModelRenderer {
GL11.glRotatef(this.rotateAngleX * 57.295776F, 1.0F, 0.0F, 0.0F);
}
// GL11.glCallList(this.displayList);
// if(this.childModels != null) {
// for(i = 0; i < this.childModels.size(); ++i) {
// ((ModelRenderer)this.childModels.get(i)).render(scale);
// }
// }
GL11.glCallList(this.displayList);
GL11.glPopMatrix();
}
@@ -81,12 +66,31 @@ public class ModelRenderOBJ extends ModelRenderer {
}
private void compileDisplayList(float scale)
{
if (this.scale == 0) this.scale = scale;
scale = this.scale;
this.displayList = GLAllocation.generateDisplayLists(1);
GL11.glNewList(this.displayList, GL11.GL_COMPILE);
GL11.glPushMatrix();
ResourceHandler.bindTexture(texture);
//scale = 1F/15F;
GL11.glScalef(scale, scale, scale);
GL11.glRotatef(180, -1, 0, 1);
model.renderAll();
GL11.glPopMatrix();
GL11.glEndList();
this.compiled = true;
}
@Override
public void renderWithRotation(float scale) {
if(!this.isHidden && this.showModel) {
// if(!this.compiled) {
// this.compileDisplayList(scale);
// }
if(!this.compiled) {
this.compileDisplayList(scale);
}
GL11.glPushMatrix();
GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale);
@@ -102,7 +106,7 @@ public class ModelRenderOBJ extends ModelRenderer {
GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F);
}
// GL11.glCallList(this.displayList);
GL11.glCallList(this.displayList);
GL11.glPopMatrix();
}
@@ -0,0 +1,181 @@
package com.brandon3055.draconicevolution.client.model;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelWyvernArmorOBJ extends ModelBiped {
public ModelRenderOBJ head;
public ModelRenderOBJ body;
public ModelRenderOBJ rightArm;
public ModelRenderOBJ leftArm;
public ModelRenderOBJ belt;
public ModelRenderOBJ rightLeg;
public ModelRenderOBJ leftLeg;
public ModelRenderOBJ rightBoot;
public ModelRenderOBJ leftBoot;
public ModelWyvernArmorOBJ(float f, boolean isHelmet, boolean isChestPiece, boolean isLeggings, boolean isdBoots) {
super(f, 0.0f, 128, 128);
this.bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F);
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F);
this.bipedBody = new ModelRenderer(this, 16, 16);
this.bipedBody.setRotationPoint(0.0F, 0.0F, 0.0F);
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.0F);
this.bipedLeftArm = new ModelRenderer(this, 40, 16);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F);
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F);
this.bipedRightArm = new ModelRenderer(this, 40, 16);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F);
this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F, 0.0F);
this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
this.bipedRightLeg = new ModelRenderer(this, 0, 16);
this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F, 0.0F);
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F);
this.head = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernHelmet.obj"), ResourceHandler.getResource("textures/models/armor/WyvernHelmet.png"));
this.body = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernBody.obj"), ResourceHandler.getResource("textures/models/armor/WyvernBody.png"));
this.rightArm = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernRightArm.obj"), ResourceHandler.getResource("textures/models/armor/WyvernRightArm.png"));
this.leftArm = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernLeftArm.obj"), ResourceHandler.getResource("textures/models/armor/WyvernLeftArm.png"));
this.belt = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernBelt.obj"), ResourceHandler.getResource("textures/models/armor/WyvernBelt.png"));
this.rightLeg = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernRightLeg.obj"), ResourceHandler.getResource("textures/models/armor/WyvernRightLeg.png"));
this.leftLeg = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernLeftLeg.obj"), ResourceHandler.getResource("textures/models/armor/WyvernLeftLeg.png"));
this.rightBoot = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernRightBoot.obj"), ResourceHandler.getResource("textures/models/armor/WyvernRightBoot.png"));
this.leftBoot = new ModelRenderOBJ(this, ResourceHandler.getResource("models/armor/WyvernLeftBoot.obj"), ResourceHandler.getResource("textures/models/armor/WyvernLeftBoot.png"));
this.bipedHead.cubeList.clear();
this.bipedHeadwear.cubeList.clear();
this.bipedBody.cubeList.clear();
this.bipedRightArm.cubeList.clear();
this.bipedLeftArm.cubeList.clear();
this.bipedLeftLeg.cubeList.clear();
this.bipedRightLeg.cubeList.clear();
body.offsetY = 0.755F;
rightArm.offsetY = 0.755F;
leftArm.offsetY = 0.755F;
head.offsetY = -0.07F;
body.offsetY = 0.755F;
body.offsetZ = -0.03F;
rightArm.offsetY = 0.72F;
rightArm.offsetX = -0.18F;
rightArm.offsetZ = 0.F;
leftArm.offsetY = 0.72F;
leftArm.offsetX = 0.18F;
leftArm.offsetZ = 0F;
belt.offsetY = 0.756F;
belt.offsetZ = -0.04F;
rightLeg.offsetY = 0.6F;
rightLeg.offsetX = -0.06F;
leftLeg.offsetY = 0.6F;
leftLeg.offsetX = 0.06F;
rightBoot.offsetY = 0.76F;
rightBoot.offsetX = -0.03F;
leftBoot.offsetY = 0.76F;
leftBoot.offsetX = 0.03F;
leftLeg.scale = 1F / 15F;
rightLeg.scale = 1F / 15F;
leftBoot.scale = 1F / 15F;
rightBoot.scale = 1F / 15F;
if (isHelmet) {
this.bipedHead.addChild(head);
}
if (isChestPiece) {
this.bipedBody.addChild(body);
this.bipedLeftArm.addChild(leftArm);
this.bipedRightArm.addChild(rightArm);
}
if (isLeggings) {
this.bipedLeftLeg.addChild(leftLeg);
this.bipedRightLeg.addChild(rightLeg);
this.bipedBody.addChild(belt);
}
if (isdBoots) {
this.bipedLeftLeg.addChild(leftBoot);
this.bipedRightLeg.addChild(rightBoot);
}
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
if (entity == null){
isSneak = false;
isRiding = false;
isChild = false;
aimedBow = false;
this.bipedRightArm.rotateAngleX = 0F;
this.bipedRightArm.rotateAngleY = 0F;
this.bipedRightArm.rotateAngleZ = 0F;
this.bipedLeftArm.rotateAngleX = 0F;
this.bipedLeftArm.rotateAngleY = 0F;
this.bipedLeftArm.rotateAngleZ = 0F;
bipedBody.rotateAngleX = 0F;
bipedBody.rotateAngleY = 0F;
bipedBody.rotateAngleZ = 0F;
bipedHead.rotateAngleX = 0F;
bipedHead.rotateAngleY = 0F;
bipedHead.rotateAngleZ = 0F;
bipedLeftLeg.rotateAngleX = 0F;
bipedLeftLeg.rotateAngleY = 0F;
bipedLeftLeg.rotateAngleZ = 0F;
bipedRightLeg.rotateAngleX = 0F;
bipedRightLeg.rotateAngleY = 0F;
bipedRightLeg.rotateAngleZ = 0F;
setRotationAngles(0, 0, 0, 0, 0, 0, null);
}
else super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
this.bipedHead.render(1F/13F);
this.bipedRightArm.render(1F/15F);
this.bipedLeftArm.render(1F/15F);
this.bipedBody.render(1F/15F);
this.bipedRightLeg.render(1F/16F);
this.bipedLeftLeg.render(1F/16F);
}
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float scale, Entity p_78087_7_)
{
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotationPointZ = 0.0F;
this.bipedLeftArm.rotationPointZ = 0.0F;
this.bipedRightLeg.rotateAngleY = 0.0F;
this.bipedLeftLeg.rotateAngleY = 0.0F;
this.bipedRightArm.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
this.bipedBody.rotateAngleX = 0.0F;
this.bipedRightLeg.rotationPointZ = 0.1F;
this.bipedLeftLeg.rotationPointZ = 0.1F;
this.bipedRightLeg.rotationPointY = 12.0F;
this.bipedLeftLeg.rotationPointY = 12.0F;
this.bipedHead.rotationPointY = 0.0F;
this.bipedHeadwear.rotationPointY = 0.0F;
this.leftLeg.rotationPointZ = 0F;
this.rightLeg.rotationPointZ = 0F;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
}
}
@@ -0,0 +1,11 @@
package com.brandon3055.draconicevolution.client.render;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
/**
* Created by brandon3055 on 3/11/2015.
*/
public interface IRenderTweak {
public void tweakRender(ItemRenderType type);
}
@@ -199,15 +199,15 @@ public class RenderDragon extends RenderLiving
return dragon instanceof EntityChaosGuardian ? enderDragonTextures2 : enderDragonTextures;
}
protected void renderEquippedItems(EntityDragon p_77029_1_, float p_77029_2_)
protected void renderEquippedItems(EntityDragon dragon, float p_77029_2_)
{
super.renderEquippedItems(p_77029_1_, p_77029_2_);
super.renderEquippedItems(dragon, p_77029_2_);
Tessellator tessellator = Tessellator.instance;
if (p_77029_1_.deathTicks > 0)
if (dragon.deathTicks > 0)
{
RenderHelper.disableStandardItemLighting();
float f1 = ((float)p_77029_1_.deathTicks + p_77029_2_) / 200.0F;
float f1 = ((float)dragon.deathTicks + p_77029_2_) / 200.0F;
float f2 = 0.0F;
if (f1 > 0.8F)
@@ -215,6 +215,8 @@ public class RenderDragon extends RenderLiving
f2 = (f1 - 0.8F) / 0.2F;
}
if (dragon instanceof EntityChaosGuardian) f2 = 0;
Random random = new Random(1L);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
@@ -0,0 +1,52 @@
package com.brandon3055.draconicevolution.client.render.entity;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.entity.EntityChaosVortex;
import com.brandon3055.draconicevolution.common.lib.References;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
/**
* Created by brandon3055 on 3/10/2015.
*/
public class RenderEntityChaosVortex extends Render {
public static IModelCustom uvSphere;
public RenderEntityChaosVortex(){
uvSphere = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj"));
}
public void doRender(EntityChaosVortex entity, double x, double y, double z, float f1, float tick) {
if (entity.ticksExisted < 100) return;
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
ResourceHandler.bindResource("textures/models/white.png");
float scale = ((float)entity.ticksExisted - 100F) + tick;
scale /= 500F;
if (scale > 0.5F) scale = 0.5F;
GL11.glScaled(scale, scale, scale);
uvSphere.renderAll();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
@Override
public void doRender(Entity entity, double x, double y, double z, float f1, float f2) {
doRender((EntityChaosVortex)entity, x, y, z, f1, f2);
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return null;
}
}
@@ -2,7 +2,6 @@ package com.brandon3055.draconicevolution.client.render.item;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
@@ -18,17 +17,13 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class RenderBow implements IItemRenderer {
//private RenderManager renderManager;
private Minecraft mc;
//private TextureManager texturemanager;
public RenderBow() {
//this.renderManager = RenderManager.instance;
this.mc = Minecraft.getMinecraft();
@@ -44,15 +39,12 @@ public class RenderBow implements IItemRenderer {
}
@Override
//RenderHelpers I don't fully understand, I'd assume they are modifiers, but I've never looked into it.
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return false;
}
@Override
//This function decides what to do in rendering an item, whether it's first or third person.
//Credit to SanAndreasP on minecraftforge forums for this code.
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
EntityLivingBase entity = (EntityLivingBase) data[1];
@@ -86,8 +78,7 @@ public class RenderBow implements IItemRenderer {
GL11.glPopMatrix(); // prevents GL Underflow errors
}
//This actually renders an Icon to be worked with.
//All of this code is directly pulled from ItemRenderer.class
private void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3)
{
RenderBlocks renderBlocksIr = new RenderBlocks();
@@ -0,0 +1,43 @@
package com.brandon3055.draconicevolution.client.render.item;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
/**
* Created by brandon3055 on 1/10/2015.
*/
public class RenderChaosFragment implements IItemRenderer {
private static IModelCustom model = AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/chaosCrystalShard.obj"));
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) GL11.glTranslated(0.5, 0.5, 0.5);
if (type != ItemRenderType.ENTITY) GL11.glRotatef(45, -1, 0, -1);
else GL11.glRotatef(45, -1, 0, 0);
GL11.glScalef(0.4F, 0.4F, 0.4F);
float size = 1f / (4 - item.getItemDamage());
GL11.glScalef(size, size, size);
ResourceHandler.bindResource("textures/models/chaosCrystal.png");
model.renderAll();
GL11.glPopMatrix();
}
}
@@ -0,0 +1,41 @@
package com.brandon3055.draconicevolution.client.render.item;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
/**
* Created by brandon3055 on 1/10/2015.
*/
public class RenderChaosShard implements IItemRenderer {
private static IModelCustom model = AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/chaosCrystalShard.obj"));
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) GL11.glTranslated(0.5, 0.5, 0.5);
if (type != ItemRenderType.ENTITY) GL11.glRotatef(45, -1, 0, -1);
else GL11.glRotatef(45, -1, 0, 0);
GL11.glScalef(0.4F, 0.4F, 0.4F);
ResourceHandler.bindResource("textures/models/chaosCrystal.png");
model.renderAll();
GL11.glPopMatrix();
}
}
@@ -0,0 +1,81 @@
package com.brandon3055.draconicevolution.client.render.item;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.model.ModelReactorStabilizerCore;
import com.brandon3055.draconicevolution.client.model.ModelReactorStabilizerRing;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
/**
* Created by brandon3055 on 2/10/2015.
*/
public class RenderStabilizerPart implements IItemRenderer {
public static ModelReactorStabilizerCore modelBase = new ModelReactorStabilizerCore();
public static ModelReactorStabilizerCore modelBaseRotors = new ModelReactorStabilizerCore();
public static ModelReactorStabilizerRing modelRing = new ModelReactorStabilizerRing();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) GL11.glTranslated(0.5, 0.5, 0.5);
switch (item.getItemDamage()){
case 0://frame
ResourceHandler.bindResource("textures/models/reactorStabilizerCore.png");
modelBase.basePlate.render(0.0625F);
break;
case 1://rotor inner
ResourceHandler.bindResource("textures/models/reactorStabilizerCore.png");
// GL11.glScaled(2, 2, 2);
// GL11.glTranslated(-0.2, 0, 0);
modelBaseRotors.rotor1R.childModels.clear();
modelBaseRotors.rotor1R.render(0.0625F);
modelBaseRotors.rotor1R_1.render(0.0625F);
modelBaseRotors.rotor1R_2.render(0.0625F);
modelBaseRotors.rotor1R_3.render(0.0625F);
modelBaseRotors.rotor1R_4.render(0.0625F);
break;
case 2://rotor outer
ResourceHandler.bindResource("textures/models/reactorStabilizerCore.png");
// GL11.glScaled(2, 2, 2);
// GL11.glTranslated(-0.3, 0, 0);
modelBaseRotors.rotor2R.childModels.clear();
modelBaseRotors.rotor2R.render(0.0625F);
modelBaseRotors.rotor2R_1.render(0.0625F);
modelBaseRotors.rotor2R_2.render(0.0625F);
modelBaseRotors.rotor2R_3.render(0.0625F);
modelBaseRotors.rotor2R_4.render(0.0625F);
break;
case 3://rotor assembly
ResourceHandler.bindResource("textures/models/reactorStabilizerCore.png");
// GL11.glScaled(1.5, 1.5, 1.5);
// GL11.glTranslated(-0.05, 0, 0);
GL11.glRotatef(30F, 0F, 0F, 1F);
modelBase.rotor1R.render(0.0625F);
modelBase.hub1.render(0.0625F);
GL11.glRotatef(60F, 0F, 0F, -1F);
modelBase.hub2.render(0.0625F);
modelBase.rotor2R.render(0.0625F);
break;
case 4://stabilizer ring
ResourceHandler.bindResource("textures/models/reactorStabilizerRing.png");
GL11.glRotatef(90F, 0F, 0F, 1F);
modelRing.render(null, -30, 1, 0, 0, 0, 1F / 16F);
break;
}
GL11.glPopMatrix();
}
}
@@ -0,0 +1,47 @@
package com.brandon3055.draconicevolution.client.render.item;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
/**
* Created by brandon3055 on 29/10/2015.
*/
public class RenderTool implements IItemRenderer{
private IModelCustom toolModel;
private String toolTexture;
private IRenderTweak tool;
//Draconic Sword
public RenderTool(String model, String texture, IRenderTweak tool){
this.tool = tool;
this.toolModel = AdvancedModelLoader.loadModel(ResourceHandler.getResource(model));
this.toolTexture = texture;
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return type == ItemRenderType.ENTITY && helper == ItemRendererHelper.ENTITY_ROTATION;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
ResourceHandler.bindResource(toolTexture);
tool.tweakRender(type);
toolModel.renderAll();
GL11.glPopMatrix();
}
}
@@ -99,7 +99,7 @@ public class ParticleReactorBeam extends EntityFX {
float sizeOrigin = 0.5F;
int color = 0xFF2200;
int alpha = 200;
int alpha = (int)(200D * reactor.renderSpeed);
float speed = 20F;
@@ -19,7 +19,6 @@ import org.lwjgl.opengl.GL11;
/**
* Created by Brandon on 27/07/2014.
*/
@SideOnly(Side.CLIENT)
public class Particles {
public static class EnergyBeamParticle extends EntityFX {
@@ -434,10 +433,18 @@ public class Particles {
tesselator.setBrightness(200);
float minU = 0.0F + 0F;//(float)this.particleTextureIndexX / 32.0F;
float maxU = 0.0F + 0.1245F;//minU + 0.124F;
float minV = 0F;//(float)this.particleTextureIndexY / 32.0F;
float maxV = 0.1245F;//minV + 0.124F;
int uIndex = 0;
int vIndex = 0;
float minU = uIndex * 0.125F;
float maxU = (uIndex+1) * 0.12F;
float minV = vIndex * 0.125F;
float maxV = (vIndex+1) * 0.125F;
// float minU = 0.0F + 0F;//(float)this.particleTextureIndexX / 32.0F;
// float maxU = 0.0F + 0.1245F;//minU + 0.124F;
// float minV = 0F;//(float)this.particleTextureIndexY / 32.0F;
// float maxV = 0.1245F;//minV + 0.124F;
float drawScale = 0.1F * this.particleScale;
if (this.particleIcon != null) {
@@ -650,7 +657,7 @@ public class Particles {
public ReactorExplosionParticle(World world, double x, double y, double z, double maxSize) {
super(world, x, y, z, 0D, 0D, 0D);
uvSphere = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj"));
if (uvSphere == null) uvSphere = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj"));
this.maxSize = maxSize;
}
@@ -771,6 +778,142 @@ public class Particles {
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
ResourceHandler.bindDefaultParticles();
tessellator.startDrawingQuads();
}
}
public static class ChaosImplosionParticle extends EntityFX
{
public static IModelCustom uvSphere;
public double size = 0;
public double maxSize;
public ChaosImplosionParticle(World world, double x, double y, double z, double maxSize) {
super(world, x, y, z, 0D, 0D, 0D);
if (uvSphere == null) uvSphere = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj"));
this.maxSize = maxSize;
}
@Override
public void onUpdate() {
//if (particleAge == 3) worldObj.playSound(posX, posY, posZ, "DraconicEvolution:fusionExplosion", 100F, 1F, false);
particleAge++;
size++;
if (size > maxSize * 1.2) setDead();
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
}
@Override
@SideOnly(Side.CLIENT)
public void renderParticle(Tessellator tessellator, float partialTick, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y
tessellator.draw();
GL11.glPushMatrix();
float xx = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTick - interpPosX);
float yy = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTick - interpPosY);
float zz = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTick - interpPosZ);
GL11.glTranslated((double)xx + 0.5, (double)yy + 0.5, (double)zz + 0.5);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
ResourceHandler.bindResource("textures/models/white.png");
double s = size + partialTick * 1F;
GL11.glScaled(s, s/4, s);
//Leading edge
GL11.glPushMatrix();
float a = (float)Math.max(0D, 0.3D - (size / (maxSize)));
GL11.glColor4f(1F, 1F, 1F, a);
GL11.glScaled(5, 10, 5);
if (a > 0)uvSphere.renderAll();
GL11.glPopMatrix();
// //Disk
// GL11.glPushMatrix();
// a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D));
// GL11.glColor4f(1F, 1F, 1F, a);
// GL11.glScaled(2, 0.2, 2);
// if (a > 0)uvSphere.renderAll();
// GL11.glPopMatrix();
//Synced edge
GL11.glPushMatrix();
a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D));
GL11.glColor4f(1F, 1F, 1F, a);
if (a > 0)uvSphere.renderAll();
GL11.glPopMatrix();
GL11.glScalef(1.5F, 1.5F, 1.5F);
//Inner edges
GL11.glPushMatrix();
a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D));
GL11.glColor4f(1F, 1F, 1F, a);
GL11.glScaled(0.8, 0.6, 0.8);
if (a > 0)uvSphere.renderAll();
GL11.glColor4f(1F, 1F, 1F, a);
GL11.glScaled(0.8, 0.7, 0.8);
if (a > 0)uvSphere.renderAll();
GL11.glColor4f(1F, 1F, 1F, a);
GL11.glScaled(0.7, 0.9, 0.7);
if (a > 0)uvSphere.renderAll();
GL11.glColor4f(1F, 1F, 1F, a);
GL11.glScaled(0.6, 0.9, 0.6);
if (a > 0)uvSphere.renderAll();
GL11.glColor4f(1F, 1F, 1F, a);
GL11.glScaled(0.5, 0.9, 0.5);
if (a > 0)uvSphere.renderAll();
GL11.glPopMatrix();
for (int i = 0; i < 10; i++)
{
GL11.glScalef(0.95F, 0.95F, 0.95F);
GL11.glPushMatrix();
a = (float)Math.max(0D, 0.5D - ((size / (maxSize)) * 0.5D));
GL11.glColor4f(1F, 1F, 1F, a);
GL11.glScaled(0.8, 0.6, 0.8);
if (a > 0)uvSphere.renderAll();
GL11.glColor4f(1F, 1F, 1F, a);
GL11.glScaled(0.8, 0.7, 0.8);
if (a > 0)uvSphere.renderAll();
GL11.glColor4f(1F, 1F, 1F, a);
GL11.glScaled(0.7, 0.9, 0.7);
if (a > 0)uvSphere.renderAll();
GL11.glColor4f(1F, 1F, 1F, a);
GL11.glScaled(0.6, 0.9, 0.6);
if (a > 0)uvSphere.renderAll();
GL11.glColor4f(1F, 1F, 1F, a);
GL11.glScaled(0.5, 0.9, 0.5);
if (a > 0)uvSphere.renderAll();
GL11.glPopMatrix();
}
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
ResourceHandler.bindDefaultParticles();
@@ -863,6 +1006,189 @@ public class Particles {
}
}
public static class ChaosBoltParticle extends EntityFX {
public int timer = 0;
public double focalX;
public double focalY;
public double focalZ;
public double shardX;
public double shardY;
public double shardZ;
private int mode;
public ChaosBoltParticle(World world, double x, double y, double z, double shardX, double shardY, double shardZ, int mode) {
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
this.focalX = x;
this.focalY = y;
this.focalZ = z;
this.shardX = shardX;
this.shardY = 79 + rand.nextDouble() * 3;
this.shardZ = shardZ;
if (mode == 0){
this.motionX = (rand.nextFloat() - 0.5F) * 0.5F;
this.motionY = (rand.nextFloat() - 0.5F) * 0.5F;
this.motionZ = (rand.nextFloat() - 0.5F) * 0.5F;
this.shardY = 80.5;
}else
{
this.motionX = 0;
this.motionY = 0;
this.motionZ = 0;
}
this.mode = mode;
this.particleMaxAge = 100;
this.noClip = true;
this.particleRed = 0;
this.particleGreen = 0;
this.particleBlue = 0;
}
@Override
public void onUpdate() {
if (particleAge++ > particleMaxAge) setDead();
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
if (mode == 0){
if (Utills.getDistanceAtoB(posX, posY, posZ, focalX, focalY, focalZ) < 0.2 && particleAge > 5) mode = 1;
double d = Utills.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ);
float motionMod = 0.1F;
motionX += (focalX - posX)/d * motionMod;
motionY += (focalY - posY)/d * motionMod;
motionZ += (focalZ - posZ)/d * motionMod;
}
if (mode == 1){
if (Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 1) setDead();
double d = Utills.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ);
particleScale = 1F - (float)d * 0.01F;
float motionMod = 1F;
motionX = (shardX - focalX)/d * motionMod;
motionY = (shardY - focalY)/d * motionMod;
motionZ = (shardZ - focalZ)/d * motionMod;
}
if (mode == 10){
if (Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ) < 0.3) setDead();
double d = Utills.getDistanceAtoB(focalX, focalY, focalZ, shardX, shardY, shardZ);
float motionMod = 0.4F;
motionX = (shardX - focalX)/d * motionMod;
motionY = (shardY - focalY)/d * motionMod;
motionZ = (shardZ - focalZ)/d * motionMod;
}
moveEntity(motionX, motionY, motionZ);
}
@Override
@SideOnly(Side.CLIENT)
public void renderParticle(Tessellator tesselator, float par2, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y
tesselator.draw();
ResourceHandler.bindParticles();
int uIndex = particleAge%5;
int vIndex = 1;
float minU = uIndex * 0.125F;
float maxU = (uIndex+1) * 0.125F;
float minV = vIndex * 0.125F;
float maxV = (vIndex+1) * 0.125F;
float drawScale = 0.2F * this.particleScale;
if (this.particleIcon != null) {
minU = this.particleIcon.getMinU();
maxU = this.particleIcon.getMaxU();
minV = this.particleIcon.getMinV();
maxV = this.particleIcon.getMaxV();
}
float drawX = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX);
float drawY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY);
float drawZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ);
tesselator.startDrawingQuads();
tesselator.setBrightness(200);
tesselator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha);
tesselator.addVertexWithUV((double) (drawX - par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ - par5 * drawScale - par7 * drawScale), (double) maxU, (double) maxV);
tesselator.addVertexWithUV((double) (drawX - par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ - par5 * drawScale + par7 * drawScale), (double) maxU, (double) minV);
tesselator.addVertexWithUV((double) (drawX + par3 * drawScale + par6 * drawScale), (double) (drawY + par4 * drawScale), (double) (drawZ + par5 * drawScale + par7 * drawScale), (double) minU, (double) minV);
tesselator.addVertexWithUV((double) (drawX + par3 * drawScale - par6 * drawScale), (double) (drawY - par4 * drawScale), (double) (drawZ + par5 * drawScale - par7 * drawScale), (double) minU, (double) maxV);
tesselator.draw();
ResourceHandler.bindDefaultParticles();
tesselator.startDrawingQuads();
}
}
public static class ChaosExpansionParticle extends EntityFX
{
public static IModelCustom uvSphere;
private final boolean shrink;
public double size = 0;
public double maxSize = 20;
public ChaosExpansionParticle(World world, double x, double y, double z, boolean shrink) {
super(world, x, y, z, 0D, 0D, 0D);
this.shrink = shrink;
if (uvSphere == null) uvSphere = AdvancedModelLoader.loadModel(new ResourceLocation(References.MODID.toLowerCase(), "models/reactorCoreModel.obj"));
if (shrink){
size = 20;
}
}
@Override
public void onUpdate() {
particleAge++;
if (shrink)size--;
else size++;
if (size > maxSize * 1 || size < 0) setDead();
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
}
@Override
@SideOnly(Side.CLIENT)
public void renderParticle(Tessellator tessellator, float partialTick, float par3, float par4, float par5, float par6, float par7) {//Note U=X V=Y
tessellator.draw();
GL11.glPushMatrix();
float xx = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTick - interpPosX);
float yy = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTick - interpPosY);
float zz = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTick - interpPosZ);
GL11.glTranslated((double)xx, (double)yy, (double)zz);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
ResourceHandler.bindResource("textures/models/white.png");
double s = (size + (partialTick * (shrink ? -1F : 1F))) * 2D;
GL11.glScaled(s, s, s);
if (shrink) GL11.glColor4f(1F, 1F, 1F, 1F - ((float)size - partialTick) / (float)maxSize);
else GL11.glColor4f(0F, 0F, 0F, 1F - ((float) size - partialTick) / (float) maxSize);
//GL11.glScaled(5, 10, 5);
uvSphere.renderAll();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
ResourceHandler.bindDefaultParticles();
tessellator.startDrawingQuads();
}
}
}
//int uIndex = 0;
//int vIndex = 0;
@@ -0,0 +1,92 @@
package com.brandon3055.draconicevolution.client.render.tile;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
/**
* Created by brandon3055 on 24/9/2015.
*/
public class RenderTileChaosShard extends TileEntitySpecialRenderer {
public static IModelCustom model = AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/chaosCrystal.obj"));
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float tick) {
renderTileEntityAt((TileChaosShard)tile, x, y, z, tick);
}
private void renderTileEntityAt(TileChaosShard tile, double x, double y, double z, float tick) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y + 0.5D, z + 0.5D);
GL11.glRotatef(((float)tile.tick + tick), 0, 1, 0);
ResourceHandler.bindResource("textures/models/chaosCrystal.png");
model.renderAll();
GL11.glPopMatrix();
if (!tile.guardianDefeated)
{
GL11.glPushMatrix();
GL11.glTranslated(0, -4.5, 0);
Tessellator tessellator = Tessellator.instance;
ResourceHandler.bindTexture(ResourceHandler.getResourceWOP("textures/entity/beacon_beam.png"));
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
OpenGlHelper.glBlendFunc(770, 1, 1, 0);
float f2 = (float) tile.tick + tick;
float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glDepthMask(false);
tessellator.startDrawingQuads();
tessellator.setColorRGBA(200, 0, 0, 62);
double size = 0.7F;
double d30 = 0.2D - size;
double d4 = 0.2D - size;
double d6 = 0.8D + size;
double d8 = 0.2D - size;
double d10 = 0.2D - size;
double d12 = 0.8D + size;
double d14 = 0.8D + size;
double d16 = 0.8D + size;
double d18 = 10.0D; //Height
double d20 = 0.0D;
double d22 = 1.0D;
double d24 = (double) (-1.0F + f3);
double d26 = d18 + d24;
tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26);
tessellator.addVertexWithUV(x + d30, y, z + d4, d22, d24);
tessellator.addVertexWithUV(x + d6, y, z + d8, d20, d24);
tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26);
tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26);
tessellator.addVertexWithUV(x + d14, y, z + d16, d22, d24);
tessellator.addVertexWithUV(x + d10, y, z + d12, d20, d24);
tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26);
tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26);
tessellator.addVertexWithUV(x + d6, y, z + d8, d22, d24);
tessellator.addVertexWithUV(x + d14, y, z + d16, d20, d24);
tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26);
tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26);
tessellator.addVertexWithUV(x + d10, y, z + d12, d22, d24);
tessellator.addVertexWithUV(x + d30, y, z + d4, d20, d24);
tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26);
tessellator.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(true);
GL11.glPopMatrix();
}
}
}
@@ -27,8 +27,10 @@ import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.*;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer;
import com.brandon3055.draconicevolution.common.utills.DragonChunkLoader;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator;
import com.brandon3055.draconicevolution.integration.ModHelper;
import com.brandon3055.draconicevolution.integration.computers.CCOCIntegration;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@@ -39,6 +41,7 @@ import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import li.cil.oc.api.machine.Callback;
import net.minecraft.client.audio.ISound;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -54,14 +57,7 @@ public class CommonProxy {
ModItems.init();
registerTileEntities();
initializeNetwork();
if (ModBlocks.isEnabled(ModBlocks.draconiumOre)) OreDictionary.registerOre("oreDraconium", ModBlocks.draconiumOre);
if (ModBlocks.isEnabled(ModBlocks.draconiumBlock)) OreDictionary.registerOre("blockDraconium", new ItemStack(ModBlocks.draconiumBlock));
if (ModBlocks.isEnabled(ModBlocks.draconicBlock)) OreDictionary.registerOre("blockDraconiumAwakened", new ItemStack(ModBlocks.draconicBlock));
if (ModItems.isEnabled(ModItems.draconiumIngot)) OreDictionary.registerOre("ingotDraconium", ModItems.draconiumIngot);
if (ModItems.isEnabled(ModItems.draconiumDust)) OreDictionary.registerOre("dustDraconium", ModItems.draconiumDust);
if (ModItems.isEnabled(ModItems.draconicIngot)) OreDictionary.registerOre("ingotDraconiumAwakened", ModItems.draconicIngot);
registerOres();
DraconicEvolution.reaperEnchant = new EnchantmentReaper(ConfigHandler.reaperEnchantID);
//
@@ -100,6 +96,8 @@ public class CommonProxy {
DETab.initialize();
PotionHandler.init();
CCOCIntegration.init();
ModHelper.init();
DragonChunkLoader.init();
LogHelper.info("Finished Initialization");
}
@@ -160,6 +158,7 @@ public class CommonProxy {
GameRegistry.registerTileEntity(TileFluidGate.class, References.RESOURCESPREFIX + "TileFluidGate");
GameRegistry.registerTileEntity(TileReactorStabilizer.class, References.RESOURCESPREFIX + "TileReactorStabilizer");
GameRegistry.registerTileEntity(TileReactorEnergyInjector.class, References.RESOURCESPREFIX + "TileReactorEnergyInjector");
GameRegistry.registerTileEntity(TileChaosShard.class, References.RESOURCESPREFIX + "TileChaosShard");
if (DraconicEvolution.debug) {
GameRegistry.registerTileEntity(TileTestBlock.class, References.RESOURCESPREFIX + "TileTestBlock");
GameRegistry.registerTileEntity(TileContainerTemplate.class, References.RESOURCESPREFIX + "TileContainerTemplate");
@@ -181,6 +180,20 @@ public class CommonProxy {
GameRegistry.registerWorldGenerator(new DraconicWorldGenerator(), 0);
}
public void registerOres(){
if (ModBlocks.isEnabled(ModBlocks.draconiumOre)) OreDictionary.registerOre("oreDraconium", ModBlocks.draconiumOre);
if (ModBlocks.isEnabled(ModBlocks.draconiumBlock)) OreDictionary.registerOre("blockDraconium", new ItemStack(ModBlocks.draconiumBlock));
if (ModBlocks.isEnabled(ModBlocks.draconicBlock)) OreDictionary.registerOre("blockDraconiumAwakened", new ItemStack(ModBlocks.draconicBlock));
if (ModItems.isEnabled(ModItems.draconiumIngot)) OreDictionary.registerOre("ingotDraconium", ModItems.draconiumIngot);
if (ModItems.isEnabled(ModItems.draconiumDust)) OreDictionary.registerOre("dustDraconium", ModItems.draconiumDust);
if (ModItems.isEnabled(ModItems.draconicIngot)) OreDictionary.registerOre("ingotDraconiumAwakened", ModItems.draconicIngot);
if (ModItems.isEnabled(ModItems.nugget)) {
OreDictionary.registerOre("nuggetDraconium", ModItems.nuggetDraconium.copy());
OreDictionary.registerOre("nuggetDraconiumAwakened", ModItems.nuggetAwakened.copy());
}
}
@Callback
public void registerEntities() {
EntityRegistry.registerModEntity(EntityCustomDragon.class, "EnderDragon", 0, DraconicEvolution.instance, 256, 3, true);
@@ -192,6 +205,8 @@ public class CommonProxy {
EntityRegistry.registerModEntity(EntityChaosGuardian.class, "ChaosGuardian", 6, DraconicEvolution.instance, 256, 1, true);
EntityRegistry.registerModEntity(EntityDragonProjectile.class, "DragonProjectile", 7, DraconicEvolution.instance, 256, 1, true);
EntityRegistry.registerModEntity(EntityChaosCrystal.class, "ChaosCrystal", 8, DraconicEvolution.instance, 256, 5, false);
EntityRegistry.registerModEntity(EntityChaosBolt.class, "ChaosBolt", 9, DraconicEvolution.instance, 32, 5, true);
EntityRegistry.registerModEntity(EntityChaosVortex.class, "EntityChaosEnergyVortex", 10, DraconicEvolution.instance, 512, 5, true);
}
public ParticleEnergyBeam energyBeam(World worldObj, double x, double y, double z, double tx, double ty, double tz, int powerFlow, boolean advanced, ParticleEnergyBeam oldBeam, boolean render, int beamType)
@@ -212,5 +227,8 @@ public class CommonProxy {
}
public ISound playISound(ISound sound){
return null;
}
}
@@ -47,7 +47,9 @@ public class ModBlocks {
public static BlockDE flowGate;
public static BlockDE reactorStabilizer;
public static BlockDE reactorEnergyInjector;
public static BlockDE chaosCrystal;
public static Block safetyFlame;
public static Block chaosShardAtmos = new ChaosShardAtmos().setBlockName(References.RESOURCESPREFIX+"chaosShardAtmos").setBlockTextureName(References.RESOURCESPREFIX+"transparency");
public static ItemStack resurrectionStone;
@@ -85,8 +87,11 @@ public class ModBlocks {
flowGate = new FlowGate();
reactorStabilizer = new ReactorStabilizer();
reactorEnergyInjector = new ReactorEnergyInjector();
chaosCrystal = new ChaosCrystal();
longRangeDislocator = new LongRangeDislocator();
if (isEnabled(chaosShardAtmos))GameRegistry.registerBlock(chaosShardAtmos, "chaosShardAtmos");
if(DraconicEvolution.debug) {
testBlock = new TestBlock();
@@ -70,6 +70,11 @@ public class ModItems {
public static ItemDE draconiumEnergyCore;
public static ItemDE draconiumFluxCapacitor;
public static ItemDE wrench;
public static ItemDE chaosShard;
public static ItemDE reactorStabilizerParts;
public static ItemDE chaoticCore;
public static ItemDE nugget;
public static ItemDE chaosFragment;
public static ItemDE teleporterMKI;
public static ItemDE teleporterMKII;
@@ -79,6 +84,15 @@ public class ModItems {
public static ItemStack wyvernEnergyCore;
public static ItemStack draconicEnergyCore;
public static ItemStack partStabFrame;
public static ItemStack partStabRotorInner;
public static ItemStack partStabRotorOuter;
public static ItemStack partStabRotorAssembly;
public static ItemStack partStabRing;
public static ItemStack nuggetDraconium;
public static ItemStack nuggetAwakened;
public static void init()
{
draconicDestructionStaff = new DraconicDistructionStaff();
@@ -124,6 +138,11 @@ public class ModItems {
draconiumEnergyCore = new DraconiumEnergyCore();
draconiumFluxCapacitor = new DraconiumFluxCapacitor();
wrench = new Wrench();
chaosShard = new ChaosShard();
reactorStabilizerParts = new ReactorStabiliserPart();
chaoticCore = new ChaoticCore();
nugget = new Nugget();
chaosFragment = new ChaosFragment();
dezilsMarshmallow = new DezilsMarshmallow();
@@ -132,6 +151,15 @@ public class ModItems {
draconicEnergyCore = new ItemStack(ModItems.draconiumEnergyCore, 1, 1);
wyvernFluxCapacitor = new ItemStack(ModItems.draconiumFluxCapacitor, 1, 0);
draconicFluxCapacitor = new ItemStack(ModItems.draconiumFluxCapacitor, 1, 1);
partStabFrame = new ItemStack(reactorStabilizerParts, 1, 0);
partStabRotorInner = new ItemStack(reactorStabilizerParts, 1, 1);
partStabRotorOuter = new ItemStack(reactorStabilizerParts, 1, 2);
partStabRotorAssembly = new ItemStack(reactorStabilizerParts, 1, 3);
partStabRing = new ItemStack(reactorStabilizerParts, 1, 4);
nuggetDraconium = new ItemStack(nugget, 1, 0);
nuggetAwakened = new ItemStack(nugget, 1, 1);
}
public static void register(final ItemDE item)
@@ -0,0 +1,85 @@
package com.brandon3055.draconicevolution.common.blocks;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.entity.EntityChaosVortex;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.Random;
/**
* Created by brandon3055 on 24/9/2015.
*/
public class ChaosCrystal extends BlockDE {
public ChaosCrystal(){
super(Material.rock);
this.setHardness(100.0F);
this.setResistance(4000.0F);
this.setBlockUnbreakable();
this.setBlockName("chaosCrystal");
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
ModBlocks.register(this);
}
@Override
public float getBlockHardness(World world, int x, int y, int z) {
TileChaosShard tile = world.getTileEntity(x, y, z) instanceof TileChaosShard ? (TileChaosShard) world.getTileEntity(x, y, z) : null;
if (tile != null) return tile.guardianDefeated ? 100F : -1F;
return super.getBlockHardness(world, x, y, z);
}
@Override
public void registerBlockIcons(IIconRegister iconRegister) {blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "transparency");}
@Override
public boolean hasTileEntity(int metadata) {
return true;
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
return new TileChaosShard();
}
@Override
public int getRenderType() {
return -1;
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
return ModItems.chaosShard;
}
@Override
public int quantityDropped(int meta, int fortune, Random random) {
return 5;
}
@Override
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
return false;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int i) {
super.breakBlock(world, x, y, z, block, i);
if (!world.isRemote){
EntityChaosVortex vortex = new EntityChaosVortex(world);
vortex.setPosition(x+0.5, y+0.5, z+0.5);
world.spawnEntityInWorld(vortex);
}
}
}
@@ -0,0 +1,41 @@
package com.brandon3055.draconicevolution.common.blocks;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.entity.EntityChaosBolt;
import net.minecraft.block.BlockAir;
import net.minecraft.entity.Entity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.Random;
/**
* Created by brandon3055 on 30/9/2015.
*/
public class ChaosShardAtmos extends BlockAir {
public ChaosShardAtmos(){
this.setTickRandomly(true);
}
@Override
public void updateTick(World world, int x, int y, int z, Random random) {
if (random.nextInt(25) == 0) {
for (int searchX = x-15; searchX < x+15; searchX++){
for (int searchZ = z-15; searchZ < z+15; searchZ++){
if (world.getBlock(searchX, 80, searchZ) == ModBlocks.chaosCrystal){
EntityChaosBolt bolt = new EntityChaosBolt(world, x+0.5, y+0.5, z+0.5, searchX+0.5, 80.5, searchZ+0.5);
world.spawnEntityInWorld(bolt);
return;
}
}
}
world.setBlockToAir(x, y, z);
}
}
@Override
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
return false;
}
}
@@ -3,6 +3,7 @@ package com.brandon3055.draconicevolution.common.blocks;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@@ -15,6 +16,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
@@ -42,9 +44,16 @@ public class InfusedObsidian extends BlockDE {
@Override
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
LogHelper.info("Can Destroy "+entity);
return false;
}
@Override
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) {
return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ);
}
public static class InfusedObsidianItemBlock extends ItemBlock {
public InfusedObsidianItemBlock(Block p_i45328_1_) {
@@ -43,7 +43,7 @@ public class LongRangeDislocator extends BlockDE {
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister iconRegister)
{
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "teteporter_front");
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "teleporter_front");
blockIconTop = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_top_0");
}
@@ -220,7 +220,7 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock {
list.add(InfoHelper.HITC() + ModBlocks.energyStorageCore.getLocalizedName());
list.add("Tier: " + InfoHelper.ITC() + (master.getTier() + 1));
String BN = String.valueOf(master.getEnergyStored());
list.add(StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.ITC() + Utills.formatNumber(master.getEnergyStored()) + " / " + Utills.formatNumber(master.getMaxEnergyStored()) + " [" + BN + " RF]");
list.add(StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.ITC() + Utills.formatNumber(master.getEnergyStored()) + " / " + Utills.formatNumber(master.getMaxEnergyStored()) + " [" + Utills.addCommas(master.getEnergyStored()) + " RF]");
return list;
}
@@ -22,6 +22,8 @@ public class ReactorCore extends BlockDE {
public ReactorCore(){
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
this.setBlockName("reactorCore");
this.setHardness(100F);
ModBlocks.register(this);
}
@@ -95,7 +95,7 @@ public class ReactorEnergyInjector extends BlockDE {
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart ? (IReactorPart)world.getTileEntity(x, y, z) : null;
if (tile != null) {
if (tile != null && player.isSneaking()) {
tile.changeRedstoneMode();
if(!world.isRemote) player.addChatComponentMessage(new ChatComponentText(tile.getRedstoneModeString()));
return true;
@@ -22,10 +22,11 @@ import net.minecraftforge.common.util.ForgeDirection;
/**
* Created by Brandon on 5/7/2015.
*/
public class ReactorStabilizer extends BlockDE{
public class ReactorStabilizer extends BlockDE {
public ReactorStabilizer() {
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
this.setBlockName("reactorStabilizer");
this.setResistance(10000F);
ModBlocks.register(this);
}
@@ -28,7 +28,8 @@ public class ContainerReactor extends ContainerDataSync {
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return itemstack != null && (itemstack.getItem() == ModItems.draconicIngot || itemstack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock));
return true;
//return itemstack != null && (itemstack.getItem() == ModItems.draconicIngot || itemstack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock));
}
@Override
@@ -38,8 +39,9 @@ public class ContainerReactor extends ContainerDataSync {
@Override
public void setInventorySlotContents(int i, ItemStack stack) {
if (i == 0 && stack != null && (stack.getItem() == ModItems.draconicIngot || stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock)))
if (i == 0 && stack != null && (stack.getItem() == ModItems.draconicIngot || stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock) || (stack.getItem() == ModItems.nugget && stack.getItemDamage() == 1)))
{
if (stack.getItem() == ModItems.nugget) reactor.reactorFuel += stack.stackSize * 16;
if (stack.getItem() == ModItems.draconicIngot) reactor.reactorFuel += stack.stackSize * 144;
if (stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock)) reactor.reactorFuel += stack.stackSize * 1296;
reactor.validateStructure();
@@ -51,12 +53,17 @@ public class ContainerReactor extends ContainerDataSync {
//Syncing //todo sort out syncing
public int LTConversionUnit = -1;
public int LTReactionIntensity = -1;
public int LTMaxReactIntensity = -1;
public int LTFieldStrength = -1;
public int LTMaxFieldStrength = -1;
public int LTEnergySaturation = -1;
public int LTMaxEnergySaturation = -1;
public int LTFuelConversion = -1;
// public int LTMaxReactIntensity = -1;
// public int LTFieldStrength = -1;
// public int LTMaxFieldStrength = -1;
// public int LTEnergySaturation = -1;
// public int LTMaxEnergySaturation = -1;
// public int LTFuelConversion = -1;
public double LTTempDrainFactor = -1;
public double LTGenerationRate = -1;
public int LTFieldDrain = -1;
public double LTFuelUseRate = -1;
//#######
public ContainerReactor(EntityPlayer player, TileReactorCore reactor){
@@ -95,7 +102,8 @@ public class ContainerReactor extends ContainerDataSync {
@Override
public void detectAndSendChanges() { //todo check what values are being synced by the tile and remove them from here
if (reactor.conversionUnit != LTConversionUnit) LTConversionUnit = (Integer) sendObjectToClient(null, 0, (int)(reactor.conversionUnit*100));
if (reactor.conversionUnit != LTConversionUnit) LTConversionUnit = (Integer) sendObjectToClient(null, 0, (int)(reactor.conversionUnit*100));
// if ((int)reactor.reactionTemperature != LTReactionIntensity)LTReactionIntensity = (Integer) sendObjectToClient(null, 1, (int) reactor.reactionTemperature);
// if ((int)reactor.maxReactTemperature != LTMaxReactIntensity)LTMaxReactIntensity = (Integer) sendObjectToClient(null, 2, (int) reactor.maxReactTemperature);
// if ((int)reactor.fieldCharge != LTFieldStrength) LTFieldStrength = (Integer) sendObjectToClient(null, 3, (int) reactor.fieldCharge);
@@ -103,6 +111,11 @@ public class ContainerReactor extends ContainerDataSync {
// if (reactor.energySaturation != LTEnergySaturation) LTEnergySaturation = (Integer) sendObjectToClient(null, 4, reactor.energySaturation);
// if (reactor.maxEnergySaturation != LTMaxEnergySaturation) LTMaxEnergySaturation = (Integer) sendObjectToClient(null, 5, reactor.maxEnergySaturation);
// if (reactor.convertedFuel != LTFuelConversion) LTFuelConversion = (Integer) sendObjectToClient(null, 6, reactor.convertedFuel);
/*if (reactor.tempDrainFactor != LTTempDrainFactor) LTTempDrainFactor = (Integer) */sendObjectToClient(null, 8, (int)(reactor.tempDrainFactor*1000D));
if (reactor.generationRate != LTGenerationRate) LTGenerationRate = (Integer) sendObjectToClient(null, 9, (int)(reactor.generationRate));
if (reactor.fieldDrain != LTFieldDrain) LTFieldDrain = (Integer) sendObjectToClient(null, 10, reactor.fieldDrain);
/*if (reactor.fuelUseRate != LTFuelUseRate) LTFuelUseRate = (Integer) */sendObjectToClient(null, 11, (int)(reactor.fuelUseRate*1000000D));
super.detectAndSendChanges();
}
@@ -117,6 +130,10 @@ public class ContainerReactor extends ContainerDataSync {
// else if (index == 5) reactor.maxEnergySaturation = value;
// else if (index == 6) reactor.convertedFuel = value;
// else if (index == 7) reactor.maxFieldCharge = value;
else if (index == 8) reactor.tempDrainFactor = value/1000D;
else if (index == 9) reactor.generationRate = value;
else if (index == 10) reactor.fieldDrain = value;
else if (index == 11) reactor.fuelUseRate = value/1000000D;
if (index == 20){
reactor.processButtonPress(value);
}
@@ -137,6 +154,30 @@ public class ContainerReactor extends ContainerDataSync {
ioSlots.getStorage()[1] = new ItemStack(ModItems.draconicIngot, i2);
reactor.reactorFuel -= i2 * 144;
}
else if (reactor.reactorFuel >= 16){
int i = reactor.reactorFuel / 16;
int i2 = Math.min(64, i);
ioSlots.getStorage()[1] = new ItemStack(ModItems.nugget, i2, 1);
reactor.reactorFuel -= i2 * 16;
}
else if (reactor.convertedFuel / 144 >= 64){
int i = reactor.convertedFuel / 1296;
int i2 = Math.min(64, i);
ioSlots.getStorage()[1] = new ItemStack(ModItems.chaosFragment, i2, 2);
reactor.convertedFuel -= i2 * 1296;
}
else if (reactor.convertedFuel >= 144){
int i = reactor.convertedFuel / 144;
int i2 = Math.min(64, i);
ioSlots.getStorage()[1] = new ItemStack(ModItems.chaosFragment, i2, 1);
reactor.convertedFuel -= i2 * 144;
}
else if (reactor.convertedFuel >= 16){
int i = reactor.convertedFuel / 16;
int i2 = Math.min(64, i);
ioSlots.getStorage()[1] = new ItemStack(ModItems.chaosFragment, i2, 0);
reactor.convertedFuel -= i2 * 16;
}
}
return super.slotClick(slot, button, p_75144_3_, player1);
@@ -159,8 +200,11 @@ public class ContainerReactor extends ContainerDataSync {
@Override
public boolean isItemValid(ItemStack stack) {
if (stack == null) return false;
else if (stack.getItem() == ModItems.nugget && stack.getItemDamage() == 1) numberAllowed = (10368 - (reactor.reactorFuel + reactor.convertedFuel)) / 16;
else if (stack.getItem() == ModItems.draconicIngot) numberAllowed = (10368 - (reactor.reactorFuel + reactor.convertedFuel)) / 144;
else if (stack.getItem() == Item.getItemFromBlock(ModBlocks.draconicBlock)) numberAllowed = (10368 - (reactor.reactorFuel + reactor.convertedFuel)) / 1296;
else return false;
return numberAllowed > 0;
}
@@ -0,0 +1,65 @@
package com.brandon3055.draconicevolution.common.entity;
import com.brandon3055.brandonscore.common.handlers.IProcess;
import com.brandon3055.brandonscore.common.handlers.ProcessHandler;
import com.brandon3055.brandonscore.common.utills.Utills;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import java.util.Random;
/**
* Created by brandon3055 on 12/8/2015.
*/
public class ChaosImplosion implements IProcess {
public static DamageSource chaosImplosion = new DamageSource("chaosImplosion").setExplosion().setDamageBypassesArmor().setDamageIsAbsolute().setDamageAllowedInCreativeMode();
private World worldObj;
private int xCoord;
private int yCoord;
private int zCoord;
private float power;
private Random random = new Random();
private double expansion = 0;
public ChaosImplosion(World world, int x, int y, int z){
this.worldObj = world;
this.xCoord = x;
this.yCoord = y;
this.zCoord = z;
this.power = 15F;
isDead = world.isRemote;
}
@Override
public void updateProcess() {
int OD = (int) expansion;
int ID = OD - 1;
int size = (int) expansion;
for (int x = xCoord - size; x < xCoord + size; x++){
for (int z = zCoord - size; z < zCoord + size; z++){
double dist = Utills.getDistanceAtoB(x, z, xCoord, zCoord);
if (dist < OD && dist >= ID)
{
float tracePower = power - (float)(expansion/10D);
tracePower *= 1F + ((random.nextFloat() - 0.5F) * 0.2);
ProcessHandler.addProcess(new ChaosImplosionTrace(worldObj, x, yCoord, z, tracePower, random));
}
}
}
isDead = expansion >= power * 10;
expansion += 1;
}
private boolean isDead = false;
@Override
public boolean isDead() {
return isDead;
}
}
@@ -0,0 +1,69 @@
package com.brandon3055.draconicevolution.common.entity;
import com.brandon3055.brandonscore.common.handlers.IProcess;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.ReactorExplosion;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import java.util.List;
import java.util.Random;
/**
* Created by brandon3055 on 12/8/2015.
*/
public class ChaosImplosionTrace implements IProcess {
private World worldObj;
private int xCoord;
private int yCoord;
private int zCoord;
private float power;
private Random random;
public ChaosImplosionTrace(World world, int x, int y, int z, float power, Random random){
this.worldObj = world;
this.xCoord = x;
this.yCoord = y;
this.zCoord = z;
this.power = power;
this.random = random;
}
@Override
public void updateProcess() {
float energy = power * 10;
for (int y = yCoord; y > 0 && energy > 0; y--){
List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord+1, y+1, zCoord+1));
for (Entity entity : entities) entity.attackEntityFrom(ChaosImplosion.chaosImplosion, power * 100);
//energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null);
if (energy >= 0) worldObj.setBlockToAir(xCoord, y, zCoord);
energy -= 0.5F + (0.1F * (yCoord - y));
}
energy = power * 20;
yCoord++;
for (int y = yCoord; y < 255 && energy > 0; y++){
List<Entity> entities = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord, y, zCoord, xCoord+1, y+1, zCoord+1));
for (Entity entity : entities) entity.attackEntityFrom(ReactorExplosion.fusionExplosion, power * 100);
//energy -= block instanceof BlockLiquid ? 10 : block.getExplosionResistance(null);
if (energy >= 0) worldObj.setBlockToAir(xCoord, y, zCoord);
energy -= 0.5F + (0.1F * (y - yCoord));
}
isDead = true;
}
private boolean isDead = false;
@Override
public boolean isDead() {
return isDead;
}
}
@@ -0,0 +1,106 @@
package com.brandon3055.draconicevolution.common.entity;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.render.particle.Particles;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
/**
* Created by brandon3055 on 30/9/2015.
*/
public class EntityChaosBolt extends Entity {
public double shardX;
public double shardY;
public double shardZ;
public boolean burst;
private static DamageSource chaosBurst = new DamageSource("chaosBurst").setDamageBypassesArmor().setDamageIsAbsolute();
public EntityChaosBolt(World world) {
this(world, 0, 0, 0, 0, 0, 0);
}
public EntityChaosBolt(World world, double x, double y, double z, double shardX, double shardY, double shardZ) {
super(world);
this.shardX = shardX;
this.shardY = shardY;
this.shardZ = shardZ;
this.setPosition(x, y, z);
this.setSize(0.25F, 0.25F);
}
@Override
public boolean isInRangeToRenderDist(double p_70112_1_) {
return false;
}
@Override
protected void entityInit() {
burst = rand.nextInt(30) == 0;
dataWatcher.addObject(20, (float)shardX);
dataWatcher.addObject(21, (float)shardZ);
dataWatcher.addObject(22, burst ? (byte)1 : (byte)0);
}
@Override
public void onUpdate() {
super.onUpdate();
burst = true;
if (worldObj.isRemote) {
shardX = dataWatcher.getWatchableObjectFloat(20);
shardZ = dataWatcher.getWatchableObjectFloat(21);
burst = dataWatcher.getWatchableObjectByte(22) == 1;
}else {
dataWatcher.updateObject(20, (float) shardX);
dataWatcher.updateObject(21, (float) shardZ);
dataWatcher.updateObject(22, burst ? (byte)1 : (byte)0);
}
if (ticksExisted == 10 && !burst) {
if (worldObj.isRemote) DraconicEvolution.proxy.spawnParticle(new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, 10), 32);
setDead();
}
else if (ticksExisted > 10){
if (ticksExisted < 25){
for (int i = 0; i < 20; i++){
if (worldObj.isRemote) DraconicEvolution.proxy.spawnParticle(new Particles.ChaosBoltParticle(worldObj, posX, posY, posZ, shardX, shardY, shardZ, 0), 32);
}
}
if (ticksExisted > 40 && !worldObj.isRemote) {
// if (ticksExisted % 5 == 0)
// {
// double dist = Utills.getDistanceAtoB(posX, posY, posZ, shardX, shardY, shardZ);
// Vec3 dir = Vec3.createVectorHelper((shardX - posX) / dist, (shardY - posY) / dist, (shardZ - posZ) / dist);
// MovingObjectPosition movingobjectposition = this.worldObj.//func_147447_a(Vec3.createVectorHelper(posX, posY, posZ), dir, false, true, false);
// Entity entity = movingobjectposition.entityHit; //WorldUtil.rayTraceEntities(worldObj, Vec3.createVectorHelper(posX, posY, posZ), dir, 20);
//
// LogHelper.info(movingobjectposition);
// if (entity instanceof EntityLivingBase) {
// entity.hurtResistantTime = 0;
// entity.attackEntityFrom(chaosBurst, 50F);
// }
// }
if (ticksExisted > 60)setDead();
}
}
}
@Override
protected void readEntityFromNBT(NBTTagCompound compound) {
// if (compound.hasKey("ShardPos")){
// int[] pos = compound.getIntArray("ShardPos");
// shardX = pos[0];
// shardY = pos[1];
// shardZ = pos[2];
// LogHelper.info("read");
// }
}
@Override
protected void writeEntityToNBT(NBTTagCompound compound) {
// compound.setIntArray("ShardPos", new int[] {(int)(shardX-0.5D), (int)(shardY-0.5D), (int)(shardZ-0.5D)});
// LogHelper.info("write");
}
}
@@ -1,9 +1,13 @@
package com.brandon3055.draconicevolution.common.entity;
import com.brandon3055.draconicevolution.common.ModBlocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@@ -24,6 +28,7 @@ public class EntityChaosCrystal extends EntityLivingBase {
public float deathAnimation = 1F;
public int shieldTime = 0;
public EntityChaosGuardian guardian;
private int timeTillDeath = -1;
public EntityChaosCrystal(World p_i1698_1_) {
super(p_i1698_1_);
@@ -70,12 +75,42 @@ public class EntityChaosCrystal extends EntityLivingBase {
int j = MathHelper.floor_double(this.posY);
int k = MathHelper.floor_double(this.posZ);
if (this.worldObj.provider instanceof WorldProviderEnd && this.worldObj.getBlock(i, j, k) != Blocks.fire)
{
this.worldObj.setBlock(i, j, k, Blocks.fire);
}
if (this.worldObj.provider instanceof WorldProviderEnd && this.worldObj.getBlock(i, j, k) != Blocks.fire) this.worldObj.setBlock(i, j, k, Blocks.fire);
}else if (deathAnimation > 0) deathAnimation -= 0.1F;
if (guardian != null && guardian.isDead) setDeathTimer();
if (timeTillDeath > 0) timeTillDeath--;
if (timeTillDeath == 0 && !worldObj.isRemote){
worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, posX, posY, posZ));
worldObj.createExplosion(this, posX, posY+2, posZ, 20, true);
for (int x = (int)posX - 5; x <= (int)posX + 5; x++){
for (int y = (int)posY - 25; y <= (int)posY + 5; y++){
for (int z = (int)posZ - 5; z <= (int)posZ + 5; z++){
Block block = worldObj.getBlock(x, y, z);
if (block == Blocks.obsidian || block == ModBlocks.infusedObsidian){
EntityFallingBlock fallingBlock = new EntityFallingBlock(worldObj, x, y, z, block);
fallingBlock.field_145812_b = 2;
fallingBlock.field_145813_c = false;
float motion = 2F;
fallingBlock.motionX = (rand.nextFloat()-0.5F) * motion;
fallingBlock.motionY = (rand.nextFloat()-0.5F) * motion;
fallingBlock.motionZ = (rand.nextFloat()-0.5F) * motion;
worldObj.setBlockToAir(x, y, z);
worldObj.spawnEntityInWorld(fallingBlock);
}
}
}
}
this.setDead();
}
}
public void setDeathTimer(){
if (timeTillDeath > 0) return;
timeTillDeath = rand.nextInt(400);
}
@Override
@@ -125,7 +160,7 @@ public class EntityChaosCrystal extends EntityLivingBase {
if (guardian == null) {
@SuppressWarnings("unchecked") List<EntityChaosGuardian> list = worldObj.getEntitiesWithinAABB(EntityChaosGuardian.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX, posY, posZ).expand(512, 512, 512));
if (list.size() > 0) guardian = list.get(0);
if (guardian != null && !guardian.crystals.contains(this)) {
if (guardian != null && guardian.crystals != null && !guardian.crystals.contains(this)) {
guardian.crystals.add(this);
guardian.updateCrystals();
}
@@ -2,7 +2,9 @@ package com.brandon3055.draconicevolution.common.entity;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.tileentities.TileChaosShard;
import com.brandon3055.draconicevolution.common.utills.DamageSourceChaos;
import com.brandon3055.draconicevolution.common.utills.DragonChunkLoader;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -87,7 +89,6 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
@Override
public void onLivingUpdate() {
//Set home position when spawned
if (!homeSet) {
homeX = (int) posX;
@@ -113,7 +114,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
f1 = MathHelper.cos(this.prevAnimTime * (float) Math.PI * 2.0F);
if (f1 <= -0.3F && f >= -0.3F) {
this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.rand.nextFloat() * 0.3F, false);
if (deathTicks <= 0) this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.rand.nextFloat() * 0.3F, false);
}
}
@@ -123,16 +124,26 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
if (!worldObj.isRemote) {
dataWatcher.updateObject(20, connectedCrystalID);
updateTarget();
if (worldObj.getClosestPlayer(posX, posY, posZ, 500) == null && getDistance(homeX, homeY, homeZ) < 100) DragonChunkLoader.stopLoading(this);
else {
if (getHealth() > 0) DragonChunkLoader.updateLoaded(this);
}
if (deathTicks > 0) DragonChunkLoader.stopLoading(this);
customAIUpdate();
if (behaviour == EnumBehaviour.FIREBOMB && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) moveSpeedMultiplier = 0;
}
if (this.getHealth() <= 0.0F) {
behaviour = EnumBehaviour.DEAD;
f = (this.rand.nextFloat() - 0.5F) * 8.0F;
f1 = (this.rand.nextFloat() - 0.5F) * 4.0F;
f2 = (this.rand.nextFloat() - 0.5F) * 8.0F;
this.worldObj.spawnParticle("largeexplode", this.posX + (double) f, this.posY + 2.0D + (double) f1, this.posZ + (double) f2, 0.0D, 0.0D, 0.0D);
} else {
}
{
this.updateDragonEnderCrystal();
f = 0.2F / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + 1.0F);
f *= moveSpeedMultiplier == 0 ? 1 : moveSpeedMultiplier;
@@ -345,6 +356,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
}
public void onCrystalTargeted(EntityPlayer player, boolean destroyed) {
if (behaviour == EnumBehaviour.DEAD) return;
target = player;
if (destroyed || behaviour == EnumBehaviour.LOW_HEALTH_STRATEGY)
{
@@ -361,7 +373,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
nextAttackTimer = 20;
attackTimer = 1000;
}
this.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "mob.enderdragon.growl", 20.0F, 0.8F + this.rand.nextFloat() * 0.3F);
if (deathTicks <= 0) this.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "mob.enderdragon.growl", 20.0F, 0.8F + this.rand.nextFloat() * 0.3F);
}
public void updateCrystals(){
@@ -376,7 +388,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
private void customAIUpdate(){
if (getHealth() < getMaxHealth() * 0.2F) behaviour = EnumBehaviour.LOW_HEALTH_STRATEGY;
if (getHealth() > 0 && getHealth() < getMaxHealth() * 0.2F) behaviour = EnumBehaviour.LOW_HEALTH_STRATEGY;
switch (behaviour){
@@ -415,11 +427,18 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
}
break;
//todo Death event
case DEAD:
target = null;
targetX = homeX;
targetY = homeY;
targetZ = homeZ;
break;
}
//ignitionChargeTimer = 10;
if (behaviour == EnumBehaviour.DEAD) return;
if (ignitionChargeTimer > 1 || (ignitionChargeTimer == 1 && ticksExisted % 20 == 0))ignitionChargeTimer--;
if (ignitionChargeTimer <= 0 && !worldObj.isRemote){
if ((ticksExisted - 19) % 20 == 0) ignitionChargeTimer = (behaviour == EnumBehaviour.LOW_HEALTH_STRATEGY ? 1000 : 2000) + rand.nextInt(600);
@@ -440,7 +459,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
}
private void updateAttack(){
if (worldObj.isRemote || getHealth() <= 0) return;
if (worldObj.isRemote || behaviour == EnumBehaviour.DEAD) return;
if (behaviour == EnumBehaviour.FIREBOMB && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3){
if (target == null || ticksExisted % 100 == 0) setNewTarget();
@@ -583,13 +602,14 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
};
private void selectNewAttack(){
if (behaviour == EnumBehaviour.DEAD) return;
if (behaviour == EnumBehaviour.LOW_HEALTH_STRATEGY) attackInProgress = ((WeightedAttack)WeightedRandom.getRandomItem(rand, weightedLowHealthAttaxks)).attack;
else if (behaviour != EnumBehaviour.FIREBOMB) attackInProgress = ((WeightedAttack)WeightedRandom.getRandomItem(rand, weightedAttacks)).attack;
else attackInProgress = ATTACK_ENERGY_CHASER;
}
private void selectNewBehaviour(){
if (worldObj.isRemote) return;
if (worldObj.isRemote || behaviour == EnumBehaviour.DEAD) return;
EnumBehaviour newBehaviour = behaviour;
while (newBehaviour == behaviour) newBehaviour = ((WeightedBehaviour)WeightedRandom.getRandomItem(rand, weightedBehaviours)).randomBehaviour;
behaviour = newBehaviour;
@@ -640,6 +660,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
}
private void setNewTarget() {
if (behaviour == EnumBehaviour.DEAD) return;
this.forceNewTarget = false;
@@ -701,6 +722,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
@Override
public boolean attackEntityFromPart(EntityDragonPart part, DamageSource damageSource, float dmg) {
if (behaviour == EnumBehaviour.DEAD) return false;
if (part != this.dragonPartHead)
{
dmg = dmg / 4.0F + 1.0F;
@@ -758,8 +780,9 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
// this.targetZ = this.posZ - (double)(f3 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F);
// this.target = null;
if ((damageSource.getEntity() instanceof EntityPlayer || damageSource.isExplosion()) && healingChaosCrystal == null)
if ((damageSource.getEntity() instanceof EntityPlayer || damageSource.isExplosion()) && healingChaosCrystal == null)//tod reanable this
{
// if (getHealth() > 1F)setHealth(1F);//tod and remove this!
this.func_82195_e(damageSource, dmg);
}
@@ -782,7 +805,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
/**Will try to avoid players, will try to teleport players, will try to relight crystals*/
LOW_HEALTH_STRATEGY(2F),
/**will die...*/
DEAD(2F);
DEAD(0.5F);
public float dragonSpeed;
private EnumBehaviour(float dragonSpeed) {this.dragonSpeed = dragonSpeed;}
@@ -825,15 +848,34 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
// homeZ = ConfigHandler.dragonEggSpawnLocation[2];
// }
// }
if (deathTicks == 0){
if (worldObj.getTileEntity(homeX, homeY, homeZ) instanceof TileChaosShard) {
((TileChaosShard) worldObj.getTileEntity(homeX, homeY, homeZ)).setDefeated();
}
else {
for (int x = homeX - 100; x < homeX + 100; x++){
for (int y = homeY - 100; y < homeX + 100; y++){
if (y < 0 || y > 255) continue;
for (int z = homeX - 100; z < homeX + 100; z++){
if (worldObj.getTileEntity(x, y, z) instanceof TileChaosShard) {
((TileChaosShard) worldObj.getTileEntity(x, y, z)).setDefeated();
break;
}
}
}
}
}
}
++this.deathTicks;
if (worldObj.rand.nextInt(5) == 2)
{
EntityLightningBolt bolt = new EntityLightningBolt(worldObj, homeX, homeY + 1, homeZ);
bolt.ignoreFrustumCheck = true;
worldObj.addWeatherEffect(bolt);
}
// if (worldObj.rand.nextInt(5) == 2)
// {
// EntityLightningBolt bolt = new EntityLightningBolt(worldObj, homeX, homeY + 1, homeZ);
// bolt.ignoreFrustumCheck = true;
// worldObj.addWeatherEffect(bolt);
// }
if (this.deathTicks >= 180 && this.deathTicks <= 200) {
float f = (this.rand.nextFloat() - 0.5F) * 8.0F;
@@ -845,27 +887,31 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
int i;
int j;
if (!this.worldObj.isRemote) {
if (this.deathTicks > 150 && this.deathTicks % 5 == 0) {
i = 1000;
while (i > 0) {
j = EntityXPOrb.getXPSplit(i);
i -= j;
this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j));
}
}
if (this.deathTicks == 1) {
this.worldObj.playBroadcastSound(1018, (int) this.posX, (int) this.posY, (int) this.posZ, 0);
}
// if (!this.worldObj.isRemote) {
// if (this.deathTicks > 150 && this.deathTicks % 5 == 0) {
// i = 1000;
//
// while (i > 0) {
// j = EntityXPOrb.getXPSplit(i);
// i -= j;
// this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j));
// }
// }
//
// }else
if (this.deathTicks == 1) {
this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.enderdragon.end", 50.0F, 1F, false);
//this.worldObj.playBroadcastSound(1018, (int) this.posX, (int) this.posY, (int) this.posZ, 0);
}
this.moveEntity(0.0D, 0.10000000149011612D, 0.0D);
this.renderYawOffset = this.rotationYaw += 20.0F;
if(getDistance(homeX, homeY, homeZ) < 20 && deathTicks % 2 == 0){
EntityLightningBolt bolt = new EntityLightningBolt(worldObj, homeX, homeY + 1, homeZ);
bolt.ignoreFrustumCheck = true;
worldObj.addWeatherEffect(bolt);
}
if (this.deathTicks == 200 && !this.worldObj.isRemote) {
i = 2000;
if (getDistance(homeX, homeY, homeZ) < 5 && !this.worldObj.isRemote) {
i = 200000;
while (i > 0) {
j = EntityXPOrb.getXPSplit(i);
@@ -873,7 +919,9 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j));
}
spawnEgg();
//spawnEgg();
updateCrystals();
for (EntityChaosCrystal crystal : crystals) crystal.setDeathTimer();
setDead();
}
}
@@ -925,6 +973,13 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
private void updateDragonEnderCrystal() {
if (worldObj.isRemote) return;
if (getHealth() <= 0) {
healingChaosCrystal = null;
connectedCrystalID = -1;
return;
}
if (this.healingChaosCrystal != null) {
if (!healingChaosCrystal.isAlive()){
this.attackEntityFromPart(this.dragonPartHead, DamageSource.setExplosionSource(null), 10.0F);
@@ -0,0 +1,87 @@
package com.brandon3055.draconicevolution.common.entity;
import com.brandon3055.brandonscore.common.handlers.ProcessHandler;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.render.particle.Particles;
import com.brandon3055.draconicevolution.common.network.GenericParticlePacket;
import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import java.util.List;
/**
* Created by brandon3055 on 3/10/2015.
*/
public class EntityChaosVortex extends Entity {
public EntityChaosVortex(World world) {
super(world);
this.noClip = true;
this.setSize(0F, 0F);
}
@Override
public boolean isInRangeToRenderDist(double p_70112_1_) {
return true;
}
@Override
protected void entityInit() {
dataWatcher.addObject(20, ticksExisted);
}
@Override
public void onUpdate() {
if (!worldObj.isRemote) dataWatcher.updateObject(20, ticksExisted);
else ticksExisted = dataWatcher.getWatchableObjectInt(20);
if (ticksExisted < 30 && ticksExisted % 5 == 0 && worldObj.isRemote) DraconicEvolution.proxy.spawnParticle(new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, false), 512);
if (ticksExisted >= 100 && ticksExisted < 130 && ticksExisted % 5 == 0 && worldObj.isRemote) DraconicEvolution.proxy.spawnParticle(new Particles.ChaosExpansionParticle(worldObj, posX, posY, posZ, true), 512);
if (ticksExisted < 100) return;
for (int i = 0; i < 10; i++) {
double x = posX - 18 + rand.nextDouble() * 36;
double y = posY - 8 + rand.nextDouble() * 16;
double z = posZ - 18 + rand.nextDouble() * 36;
if (worldObj.isRemote) DraconicEvolution.proxy.spawnParticle(new Particles.AdvancedSeekerParticle(worldObj, x, y, z, posX, posY, posZ, 2, 1f, 1f, 1f, 100), 128);
}
if (ticksExisted > 130 && worldObj.isRemote && ticksExisted % 2 == 0) shakeScreen();
if (ticksExisted == 600 && !worldObj.isRemote) {
DraconicEvolution.network.sendToAllAround(new GenericParticlePacket(GenericParticlePacket.CHAOS_IMPLOSION, posX, posY, posZ), new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 512));
ProcessHandler.addProcess(new ChaosImplosion(worldObj, (int) posX, (int) posY, (int) posZ));
}
if (ticksExisted > 620) setDead();
}
private void shakeScreen(){
double intensity = (ticksExisted - 130) / 100D;
if (intensity > 1D) intensity = 1D;
@SuppressWarnings("unchecked") List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, boundingBox.expand(200, 200, 200));
for (EntityPlayer player : players){
double x = (rand.nextDouble() - 0.5) * 2 * intensity;
double z = (rand.nextDouble() - 0.5) * 2 * intensity;
player.moveEntity(x/5D, 0, z/5D);
player.rotationYaw -= x*2;
player.rotationPitch -= z*2;
}
}
@Override
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
}
@Override
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
}
}
@@ -354,10 +354,10 @@ public class EntityCustomDragon extends EntityDragon {
this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j));
}
}
if (this.deathTicks == 1) {
this.worldObj.playBroadcastSound(1018, (int) this.posX, (int) this.posY, (int) this.posZ, 0);
}
}
else if (this.deathTicks == 1) {
this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.enderdragon.end", 50.0F, 1F, false);
//this.worldObj.playBroadcastSound(1018, (int) this.posX, (int) this.posY, (int) this.posZ, 0);
}
this.moveEntity(0.0D, 0.10000000149011612D, 0.0D);
@@ -31,6 +31,7 @@ public class ConfigHandler {
public static boolean enableHudDisplay;
public static boolean enableVersionChecker;
public static boolean dragonBreaksBlocks;
public static boolean sumonRitualAccelerated;
public static int[] dragonEggSpawnLocation;
public static int[] oreGenDimentionBlacklist;
private static String[] disabledBlocksItems;
@@ -41,6 +42,7 @@ public class ConfigHandler {
public static boolean speedLimitops;
public static boolean rapidlyDespawnMinedItems;
public static boolean useOldArmorModel;
public static boolean useOldD2DToolTextures;
//spawner
public static String[] spawnerList;
@@ -107,6 +109,8 @@ public class ConfigHandler {
speedLimitops = config.get(Configuration.CATEGORY_GENERAL, "Speed limit effects ops", false, "Dose the speed limit effect ops").getBoolean(false);
rapidlyDespawnMinedItems = config.get(Configuration.CATEGORY_GENERAL, "Rapidly despawn aoe mined items", false, "If true items dropped by a tool in aoe mode will despawn after 5 seconds").getBoolean(false);
useOldArmorModel = config.get(Configuration.CATEGORY_GENERAL, "Use old armor model", false, "If true the armor will use the original vanilla 2D model instead of the new 3D models").getBoolean(false);
sumonRitualAccelerated = config.get(Configuration.CATEGORY_GENERAL, "Fast Summon Ritual", false, "If true the resurrection ritual will be a lot faster").getBoolean(false);
useOldD2DToolTextures = config.get(Configuration.CATEGORY_GENERAL, "Use old 2D tool textures", false, "If true the 3D tool models will be replaced with standard 2D textures").getBoolean(false);
//Spawner
spawnerListType = config.get("spawner", "listType", false, "Sets weather the spawner list is a white list or a black list (true = white list false = black list)").getBoolean(false);
@@ -27,15 +27,34 @@ public class CraftingHandler {
addOre(ModItems.draconicCore, "CSC", "SMS", "CSC", 'C', "ingotGold", 'S', ModItems.draconiumIngot, 'M', "gemDiamond");
add(ModItems.wyvernCore, "CSC", "SMS", "CSC", 'C', ModItems.draconiumIngot, 'S', ModItems.draconicCore, 'M', Items.nether_star);
addOre(ModItems.awakenedCore, "CSC", "SCS", "CSC", 'C', "ingotDraconiumAwakened", 'S', ModItems.wyvernCore);
addOre(ModItems.chaoticCore, "ACA", "CSC", "ACA", 'A', "ingotDraconiumAwakened", 'C', ModItems.awakenedCore, 'S', ModItems.chaosShard);
add(ModItems.wyvernEnergyCore, "CSC", "SMS", "CSC", 'C', ModItems.draconiumIngot, 'S', Blocks.redstone_block, 'M', ModItems.draconicCore);
addOre(ModItems.draconicEnergyCore, "CSC", "SMS", "CSC", 'C', "ingotDraconiumAwakened", 'S', ModItems.wyvernEnergyCore, 'M', ModItems.wyvernCore);
//addOre(ModItems.draconiumBlend, " D ", "DID", " D ", 'I', "ingotIron", 'D', ModItems.draconiumDust);
addShaplessOre(getStack(ModItems.draconicIngot, 9, 0), "blockDraconiumAwakened");
addShaplessOre(getStack(ModItems.draconiumIngot, 9, 0), "blockDraconium");
addShaplessOre(getStack(ModItems.nugget, 9, 0), "ingotDraconium");
addShaplessOre(getStack(ModItems.nugget, 9, 1), "ingotDraconiumAwakened");
addOre(ModItems.draconiumIngot, "III", "III", "III", 'I', "nuggetDraconium");
addOre(ModItems.draconicIngot, "III", "III", "III", 'I', "nuggetDraconiumAwakened");
add(getStack(ModItems.chaosFragment, 1, 1), "III", "III", "III", 'I', getStack(ModItems.chaosFragment, 1, 0));
add(getStack(ModItems.chaosFragment, 1, 2), "III", "III", "III", 'I', getStack(ModItems.chaosFragment, 1, 1));
add(ModItems.chaosShard, "III", "III", "III", 'I', getStack(ModItems.chaosFragment, 1, 2));
if (ModItems.isEnabled(ModItems.draconiumIngot) && ModItems.isEnabled(ModItems.draconiumBlend)) GameRegistry.addSmelting(ModItems.draconiumBlend, getStack(ModItems.draconiumIngot, 2, 0), 1.0f);
if (ModItems.isEnabled(ModItems.draconiumIngot) && ModItems.isEnabled(ModItems.draconiumDust)) GameRegistry.addSmelting(new ItemStack(ModItems.draconiumDust), getStack(ModItems.draconiumIngot, 1, 0), 1.0f);
//Reactor
addOre(ModItems.partStabFrame, "III", "CD ", "III", 'I', "ingotIron", 'C', ModItems.wyvernCore, 'D', "ingotDraconiumAwakened");
addOre(ModItems.partStabRotorInner, " ", "III", "CWW", 'I', "ingotDraconiumAwakened", 'W', "ingotDraconium", 'C', ModItems.draconicCore);
addOre(ModItems.partStabRotorOuter, " ", "III", "CWW", 'I', "gemDiamond", 'W', "ingotDraconium", 'C', ModItems.draconicCore);
addOre(ModItems.partStabRotorAssembly, " IO", "CWW", " IO", 'I', ModItems.partStabRotorInner, 'O', ModItems.partStabRotorOuter, 'C', ModItems.wyvernCore, 'W', "ingotDraconium");
addOre(ModItems.partStabRing, "GDG", "DCD", "GDG", 'G', "ingotGold", 'D', "gemDiamond", 'C', ModItems.wyvernCore);
addOre(ModBlocks.reactorStabilizer, "ICI", "FSR", "IEI", 'I', "ingotDraconiumAwakened", 'C', ModItems.chaoticCore, 'F', ModItems.partStabFrame, 'S', ModItems.partStabRotorAssembly, 'R', ModItems.partStabRing, 'E', ModItems.draconicEnergyCore);
addOre(ModBlocks.reactorEnergyInjector, "IRI", "RCR", "IRI", 'I', "ingotDraconium", 'R', ModItems.partStabRotorInner, 'C', ModItems.wyvernCore);
addOre(ModBlocks.reactorCore, " I ", "ISI", " I ", 'I', "ingotDraconiumAwakened", 'S', ModItems.chaosShard);
//Wyvern tools
add(ModItems.wyvernFluxCapacitor, "CSC", "SMS", "CSC", 'C', ModItems.draconiumIngot, 'S', ModItems.wyvernEnergyCore, 'M', ModItems.wyvernCore);
@@ -168,7 +168,6 @@ public class MinecraftForgeEventHandler {
@SubscribeEvent
public void onDropEvent(LivingDropsEvent event) {
if (!event.entity.worldObj.isRemote && ((event.entity instanceof EntityDragon) || (EntityList.getEntityString(event.entity) != null && !EntityList.getEntityString(event.entity).isEmpty() && EntityList.getEntityString(event.entity).equals("HardcoreEnderExpansion.Dragon"))))
{
EntityItem item = new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(ModItems.dragonHeart));
@@ -0,0 +1,33 @@
package com.brandon3055.draconicevolution.common.items;
import com.brandon3055.draconicevolution.common.ModItems;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.List;
/**
* Created by brandon3055 on 8/10/2015.
*/
public class ChaosFragment extends ItemDE {
public ChaosFragment() {
this.setUnlocalizedName("chaosFragment");
this.setHasSubtypes(true);
ModItems.register(this);
}
@Override
public void getSubItems(Item item, CreativeTabs p_150895_2_, List list) {
list.add(new ItemStack(item, 1, 0));
list.add(new ItemStack(item, 1, 1));
list.add(new ItemStack(item, 1, 2));
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
return super.getUnlocalizedName(itemStack)+itemStack.getItemDamage();
}
}
@@ -0,0 +1,33 @@
package com.brandon3055.draconicevolution.common.items;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* Created by brandon3055 on 1/10/2015.
*/
public class ChaosShard extends ItemDE {
public ChaosShard(){
this.setUnlocalizedName("chaosShard");
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
ModItems.register(this);
}
@Override
public void registerIcons(IIconRegister iconRegister) {}
@Override
public boolean hasCustomEntity(ItemStack stack) {
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
}
@@ -0,0 +1,21 @@
package com.brandon3055.draconicevolution.common.items;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems;
import net.minecraft.item.ItemStack;
/**
* Created by brandon3055 on 2/10/2015.
*/
public class ChaoticCore extends ItemDE {
public ChaoticCore() {
this.setUnlocalizedName("chaoticCore");
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
ModItems.register(this);
}
@Override
public boolean hasEffect(ItemStack par1ItemStack, int pass) {
return true;
}
}
@@ -0,0 +1,48 @@
package com.brandon3055.draconicevolution.common.items;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import java.util.List;
/**
* Created by brandon3055 on 8/10/2015.
*/
public class Nugget extends ItemDE {
private IIcon draconium;
private IIcon awakened;
public Nugget() {
this.setUnlocalizedName("nugget");
this.setHasSubtypes(true);
ModItems.register(this);
}
@Override
public void getSubItems(Item item, CreativeTabs p_150895_2_, List list) {
list.add(new ItemStack(item, 1, 0));
list.add(new ItemStack(item, 1, 1));
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
return super.getUnlocalizedName(itemStack) + (itemStack.getItemDamage() == 0 ? ".draconium" : ".awakened");
}
@Override
public void registerIcons(IIconRegister iconRegister) {
draconium = iconRegister.registerIcon(References.RESOURCESPREFIX+"nuggetDraconium");
awakened = iconRegister.registerIcon(References.RESOURCESPREFIX+"nuggetAwakened");
}
@Override
public IIcon getIconFromDamage(int dmg) {
return dmg == 0 ? draconium : awakened;
}
}
@@ -0,0 +1,47 @@
package com.brandon3055.draconicevolution.common.items;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by brandon3055 on 2/10/2015.
*/
public class ReactorStabiliserPart extends ItemDE {
public static final Map<Integer, String> parts = new HashMap<Integer, String>(){{
put(0, "frame");
put(1, "rotorInner");
put(2, "rotorOuter");
put(3, "rotorAssembly");
put(4, "stabilizerRing");
}};
public ReactorStabiliserPart(){
this.setUnlocalizedName("reactorCraftingPart");
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
this.setHasSubtypes(true);
ModItems.register(this);
}
@Override
public void getSubItems(Item item, CreativeTabs p_150895_2_, List list) {
for (Integer i : parts.keySet()) list.add(new ItemStack(item, 1, i));
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
if (parts.containsKey(itemStack.getItemDamage())) return super.getUnlocalizedName(itemStack) + "." + parts.get(itemStack.getItemDamage());
else return super.getUnlocalizedName(itemStack);
}
@Override
public void registerIcons(IIconRegister iconRegister) {}
}
@@ -9,7 +9,9 @@ import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
@@ -105,11 +107,11 @@ public class Tclogo extends ItemDE {
}
private static int lts = 0;
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
// if ((int)System.currentTimeMillis() < lts + 10) return stack;
// else lts = (int)System.currentTimeMillis();
//world.playSound(player.posX, player.posY, player.posZ, "DraconicEvolution:fusionExplosion", 1F, 1F, false);
@@ -135,6 +137,33 @@ public class Tclogo extends ItemDE {
if (!world.isRemote)
{
EntityFallingBlock fallingBlock = new EntityFallingBlock(world, (int)player.posX + 0.5, (int)player.posY + 0.5, (int)player.posZ + 0.5, Blocks.obsidian, 0);
fallingBlock.field_145812_b = 2;
float motion = 0.005F;
//fallingBlock.motionX = (rand.nextFloat()-0.5F) * motion;
//fallingBlock.motionY = (rand.nextFloat()-0.5F) * motion;
//fallingBlock.motionZ = (rand.nextFloat()-0.5F) * motion;
world.spawnEntityInWorld(fallingBlock);
// try
// {
// for (Object o : AchievementList.achievementList)
// {
// LogHelper.info(o);
// if (o instanceof Achievement)LogHelper.info(((EntityPlayerMP) player).func_147099_x().hasAchievementUnlocked((Achievement) o));
// if (o instanceof Achievement)LogHelper.info(((EntityPlayerMP) player).func_147099_x().canUnlockAchievement((Achievement) o));
// LogHelper.info(o instanceof Achievement);
// }
// //LogHelper.info(FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList);
// }
// catch (Exception e) {e.printStackTrace();}
//LogHelper.info();
// LogHelper.info("#########################");
// Map<Integer, BlockCollection.BlockDat> blocks = new HashMap<Integer, BlockCollection.BlockDat>();
// List<Integer> l = new ArrayList<Integer>();
@@ -4,7 +4,7 @@ import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.model.ModelDraconicArmor;
import com.brandon3055.draconicevolution.client.model.ModelDraconicArmorOBJ;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
@@ -12,6 +12,7 @@ import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import com.brandon3055.draconicevolution.integration.ModHelper;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -220,6 +221,7 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
} else for (PotionEffect potion : potions) {
int id = potion.getPotionID();
if (ReflectionHelper.getPrivateValue(Potion.class, Potion.potionTypes[id], new String[]{"isBadEffect", "field_76418_K", "J"})) {
if (potion.getPotionID() == Potion.digSlowdown.id && ModHelper.isHoldingCleaver(player)) break;
if ((player.getHeldItem() == null || (player.getHeldItem().getItem() != ModItems.wyvernBow && player.getHeldItem().getItem() != ModItems.draconicBow)) || id != 2) {
player.removePotionEffect(id);
flag = true;
@@ -345,10 +347,10 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
if (ConfigHandler.useOldArmorModel) return super.getArmorModel(entityLiving, itemStack, armorSlot);
if (model == null) {
if (armorType == 0) model = new ModelDraconicArmor(1.1F, true, false, false, false, true);
else if (armorType == 1) model = new ModelDraconicArmor(1.1F, false, true, false, false, true);
else if (armorType == 2) model = new ModelDraconicArmor(1.1F, false, false, true, false, true);
else model = new ModelDraconicArmor(1.1F, false, false, false, true, true);
if (armorType == 0) model = new ModelDraconicArmorOBJ(1.1F, true, false, false, false);
else if (armorType == 1) model = new ModelDraconicArmorOBJ(1.1F, false, true, false, false);
else if (armorType == 2) model = new ModelDraconicArmorOBJ(1.1F, false, false, true, false);
else model = new ModelDraconicArmorOBJ(1.1F, false, false, false, true);
this.model.bipedHead.showModel = (armorType == 0);
this.model.bipedHeadwear.showModel = (armorType == 0);
@@ -359,6 +361,21 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
this.model.bipedRightLeg.showModel = (armorType == 2 || armorType == 3);
}
// if (model == null) {
// if (armorType == 0) model = new ModelDraconicArmor(1.1F, true, false, false, false, true);
// else if (armorType == 1) model = new ModelDraconicArmor(1.1F, false, true, false, false, true);
// else if (armorType == 2) model = new ModelDraconicArmor(1.1F, false, false, true, false, true);
// else model = new ModelDraconicArmor(1.1F, false, false, false, true, true);
//
// this.model.bipedHead.showModel = (armorType == 0);
// this.model.bipedHeadwear.showModel = (armorType == 0);
// this.model.bipedBody.showModel = ((armorType == 1) || (armorType == 2));
// this.model.bipedLeftArm.showModel = (armorType == 1);
// this.model.bipedRightArm.showModel = (armorType == 1);
// this.model.bipedLeftLeg.showModel = (armorType == 2 || armorType == 3);
// this.model.bipedRightLeg.showModel = (armorType == 2 || armorType == 3);
// }
if (entityLiving == null) return model;
this.model.isSneak = entityLiving.isSneaking();
@@ -4,12 +4,14 @@ import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.model.ModelDraconicArmor;
import com.brandon3055.draconicevolution.client.model.ModelWyvernArmorOBJ;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.*;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -272,10 +274,10 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyCont
if (ConfigHandler.useOldArmorModel) return super.getArmorModel(entityLiving, itemStack, armorSlot);
if (model == null) {
if (armorType == 0) model = new ModelDraconicArmor(1.0F, true, false, false, false, false);
else if (armorType == 1) model = new ModelDraconicArmor(1F, false, true, false, false, false);
else if (armorType == 2) model = new ModelDraconicArmor(1F, false, false, true, false, false);
else model = new ModelDraconicArmor(1F, false, false, false, true, false);
if (armorType == 0) model = new ModelWyvernArmorOBJ(1.0F, true, false, false, false);
else if (armorType == 1) model = new ModelWyvernArmorOBJ(1F, false, true, false, false);
else if (armorType == 2) model = new ModelWyvernArmorOBJ(1F, false, false, true, false);
else model = new ModelWyvernArmorOBJ(1F, false, false, false, true);
this.model.bipedHead.showModel = (armorType == 0);
this.model.bipedHeadwear.showModel = (armorType == 0);
@@ -286,6 +288,21 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyCont
this.model.bipedRightLeg.showModel = (armorType == 2 || armorType == 3);
}
// if (model == null) {
// if (armorType == 0) model = new ModelDraconicArmor(1.0F, true, false, false, false, false);
// else if (armorType == 1) model = new ModelDraconicArmor(1F, false, true, false, false, false);
// else if (armorType == 2) model = new ModelDraconicArmor(1F, false, false, true, false, false);
// else model = new ModelDraconicArmor(1F, false, false, false, true, false);
//
// this.model.bipedHead.showModel = (armorType == 0);
// this.model.bipedHeadwear.showModel = (armorType == 0);
// this.model.bipedBody.showModel = ((armorType == 1) || (armorType == 2));
// this.model.bipedLeftArm.showModel = (armorType == 1);
// this.model.bipedRightArm.showModel = (armorType == 1);
// this.model.bipedLeftLeg.showModel = (armorType == 2 || armorType == 3);
// this.model.bipedRightLeg.showModel = (armorType == 2 || armorType == 3);
// }
if (entityLiving == null) return model;
this.model.isSneak = entityLiving.isSneaking();
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.common.items.tools;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool;
import com.brandon3055.draconicevolution.common.lib.References;
@@ -14,10 +15,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import java.util.List;
public class DraconicAxe extends MiningTool implements IInventoryTool {//todo axe & fields
public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTweak {//todo axe & fields
public DraconicAxe() {
super(ModItems.DRACONIUM_T1);
@@ -163,6 +166,25 @@ public class DraconicAxe extends MiningTool implements IInventoryTool {//todo ax
}
}
@Override
public void tweakRender(IItemRenderer.ItemRenderType type) {
GL11.glTranslated(0.34, 0.69, 0.1);
GL11.glRotatef(90, 1, 0, 0);
GL11.glRotatef(140, 0, -1, 0);
GL11.glRotatef(180, 0, 0, 1);
GL11.glScaled(0.7, 0.7, 0.7);
if (type == IItemRenderer.ItemRenderType.INVENTORY){
GL11.glScalef(11, 11, 11);
GL11.glRotatef(180, 0, 1, 0);
GL11.glTranslated(-1.3, 0, -0.45);
}
else if (type == IItemRenderer.ItemRenderType.ENTITY){
GL11.glRotatef(90.5F, 0, 1, 0);
GL11.glTranslated(0, 0, -0.9);
}
}
// @SuppressWarnings({"rawtypes", "unchecked"})
// @Override
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.common.items.tools;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler;
@@ -19,10 +20,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import java.util.List;
public class DraconicDistructionStaff extends MiningTool implements IInventoryTool {
public class DraconicDistructionStaff extends MiningTool implements IInventoryTool, IRenderTweak {
public DraconicDistructionStaff() {
@@ -91,4 +94,25 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo
list.add(EnumChatFormatting.BLUE + "+" + ToolHandler.getBaseAttackDamage(stack) + " " + StatCollector.translateToLocal("info.de.attackDamage.txt"));
list.add(EnumChatFormatting.BLUE + "+30%" + " " + StatCollector.translateToLocal("info.de.bonusHealthDamage.txt"));
}
@Override
public void tweakRender(IItemRenderer.ItemRenderType type) {
GL11.glTranslated(0.77, 0.19, -0.15);
GL11.glRotatef(90, 1, 0, 0);
GL11.glRotatef(-35, 0, -1, 0);
GL11.glScaled(0.7, 0.7, 0.7);
if (type == IItemRenderer.ItemRenderType.INVENTORY){
GL11.glScalef(6F, 6F, 6F);
GL11.glRotatef(145, 0, 1, 0);
GL11.glTranslated(-1.7, 0, 1.8);
}
else if (type == IItemRenderer.ItemRenderType.ENTITY){
GL11.glRotatef(-34.5F, 0, 1, 0);
GL11.glTranslated(-1.1, 0, -0.2);
}
else if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
GL11.glTranslated(0, 0.4, 0);
}
}
}
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.lib.References;
@@ -25,12 +26,14 @@ import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.UseHoeEvent;
import org.lwjgl.opengl.GL11;
import java.util.List;
public class DraconicHoe extends ItemHoe implements IEnergyContainerItem{
public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRenderTweak {
protected int capacity = References.DRACONICCAPACITY;
protected int maxReceive = References.DRACONICTRANSFER;
@@ -230,4 +233,25 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem{
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
@Override
public void tweakRender(IItemRenderer.ItemRenderType type) {
GL11.glTranslated(0.4, 1, 0);
GL11.glRotatef(90, 1, 0, 0);
GL11.glRotatef(140, 0, -1, 0);
GL11.glRotatef(-90, 0, 0, 1);
GL11.glScaled(0.6, 0.6, 0.6);
if (type == IItemRenderer.ItemRenderType.INVENTORY){
GL11.glScalef(12F, 12F, 12F);
GL11.glRotatef(180, 0, 1, 0);
GL11.glRotatef(90, 0, 0, 1);
GL11.glTranslated(-1.4, 0, -0.1);
}
else if (type == IItemRenderer.ItemRenderType.ENTITY){
GL11.glRotatef(90.5F, 1, 0, 0);
GL11.glRotatef(90F, 0, 0, -1);
GL11.glTranslated(0.35, -0.4, -1);
}
}
}
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.common.items.tools;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool;
import com.brandon3055.draconicevolution.common.lib.References;
@@ -10,10 +11,12 @@ import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import java.util.List;
public class DraconicPickaxe extends MiningTool implements IInventoryTool {
public class DraconicPickaxe extends MiningTool implements IInventoryTool, IRenderTweak {
public DraconicPickaxe() {
@@ -51,6 +54,25 @@ public class DraconicPickaxe extends MiningTool implements IInventoryTool {
return enchant.type == EnumEnchantmentType.digger;
}
@Override
public void tweakRender(IItemRenderer.ItemRenderType type) {
GL11.glTranslated(0.34, 0.69, 0.1);
GL11.glRotatef(90, 1, 0, 0);
GL11.glRotatef(140, 0, -1, 0);
GL11.glRotatef(180, 0, 0, 1);
GL11.glScaled(0.7, 0.7, 0.7);
if (type == IItemRenderer.ItemRenderType.INVENTORY){
GL11.glScalef(11.8F, 11.8F, 11.8F);
GL11.glRotatef(180, 0, 1, 0);
GL11.glTranslated(-1.2, 0, -0.35);
}
else if (type == IItemRenderer.ItemRenderType.ENTITY){
GL11.glRotatef(90.5F, 0, 1, 0);
GL11.glTranslated(0, 0, -0.9);
}
}
// @Override
// public boolean isItemTool(ItemStack p_77616_1_) {
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.common.items.tools;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool;
import com.brandon3055.draconicevolution.common.lib.References;
@@ -10,10 +11,12 @@ import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import java.util.List;
public class DraconicShovel extends MiningTool implements IInventoryTool {
public class DraconicShovel extends MiningTool implements IInventoryTool, IRenderTweak {
// public IIcon itemIcon0;
// public IIcon itemIcon1;
// public IIcon itemIcon2;
@@ -55,6 +58,28 @@ public class DraconicShovel extends MiningTool implements IInventoryTool {
return enchant.type == EnumEnchantmentType.digger;
}
@Override
public void tweakRender(IItemRenderer.ItemRenderType type) {
GL11.glTranslated(0.15, 0.9, -0.12);
GL11.glRotatef(90, 1, 0, 0);
GL11.glRotatef(140, 0, -1, 0);
GL11.glScaled(0.7, 0.7, 0.7);
if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
GL11.glRotatef(180, 0, 0, 1);
GL11.glTranslated(0, -0.4, 0);
}
else if (type == IItemRenderer.ItemRenderType.INVENTORY){
GL11.glRotatef(180, 0, 0, 1);
GL11.glScalef(10, 10, 10);
GL11.glRotatef(180, 0, 1, 0);
GL11.glTranslated(-1.45, 0, -0.15);
}
else if (type == IItemRenderer.ItemRenderType.ENTITY){
GL11.glRotatef(-90.5F, 0, 1, 0);
GL11.glTranslated(-0.38, 0, -0.6);
}
}
// @Override
// public boolean isItemTool(ItemStack p_77616_1_) {
@@ -1,10 +1,10 @@
package com.brandon3055.draconicevolution.common.items.tools;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.draconicevolution.common.items.ItemDE;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.ItemDE;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.relauncher.Side;
@@ -67,7 +67,7 @@ public class SafetyMatch extends ItemDE {
@Override
public boolean showDurabilityBar(ItemStack stack) {
return stack.getItemDamage() != 1000;
return stack.getItemDamage() != 1000 && stack.getItemDamage() != 0;
}
@Override
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.common.items.tools;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool;
import com.brandon3055.draconicevolution.common.lib.References;
@@ -10,10 +11,12 @@ import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import java.util.List;
public class WyvernPickaxe extends MiningTool implements IInventoryTool {
public class WyvernPickaxe extends MiningTool implements IInventoryTool, IRenderTweak {
public WyvernPickaxe() {
super(ModItems.DRACONIUM_T1);
@@ -48,6 +51,28 @@ public class WyvernPickaxe extends MiningTool implements IInventoryTool {
return enchant.type == EnumEnchantmentType.digger;
}
@Override
public void tweakRender(IItemRenderer.ItemRenderType type) {
GL11.glTranslated(0.4, 0.65, 0.1);
GL11.glRotatef(90, 1, 0, 0);
GL11.glRotatef(140, 0, -1, 0);
GL11.glRotatef(180, 0, 0, 1);
GL11.glScaled(0.6, 0.6, 0.6);
if (type == IItemRenderer.ItemRenderType.INVENTORY){
GL11.glScalef(13.8F, 13.8F, 13.8F);
GL11.glRotatef(180, 0, 1, 0);
GL11.glTranslated(-1.2, 0, -0.35);
}
else if (type == IItemRenderer.ItemRenderType.ENTITY){
GL11.glRotatef(90.5F, 0, 1, 0);
GL11.glTranslated(-0.1, 0, -0.9);
}
}
// @Override
// public boolean isItemTool(ItemStack p_77616_1_) {
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.common.items.tools;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool;
import com.brandon3055.draconicevolution.common.lib.References;
@@ -10,10 +11,12 @@ import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import java.util.List;
public class WyvernShovel extends MiningTool implements IInventoryTool {
public class WyvernShovel extends MiningTool implements IInventoryTool, IRenderTweak {
public WyvernShovel() {
@@ -49,6 +52,29 @@ public class WyvernShovel extends MiningTool implements IInventoryTool {
return enchant.type == EnumEnchantmentType.digger;
}
@Override
public void tweakRender(IItemRenderer.ItemRenderType type) {
GL11.glTranslated(0.23, 0.85, -0.1);
GL11.glRotatef(90, 1, 0, 0);
GL11.glRotatef(140, 0, -1, 0);
GL11.glScaled(0.6, 0.6, 0.6);
if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
GL11.glRotatef(180, 0, 0, 1);
GL11.glTranslated(0, -0.4, 0);
}
else if (type == IItemRenderer.ItemRenderType.INVENTORY){
GL11.glRotatef(180, 0, 0, 1);
GL11.glScalef(12.5F, 12.5F, 12.5F);
GL11.glRotatef(180, 0, 1, 0);
GL11.glTranslated(-1.35, 0, -0.05);
}
else if (type == IItemRenderer.ItemRenderType.ENTITY){
GL11.glRotatef(-90.5F, 0, 1, 0);
GL11.glTranslated(-0.3, 0, -0.6);
}
}
// @Override
// public boolean isItemTool(ItemStack p_77616_1_) {
@@ -7,6 +7,7 @@ import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.keybinding.KeyBindings;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.network.ToolModePacket;
import com.brandon3055.draconicevolution.common.utills.*;
@@ -146,7 +147,7 @@ public class ToolBase extends RFItemBase {
}
addAditionalInformation(stack, player, list, extended);
if (show) InfoHelper.addLore(stack, list, true);
if (show && !ConfigHandler.disableLore) InfoHelper.addLore(stack, list, true);
InfoHelper.addEnergyInfo(stack, list);
}
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.weapons;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler;
@@ -29,11 +30,13 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.List;
public class DraconicSword extends ItemSword implements IEnergyContainerItem, IInventoryTool {
public class DraconicSword extends ItemSword implements IEnergyContainerItem, IInventoryTool, IRenderTweak {
protected int capacity = References.DRACONICCAPACITY;
protected int maxReceive = References.DRACONICTRANSFER;
protected int maxExtract = References.DRACONICTRANSFER * 50;
@@ -194,4 +197,27 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem, II
map.clear();
return map;
}
@Override
public void tweakRender(IItemRenderer.ItemRenderType type) {
GL11.glTranslated(-0.01, 1.11, -0.15);
GL11.glRotatef(90, 1, 0, 0);
GL11.glRotatef(140, 0, -1, 0);
GL11.glScaled(0.7, 0.7, 0.7);
if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
GL11.glRotatef(180, 0, 0, 1);
GL11.glTranslated(0, -0.4, 0);
}
else if (type == IItemRenderer.ItemRenderType.INVENTORY){
GL11.glScalef(8, 8, 8);
GL11.glRotatef(180, 0, 1, 0);
GL11.glTranslated(1.9, 0, 0);
}
else if (type == IItemRenderer.ItemRenderType.ENTITY){
GL11.glRotatef(-90.5F, 0, 1, 0);
GL11.glTranslated(-0.8, 0, 0);
}
}
}
@@ -1,16 +1,17 @@
package com.brandon3055.draconicevolution.common.items.weapons;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.google.common.collect.Multimap;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -30,11 +31,13 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.List;
public class WyvernSword extends ItemSword implements IEnergyContainerItem, IInventoryTool {
public class WyvernSword extends ItemSword implements IEnergyContainerItem, IInventoryTool, IRenderTweak {
protected int capacity = References.WYVERNCAPACITY;
protected int maxReceive = References.WYVERNTRANSFER;
@@ -207,5 +210,24 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem, IInv
map.clear();
return map;
}
@Override
public void tweakRender(IItemRenderer.ItemRenderType type) {
GL11.glTranslated(0.25, 0.8, 0.05);
GL11.glRotatef(90, 1, 0, 0);
GL11.glRotatef(140, 0, -1, 0);
GL11.glRotatef(180, 0, 0, 1);
GL11.glScaled(0.6, 0.6, 0.6);
if (type == IItemRenderer.ItemRenderType.INVENTORY){
GL11.glScalef(11.8F, 11.8F, 11.8F);
GL11.glRotatef(180, 0, 1, 0);
GL11.glTranslated(-1.5, 0, -0.1);
}
else if (type == IItemRenderer.ItemRenderType.ENTITY){
GL11.glRotatef(90.5F, 0, 1, 0);
GL11.glTranslated(0.2, 0, -0.8);
}
}
}
@@ -6,7 +6,7 @@ public final class References {
public static final String VERSION = VersionHandler.FULL_VERSION;
public static final String MCVERSION = VersionHandler.MCVERSION;
public static final String CLIENTPROXYLOCATION = "com.brandon3055.draconicevolution.client.ClientProxy";
public static final String SERVERPROXYLOCATION = "com.brandon3055.draconicevolution.common.CommonProxy";
public static final String SERVERPROXYLOCATION = "com.brandon3055.draconicevolution.common.CommonProxy";
public static final String GUIFACTORY = "com.brandon3055.draconicevolution.client.gui.DEGUIFactory";
public static final String RESOURCESPREFIX = MODID.toLowerCase() + ":";
@@ -6,7 +6,7 @@ package com.brandon3055.draconicevolution.common.lib;
public class VersionHandler
{
public static final String VERSION = "1.0.2";
public static final int SNAPSHOT = 3;
public static final int SNAPSHOT = 5;
public static final String MCVERSION = "1.7.10";
public static final String FULL_VERSION = VERSION + (SNAPSHOT > 0 ? "-snapshot_" + SNAPSHOT : "");
@@ -1,17 +1,20 @@
package com.brandon3055.draconicevolution.common.network;
import com.brandon3055.brandonscore.BrandonsCore;
import com.brandon3055.draconicevolution.client.handler.ParticleHandler;
import com.brandon3055.draconicevolution.client.render.particle.Particles;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
public class GenericParticlePacket implements IMessage
{
public static final byte ENERGY_BALL_KILL = 0;
public static final byte CHAOS_BALL_KILL = 1;
public static final byte CHAOS_IMPLOSION = 3;
byte particleId = 0;
double posX;
@@ -45,6 +48,7 @@ public class GenericParticlePacket implements IMessage
public static class Handler implements IMessageHandler<GenericParticlePacket, IMessage> {
@SideOnly(Side.CLIENT)
@Override
public IMessage onMessage(GenericParticlePacket message, MessageContext ctx) {
switch (message.particleId) {
@@ -52,7 +56,7 @@ public class GenericParticlePacket implements IMessage
{
Particles.DragonProjectileParticle particle;
for (int i = 0; i < 100; i++){
particle = new Particles.DragonProjectileParticle(FMLClientHandler.instance().getWorldClient(), message.posX, message.posY, message.posZ, 0x00FFFF);
particle = new Particles.DragonProjectileParticle(BrandonsCore.proxy.getClientWorld(), message.posX, message.posY, message.posZ, 0x00FFFF);
double m = 0.5D;
particle.motionX = (particle.worldObj.rand.nextDouble() - 0.5) * m;
particle.motionY = (particle.worldObj.rand.nextDouble() - 0.5) * m;
@@ -65,7 +69,7 @@ public class GenericParticlePacket implements IMessage
{
Particles.DragonProjectileParticle particle;
for (int i = 0; i < 100; i++){
particle = new Particles.DragonProjectileParticle(FMLClientHandler.instance().getWorldClient(), message.posX, message.posY, message.posZ, 0x440000);
particle = new Particles.DragonProjectileParticle(BrandonsCore.proxy.getClientWorld(), message.posX, message.posY, message.posZ, 0x440000);
double m = 0.5D;
particle.motionX = (particle.worldObj.rand.nextDouble() - 0.5) * m;
particle.motionY = (particle.worldObj.rand.nextDouble() - 0.5) * m;
@@ -74,6 +78,11 @@ public class GenericParticlePacket implements IMessage
}
break;
}
case CHAOS_IMPLOSION:
{
ParticleHandler.spawnCustomParticle(new Particles.ChaosImplosionParticle(BrandonsCore.proxy.getClientWorld(), message.posX, message.posY, message.posZ, 200F), 512);
break;
}
default:
@@ -0,0 +1,71 @@
package com.brandon3055.draconicevolution.common.tileentities;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
/**
* Created by brandon3055 on 24/9/2015.
*/
public class TileChaosShard extends TileEntity {
public int tick = 0;
public boolean guardianDefeated = false;
private int soundTimer;
@Override
public void updateEntity() {
tick++;
if (worldObj.isRemote && soundTimer-- <= 0){
soundTimer = 3600 + worldObj.rand.nextInt(1200);
worldObj.playSound(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "draconicevolution:chaosChamberAmbient", 1.5F, worldObj.rand.nextFloat() * 0.4F + 0.8F, false);
}
if (!worldObj.isRemote && guardianDefeated && worldObj.rand.nextInt(50) == 0) {
int x = 5 - worldObj.rand.nextInt(11);
int z = 5 - worldObj.rand.nextInt(11);
EntityLightningBolt bolt = new EntityLightningBolt(worldObj, xCoord+x, worldObj.getTopSolidOrLiquidBlock(xCoord+x, zCoord+z), zCoord+z);
bolt.ignoreFrustumCheck = true;
worldObj.addWeatherEffect(bolt);
}
}
public void setDefeated(){
guardianDefeated = true;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@Override
public void writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
compound.setBoolean("GuardianDefeated", guardianDefeated);
}
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
guardianDefeated = compound.getBoolean("GuardianDefeated");
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound tagCompound = new NBTTagCompound();
writeToNBT(tagCompound);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tagCompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return super.getRenderBoundingBox().expand(1, 3, 1);
}
}
@@ -5,7 +5,10 @@ import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
/**
* Created by Brandon on 29/6/2015.
@@ -84,4 +87,10 @@ public class TileFluidGate extends TileGate implements IFluidHandler {
int b2 = shift ? ctrl ? 100 : 50 : ctrl ? 10 : 1;
return b1 + "/" + b2 + " MB/t";
}
@Override
public String getName() {
return "fluid_gate";
}
}
@@ -69,4 +69,9 @@ public class TileFluxGate extends TileGate implements IEnergyReceiver {
int b2 = shift ? ctrl ? 1000 : 100 : ctrl ? 1 : 10;
return b1 + "/" + b2 + " RF/t";
}
@Override
public String getName() {
return "flux_gate";
}
}
@@ -1,6 +1,9 @@
package com.brandon3055.draconicevolution.common.tileentities.gates;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync;
import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
@@ -10,12 +13,14 @@ import net.minecraftforge.common.util.ForgeDirection;
/**
* Created by Brandon on 29/6/2015.
*/
public abstract class TileGate extends TileObjectSync {
public abstract class TileGate extends TileObjectSync implements IDEPeripheral {
public ForgeDirection output = ForgeDirection.DOWN;
public int flowRSLow = 0;
public int flowRSHigh = 1000;
public int signal = -1;
public boolean flowOverridden = false;
protected int flowOverride = 0;
public abstract String getFlowSetting(int selector);
@@ -24,6 +29,7 @@ public abstract class TileGate extends TileObjectSync {
public abstract String getToolTip(int selector, boolean shift, boolean ctrl);
public int getActualFlow(){
if (flowOverridden) return flowOverride;
if (signal == -1 ) signal = worldObj.getStrongestIndirectPower(xCoord, yCoord, zCoord);
return flowRSLow + (int) (((double)signal / 15D) * (double)(flowRSHigh - flowRSLow));
}
@@ -35,6 +41,19 @@ public abstract class TileGate extends TileObjectSync {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@Override
public void receiveObjectFromServer(int index, Object object) {
if (index == 2){
flowOverridden = (Boolean) object;
}else if (index == 3) {
flowOverride = (Integer) object;
}else if (index == 4) {
flowRSHigh = (Integer) object;
}else if (index == 5) {
flowRSLow = (Integer) object;
}
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound compound = new NBTTagCompound();
@@ -54,6 +73,8 @@ public abstract class TileGate extends TileObjectSync {
compound.setInteger("FlowRSLow", flowRSLow);
compound.setInteger("FlowRSHigh", flowRSHigh);
compound.setInteger("Signal", signal);
compound.setInteger("FlowOverride", flowOverride);
compound.setBoolean("FlowOverridden", flowOverridden);
}
@Override
@@ -63,5 +84,50 @@ public abstract class TileGate extends TileObjectSync {
flowRSLow = compound.getInteger("FlowRSLow");
flowRSHigh = compound.getInteger("FlowRSHigh");
signal = compound.getInteger("Signal");
flowOverride = compound.getInteger("FlowOverride");
flowOverridden = compound.getBoolean("FlowOverridden");
}
@Override
public String[] getMethodNames() {
return new String[] { "getFlow", "setOverrideEnabled", "getOverrideEnabled", "setFlowOverride", "setSignalHighFlow", "getSignalHighFlow", "setSignalLowFlow", "getSignalLowFlow" };
}
@Override
public Object[] callMethod(String method, Object... args) {
if (method.equals("getFlow")){
return new Object[] { getActualFlow() };
}
else if (method.equals("setOverrideEnabled")){
if (args.length == 0 || !(args[0] instanceof Boolean)) throw new IllegalArgumentException("Expected Boolean got "+(args.length == 0 ? "nil" : args[0].getClass().getSimpleName()));
flowOverridden = (Boolean)args[0];
if (!worldObj.isRemote) sendObjectToClient(References.BOOLEAN_ID, 2, flowOverridden);
}
else if (method.equals("getOverrideEnabled")){
return new Object[] { flowOverridden };
}
else if (method.equals("setFlowOverride")){
if (args.length == 0 || !(args[0] instanceof Number)) throw new IllegalArgumentException("Expected Number got "+(args.length == 0 ? "nil" : args[0].getClass().getSimpleName()));
flowOverride = Utills.toInt((Double)args[0]);
if (!worldObj.isRemote) sendObjectToClient(References.INT_ID, 3, flowOverride);
}
else if (method.equals("setSignalHighFlow")){
if (args.length == 0 || !(args[0] instanceof Number)) throw new IllegalArgumentException("Expected Number got "+(args.length == 0 ? "nil" : args[0].getClass().getSimpleName()));
flowRSHigh = Utills.toInt((Double)args[0]);
if (!worldObj.isRemote) sendObjectToClient(References.INT_ID, 4, flowRSHigh);
}
else if (method.equals("getSignalHighFlow")){
return new Object[] { flowRSHigh };
}
else if (method.equals("setSignalLowFlow")){
if (args.length == 0 || !(args[0] instanceof Number)) throw new IllegalArgumentException("Expected Number got "+(args.length == 0 ? "nil" : args[0].getClass().getSimpleName()));
flowRSLow = Utills.toInt((Double)args[0]);
if (!worldObj.isRemote) sendObjectToClient(References.INT_ID, 5, flowRSLow);
}
else if (method.equals("getSignalLowFlow")){
return new Object[] { flowRSLow };
}
return new Object[0];
}
}
@@ -4,6 +4,7 @@ import com.brandon3055.draconicevolution.client.render.particle.Particles.Advanc
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper;
import com.brandon3055.draconicevolution.client.handler.ParticleHandler;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer;
@@ -51,16 +52,16 @@ public class TileEnderResurrection extends TileEntity{
public void updateEntity() {
if (spawnInProgress){
//if (timer < 1800) timer = 2200;
if (timer % 10 == 0 && !arePillarsValid() || !isBaseValid()) spawnInProgress = false;
if (!arePillarsValid() || !isBaseValid()) spawnInProgress = false;
effectDrive();
findAndActivateChrystals(timer - 200, true);
if (timer > 2390 && arePillarsValid() && isBaseValid()) {
spawn();
spawnInProgress = false;
}
if (timer < 556 || timer > 2300)
timer++;
if (timer < 556 || timer > 2300) timer++;
else timer += 2;
if (ConfigHandler.sumonRitualAccelerated) timer += 20;
}
}
@@ -9,6 +9,7 @@ import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync;
import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -27,7 +28,7 @@ import java.util.Random;
/**
* Created by Brandon on 28/07/2014.
*/
public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, IExtendedRFStorage {
public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, IExtendedRFStorage, IDEPeripheral {
public boolean active = false;
public boolean lastTickActive = false;
public boolean reciveEnergy = false; //Power Flow to system
@@ -339,4 +340,21 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I
public long getExtendedCapacity() {
return getMaster() != null ? getMaster().getMaxEnergyStored() : 0L;
}
@Override
public String getName() {
return "draconic_rf_storage";
}
@Override
public String[] getMethodNames() {
return new String[] {"getEnergyStored", "getMaxEnergyStored"};
}
@Override
public Object[] callMethod(String method, Object... args) {
if (method.equals("getEnergyStored")) return new Object[] {getExtendedStorage()};
else if (method.equals("getMaxEnergyStored")) return new Object[] {getExtendedCapacity()};
return new Object[0];
}
}
@@ -4,6 +4,7 @@ import com.brandon3055.brandonscore.BrandonsCore;
import com.brandon3055.brandonscore.common.handlers.ProcessHandler;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.ReactorSound;
import com.brandon3055.draconicevolution.client.gui.GuiHandler;
import com.brandon3055.draconicevolution.client.render.particle.Particles;
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart;
@@ -61,6 +62,9 @@ public class TileReactorCore extends TileObjectSync {
public int energySaturation = 0;
public int maxEnergySaturation = 0;
@SideOnly(Side.CLIENT)
private ReactorSound reactorSound;
//#######################
//TODO DONT FORGET TO ACTUALLY FINISH ALL THESE THINGS!!!!
@@ -73,9 +77,9 @@ public class TileReactorCore extends TileObjectSync {
//-GUI info (maby speed up gui sync via the container)
//-GUI warning red bars
//-Maby get around to setting the angle of the stabiliser elements
//-SOUND!!!!!
//-CC Integration
//-Redstone
//Check //-SOUND!!!!!
//Check //-CC Integration
//Check //-Redstone
//-Add reactor and gates to tablet
@@ -85,6 +89,8 @@ public class TileReactorCore extends TileObjectSync {
public void updateEntity() {
tick++;
if (worldObj.isRemote) {
updateSound();
renderSpeed = (float)Math.min((reactionTemperature-20) / 2000D, 1D);
stabilizerRender = (float)Math.min(fieldCharge / (maxFieldCharge * 0.1D), 1D);
renderRotation += renderSpeed;
@@ -112,14 +118,17 @@ public class TileReactorCore extends TileObjectSync {
detectAndSendChanges();
}
@SideOnly(Side.CLIENT)
private void updateSound(){if (reactorSound == null) reactorSound = (ReactorSound)DraconicEvolution.proxy.playISound(new ReactorSound(this));}
private void checkPlayerCollision(){
EntityPlayer player = BrandonsCore.proxy.getClientPlayer();
double distance = Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
if (distance < (getCoreDiameter()/2) + 0.5){
double dMod = 1D - (distance / Math.max(0.1, (getCoreDiameter()/2) + 0.5));
double offsetX = player.posX - xCoord;
double offsetY = player.posY - yCoord;
double offsetZ = player.posZ - zCoord;
double offsetX = player.posX - xCoord + 0.5;
double offsetY = player.posY - yCoord + 0.5;
double offsetZ = player.posZ - zCoord + 0.5;
double m = 1D * dMod;
player.addVelocity(offsetX*m, offsetY*m, offsetZ*m);
}
@@ -145,6 +154,12 @@ public class TileReactorCore extends TileObjectSync {
private boolean hasExploded = false;
public double tempDrainFactor;
public double generationRate;
public int fieldDrain;
public double fuelUseRate;
private void runTick(){
//Inverted core saturation (if multiplied by 100 this creates infinite numbers which breaks the code)
double saturation = ((double)energySaturation / (double)maxEnergySaturation);
@@ -176,15 +191,16 @@ public class TileReactorCore extends TileObjectSync {
//======================
//Energy Calculation
int baseMaxRFt = (int)((maxEnergySaturation / 1000D) * ConfigHandler.reactorOutputMultiplier);
int baseMaxRFt = (int)((maxEnergySaturation / 1000D) * ConfigHandler.reactorOutputMultiplier * 1.5D);
int maxRFt = (int)(baseMaxRFt * (1D+(conversion*2)));
energySaturation += (1D - saturation) * maxRFt;
generationRate = (1D - saturation) * maxRFt;
energySaturation += generationRate;
//LogHelper.info((1D - saturation) * maxRFt);
//======================
//When temp < 1000 power drain is 0, when temp > 2000 power drain is 1, when temp > 8000 power drain increases exponentially
double tempDrainFactor = reactionTemperature > 8000 ? 1 + ((reactionTemperature-8000) * (reactionTemperature-8000) * 0.0000025) : reactionTemperature > 2000 ? 1 : reactionTemperature > 1000 ? (reactionTemperature-1000)/1000 : 0;
tempDrainFactor = reactionTemperature > 8000 ? 1 + ((reactionTemperature-8000) * (reactionTemperature-8000) * 0.0000025) : reactionTemperature > 2000 ? 1 : reactionTemperature > 1000 ? (reactionTemperature-1000)/1000 : 0;
//todo add to guiInfo
//-temp drain factor
//-mass
@@ -192,14 +208,14 @@ public class TileReactorCore extends TileObjectSync {
//-field drain
//Field Drain Calculation
int fieldDrain = (int)Math.min(tempDrainFactor * (1D-saturation) * (baseMaxRFt / 10.923556), (double) Integer.MAX_VALUE); //<(baseMaxRFt/make smaller to increase field power drain)
fieldDrain = (int)Math.min(tempDrainFactor * (1D-saturation) * (baseMaxRFt / 10.923556), (double) Integer.MAX_VALUE); //<(baseMaxRFt/make smaller to increase field power drain)
// LogHelper.info(fieldDrain+" "+tempDrainFactor+" "+(1D-saturation)+" "+tempDrainFactor * (1D-saturation) * (baseMaxRFt/10.923556));
fieldCharge -= fieldDrain;
//======================
//Calculate Fuel Usage
double useRate = tempDrainFactor * (1D-saturation) * (0.001 * ConfigHandler.reactorFuelUsageMultiplier); //<Last number is base fuel usage rate
conversionUnit += useRate;
fuelUseRate = tempDrainFactor * (1D-saturation) * (0.001 * ConfigHandler.reactorFuelUsageMultiplier); //<Last number is base fuel usage rate
conversionUnit += fuelUseRate;
if (conversionUnit >= 1 && reactorFuel > 0){
conversionUnit--;
reactorFuel--;
@@ -208,15 +224,11 @@ public class TileReactorCore extends TileObjectSync {
//====================
//Make BOOM!!!
if ((fieldCharge <= 0) && !hasExploded) {
hasExploded = true;
goBoom();
}
//===========
}
@@ -230,6 +242,7 @@ public class TileReactorCore extends TileObjectSync {
ProcessHandler.addProcess(new ReactorExplosion(worldObj, xCoord, yCoord, zCoord, power));
sendObjectToClient(References.INT_ID, 100, (int) (power * 10F), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 512));
}
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
@@ -347,14 +360,24 @@ public class TileReactorCore extends TileObjectSync {
public boolean canStart(){
validateStructure();
return reactionTemperature >= 2000 && fieldCharge >= (maxFieldCharge / 2) && energySaturation >= (maxEnergySaturation / 2) && isStructureValid;
return reactionTemperature >= 2000 && fieldCharge >= (maxFieldCharge / 2) && energySaturation >= (maxEnergySaturation / 2) && isStructureValid && convertedFuel + reactorFuel + conversionUnit >= 144;
}
public void processButtonPress(int button){
public boolean canCharge() {
validateStructure();
if (button == 0 && reactorState != STATE_ONLINE && isStructureValid) reactorState = STATE_START;
else if (button == 1 && isStructureValid) reactorState = STATE_ONLINE;
else if (button == 2 && reactorState != STATE_OFFLINE) reactorState = STATE_STOP;
return reactorState != STATE_ONLINE && isStructureValid && convertedFuel + reactorFuel + conversionUnit >= 144;
}
public boolean canStop(){
validateStructure();
return reactorState != STATE_OFFLINE && isStructureValid;
}
public void processButtonPress(int button){
if (button == 0 && canCharge()) reactorState = STATE_START;
else if (button == 1 && canStart()) reactorState = STATE_ONLINE;
else if (button == 2 && canStop()) reactorState = STATE_STOP;
}
public double getCoreDiameter(){//todo adjust so the core dose not expand before 1000>2000c
@@ -6,6 +6,7 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam;
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper;
import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
@@ -15,10 +16,13 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Brandon on 23/7/2015.
*/
public class TileReactorEnergyInjector extends TileEntity implements IReactorPart, IEnergyReceiver{
public class TileReactorEnergyInjector extends TileEntity implements IReactorPart, IEnergyReceiver, IDEPeripheral{
public float modelIllumination = 1F;
public int facingDirection = ForgeDirection.UP.ordinal();
@@ -44,8 +48,7 @@ public class TileReactorEnergyInjector extends TileEntity implements IReactorPar
rsCach = rs;
Utills.updateNeabourBlocks(worldObj, xCoord, yCoord, zCoord);
}
}
}
}}
public void onPlaced() {
checkForMaster();
@@ -179,4 +182,57 @@ public class TileReactorEnergyInjector extends TileEntity implements IReactorPar
public boolean canConnectEnergy(ForgeDirection from) {
return from == ForgeDirection.getOrientation(facingDirection).getOpposite();
}
@Override
public String getName() {
return "draconic_reactor";
}
@Override
public String[] getMethodNames() {
return new String[] {"getReactorInfo", "chargeReactor", "activateReactor", "stopReactor"};
}
@Override
public Object[] callMethod(String method, Object... args) {
if (!(getMaster().getTileEntity(worldObj) instanceof TileReactorCore)) return null;
TileReactorCore reactor = (TileReactorCore)getMaster().getTileEntity(worldObj);
if (args.length > 0) throw new IllegalArgumentException("This method dose not accept arguments");
if (method.equals("getReactorInfo")){
Map<Object, Object> map = new HashMap<Object, Object>();
map.put("temperature", Utills.round(reactor.reactionTemperature, 100));
map.put("fieldStrength", Utills.round(reactor.fieldCharge, 100));
map.put("maxFieldStrength", Utills.round(reactor.maxFieldCharge, 100));
map.put("energySaturation", reactor.energySaturation);
map.put("maxEnergySaturation", reactor.maxEnergySaturation);
map.put("fuelConversion", Utills.round((double)reactor.convertedFuel + reactor.conversionUnit, 1000));
map.put("maxFuelConversion", reactor.reactorFuel + reactor.convertedFuel);
map.put("generationRate", (int)reactor.generationRate);
map.put("fieldDrainRate", reactor.fieldDrain);
map.put("fuelConversionRateN", (int)Math.round(reactor.fuelUseRate * 1000000D));
map.put("status", reactor.reactorState == 0 ? "offline" : reactor.reactorState == 1 && !reactor.canStart() ? "charging" : reactor.reactorState == 1 && reactor.canStart() ? "charged" : reactor.reactorState == 2 ? "online" : reactor.reactorState == 3 ? "stopping" : "invalid");
return new Object[]{ map };
}
else if (method.equals("chargeReactor")){
if (reactor.canCharge()) {
reactor.reactorState = TileReactorCore.STATE_START;
return new Object[] { true };
} else return new Object[] { false };
}
else if (method.equals("activateReactor")){
if (reactor.canStart()) {
reactor.reactorState = TileReactorCore.STATE_ONLINE;
return new Object[] { true };
} else return new Object[] { false };
}
else if (method.equals("stopReactor")){
if (reactor.canStop()) {
reactor.reactorState = TileReactorCore.STATE_STOP;
return new Object[] { true };
} else return new Object[] { false };
}
return new Object[] {};
}
}
@@ -7,7 +7,6 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam;
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
@@ -17,7 +16,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Created by brandon3055 on 5/7/2015.
@@ -212,18 +212,54 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I
@Override
public String getName() {
LogHelper.info("name");
return "draconic_reactor";
}
@Override
public String[] getMethodNames() {
return new String[] {"test1", "test2"};
return new String[] {"getReactorInfo", "chargeReactor", "activateReactor", "stopReactor"};
}
@Override
public Object[] callMethod(String method, Object... args) {
LogHelper.info(method+" "+ Arrays.asList(args));
return new Object[0];
if (!(getMaster().getTileEntity(worldObj) instanceof TileReactorCore)) return null;
TileReactorCore reactor = (TileReactorCore)getMaster().getTileEntity(worldObj);
if (args.length > 0) throw new IllegalArgumentException("This method dose not accept arguments");
if (method.equals("getReactorInfo")){
Map<Object, Object> map = new HashMap<Object, Object>();
map.put("temperature", Utills.round(reactor.reactionTemperature, 100));
map.put("fieldStrength", Utills.round(reactor.fieldCharge, 100));
map.put("maxFieldStrength", Utills.round(reactor.maxFieldCharge, 100));
map.put("energySaturation", reactor.energySaturation);
map.put("maxEnergySaturation", reactor.maxEnergySaturation);
map.put("fuelConversion", Utills.round((double)reactor.convertedFuel + reactor.conversionUnit, 1000));
map.put("maxFuelConversion", reactor.reactorFuel + reactor.convertedFuel);
map.put("generationRate", (int)reactor.generationRate);
map.put("fieldDrainRate", reactor.fieldDrain);
map.put("fuelConversionRateN", (int)Math.round(reactor.fuelUseRate * 1000000D));
map.put("status", reactor.reactorState == 0 ? "offline" : reactor.reactorState == 1 && !reactor.canStart() ? "charging" : reactor.reactorState == 1 && reactor.canStart() ? "charged" : reactor.reactorState == 2 ? "online" : reactor.reactorState == 3 ? "stopping" : "invalid");
return new Object[]{ map };
}
else if (method.equals("chargeReactor")){
if (reactor.canCharge()) {
reactor.reactorState = TileReactorCore.STATE_START;
return new Object[] { true };
} else return new Object[] { false };
}
else if (method.equals("activateReactor")){
if (reactor.canStart()) {
reactor.reactorState = TileReactorCore.STATE_ONLINE;
return new Object[] { true };
} else return new Object[] { false };
}
else if (method.equals("stopReactor")){
if (reactor.canStop()) {
reactor.reactorState = TileReactorCore.STATE_STOP;
return new Object[] { true };
} else return new Object[] { false };
}
return new Object[] {};
}
}
@@ -0,0 +1,94 @@
package com.brandon3055.draconicevolution.common.utills;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.MinecraftForge;
import java.util.*;
/**
* Created by brandon3055 on 21/10/2015.
*/
public class DragonChunkLoader implements LoadingCallback {
public static DragonChunkLoader instance;
public static Map<EntityChaosGuardian, Ticket> ticketList = new HashMap<EntityChaosGuardian, Ticket>();
public static void init(){
instance = new DragonChunkLoader();
MinecraftForge.EVENT_BUS.register(instance);
ForgeChunkManager.setForcedChunkLoadingCallback(DraconicEvolution.instance, instance);
}
public static void updateLoaded(EntityChaosGuardian guardian){
Ticket ticket;
if (ticketList.containsKey(guardian)) {
ticket = ticketList.get(guardian);
}
else
{
ticket = ForgeChunkManager.requestTicket(DraconicEvolution.instance, guardian.worldObj, ForgeChunkManager.Type.ENTITY);
if (ticket != null) {
ticket.bindEntity(guardian);
ticket.setChunkListDepth(9);
ticketList.put(guardian, ticket);
}
else {
LogHelper.error("Could not get ticket for dragon");
return;
}
}
if (ticket == null || guardian.ticksExisted % 4 != 0) return;
Set<ChunkCoordIntPair> dragonChunks = new HashSet<ChunkCoordIntPair>();
for(int xx = guardian.chunkCoordX-1; xx <= guardian.chunkCoordX+1; xx++){
for(int zz = guardian.chunkCoordZ-1; zz <= guardian.chunkCoordZ+1; zz++){
dragonChunks.add(new ChunkCoordIntPair(xx,zz));
}
}
Set<ChunkCoordIntPair> toLoad = new HashSet<ChunkCoordIntPair>();
Set<ChunkCoordIntPair> toUnload = new HashSet<ChunkCoordIntPair>();
for (ChunkCoordIntPair pair : ticket.getChunkList()){
if (!contains(dragonChunks, pair)) toUnload.add(pair);
}
for (ChunkCoordIntPair pair : dragonChunks){
if (!contains(ticket.getChunkList(), pair)) toLoad.add(pair);
}
for(ChunkCoordIntPair unload : toUnload) ForgeChunkManager.unforceChunk(ticket, unload);
for(ChunkCoordIntPair load : toLoad) ForgeChunkManager.forceChunk(ticket, load);
}
private static boolean contains(Set<ChunkCoordIntPair> set, ChunkCoordIntPair pair){
for (ChunkCoordIntPair pair1 : set) if (pair1.equals(pair)) return true;
return false;
}
public static void stopLoading(EntityChaosGuardian guardian){
if (!ticketList.containsKey(guardian)) return;
ForgeChunkManager.releaseTicket(ticketList.get(guardian));
ticketList.remove(guardian);
}
@Override
public void ticketsLoaded(List<ForgeChunkManager.Ticket> tickets, World world) {
if (!tickets.isEmpty()){
for (Ticket ticket : tickets){
if (ticket.getType() == ForgeChunkManager.Type.ENTITY && ticket.getEntity() instanceof EntityChaosGuardian){
updateLoaded((EntityChaosGuardian) ticket.getEntity());
}
}
}
}
}
@@ -6,6 +6,7 @@ import com.brandon3055.brandonscore.common.utills.SimplexNoise;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.entity.EntityChaosCrystal;
import com.brandon3055.draconicevolution.common.entity.EntityChaosGuardian;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
@@ -77,7 +78,12 @@ public class ChaosWorldGenHandler {
density = centerFalloff * plateauFalloff * heightMapFalloff;
if (density > 0.1 && world.getBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z) == Blocks.air) world.setBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z, Blocks.end_stone);
if (density > 0.1 && world.getBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z) == Blocks.air) world.setBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z, (dist > 60 || dist > random.nextInt(60)) ? Blocks.end_stone : Blocks.obsidian);
// if (density > 0.1 && world.getBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z) == Blocks.air) {
// boolean b = dist > 60 || dist > random.nextInt(60);
// world.setBlock(x + closestSpawn.x, y + 64, z + closestSpawn.z, (dist > 60 || dist > random.nextInt(60)) ? Blocks.end_stone : Blocks.obsidian);
// }
}
}
}
@@ -85,11 +91,35 @@ public class ChaosWorldGenHandler {
public static void generateStructures(World world, DataUtills.XZPair<Integer, Integer> islandCenter, Random random){
int outerRadius = 330;
//Gen Chaos Cavern
int shardY = 80;
int coreHeight = 10;
int coreWidth = 20;
for(int y = shardY-coreHeight; y <= shardY+coreHeight; y++){
int h = Math.abs(y-shardY);
int inRadius = h-3;
double yp = (coreHeight - h) / (double)coreHeight;
int outRadius = (int)(yp * coreWidth);
outRadius -= (outRadius * outRadius)/100;
genCoreSlice(world, islandCenter.x, y, islandCenter.z, inRadius, shardY, coreWidth, true, random);
genCoreSlice(world, islandCenter.x, y, islandCenter.z, outRadius, shardY, coreWidth, false, random);
}
world.setBlock(islandCenter.x, shardY, islandCenter.z, ModBlocks.chaosCrystal);
EntityChaosGuardian guardian = new EntityChaosGuardian(world);
guardian.setPositionAndUpdate(islandCenter.x, shardY, islandCenter.z);
world.spawnEntityInWorld(guardian);
//Gen Ring
int rings = 4;
int width = 20;
int spacing = 8;
//Gen Ring
for (int x = islandCenter.x - outerRadius; x <= islandCenter.x + outerRadius; x++) {
for (int z = islandCenter.z - outerRadius; z <= islandCenter.z + outerRadius; z++) {
int dist = (int) (Utills.getDistanceAtoB(x, z, islandCenter.x, islandCenter.z));
@@ -108,6 +138,35 @@ public class ChaosWorldGenHandler {
generateObelisks(world, islandCenter, random);
}
public static void genCoreSlice(World world, int xi, int yi, int zi, int ringRadius, int yc, int coreRadious, boolean fillIn, Random rand) {
for( int x = xi-coreRadious ; x<= xi+coreRadious; x++) {
for (int z = zi - coreRadious; z <= zi + coreRadious; z++) {
double dist = Utills.getDistanceAtoB(x, yi, z, xi, yc, zi);
double oRad = coreRadious - (Math.abs(yc-yi) * Math.abs(yc-yi))/10;
if (dist > oRad-3D && rand.nextDouble()*3D < dist-(oRad-3D)) continue;
if (fillIn && (int) (Utills.getDistanceAtoB(x, z, xi, zi)) <= ringRadius)
{
if ((int)dist < 9)world.setBlock(x, yi, z, ModBlocks.infusedObsidian);
else world.setBlock(x, yi, z, Blocks.obsidian);
}
else
if (!fillIn && (int) (Utills.getDistanceAtoB(x, z, xi, zi)) >= ringRadius)
{
world.setBlock(x, yi, z, Blocks.obsidian);
}
else if (!fillIn && (int) Utills.getDistanceAtoB(x, z, xi, zi) <= ringRadius)
{
Block b = world.getBlock(x, yi, z);
if (b == Blocks.air || b == Blocks.end_stone || b == Blocks.obsidian) world.setBlock(x, yi, z, ModBlocks.chaosShardAtmos);
}
}
}
}
public static DataUtills.XZPair<Integer, Integer> getClosestChaosSpawn(int chunkX, int chunkZ){
return new DataUtills.XZPair<Integer, Integer>(Utills.getNearestMultiple(chunkX * 16, 10000), Utills.getNearestMultiple(chunkZ*16, 10000));
}
@@ -0,0 +1,29 @@
package com.brandon3055.draconicevolution.integration;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
/**
* Created by brandon3055 on 29/9/2015.
*/
public class ModHelper {
public static boolean isTConInstalled;
private static Item cleaver;
public static void init(){
isTConInstalled = Loader.isModLoaded("TConstruct");
}
public static boolean isHoldingCleaver(EntityPlayer player){
if (!isTConInstalled) return false;
else if (cleaver == null) cleaver = GameRegistry.findItem("TConstruct", "cleaver");
return cleaver != null && player.getHeldItem() != null && player.getHeldItem().getItem().equals(cleaver);
}
}
@@ -28,7 +28,14 @@ public class CCAdapter implements IPeripheral {
@Override
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException {
return peripheral.callMethod(peripheral.getMethodNames()[method], arguments);
try
{
return peripheral.callMethod(peripheral.getMethodNames()[method], arguments);
}
catch (Exception e)
{
throw new LuaException(e.getMessage());
}
}
@Override
@@ -29,11 +29,11 @@ public class DEManagedPeripheral extends ManagedEnvironment implements ManagedPe
@Override
public String preferredName() {
return "draconic_reactor";
return peripheral.getName();
}
@Override
public int priority() {
return 1;
return 10;
}
}
@@ -27,6 +27,8 @@ public class NEIDraconicevolutionConfig implements IConfigureNEI
API.hideItem(new ItemStack(ModItems.dezilsMarshmallow));
API.hideItem(new ItemStack(ModItems.creativeStructureSpawner, 1, 1));
API.hideItem(new ItemStack(ModBlocks.portal));
API.hideItem(new ItemStack(ModBlocks.chaosShardAtmos));
API.hideItem(new ItemStack(ModBlocks.chaosCrystal));
LogHelper.info("Added NEI integration");
}