Added Ritual of Ender Resurrection

This commit is contained in:
brandon3055 committed 2014-08-11 10:57:44 +10:00
1 parent 49a671a1b6
commit c432156fc0
83 files changed
+1718 -260

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
package cofh.api;
public class CoFHAPIProps {
private CoFHAPIProps() {
}
public static final String VERSION = "1.7.10R1.0.0";
}
@@ -2,8 +2,9 @@
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
* http://www.teamcofh.com
*/
@API(apiVersion = "1.0", owner = "CoFHCore", provides = "CoFHAPI|energy")
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|energy")
package cofh.api.energy;
import cofh.api.CoFHAPIProps;
import cpw.mods.fml.common.API;
+1 -1
View File
@@ -2,7 +2,7 @@
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
* http://www.teamcofh.com
*/
@API(apiVersion = "1.0", owner = "CoFHCore", provides = "CoFHAPI")
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI")
package cofh.api;
import cpw.mods.fml.common.API;
@@ -1,27 +1,20 @@
package com.brandon3055.draconicevolution;
import java.util.Arrays;
import com.brandon3055.draconicevolution.client.creativetab.DETab;
import com.brandon3055.draconicevolution.common.core.network.ChannelHandler;
import com.brandon3055.draconicevolution.common.core.proxy.CommonProxy;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import net.minecraft.stats.Achievement;
import net.minecraftforge.common.AchievementPage;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.creativetab.CreativeTabs;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.FMLEventChannel;
import com.brandon3055.draconicevolution.client.creativetab.TolkienTab;
import com.brandon3055.draconicevolution.common.core.network.ChannelHandler;
import com.brandon3055.draconicevolution.common.core.proxy.CommonProxy;
import com.brandon3055.draconicevolution.common.lib.References;
import net.minecraft.creativetab.CreativeTabs;
@Mod(modid = References.MODID, name = References.MODNAME, version = References.VERSION, canBeDeactivated = false)
import java.util.Arrays;
@Mod(modid = References.MODID, name = References.MODNAME, version = References.VERSION, canBeDeactivated = false, guiFactory = References.GUIFACTORY)
public class DraconicEvolution {
@Mod.Instance(References.MODID)
@@ -30,16 +23,15 @@ public class DraconicEvolution {
@SidedProxy(clientSide = References.CLIENTPROXYLOCATION, serverSide = References.COMMONPROXYLOCATION)
public static CommonProxy proxy;
private static CreativeTabs tolkienTabToolsWeapons = new TolkienTab(CreativeTabs.getNextID(), References.MODID, "toolsAndWeapons");
private static CreativeTabs tolkienTabBlocksItems = new TolkienTab(CreativeTabs.getNextID(), References.MODID, "blocksAndItems");
public static CreativeTabs tolkienTabToolsWeapons = new DETab(CreativeTabs.getNextID(), References.MODID, "toolsAndWeapons", 0);
public static CreativeTabs tolkienTabBlocksItems = new DETab(CreativeTabs.getNextID(), References.MODID, "blocksAndItems", 1);
public static final String networkChannelName = "DraconicEvolution";
public static ChannelHandler channelHandler = new ChannelHandler(References.MODID, networkChannelName);
//public static FMLEventChannel channel;
public static boolean debug = false;
public DraconicEvolution()
{
//logger.info("This is Draconic Evolution");
LogHelper.info("Hello Minecraft!!!");
}
@Mod.EventHandler
@@ -82,9 +74,4 @@ public class DraconicEvolution {
proxy.postInit(event);
}
public static CreativeTabs getCreativeTab(int tab)
{
return tab == 1 ? tolkienTabToolsWeapons : tolkienTabBlocksItems;
}
}
@@ -0,0 +1,35 @@
package com.brandon3055.draconicevolution.client.creativetab;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
public class DETab extends CreativeTabs {
private String label;
private int tab;
public DETab(int id, String modid, String label, int tab) {
super(id, modid);
this.label = label;
this.tab = tab;
}
@Override
public Item getTabIconItem()
{
if (tab == 0){
return ModItems.draconicBow;
}else if (tab == 1){
return Item.getItemFromBlock(ModBlocks.energyInfuser);
}else
return Items.apple;
}
@Override
public String getTabLabel()
{
return this.label;
}
}
@@ -1,38 +0,0 @@
package com.brandon3055.draconicevolution.client.creativetab;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class TolkienTab extends CreativeTabs {
private String label;
public TolkienTab(final int id, final String modid, final String label) {
super(id, modid);
this.label = label;
}
@Override
public Item getTabIconItem()
{
if(this.label.equals("toolsAndWeapons"))
return ModItems.draconicBow;
else if(this.label.equals("blocksAndItems"))
return ConfigHandler.disableSunDial == 2 ? Item.getItemFromBlock(ModBlocks.weatherController) : Item.getItemFromBlock(ModBlocks.sunDial);
else
return ModItems.tclogo;
}
@Override
public String getTabLabel()
{
return this.label;
}
}
@@ -0,0 +1,22 @@
package com.brandon3055.draconicevolution.client.interfaces;
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import java.util.List;
/**
* Created by Brandon on 6/08/2014.
*/
public class ConfigGUI extends GuiConfig {
public ConfigGUI(GuiScreen parent) {
super(parent, new ConfigElement(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements() , References.MODID, false, false, GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString()));
configElements.addAll(new ConfigElement(ConfigHandler.config.getCategory("spawner")).getChildElements());
configElements.addAll(new ConfigElement(ConfigHandler.config.getCategory("long range dislocator")).getChildElements());
}
}
@@ -0,0 +1,32 @@
package com.brandon3055.draconicevolution.client.interfaces;
import cpw.mods.fml.client.IModGuiFactory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import java.util.Set;
/**
* Created by Brandon on 6/08/2014.
*/
public class DEGUIFactory implements IModGuiFactory {
@Override
public void initialize(Minecraft minecraftInstance) {
}
@Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return ConfigGUI.class;
}
@Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
return null;
}
@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
return null;
}
}
@@ -0,0 +1,319 @@
package com.brandon3055.draconicevolution.client.render;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelDragon;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.BossStatus;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import java.util.Random;
/**
* Created by Brandon on 11/08/2014.
*/
@SideOnly(Side.CLIENT)
public class CustomDragonRenderer extends RenderLiving
{
private static final ResourceLocation enderDragonExplodingTextures = new ResourceLocation("textures/entity/enderdragon/dragon_exploding.png");
private static final ResourceLocation enderDragonCrystalBeamTextures = new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png");
private static final ResourceLocation enderDragonEyesTextures = new ResourceLocation("textures/entity/enderdragon/dragon_eyes.png");
private static final ResourceLocation enderDragonTextures = new ResourceLocation(References.RESOURCESPREFIX + "textures/entity/de_dragon.png");
/** An instance of the dragon model in RenderDragon */
protected ModelDragon modelDragon;
public CustomDragonRenderer()
{
super(new ModelDragon(0.0F), 0.5F);
this.modelDragon = (ModelDragon)this.mainModel;
this.setRenderPassModel(this.mainModel);
}
protected void rotateCorpse(EntityDragon p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_)
{
float f3 = (float)p_77043_1_.getMovementOffsets(7, p_77043_4_)[0];
float f4 = (float)(p_77043_1_.getMovementOffsets(5, p_77043_4_)[1] - p_77043_1_.getMovementOffsets(10, p_77043_4_)[1]);
GL11.glRotatef(-f3, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(f4 * 10.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.0F, 1.0F);
if (p_77043_1_.deathTime > 0)
{
float f5 = ((float)p_77043_1_.deathTime + p_77043_4_ - 1.0F) / 20.0F * 1.6F;
f5 = MathHelper.sqrt_float(f5);
if (f5 > 1.0F)
{
f5 = 1.0F;
}
GL11.glRotatef(f5 * this.getDeathMaxRotation(p_77043_1_), 0.0F, 0.0F, 1.0F);
}
}
/**
* Renders the model in RenderLiving
*/
protected void renderModel(EntityDragon p_77036_1_, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_)
{
if (p_77036_1_.deathTicks > 0)
{
float f6 = (float)p_77036_1_.deathTicks / 200.0F;
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glAlphaFunc(GL11.GL_GREATER, f6);
this.bindTexture(enderDragonExplodingTextures);
this.mainModel.render(p_77036_1_, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
GL11.glDepthFunc(GL11.GL_EQUAL);
}
this.bindEntityTexture(p_77036_1_);
this.mainModel.render(p_77036_1_, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_);
if (p_77036_1_.hurtTime > 0)
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F);
this.mainModel.render(p_77036_1_, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityDragon p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
BossStatus.setBossStatus(p_76986_1_, false);
super.doRender((EntityLiving)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
if (p_76986_1_.healingEnderCrystal != null)
{
float f2 = (float)p_76986_1_.healingEnderCrystal.innerRotation + p_76986_9_;
float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F;
f3 = (f3 * f3 + f3) * 0.2F;
float f4 = (float)(p_76986_1_.healingEnderCrystal.posX - p_76986_1_.posX - (p_76986_1_.prevPosX - p_76986_1_.posX) * (double)(1.0F - p_76986_9_));
float f5 = (float)((double)f3 + p_76986_1_.healingEnderCrystal.posY - 1.0D - p_76986_1_.posY - (p_76986_1_.prevPosY - p_76986_1_.posY) * (double)(1.0F - p_76986_9_));
float f6 = (float)(p_76986_1_.healingEnderCrystal.posZ - p_76986_1_.posZ - (p_76986_1_.prevPosZ - p_76986_1_.posZ) * (double)(1.0F - p_76986_9_));
float f7 = MathHelper.sqrt_float(f4 * f4 + f6 * f6);
float f8 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6);
GL11.glPushMatrix();
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_ + 2.0F, (float)p_76986_6_);
GL11.glRotatef((float)(-Math.atan2((double)f6, (double)f4)) * 180.0F / (float)Math.PI - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef((float)(-Math.atan2((double)f7, (double)f5)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F);
Tessellator tessellator = Tessellator.instance;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_CULL_FACE);
this.bindTexture(enderDragonCrystalBeamTextures);
GL11.glShadeModel(GL11.GL_SMOOTH);
float f9 = 0.0F - ((float)p_76986_1_.ticksExisted + p_76986_9_) * 0.01F;
float f10 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6) / 32.0F - ((float)p_76986_1_.ticksExisted + p_76986_9_) * 0.01F;
tessellator.startDrawing(5);
byte b0 = 8;
for (int i = 0; i <= b0; ++i)
{
float f11 = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.0F / (float)b0) * 0.75F;
float f12 = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.0F / (float)b0) * 0.75F;
float f13 = (float)(i % b0) * 1.0F / (float)b0;
tessellator.setColorOpaque_I(0);
tessellator.addVertexWithUV((double)(f11 * 0.2F), (double)(f12 * 0.2F), 0.0D, (double)f13, (double)f10);
tessellator.setColorOpaque_I(16777215);
tessellator.addVertexWithUV((double)f11, (double)f12, (double)f8, (double)f13, (double)f9);
}
tessellator.draw();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_FLAT);
RenderHelper.enableStandardItemLighting();
GL11.glPopMatrix();
}
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(EntityDragon p_110775_1_)
{
return enderDragonTextures;
}
protected void renderEquippedItems(EntityDragon p_77029_1_, float p_77029_2_)
{
super.renderEquippedItems(p_77029_1_, p_77029_2_);
Tessellator tessellator = Tessellator.instance;
if (p_77029_1_.deathTicks > 0)
{
RenderHelper.disableStandardItemLighting();
float f1 = ((float)p_77029_1_.deathTicks + p_77029_2_) / 200.0F;
float f2 = 0.0F;
if (f1 > 0.8F)
{
f2 = (f1 - 0.8F) / 0.2F;
}
Random random = new Random(432L);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDepthMask(false);
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, -1.0F, -2.0F);
for (int i = 0; (float)i < (f1 + f1 * f1) / 2.0F * 60.0F; ++i)
{
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F);
tessellator.startDrawing(6);
float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
tessellator.setColorRGBA_I(16777215, (int)(255.0F * (1.0F - f2)));
tessellator.addVertex(0.0D, 0.0D, 0.0D);
tessellator.setColorRGBA_I(16711935, 0);
tessellator.addVertex(-0.866D * (double)f4, (double)f3, (double)(-0.5F * f4));
tessellator.addVertex(0.866D * (double)f4, (double)f3, (double)(-0.5F * f4));
tessellator.addVertex(0.0D, (double)f3, (double)(1.0F * f4));
tessellator.addVertex(-0.866D * (double)f4, (double)f3, (double)(-0.5F * f4));
tessellator.draw();
}
GL11.glPopMatrix();
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_ALPHA_TEST);
RenderHelper.enableStandardItemLighting();
}
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityDragon p_77032_1_, int p_77032_2_, float p_77032_3_)
{
if (p_77032_2_ == 1)
{
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
if (p_77032_2_ != 0)
{
return -1;
}
else
{
this.bindTexture(enderDragonEyesTextures);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_EQUAL);
char c0 = 61680;
int j = c0 % 65536;
int k = c0 / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
return 1;
}
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntityDragon)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityLivingBase p_77032_1_, int p_77032_2_, float p_77032_3_)
{
return this.shouldRenderPass((EntityDragon)p_77032_1_, p_77032_2_, p_77032_3_);
}
protected void renderEquippedItems(EntityLivingBase p_77029_1_, float p_77029_2_)
{
this.renderEquippedItems((EntityDragon)p_77029_1_, p_77029_2_);
}
protected void rotateCorpse(EntityLivingBase p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_)
{
this.rotateCorpse((EntityDragon)p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_);
}
/**
* Renders the model in RenderLiving
*/
protected void renderModel(EntityLivingBase p_77036_1_, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_)
{
this.renderModel((EntityDragon)p_77036_1_, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntityDragon)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity p_110775_1_)
{
return this.getEntityTexture((EntityDragon)p_110775_1_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntityDragon)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
}
@@ -1,7 +1,5 @@
package com.brandon3055.draconicevolution.client.render;
import com.brandon3055.draconicevolution.common.core.handler.ParticleHandler;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -270,4 +268,186 @@ public final class Particles {
}
}
public static class AdvancedSeekerParticle extends EntityFX {
public double targetX;
public double targetY;
public double targetZ;
public double startDist = 0;
public int behaviour;
public int timer = 0;
public AdvancedSeekerParticle(World world, double x, double y, double z, double tX, double tY, double tZ, int type, int maxAge) {
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
this.targetX = tX;
this.targetY = tY;
this.targetZ = tZ;
this.motionX = 0;
this.motionY = 0;
this.motionZ = 0;
this.particleTextureIndexX = 0;
this.particleTextureIndexY = 0;
this.particleScale = world.rand.nextFloat() + 0.5F;
this.particleMaxAge = 100;
this.noClip = true;
this.behaviour = type;
this.startDist = getDistance(targetX, targetY, targetZ);
this.particleMaxAge = maxAge;
}
public AdvancedSeekerParticle(World world, double x, double y, double z, double tX, double tY, double tZ, int type, float red, float green, float blue, int maxAge) {
this(world, x, y, z, tX, tY, tZ, type, maxAge);
this.particleRed = red;
this.particleGreen = green;
this.particleBlue = blue;
}
public AdvancedSeekerParticle(World world, double x, double y, double z, double tX, double tY, double tZ, int type, float red, float green, float blue, int maxAge, int timer) {
this(world, x, y, z, tX, tY, tZ, type, maxAge);
this.particleRed = red;
this.particleGreen = green;
this.particleBlue = blue;
this.timer = timer;
}
@Override
public void onUpdate() {
switch (behaviour){
case 1:
behaviour1();
break;
case 2:
behaviour2();
break;
case 3:
behaviour3();
break;}
}
/**Fade Out*/
private void behaviour1(){
if (particleAge > particleMaxAge) setDead();
if (particleAge + 10 >= particleMaxAge) particleAlpha = ((float)particleMaxAge - (float)particleAge) / 10F;
particleAge ++;
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
moveEntity(motionX, motionY, motionZ);
}
/**Go to target and expand with timer*/
private void behaviour3(){
if (this.getDistanceSq(targetX, targetY, targetZ) < 0.1 && particleAge < particleMaxAge - 40) particleAge = particleMaxAge - 40;
if (particleAge > particleMaxAge) setDead();
particleAge ++;
if (particleScale > 0) particleScale -= 0.02F;
if ((particleRed == 1F || (particleGreen == 1F && particleBlue == 0F)) && particleAge > particleMaxAge - 10){
int t = timer - 300;
particleScale = (float)t / (1F - (particleAge / (particleMaxAge - 10F)) * 100F);
}else if (particleBlue == 1F && particleAge > particleMaxAge - 15){
int t = timer - 700;
particleScale = (float)t / (1F - (particleAge / (particleMaxAge - 10F)) * 100F);
}
float motionMod = 0.001F * Math.max(1F - (float) (particleAge / 50), 0F);
motionX += (targetX - posX) * motionMod;
motionY += (targetY - posY) * motionMod;
motionZ += (targetZ - posZ) * motionMod;
float directMotMod = 0.05F;
float directMotT = Math.max(1F-((float)particleAge/(float)50), 0F);
directMotMod = (directMotMod * (1F - directMotT));
motionX = (motionX * directMotT) + (targetX - posX) * directMotMod;
motionY = (motionY * directMotT) + (targetY - posY) * directMotMod;
motionZ = (motionZ * directMotT) + (targetZ - posZ) * directMotMod;
if (particleMaxAge - particleAge < 40 && timer > 2300 && (particleRed == 1F || (particleGreen == 1f && particleBlue == 1f))){
double yChange = (double)(timer - 2300);
//setPosition(posX, targetY + yChange, posZ);
if (posY < targetY + 60)motionY = yChange * 0.05F;
}
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
moveEntity(motionX, motionY, motionZ);
}
/**Goes to target and Expand*/
private void behaviour2(){
if (particleAge > particleMaxAge) setDead();
particleAge ++;
if (particleScale > 0) particleScale -= 0.02F;
if (particleAge > particleMaxAge - 10){
particleScale += 1F;
particleAlpha -= 0.1F;
}
float motionMod = 0.001F * Math.max(1F - (float) (particleAge / 50), 0F);
motionX += (targetX - posX) * motionMod;
motionY += (targetY - posY) * motionMod;
motionZ += (targetZ - posZ) * motionMod;
float directMotMod = 0.05F;
float directMotT = Math.max(1F-((float)particleAge/(float)50), 0F);
directMotMod = (directMotMod * (1F - directMotT));
motionX = (motionX * directMotT) + (targetX - posX) * directMotMod;
motionY = (motionY * directMotT) + (targetY - posY) * directMotMod;
motionZ = (motionZ * directMotT) + (targetZ - posZ) * directMotMod;
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
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();
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(References.RESOURCESPREFIX + "textures/particle/particles.png"));
tesselator.startDrawingQuads();
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;
float drawScale = 0.1F * 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.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha);
//tesselator.setColorRGBA(0, 255, 255, (int) (this.particleAlpha * 255F));
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();
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("textures/particle/particles.png"));
tesselator.startDrawingQuads();
}
}
}
@@ -1,13 +1,8 @@
package com.brandon3055.draconicevolution.common.blocks;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -7,6 +7,8 @@ import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockMobSpawner;
import net.minecraft.block.material.Material;
@@ -37,7 +39,7 @@ public class CustomSpawner extends BlockDE{
{
super(Material.rock);
this.setBlockName(Strings.customSpawnerName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setHardness(10F);
this.setHarvestLevel("pickaxe", 3);
ModBlocks.register(this);
@@ -150,6 +152,7 @@ public class CustomSpawner extends BlockDE{
return 1;
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon("mob_spawner");
@@ -1,29 +1,96 @@
package com.brandon3055.draconicevolution.common.blocks;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.blocks.itemblocks.DraconiumItemBlock;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnderResurrection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
/**
* Created by Brandon on 25/07/2014.
*/
public class Draconium extends BlockDE {
private final int DRACONIUM_META = 0;
private final int SUMMON_BLOCK_META = 1;
private final int CHARGED_DRACONIUM_META = 2;
IIcon icons[] = new IIcon[3];
public Draconium() {
super(Material.iron);
this.setHardness(10F);
this.setResistance(100F);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setBlockName(Strings.draconiumName);
ModBlocks.register(this);
ModBlocks.registerWithItem(this, DraconiumItemBlock.class);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconium_block");
for (int i = 0; i < 3; i++)
icons[i] = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconium_block_" + i);
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconium_block_blank");
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int side, int meta) {
if ((meta == DRACONIUM_META || meta == CHARGED_DRACONIUM_META) && (side == 0 || side == 1)) return blockIcon;
return icons[meta];
}
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(Item item, CreativeTabs p_149666_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 boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
return true;
}
@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_) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) return false;
if (meta == 1){
TileEnderResurrection tile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnderResurrection) ? (TileEnderResurrection) world.getTileEntity(x, y, z) : null;
if (tile != null) return tile.onActivated(player);
}
return false;
}
@Override
public boolean hasTileEntity(int metadata) {
if (metadata == 1) return true;
return false;
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
if (metadata == 1) return new TileEnderResurrection();
return null;
}
@Override
public int damageDropped(int meta) {
return meta;
}
}
@@ -25,7 +25,7 @@ public class DraconiumOre extends BlockDE {
protected DraconiumOre() {
super(Material.rock);
this.setBlockName(Strings.draconiumOreName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setHardness(5f);
this.setResistance(20.0f);
ModBlocks.register(this);
@@ -5,12 +5,14 @@ import com.brandon3055.draconicevolution.common.blocks.multiblock.EnergyPylon;
import com.brandon3055.draconicevolution.common.blocks.multiblock.EnergyStorageCore;
import com.brandon3055.draconicevolution.common.blocks.multiblock.InvisibleMultiblock;
import com.brandon3055.draconicevolution.common.core.utills.Utills;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.common.registry.GameRegistry;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
@GameRegistry.ObjectHolder(References.MODID)
public class ModBlocks {
public static BlockDE xRayBlock;
public static BlockDE weatherController;
@@ -55,6 +57,7 @@ public class ModBlocks {
if(DraconicEvolution.debug) testBlock = new TestBlock();
if (ConfigHandler.updateFix)
{
Block changer1 = new Utills.BlockChanger("tile.particleGenerator", particleGenerator);
Block changer2 = new Utills.BlockChanger("tile.customSpawner", customSpawner);
@@ -32,7 +32,7 @@ public class ParticleGenerator extends BlockDE
public ParticleGenerator() {
super(Material.rock);
this.setBlockName(Strings.particleGeneratorName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setStepSound(soundTypeStone);
this.setHardness(1f);
this.setResistance(200.0f);
@@ -40,6 +40,7 @@ public class ParticleGenerator extends BlockDE
ModBlocks.register(this);
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister)
{
@@ -64,6 +65,7 @@ public class ParticleGenerator extends BlockDE
return true;
}
@SideOnly(Side.CLIENT)
@Override
public int getRenderType()
{
@@ -30,7 +30,7 @@ public class Potentiometer extends BlockDE
protected Potentiometer() {
super(Material.circuits);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setHardness(0.3f);
this.setResistance(0.1f);
this.setLightLevel(0.3F);
@@ -22,7 +22,7 @@ public class RainSensor extends BlockDE
protected RainSensor() {
super(Material.iron);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setBlockBounds(0, 0, 0, 1, 0.125F, 1);
this.setHardness(5f);
this.setResistance(10f);
@@ -3,8 +3,8 @@ package com.brandon3055.draconicevolution.common.blocks;
import java.util.List;
import java.util.Random;
import com.brandon3055.draconicevolution.common.blocks.itemblocks.TestItemBlock;
import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
@@ -25,7 +25,7 @@ public class TestBlock extends BlockDE {
protected TestBlock() {
super(Material.rock);
this.setBlockName("testBlock");
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setHardness(5f);
this.setResistance(200.0f);
//this.setBlockBounds(0.4f, 0f, 0.4f, 0.6f, 1f, 0.6f);
@@ -23,7 +23,7 @@ public class XRayBlock extends BlockDE {
protected XRayBlock() {
super(Material.rock);
this.setBlockName(Strings.xrayBlockName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setBlockBounds(0.4F, 0.4F, 0.4F, 0.6F, 0.6F, 0.6F);
this.setHardness(7f);
this.setHarvestLevel("pickaxe", 4);
@@ -0,0 +1,87 @@
package com.brandon3055.draconicevolution.common.blocks.itemblocks;
import cofh.api.energy.IEnergyContainerItem;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import java.util.List;
/**
* Created by Brandon on 8/08/2014.
*/
public class DraconiumItemBlock extends ItemBlock implements IEnergyContainerItem{
public DraconiumItemBlock(Block block) {
super(block);
setHasSubtypes(true);
}
protected int capacity = 100000000;
protected int maxReceive = 10000000;
protected int maxExtract = 10000000;
@SuppressWarnings("unchecked")
@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 int getMetadata(int par1) {
return par1;
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return super.getUnlocalizedName(stack) + stack.getItemDamage();
}
@Override
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
if(container.getItemDamage() != 0) return 0;
if (container.stackTagCompound == null) {
container.stackTagCompound = new NBTTagCompound();
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
if (!simulate) {
energy += energyReceived;
container.stackTagCompound.setInteger("EnergyHelper", energy);
}
if (getEnergyStored(container) == getMaxEnergyStored(container)) container.setItemDamage(2);
return energyReceived;
}
@Override
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
return 0;
}
@Override
public int getEnergyStored(ItemStack container) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
return 0;
}
return container.stackTagCompound.getInteger("EnergyHelper");
}
@Override
public int getMaxEnergyStored(ItemStack container) {
return capacity;
}
@Override
public void onUpdate(ItemStack stack, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) {
if (stack.getItemDamage() == 0 && getEnergyStored(stack) == getMaxEnergyStored(stack)) stack.setItemDamage(2);
super.onUpdate(stack, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_);
}
}
@@ -1,4 +1,4 @@
package com.brandon3055.draconicevolution.common.blocks;
package com.brandon3055.draconicevolution.common.blocks.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
@@ -1,4 +1,4 @@
package com.brandon3055.draconicevolution.common.blocks;
package com.brandon3055.draconicevolution.common.blocks.itemblocks;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
@@ -9,6 +9,8 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -27,7 +29,7 @@ public class EnergyInfuser extends BlockContainerDE {
public EnergyInfuser() {
super(Material.iron);
this.setBlockName(Strings.energyInfuserName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setStepSound(soundTypeStone);
this.setHardness(1f);
this.setResistance(200.0f);
@@ -35,6 +37,7 @@ public class EnergyInfuser extends BlockContainerDE {
ModBlocks.register(this);
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "machine_side");
@@ -54,6 +57,7 @@ public class EnergyInfuser extends BlockContainerDE {
return true;
}
@SideOnly(Side.CLIENT)
@Override
public int getRenderType() {
return -1;
@@ -49,7 +49,7 @@ public class Generator extends BlockContainerDE {
public Generator() {
super(Material.rock);
this.setBlockName(Strings.generatorName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setStepSound(soundTypeStone);
this.setHardness(1f);
this.setResistance(2000.0f);
@@ -42,7 +42,7 @@ public class Grinder extends BlockContainerDE
public Grinder() {
super(Material.rock);
this.setBlockName(Strings.grinderName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setStepSound(soundTypeStone);
this.setHardness(1f);
this.setResistance(2000.0f);
@@ -2,13 +2,12 @@ package com.brandon3055.draconicevolution.common.blocks.machine;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.blocks.LRDItemBlock;
import com.brandon3055.draconicevolution.common.blocks.itemblocks.LRDItemBlock;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@@ -33,7 +32,7 @@ public class LongRangeDislocator extends BlockDE {
public LongRangeDislocator() {
this.setBlockName(Strings.longRangeDislocatorName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setHardness(5f);
this.setResistance(20.0f);
ModBlocks.registerWithItem(this, LRDItemBlock.class);
@@ -57,6 +56,7 @@ public class LongRangeDislocator extends BlockDE {
return blockIcon;
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(Item item, CreativeTabs p_149666_2_, List list) {
//list.add(new ItemStack(item, 1, 0));
@@ -26,7 +26,7 @@ public class PlayerDetector extends BlockDE
public PlayerDetector() {
this.setBlockName(Strings.playerDetectorName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setStepSound(soundTypeStone);
this.setHardness(1f);
this.setResistance(200.0f);
@@ -9,6 +9,8 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TilePlayerDetectorAdvanced;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -33,13 +35,14 @@ public class PlayerDetectorAdvanced extends BlockContainerDE
public PlayerDetectorAdvanced() {
super(Material.iron);
this.setBlockName(Strings.playerDetectorAdvancedName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setStepSound(soundTypeStone);
this.setHardness(1f);
this.setResistance(200.0f);
ModBlocks.register(this);
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister)
{
@@ -59,6 +62,7 @@ public class PlayerDetectorAdvanced extends BlockContainerDE
return true;
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
{
@@ -89,7 +93,8 @@ public class PlayerDetectorAdvanced extends BlockContainerDE
return null;
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int side, int meta)
{
@@ -25,7 +25,7 @@ public class SunDial extends BlockDE {
public SunDial() {
this.setBlockName(Strings.blockSunDialName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setStepSound(soundTypeStone);
this.setHardness(1f);
this.setResistance(200.0f);
@@ -43,7 +43,7 @@ public class WeatherController extends BlockContainerDE {
public WeatherController() {
super(Material.rock);
this.setBlockName(Strings.blockWeatherControllerName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setStepSound(soundTypeStone);
this.setHardness(1f);
this.setResistance(200.0f);
@@ -35,7 +35,7 @@ public class EnergyPylon extends BlockDE {
super(Material.iron);
this.setHardness(5F);
this.setResistance(20F);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setBlockName(Strings.energyPylonName);
ModBlocks.register(this);
}
@@ -101,6 +101,7 @@ public class EnergyPylon extends BlockDE {
if (thisTile != null) {
thisTile.onActivated();
}
if (world.getBlockMetadata(x, y, z) == 0 && world.getTileEntity(x, y, z) != null) world.removeTileEntity(x, y, z);
}
private boolean isGlass(World world, int x, int y, int z){
@@ -30,7 +30,7 @@ public class EnergyStorageCore extends BlockDE {
super(Material.iron);
this.setHardness(10F);
this.setResistance(100F);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setBlockName(Strings.energyStorageCoreName);
ModBlocks.register(this);
}
@@ -17,9 +17,11 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import java.util.Random;
@@ -97,6 +99,7 @@ public class InvisibleMultiblock extends BlockDE {
return false;
}
if (!world.isRemote) {
world.markBlockForUpdate(master.xCoord, master.yCoord, master.zCoord);
player.addChatComponentMessage(new ChatComponentText("Tier:" + master.getTier()));
player.addChatComponentMessage(new ChatComponentText("" + Utills.formatNumber(master.getEnergyStored()) + " / " + Utills.formatNumber(master.getMaxEnergyStored())));
}
@@ -171,5 +174,13 @@ public class InvisibleMultiblock extends BlockDE {
return super.getSelectedBoundingBoxFromPool(world, x, y, z);
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
if (world.getBlockMetadata(x, y, z) == 0)
return new ItemStack(ModBlocks.draconium);
else if (world.getBlockMetadata(x, y, z) == 1)
return new ItemStack(Blocks.redstone_block);
else
return new ItemStack(Blocks.glass);
}
}
@@ -1,11 +1,14 @@
package com.brandon3055.draconicevolution.common.core.handler;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import net.minecraftforge.common.config.Configuration;
import java.io.File;
import net.minecraftforge.common.config.Configuration;
public class ConfigHandler {
public static Configuration config;
public static int disableSunDial;
public static int teleporterUsesPerPearl;
public static int disableXrayBlock;
@@ -23,34 +26,61 @@ public class ConfigHandler {
private static String[] defaultList = new String[] {"ExampleMob1", "ExampleMob2", "ExampleMob3 (these examples can be deleted)"};
public static void init(File confFile) {
Configuration config = new Configuration(confFile);
if (config == null) {
config = new Configuration(confFile);
syncConfig();
}
}
public static void syncConfig() {
try {
config.load();
//config.load();
disableSunDial = config.get(Configuration.CATEGORY_GENERAL, "Disable Sun Dial", 0, "Disable Sun Dial 0:Default, 1:Disable recipe, 2:Disable completely").getInt(0);
disableXrayBlock = config.get(Configuration.CATEGORY_GENERAL, "Disable Xray Block", 0, "Disable Distortion Flame 0:Default, 1:Disable recipe, 2:Disable completely").getInt(0);
teleporterUsesPerPearl = config.get(Configuration.CATEGORY_GENERAL, "Teleporter Uses PerPearl", 10, "Charm of Dislocation uses per Ender pearl").getInt(10);
teleporterUsesPerPearl = config.get(Configuration.CATEGORY_GENERAL, "Teleporter Uses PerPearl", 1, "Charm of Dislocation uses per Ender pearl").getInt(10);
bowBlockDamage = config.get(Configuration.CATEGORY_GENERAL, "Bow Block Damage", true, "Dose Draconic bow explosion damage blocks").getBoolean(true);
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);
spawnerList = config.getStringList("Spawn List", "Spawner", defaultList, "List of names that will be ether accepted or rejected by the spawner depending on the list type");
soulDropChance = config.get("Spawner", "soulDropChance", 1000, "Mobs have a 1 in this number chance to drop a soul", 1, Integer.MAX_VALUE).getInt(1000);
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);
spawnerList = config.getStringList("Spawn List", "spawner", defaultList, "List of names that will be ether accepted or rejected by the spawner depending on the list type");
soulDropChance = config.get("spawner", "soulDropChance", 1000, "Mobs have a 1 in this number chance to drop a soul", 1, Integer.MAX_VALUE).getInt(1000);
updateFix = config.get(Configuration.CATEGORY_GENERAL, "Update Fix", true, "Convert blocks from v0.9.2 to the v0.2.3+ format (set to false if you are not updating from v0.9.2 or earlier)").getBoolean(true);
//dislocator_Min_Range = config.get("Long Range Dislocator", "Admin Dislocator Min Range", 1000000).getInt(1000000);
//dislocator_Max_Range = config.get("Long Range Dislocator", "Admin Dislocator Max Range", 29000000).getInt(29000000);
admin_dislocator_Min_Range = config.get("Long Range Dislocator", "Dislocator Min Range", 1000).getInt(1000);
admin_dislocator_Max_Range = config.get("Long Range Dislocator", "Dislocator Max Range", 10000).getInt(10000);
admin_dislocator_Detect_Range = config.get("Long Range Dislocator", "Admin Dislocator Detect Range", 5).getInt(5);
disable_LRD = config.get("Long Range Dislocator", "Disable Dislocator", 0, "Disable Long Range Dislocator 0:Default, 1:Disable recipe, 2:Disable completely (Includes Admin Dislocator)").getInt(0);
admin_dislocator_Min_Range = config.get("long range dislocator", "Dislocator Min Range", 1000).getInt(1000);
admin_dislocator_Max_Range = config.get("long range dislocator", "Dislocator Max Range", 10000).getInt(10000);
admin_dislocator_Detect_Range = config.get("long range dislocator", "Admin Dislocator Detect Range", 5).getInt(5);
disable_LRD = config.get("long range dislocator", "Disable Dislocator", 0, "Disable Long Range Dislocator 0:Default, 1:Disable recipe, 2:Disable completely (Includes Admin Dislocator)").getInt(0);
}
catch (Exception e) {
//DraconicEvolution.logger.error("Unable to load Config");
LogHelper.error("Unable to load Config");
e.printStackTrace();
}
finally {
config.save();
}
}
}
/*
{
//config.load();
disableSunDial = config.getInt("Disable Sun Dial", Configuration.CATEGORY_GENERAL, disableSunDial, 0, 2, "Disable Sun Dial 0:Default, 1:Disable recipe, 2:Disable completely");
disableXrayBlock = config.getInt("Disable Xray Block", Configuration.CATEGORY_GENERAL, disableXrayBlock, 0, 2, "Disable Distortion Flame 0:Default, 1:Disable recipe, 2:Disable completely");
teleporterUsesPerPearl = config.getInt("Teleporter Uses PerPearl", Configuration.CATEGORY_GENERAL, teleporterUsesPerPearl, 0, Integer.MAX_VALUE, "Charm of Dislocation uses per Ender pearl");
bowBlockDamage = config.getBoolean(Configuration.CATEGORY_GENERAL, "Bow Block Damage", bowBlockDamage, "Dose Draconic bow explosion damage blocks");
spawnerListType = config.getBoolean("spawner", "listType", spawnerListType, "Sets weather the spawner list is a white list or a black list (true = white list false = black list)");
spawnerList = config.getStringList("Spawn List", "spawner", defaultList, "List of names that will be ether accepted or rejected by the spawner depending on the list type");
soulDropChance = config.getInt("soulDropChance", "spawner", soulDropChance, 1, Integer.MAX_VALUE, "Mobs have a 1 in this number chance to drop a soul");
updateFix = config.getBoolean(Configuration.CATEGORY_GENERAL, "Update Fix", updateFix, "Convert blocks from v0.9.2 to the v0.2.3+ format (set to false if you are not updating from v0.9.2 or earlier)");
//dislocator_Min_Range = config.get("Long Range Dislocator", "Admin Dislocator Min Range", 1000000).getInt(1000000);
//dislocator_Max_Range = config.get("Long Range Dislocator", "Admin Dislocator Max Range", 29000000).getInt(29000000);
admin_dislocator_Min_Range = config.getInt("Dislocator Min Range", "long range dislocator", admin_dislocator_Min_Range, 0, 100000, "");
admin_dislocator_Max_Range = config.getInt("Dislocator Max Range", "long range dislocator", admin_dislocator_Max_Range, 0, 100000, "");
admin_dislocator_Detect_Range = config.getInt("long range dislocator", "Admin Dislocator Detect Range", admin_dislocator_Detect_Range, 0, 100, "");
disable_LRD = config.getInt("Disable Dislocator", "long range dislocator", disable_LRD, 0, 2, "Disable Long Range Dislocator 0:Default, 1:Disable recipe, 2:Disable completely (Includes Admin Dislocator)");
}
*/
@@ -69,6 +69,9 @@ public class CraftingHandler {
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.playerDetectorAdvanced), "ISI", "EDE", "ICI", 'I', ModItems.draconiumIngot, 'E', Items.ender_eye, 'S', new ItemStack(Items.skull, 1, 1), 'C', Items.compass, 'D', ModBlocks.playerDetector);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.generator, 1, 3), "NIN", "IFI", "NCN", 'N', Items.netherbrick, 'I', Items.iron_ingot, 'F', Blocks.furnace, 'C', ModItems.draconicCore);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.energyInfuser), "IPI", "CEC", "IDI", 'I', ModItems.draconiumIngot, 'P', ModBlocks.particleGenerator, 'C', ModItems.draconicCore, 'D', ModItems.infusedCompound, 'E', Blocks.enchanting_table);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.draconium), "III", "III", "III", 'I', ModItems.draconiumIngot);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.energyStorageCore), "SRS", "DCD", "SRS", 'S', Items.nether_star, 'R', Blocks.redstone_block, 'C', ModItems.draconicCore, 'D', ModBlocks.draconium);
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.energyPylon, 2), "IEI", "MCM", "IDI", 'I', ModItems.draconiumIngot, 'E', Items.ender_eye, 'C', ModItems.draconicCore, 'D', Items.diamond, 'M', Items.emerald);
if(ConfigHandler.disableSunDial == 0)
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.sunDial), "IFI", "TDT", "GEG", 'I', ModItems.draconiumIngot, 'F', ModItems.sunFocus, 'T', ModItems.draconicCore, 'G', Blocks.glowstone, 'E', Blocks.enchanting_table, 'D', ModItems.dragonHeart);
@@ -1,5 +1,19 @@
package com.brandon3055.draconicevolution.common.core.handler;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class FMLEventHandler {
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
if(eventArgs.modID.equalsIgnoreCase(References.MODID)) {
ConfigHandler.syncConfig();
LogHelper.info("Config Changed");
}
}
}
@@ -4,7 +4,7 @@ package com.brandon3055.draconicevolution.common.core.handler;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.core.utills.Utills;
import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer;
import com.brandon3055.draconicevolution.common.items.ModItems;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
@@ -12,20 +12,15 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import net.minecraftforge.event.world.ChunkEvent;
import sun.rmi.runtime.Log;
import java.util.ArrayList;
import java.util.List;
@@ -89,7 +84,7 @@ public class MinecraftForgeEventHandler {
EntityLivingBase entity = event.entityLiving;
Entity attacker = event.source.getEntity();
if (attacker == null || !(attacker instanceof EntityPlayer)) { return; }
if (!(((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.draconicSword) || ((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.draconicDistructionStaff) || ((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.draconicBow) || ((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.wyvernBow) || ((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.wyvernSword))) { return; }
if (((EntityPlayer) attacker).getHeldItem() == null || !(((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.draconicSword) || ((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.draconicDistructionStaff) || ((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.draconicBow) || ((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.wyvernBow) || ((EntityPlayer) attacker).getHeldItem().getItem().equals(ModItems.wyvernSword))) { return; }
World world = entity.worldObj;
int rand = random.nextInt(ConfigHandler.soulDropChance);
if (rand == 0) {
@@ -127,7 +122,7 @@ public class MinecraftForgeEventHandler {
for (int x = 0; x < 16; ++x) {
for (int y = 0; y < 16; ++y) {
for (int z = 0; z < 16; ++z) {
changeBlock(storage, x, y, z);
if (changeBlock(storage, x, y, z)) chunk.isModified = true;
}
}
}
@@ -150,8 +145,15 @@ public class MinecraftForgeEventHandler {
}
private boolean makeChange(ExtendedBlockStorage storage, int x, int y, int z, Block block){
if (block == null) return false;
LogHelper.info("Changing block at [X:"+x+" Y:"+y+" Z:"+z+"] from "+storage.getBlockByExtId(x, y, z).getUnlocalizedName()+" to "+block.getUnlocalizedName());
storage.func_150818_a(x, y, z, block);
return true;
}
@SubscribeEvent
public void onEntityConstructing(EntityEvent.EntityConstructing event)
{
if (event.entity instanceof EntityPlayer && ExtendedPlayer.get((EntityPlayer) event.entity) == null) ExtendedPlayer.register((EntityPlayer) event.entity);
}
}
@@ -58,7 +58,7 @@ public class ParticleHandler
int var14 = mc.gameSettings.particleSetting;
if (var14 == 1 && theWorld.rand.nextInt(3) == 0)
{
//var14 = 2;
var14 = 2;
}
double var15 = mc.renderViewEntity.posX - particle.posX;
double var17 = mc.renderViewEntity.posY - particle.posY;
@@ -1,23 +1,24 @@
package com.brandon3055.draconicevolution.common.core.proxy;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.render.*;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.tileentities.TileCustomSpawner;
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
import com.brandon3055.draconicevolution.common.tileentities.TileTestBlock;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
import net.minecraft.client.renderer.tileentity.TileEntityMobSpawnerRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.tileentities.TileParticleGenerator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraftforge.client.MinecraftForgeClient;
public class ClientProxy extends CommonProxy {
private final static boolean debug = DraconicEvolution.debug;
@@ -75,5 +76,7 @@ public class ClientProxy extends CommonProxy {
render = new EnergyPylonRenderer();
ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyPylon.class, render);
RenderingRegistry.registerEntityRenderingHandler(EntityCustomDragon.class, new CustomDragonRenderer());
}
}
@@ -1,47 +1,45 @@
package com.brandon3055.draconicevolution.common.core.proxy;
import com.brandon3055.draconicevolution.common.core.handler.MinecraftForgeEventHandler;
import com.brandon3055.draconicevolution.common.core.network.*;
import com.brandon3055.draconicevolution.common.core.utills.Utills;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.*;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileInvisibleMultiblock;
import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.core.handler.CraftingHandler;
import com.brandon3055.draconicevolution.common.core.handler.FMLEventHandler;
import com.brandon3055.draconicevolution.common.core.handler.MinecraftForgeEventHandler;
import com.brandon3055.draconicevolution.common.core.network.*;
import com.brandon3055.draconicevolution.common.core.utills.Utills;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.*;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnderResurrection;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileInvisibleMultiblock;
import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraftforge.common.MinecraftForge;
public class CommonProxy {
private final static boolean debug = DraconicEvolution.debug;
public void preInit(FMLPreInitializationEvent event)
{
public void preInit(FMLPreInitializationEvent event) {
ConfigHandler.init(event.getSuggestedConfigurationFile());
registerEventListeners();
ModBlocks.init();
ModItems.init();
GameRegistry.registerWorldGenerator(new DraconicWorldGenerator(), 1);
registerTileEntities();
}
public void init(FMLInitializationEvent event)
{
public void init(FMLInitializationEvent event) {
CraftingHandler.init();
registerEventListeners();
registerGuiHandeler();
registerWorldGen();
DraconicEvolution.channelHandler.initialise();
@@ -49,44 +47,41 @@ public class CommonProxy {
registerEntitys();
}
public void postInit(FMLPostInitializationEvent event)
{
public void postInit(FMLPostInitializationEvent event) {
DraconicEvolution.channelHandler.postInitialise();
}
public void registerTileEntities()
{
GameRegistry.registerTileEntity(TileWeatherController.class, "TileWeatherController");
GameRegistry.registerTileEntity(TileSunDial.class, "TileSunDial");
GameRegistry.registerTileEntity(TileGrinder.class, "TileGrinder");
GameRegistry.registerTileEntity(TilePotentiometer.class, "TilePotentiometer");
GameRegistry.registerTileEntity(TileParticleGenerator.class, "TileParticleGenerator");
GameRegistry.registerTileEntity(TilePlayerDetector.class, "TilePlayerDetector");
GameRegistry.registerTileEntity(TilePlayerDetectorAdvanced.class, "TilePlayerDetectorAdvanced");
GameRegistry.registerTileEntity(TileEnergyInfuser.class, "TileEnergyInfuser");
GameRegistry.registerTileEntity(TileCustomSpawner.class, "TileCustomSpawner");
GameRegistry.registerTileEntity(TileGenerator.class, "TileGenerator");
GameRegistry.registerTileEntity(TileEnergyStorageCore.class, "TileEnergyStorageCore");
GameRegistry.registerTileEntity(TileInvisibleMultiblock.class, "TileInvisibleMultiblock");
GameRegistry.registerTileEntity(TileEnergyPylon.class, "TileEnergyPylon");
GameRegistry.registerTileEntity(Utills.TileBlockChanger.class, "TileBlockChanger");
if(DraconicEvolution.debug)
GameRegistry.registerTileEntity(TileTestBlock.class, "TileTestBlock");
public void registerTileEntities() {
GameRegistry.registerTileEntity(TileWeatherController.class, References.RESOURCESPREFIX + "TileWeatherController");
GameRegistry.registerTileEntity(TileSunDial.class, References.RESOURCESPREFIX + "TileSunDial");
GameRegistry.registerTileEntity(TileGrinder.class, References.RESOURCESPREFIX + "TileGrinder");
GameRegistry.registerTileEntity(TilePotentiometer.class, References.RESOURCESPREFIX + "TilePotentiometer");
GameRegistry.registerTileEntity(TileParticleGenerator.class, References.RESOURCESPREFIX + "TileParticleGenerator");
GameRegistry.registerTileEntity(TilePlayerDetector.class, References.RESOURCESPREFIX + "TilePlayerDetector");
GameRegistry.registerTileEntity(TilePlayerDetectorAdvanced.class, References.RESOURCESPREFIX + "TilePlayerDetectorAdvanced");
GameRegistry.registerTileEntity(TileEnergyInfuser.class, References.RESOURCESPREFIX + "TileEnergyInfuser");
GameRegistry.registerTileEntity(TileCustomSpawner.class, References.RESOURCESPREFIX + "TileCustomSpawner");
GameRegistry.registerTileEntity(TileGenerator.class, References.RESOURCESPREFIX + "TileGenerator");
GameRegistry.registerTileEntity(TileEnergyStorageCore.class, References.RESOURCESPREFIX + "TileEnergyStorageCore");
GameRegistry.registerTileEntity(TileInvisibleMultiblock.class, References.RESOURCESPREFIX + "TileInvisibleMultiblock");
GameRegistry.registerTileEntity(TileEnergyPylon.class, References.RESOURCESPREFIX + "TileEnergyPylon");
GameRegistry.registerTileEntity(Utills.TileBlockChanger.class, References.RESOURCESPREFIX + "TileBlockChanger");
GameRegistry.registerTileEntity(TileEnderResurrection.class, References.RESOURCESPREFIX + "TileEnderResurrection");
if (DraconicEvolution.debug)
GameRegistry.registerTileEntity(TileTestBlock.class, "References.RESOURCESPREFIX + TileTestBlock");
}
public void registerEventListeners()
{
public void registerEventListeners() {
MinecraftForge.EVENT_BUS.register(new MinecraftForgeEventHandler());
FMLCommonHandler.instance().bus().register(new FMLEventHandler());
}
public void registerPackets()
{
if(debug){
public void registerPackets() {
if (debug) {
System.out.println("[DEBUG]CommonProxy: registerPackets");
DraconicEvolution.channelHandler.registerPacket(ExamplePacket.class);
}
DraconicEvolution.channelHandler.registerPacket(ButtonPacket.class);
DraconicEvolution.channelHandler.registerPacket(TeleporterPacket.class);
DraconicEvolution.channelHandler.registerPacket(TeleporterStringPacket.class);
@@ -95,19 +90,17 @@ public class CommonProxy {
DraconicEvolution.channelHandler.registerPacket(PlayerDetectorButtonPacket.class);
}
public void registerGuiHandeler()
{
public void registerGuiHandeler() {
new GuiHandler();
}
public void registerWorldGen()
{
public void registerWorldGen() {
GameRegistry.registerWorldGenerator(new DraconicWorldGenerator(), 1);
}
public void registerEntitys(){
public void registerEntitys() {
//int cyan = (0 << 16) + (255 << 8) + 255;
//EntityRegistry.registerGlobalEntityID(EntityCustomDragon.class, References.RESOURCESPREFIX + "EnderDragon", EntityRegistry.findGlobalUniqueEntityId(), cyan, 0);
EntityRegistry.registerModEntity(EntityCustomDragon.class, References.RESOURCESPREFIX + "EnderDragon", 0, DraconicEvolution.instance, 200, 3, true);
EntityRegistry.registerModEntity(EntityCustomDragon.class, "EnderDragon", 0, DraconicEvolution.instance, 500, 3, true);
}
}
@@ -4,10 +4,16 @@ import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import java.util.List;
/**
* Created by Brandon on 25/07/2014.
*/
@@ -17,24 +23,24 @@ public class Utills {
if (value < 1000D)
return String.valueOf(value);
else if (value < 1000000D)
return String.valueOf(Math.round(value/10D)/100D) + "K";
return String.valueOf(Math.round(value)/1000D) + "K";
else if (value < 1000000000D)
return String.valueOf(Math.round(value/10000D)/100D) + "M";
return String.valueOf(Math.round(value/1000D)/1000D) + "M";
else if (value < 1000000000000D)
return String.valueOf(Math.round(value/10000000D)/100D) + "B";
return String.valueOf(Math.round(value/1000000D)/1000D) + "B";
else
return String.valueOf(Math.round(value/10000000000D)/100D) + "T";
return String.valueOf(Math.round(value/1000000000D)/1000D) + "T";
}
public static class BlockChanger extends Block{
private BlockDE block;
public BlockDE block;
public BlockChanger(String name, BlockDE block) {
super(Material.rock);
this.setBlockName(name);
this.block = block;
GameRegistry.registerBlock(this, name);
GameRegistry.registerBlock(this, BlockChangerItem.class ,name);
}
@Override
@@ -72,4 +78,28 @@ public class Utills {
worldObj.removeTileEntity(xCoord,yCoord,zCoord);
}
}
public static class BlockChangerItem extends ItemBlock {
private BlockChanger block;
public BlockChangerItem(Block block) {
super(block);
if (block instanceof BlockChanger) this.block = (BlockChanger)block;
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean p_77663_5_) {
if (entity instanceof EntityPlayer && block.block != null){
EntityPlayer player = (EntityPlayer)entity;
player.inventory.setInventorySlotContents(slot, new ItemStack(Item.getItemFromBlock(block.block), stack.stackSize));
}
}
@SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean p_77624_4_) {
list.add("This block was broken by the update");
list.add("Place it in your inventory to fix it");
}
}
}
@@ -15,6 +15,8 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
@@ -35,22 +37,28 @@ public class EntityCustomDragon extends EntityDragon {
private int portalY = 67;
private int portalZ = 0;
private boolean createPortal = true;
public float attackDamage = 10F;
public EntityCustomDragon(World par1World) {
super(par1World);
this.serverPosX = (int) this.posX;
this.serverPosY = (int) this.posY;
this.serverPosZ = (int) this.posZ;
}
public EntityCustomDragon(World world, double health, float attack){
this(world);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(health);
this.attackDamage = attack;
//LogHelper.info(attackDamage);
this.addPotionEffect(new PotionEffect(10, 600, 10, false));;
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200D);
}
@Override
public void onLivingUpdate() {
float f;
float f1;
@@ -366,10 +374,11 @@ public class EntityCustomDragon extends EntityDragon {
private void attackEntitiesInList(List par1List) {
for (int i = 0; i < par1List.size(); ++i) {
LogHelper.info(attackDamage);
Entity entity = (Entity) par1List.get(i);
if (entity instanceof EntityLivingBase) {
entity.attackEntityFrom(DamageSource.causeMobDamage(this), 10.0F);
entity.attackEntityFrom(DamageSource.causeMobDamage(this), attackDamage);
}
}
}
@@ -555,4 +564,15 @@ public class EntityCustomDragon extends EntityDragon {
this.worldObj.setBlock(par1, b0 + 3, par2, Blocks.bedrock);
}
@Override
public void writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
compound.setFloat("AttackDamage", attackDamage);
}
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
attackDamage = compound.getFloat("AttackDamage");
}
}
@@ -0,0 +1,69 @@
package com.brandon3055.draconicevolution.common.entity;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
/**
* Created by Brandon on 9/08/2014.
*/
public class ExtendedPlayer implements IExtendedEntityProperties {
public final static String EXT_PROP_NAME = "DEPlayerProperties";
private final EntityPlayer player;
private int spawnCount;
public ExtendedPlayer(EntityPlayer player) {
this.player = player;
this.spawnCount = 0;
}
/**
* Used to register these extended properties for the player during EntityConstructing event
* This method is for convenience only; it will make your code look nicer
*/
public static final void register(EntityPlayer player) {
player.registerExtendedProperties(ExtendedPlayer.EXT_PROP_NAME, new ExtendedPlayer(player));
}
/**
* Returns ExtendedPlayer properties for player
* This method is for convenience only; it will make your code look nicer
*/
public static final ExtendedPlayer get(EntityPlayer player) {
return (ExtendedPlayer) player.getExtendedProperties(EXT_PROP_NAME);
}
@Override
public void saveNBTData(NBTTagCompound compound) {
NBTTagCompound properties = new NBTTagCompound();
properties.setInteger("SpawnCount", spawnCount);
compound.setTag(EXT_PROP_NAME, properties);
}
@Override
public void loadNBTData(NBTTagCompound compound) {
NBTTagCompound properties = (NBTTagCompound) compound.getTag(EXT_PROP_NAME);
spawnCount = properties.getInteger("SpawnCount");
LogHelper.info("Read ExtendedPlayer: " + player.getCommandSenderName() + " SpawnCount = " +spawnCount);
}
@Override
public void init(Entity entity, World world) {
}
public int getSpawnCount() {
return spawnCount;
}
/**
* Simple method sets current mana to max mana
*/
public void setSpawnCount(int count) {
spawnCount = count;
}
}
@@ -10,7 +10,7 @@ import net.minecraft.item.ItemStack;
public class DraconicCompound extends ItemDE {
public DraconicCompound() {
this.setUnlocalizedName(Strings.draconicCompoundName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
ModItems.register(this);
}
@@ -15,7 +15,7 @@ import java.util.List;
public class DraconicCore extends ItemDE {
public DraconicCore() {
this.setUnlocalizedName(Strings.draconicCoreName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
ModItems.register(this);
}
@@ -6,7 +6,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
public class DraconiumBlend extends ItemDE {
public DraconiumBlend() {
this.setUnlocalizedName(Strings.draconiumBlendName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
ModItems.register(this);
}
@@ -6,7 +6,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
public class DraconiumDust extends ItemDE {
public DraconiumDust() {
this.setUnlocalizedName(Strings.draconiumDustName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
ModItems.register(this);
}
@@ -6,7 +6,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
public class DraconiumIngot extends ItemDE {
public DraconiumIngot() {
this.setUnlocalizedName(Strings.draconiumIngotName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
ModItems.register(this);
}
@@ -6,7 +6,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
public class DragonHeart extends ItemDE {
public DragonHeart() {
this.setUnlocalizedName(Strings.dragonHeartName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
ModItems.register(this);
}
@@ -6,7 +6,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
public class InfusedCompound extends ItemDE {
public InfusedCompound() {
this.setUnlocalizedName(Strings.infusedCompoundName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
ModItems.register(this);
}
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items;
import com.brandon3055.draconicevolution.common.items.armor.DraconicArmor;
import com.brandon3055.draconicevolution.common.items.armor.WyvernArmor;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
@@ -22,6 +23,7 @@ import com.brandon3055.draconicevolution.common.items.weapons.DraconicSword;
import com.brandon3055.draconicevolution.common.items.weapons.WyvernBow;
import com.brandon3055.draconicevolution.common.items.weapons.WyvernSword;
@GameRegistry.ObjectHolder(References.MODID)
public class ModItems {
public static ArmorMaterial DRACONIUMARMOR_T1 = EnumHelper.addArmorMaterial("DRACONIUMARMOR_T1", -1, new int[] { 3, 8, 6, 3 }, 30);
public static ArmorMaterial DRACONIUMARMOR_T2 = EnumHelper.addArmorMaterial("DRACONIUMARMOR_T2", -1, new int[] { 3, 8, 6, 3 }, 30);
@@ -6,7 +6,7 @@ import com.brandon3055.draconicevolution.common.lib.Strings;
public class SunFocus extends ItemDE {
public SunFocus() {
this.setUnlocalizedName(Strings.sunFocusName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(2));
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
ModItems.register(this);
}
@@ -1,10 +1,8 @@
package com.brandon3055.draconicevolution.common.items.armor;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraftforge.common.ISpecialArmor;
@@ -57,7 +55,7 @@ public class ArmorPropertiesHandler {
ItemStack slotLeggs = player.getEquipmentInSlot(2);
ItemStack slotChest = player.getEquipmentInSlot(3);
ItemStack slotHelmet = player.getEquipmentInSlot(4);
if (slotBoots == null || slotHelmet == null || slotChest == null || slotHelmet == null)
if (slotBoots == null || slotHelmet == null || slotChest == null || slotLeggs == null)
return false;
if(slotBoots.getItem() == ModItems.draconicBoots && slotLeggs.getItem() == ModItems.draconicLeggs && slotChest.getItem() == ModItems.draconicChest && slotHelmet.getItem() == ModItems.draconicHelm)
return true;
@@ -97,7 +95,7 @@ public class ArmorPropertiesHandler {
ItemStack slotLeggs = player.getEquipmentInSlot(2);
ItemStack slotChest = player.getEquipmentInSlot(3);
ItemStack slotHelmet = player.getEquipmentInSlot(4);
if (slotBoots == null || slotHelmet == null || slotChest == null || slotHelmet == null)
if (slotBoots == null || slotHelmet == null || slotChest == null || slotLeggs == null)
return false;
if(slotBoots.getItem() == ModItems.wyvernBoots && slotLeggs.getItem() == ModItems.wyvernLeggs && slotChest.getItem() == ModItems.wyvernChest && slotHelmet.getItem() == ModItems.wyvernHelm)
return true;
@@ -41,7 +41,7 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor{
public DraconicArmor(ArmorMaterial material, int armorType, String name) {
super(material, 0, armorType);
this.setUnlocalizedName(name);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
GameRegistry.registerItem(this, name);
}
@@ -40,7 +40,7 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor{
public WyvernArmor(ArmorMaterial material, int armorType, String name) {
super(material, 0, armorType);
this.setUnlocalizedName(name);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
GameRegistry.registerItem(this, name);
}
@@ -35,7 +35,7 @@ public class DraconicAxe extends ItemAxe implements IEnergyContainerItem{
public DraconicAxe() {
super(ModItems.DRACONIUM_T1);
this.setUnlocalizedName(Strings.draconicAxeName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
GameRegistry.registerItem(this, Strings.draconicAxeName);
}
@@ -68,7 +68,7 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
public DraconicDistructionStaff() {
super(0F, ModItems.DRACONIUM_T3, minableBlocks);
this.setUnlocalizedName(Strings.draconicDStaffName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
this.setHarvestLevel("pickaxe", 4);
this.setHarvestLevel("spade", 4);
this.setHarvestLevel("axe", 4);
@@ -39,7 +39,7 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem{
public DraconicHoe() {
super(ModItems.DRACONIUM_T1);
this.setUnlocalizedName(Strings.draconicHoeName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
GameRegistry.registerItem(this, Strings.draconicHoeName);
}
@@ -41,7 +41,7 @@ public class DraconicPickaxe extends ItemPickaxe implements IEnergyContainerItem
public DraconicPickaxe() {
super(ModItems.DRACONIUM_T2);
this.setUnlocalizedName(Strings.draconicPickaxeName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
GameRegistry.registerItem(this, Strings.draconicPickaxeName);
}
@@ -41,7 +41,7 @@ public class DraconicShovel extends ItemSpade implements IEnergyContainerItem{
public DraconicShovel() {
super(ModItems.DRACONIUM_T2);
this.setUnlocalizedName(Strings.draconicShovelName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
GameRegistry.registerItem(this, Strings.draconicShovelName);
}
@@ -21,7 +21,7 @@ public class Reader extends ItemDE
{
public Reader() {
this.setUnlocalizedName(Strings.readerName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
this.setMaxStackSize(1);
GameRegistry.registerItem(this, Strings.readerName);
}
@@ -33,7 +33,7 @@ public class TeleporterMKI extends ItemDE
public TeleporterMKI() {
this.setUnlocalizedName(Strings.teleporterMKIName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
this.setMaxDamage(19);
this.setMaxStackSize(1);
GameRegistry.registerItem(this, Strings.teleporterMKIName);
@@ -33,7 +33,7 @@ public class TeleporterMKII extends ItemDE
public TeleporterMKII() {
this.setUnlocalizedName(Strings.teleporterMKIIName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
this.setMaxStackSize(1);
GameRegistry.registerItem(this, Strings.teleporterMKIIName);
}
@@ -1,9 +1,5 @@
package com.brandon3055.draconicevolution.common.items.tools;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
@@ -24,6 +20,10 @@ import net.minecraft.util.*;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings.GameType;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ToolHandler {
public static Material[] materialsPick = {Material.anvil, Material.circuits, Material.coral, Material.glass, Material.ice, Material.iron, Material.rock};
public static Material[] materialsShovel = {Material.clay, Material.ground, Material.grass, Material.sand, Material.snow, Material.craftedSnow};
@@ -40,7 +40,7 @@ public class WyvernPickaxe extends ItemPickaxe implements IEnergyContainerItem{
public WyvernPickaxe() {
super(ModItems.DRACONIUM_T1);
this.setUnlocalizedName(Strings.wyvernPickaxeName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
GameRegistry.registerItem(this, Strings.wyvernPickaxeName);
}
@@ -40,7 +40,7 @@ public class WyvernShovel extends ItemSpade implements IEnergyContainerItem{
public WyvernShovel() {
super(ModItems.DRACONIUM_T1);
this.setUnlocalizedName(Strings.wyvernShovelName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
GameRegistry.registerItem(this, Strings.wyvernShovelName);
}
@@ -35,7 +35,7 @@ public class DraconicBow extends ItemBow
public DraconicBow() {
this.maxStackSize = 1;
this.setMaxDamage(-1);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
this.setUnlocalizedName(Strings.draconicBowName);
GameRegistry.registerItem(this, Strings.draconicBowName);
}
@@ -30,7 +30,7 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem{
public DraconicSword() {
super(ModItems.DRACONIUM_T2);
this.setUnlocalizedName(Strings.draconicSwordName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
GameRegistry.registerItem(this, Strings.draconicSwordName);
}
@@ -1,7 +1,13 @@
package com.brandon3055.draconicevolution.common.items.weapons;
import java.util.List;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@@ -17,14 +23,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import java.util.List;
public class WyvernBow extends ItemBow {
public static final String[] bowPullIconNameArray = new String[] { "pulling_0", "pulling_1", "pulling_2" };
@@ -34,7 +33,7 @@ public class WyvernBow extends ItemBow {
public WyvernBow() {
this.maxStackSize = 1;
this.setMaxDamage(-1);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
this.setUnlocalizedName(Strings.wyvernBowName);
GameRegistry.registerItem(this, Strings.wyvernBowName);
}
@@ -33,7 +33,7 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem{
public WyvernSword() {
super(ModItems.DRACONIUM_T1);
this.setUnlocalizedName(Strings.wyvernSwordName);
this.setCreativeTab(DraconicEvolution.getCreativeTab(1));
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
GameRegistry.registerItem(this, Strings.wyvernSwordName);
}
@@ -3,10 +3,11 @@ package com.brandon3055.draconicevolution.common.lib;
public class References {
public static final String MODID = "DraconicEvolution";
public static final String MODNAME = "Draconic Evolution";
public static final String VERSION = "0.9.2-Beta";
public static final String VERSION = "0.9.32-Beta";
public static final String MCVERSION = "1.7.10";
public static final String CLIENTPROXYLOCATION = "com.brandon3055.draconicevolution.common.core.proxy.ClientProxy";
public static final String COMMONPROXYLOCATION = "com.brandon3055.draconicevolution.common.core.proxy.CommonProxy";
public static final String GUIFACTORY = "com.brandon3055.draconicevolution.client.interfaces.DEGUIFactory";
public static final String RESOURCESPREFIX = MODID.toLowerCase() + ":";
@@ -0,0 +1,382 @@
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles;
import com.brandon3055.draconicevolution.client.render.Particles.AdvancedSeekerParticle;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper;
import com.brandon3055.draconicevolution.common.core.handler.ParticleHandler;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
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.ChatComponentTranslation;
import java.util.Random;
/**
* Created by Brandon on 8/08/2014.
*/
public class TileEnderResurrection extends TileEntity{
private MultiblockHelper.TileLocation diamondPillars[] = new MultiblockHelper.TileLocation[4];
private MultiblockHelper.TileLocation draconiumPillars[] = new MultiblockHelper.TileLocation[4];
private ExtendedPlayer playerProps;
private EntityPlayer owner;
private boolean spawnInProgress = false;
private int timer = 0;
private double level = 0;
public TileEnderResurrection(){
for (int i = 0; i < diamondPillars.length; i++)
{
diamondPillars[i] = new MultiblockHelper.TileLocation();
}
for (int i = 0; i < draconiumPillars.length; i++)
{
draconiumPillars[i] = new MultiblockHelper.TileLocation();
}
}
@Override
public void updateEntity() {
if (spawnInProgress){
//if (timer < 1800) timer = 2200;
if (timer % 10 == 0 && !arePillarsValid() || !isBaseValid()) spawnInProgress = false;
effectDrive();
findAndActivateChrystals(timer - 200, true);
if (timer > 2390 && arePillarsValid() && isBaseValid()) {
spawn();
spawnInProgress = false;
}
timer++;
}
}
private void spawn(){
if (owner == null) return;
for (int i = 0; i < diamondPillars.length; i++){
if (diamondPillars[i] == null) return;
worldObj.setBlockToAir(diamondPillars[i].getXCoord(), diamondPillars[i].getYCoord(), diamondPillars[i].getZCoord());
if (!worldObj.isRemote) worldObj.createExplosion(owner, diamondPillars[i].getXCoord() + 0.5, diamondPillars[i].getYCoord() + 0.5, diamondPillars[i].getZCoord() + 0.5, 3, true);
}
for (int i = 0; i < draconiumPillars.length; i++){
if (draconiumPillars[i] == null) return;
worldObj.setBlockToAir(draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord(), draconiumPillars[i].getZCoord());
if (!worldObj.isRemote) worldObj.createExplosion(owner, draconiumPillars[i].getXCoord() + 0.5, draconiumPillars[i].getYCoord() + 0.5, draconiumPillars[i].getZCoord() + 0.5, 3, true);
}
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
if (!worldObj.isRemote) worldObj.createExplosion(owner, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 3, true);
if (!worldObj.isRemote) worldObj.createExplosion(null, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 10, false);
if (level > 10) level = 10;
EntityCustomDragon dragon = new EntityCustomDragon(worldObj, 200D + level * 50, 10F + (float)level * 5F);
dragon.setPosition(xCoord, yCoord + 60, zCoord);
dragon.onSpawnWithEgg(null);
if (!worldObj.isRemote)
worldObj.spawnEntityInWorld(dragon);
playerProps.setSpawnCount(playerProps.getSpawnCount()+1);
}
private void lEffects() {
int x = -100+worldObj.rand.nextInt(200);
int z = -100+worldObj.rand.nextInt(200);
EntityLightningBolt bolt = new EntityLightningBolt(worldObj, x, worldObj.getTopSolidOrLiquidBlock(z, z)-1, z);
if (!worldObj.isRemote)
worldObj.addWeatherEffect(bolt);
EntityPlayer p = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 100);
float yaw = p.rotationYaw;
float pitch = p.rotationPitch;
float mod = 0.1F;
yaw += worldObj.rand.nextBoolean() ? mod : -mod;
pitch += worldObj.rand.nextBoolean() ? mod : -mod;
//yaw += (-0.5F+worldObj.rand.nextFloat())*mod;
//pitch += (-0.5F+worldObj.rand.nextFloat())*mod;
if (worldObj.isRemote)
p.setLocationAndAngles(p.posX, p.posY-1.6, p.posZ, yaw, pitch);
}
private void effectDrive(){
if (timer == 1 || worldObj.rand.nextInt(50) == 0) randomBolt();
if (timer > 100 && worldObj.rand.nextInt(Math.max(1, 50 - (timer/40))) == 0) randomBolt();
if (timer == 10 || timer == 20 || timer == 30 || timer == 40) draconiumStrikes(timer/10);
if (worldObj.rand.nextInt(50) == 0) draconiumStrikes(worldObj.rand.nextInt(4) + 1);
if (timer > 60 && worldObj.isRemote) coreParticles();
findAndActivateChrystals(timer, false);
findAndActivateChrystals(timer - 50, false);
findAndActivateChrystals(timer - 100, false);
//if (timer == 1) worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "draconicevolution:boom", 10F, worldObj.rand.nextFloat() * 0.1F + 0.9F);
//if (timer == 1 || worldObj.rand.nextInt(50) == 0) worldObj.playSoundEffect(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "ambient.weather.thunder", 10F, worldObj.rand.nextFloat() * 0.1F + 0.9F);
if (worldObj.rand.nextInt(50) == 0 && timer < 300) centreStrike();
}
private void draconiumStrikes(int pillar){
if (pillar != 1 && pillar != 2 && pillar != 3 && pillar != 4) return;
pillar--;
if (draconiumPillars[pillar] == null) return;
EntityLightningBolt bolt = new EntityLightningBolt(worldObj, draconiumPillars[pillar].getXCoord(), draconiumPillars[pillar].getYCoord(), draconiumPillars[pillar].getZCoord());
if (!worldObj.isRemote)
worldObj.addWeatherEffect(bolt);
}
private void findAndActivateChrystals(int y, boolean spawnCrystal){
if (worldObj.isRemote) return;
if (y < 0 || y > 250) return;
for (int x = -200; x < 200; x++){
for (int z = -200; z < 200; z++){
if (worldObj.getBlock(x, y, z) == Blocks.bedrock){
boolean flag = true;
for (int x1 = x-1; x1 <= x+1; x1++){
for (int y1 = y-1; y1 <= y+1; y1++){
for (int z1 = z-1; z1 <= z+1; z1++){
if ((x1 != x || y1 != y || z1 != z) && worldObj.getBlock(x1, y1, z1) == Blocks.bedrock) flag = false;
}
}
}
if (flag && !worldObj.isRemote) {
if (spawnCrystal) {
//EntityEnderCrystal crystal = new EntityEnderCrystal(worldObj);
//crystal.setPosition(x + 0.5, y + 1, z + 0.5);
//worldObj.spawnEntityInWorld(crystal);
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setString("id", "EnderCrystal");
Entity crystal = EntityList.createEntityFromNBT(nbttagcompound, worldObj);
crystal.setPosition(x + 0.5, y + 1, z + 0.5);
worldObj.spawnEntityInWorld(crystal);
}else
worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, x, y + 1, z));
}
}
}
}
}
private void centreStrike(){
EntityLightningBolt bolt = new EntityLightningBolt(worldObj, xCoord, yCoord, zCoord);
if (!worldObj.isRemote)
worldObj.addWeatherEffect(bolt);
}
private void randomBolt(){
int x = -100+worldObj.rand.nextInt(200);
int z = -100+worldObj.rand.nextInt(200);
EntityLightningBolt bolt = new EntityLightningBolt(worldObj, x, worldObj.getTopSolidOrLiquidBlock(z, z)-1, z);
if (!worldObj.isRemote)
worldObj.addWeatherEffect(bolt);
}
public boolean onActivated(EntityPlayer player){
boolean flag = true;
if (player.dimension != 1) return true;
if (xCoord > 80 || zCoord > 80 || xCoord < -80 || zCoord < -80){
if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.SpawnDragonToFarFrom00.txt"));
return false;
}
playerProps = ExtendedPlayer.get(player);
owner = player;
if (spawnInProgress) {
for (int i = 0; i < draconiumPillars.length; i++){
if (draconiumPillars[i] == null || !arePillarsValid()) return false;
worldObj.setBlock(draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord(), draconiumPillars[i].getZCoord(), ModBlocks.draconium);
}
flag = false;
}
if (!isBaseValid()) flag = false;
if (!findPillars()) flag = false;
if (!arePillarsValid()) flag = false;
if (!spawnInProgress && flag) timer = 0;
spawnInProgress = flag;
level = (double)playerProps.getSpawnCount() / 2D;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
if (flag && !worldObj.isRemote) LogHelper.info("Starting Ritual of Ender Resurrection (Level "+level+")");
return flag;
}
private boolean isBaseValid(){
if (worldObj.getBlock(xCoord+1, yCoord, zCoord) != Blocks.obsidian || worldObj.getBlock(xCoord-1, yCoord, zCoord) != Blocks.obsidian || worldObj.getBlock(xCoord, yCoord, zCoord+1) != Blocks.obsidian || worldObj.getBlock(xCoord, yCoord, zCoord-1) != Blocks.obsidian) return false;
if (worldObj.getBlock(xCoord+1, yCoord, zCoord+1) != Blocks.glowstone || worldObj.getBlock(xCoord-1, yCoord, zCoord-1) != Blocks.glowstone || worldObj.getBlock(xCoord-1, yCoord, zCoord+1) != Blocks.glowstone || worldObj.getBlock(xCoord+1, yCoord, zCoord-1) != Blocks.glowstone) return false;
return true;
}
private boolean arePillarsValid(){
for (int i = 0; i < diamondPillars.length; i++){
if (diamondPillars[i] == null) return false;
if (worldObj.getBlock(diamondPillars[i].getXCoord(), diamondPillars[i].getYCoord(), diamondPillars[i].getZCoord()) != Blocks.diamond_block || worldObj.getBlock(diamondPillars[i].getXCoord(), diamondPillars[i].getYCoord()-1, diamondPillars[i].getZCoord()) != Blocks.quartz_block) return false;
}
for (int i = 0; i < draconiumPillars.length; i++){
if (draconiumPillars[i] == null) return false;
if ((worldObj.getBlock(draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord(), draconiumPillars[i].getZCoord()) != ModBlocks.draconium && worldObj.getBlockMetadata(draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord(), draconiumPillars[i].getZCoord()) != 2) || worldObj.getBlock(draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord()-1, draconiumPillars[i].getZCoord()) != Blocks.quartz_block || worldObj.getBlock(draconiumPillars[i].getXCoord(), draconiumPillars[i].getYCoord()-2, draconiumPillars[i].getZCoord()) != Blocks.quartz_block) return false;
}
return true;
}
private boolean findPillars(){
int xzRange = 6;
int draconiumCount = 0;
int diamondCount = 0;
for (int x = xCoord - xzRange; x < xCoord + xzRange; x++){
for (int y = yCoord +2; y < yCoord + 5; y++){
for (int z = zCoord - xzRange; z < zCoord + xzRange; z++){
if (worldObj.getBlock(x, y, z) == ModBlocks.draconium && isPillarValid(0, x, y, z) && worldObj.getBlockMetadata(x, y, z) == 2 && draconiumCount < 4){
draconiumPillars[draconiumCount] = new MultiblockHelper.TileLocation(x, y, z);
draconiumCount++;
}
}
}
}
for (int x = xCoord - xzRange; x < xCoord + xzRange; x++){
for (int y = yCoord +1; y < yCoord + 4; y++){
for (int z = zCoord - xzRange; z < zCoord + xzRange; z++){
if (worldObj.getBlock(x, y, z) == Blocks.diamond_block && isPillarValid(1, x, y, z) && diamondCount < 4){
diamondPillars[diamondCount] = new MultiblockHelper.TileLocation(x, y, z);
diamondCount++;
}
}
}
}
return draconiumCount == 4 && diamondCount == 4;
}
@SideOnly(Side.CLIENT)
private void coreParticles(){
Random rand = new Random();
{
float mM = 0.4F;
for (int i = 0; i < draconiumPillars.length; i++){
if (draconiumPillars[i] == null) return;
AdvancedSeekerParticle particle = new AdvancedSeekerParticle(worldObj, draconiumPillars[i].getXCoord()+0.5, draconiumPillars[i].getYCoord()+0.5, draconiumPillars[i].getZCoord()+0.5, xCoord+0.5, yCoord+0.5, zCoord+0.5, 2, 0F, 1.0F, 1.0F, 100);
AdvancedSeekerParticle particle2;
if (timer < 300)
particle2 = new AdvancedSeekerParticle(worldObj, draconiumPillars[i].getXCoord()+0.5, draconiumPillars[i].getYCoord()+0.5, draconiumPillars[i].getZCoord()+0.5, xCoord+0.5, yCoord+0.5, zCoord+0.5, 1, 1F, 0.0F, 0F, 40);
else {
particle2 = new AdvancedSeekerParticle(worldObj, draconiumPillars[i].getXCoord() + 0.5, draconiumPillars[i].getYCoord() + 0.5, draconiumPillars[i].getZCoord() + 0.5, xCoord + rand.nextFloat(), yCoord + 3 + rand.nextFloat(), zCoord + rand.nextFloat(), 3, 1F, 0.0F, 0F, 70, timer);
}
if (timer > 2000){
AdvancedSeekerParticle toDiamond = new AdvancedSeekerParticle(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, diamondPillars[i].getXCoord() + rand.nextFloat(), diamondPillars[i].getYCoord() + rand.nextFloat(), diamondPillars[i].getZCoord() + rand.nextFloat(), 3, 0, 1, 0, 100);
ParticleHandler.spawnCustomParticle(toDiamond, 250);
if (timer > 2100){
AdvancedSeekerParticle toSpawn = new AdvancedSeekerParticle(worldObj, diamondPillars[i].getXCoord() + rand.nextFloat(), diamondPillars[i].getYCoord() + rand.nextFloat(), diamondPillars[i].getZCoord() + rand.nextFloat(), xCoord - 3.5 + (double)(rand.nextFloat()*7F), yCoord+60+rand.nextInt(5), zCoord - 3.5 + (double)(rand.nextFloat()*7F), 3, 0F, 1F, 0F, 100, timer);
ParticleHandler.spawnCustomParticle(toSpawn, 250);
}
}
particle.motionX = (rand.nextFloat()-0.5)*mM;
particle.motionZ = (rand.nextFloat()-0.5)*mM;
particle2.motionX = (rand.nextFloat()-0.5)*mM;
particle2.motionZ = (rand.nextFloat()-0.5)*mM;
ParticleHandler.spawnCustomParticle(particle, 250);
ParticleHandler.spawnCustomParticle(particle2, 250);
}
if (timer > 300)
{
int t;
if (timer > 700)
t = timer;
else
t = 700;
AdvancedSeekerParticle particle3 = new AdvancedSeekerParticle(worldObj, xCoord + rand.nextFloat(), yCoord + 0.5, zCoord + rand.nextFloat(), xCoord + rand.nextFloat(), yCoord + 3 + rand.nextFloat(), zCoord + rand.nextFloat(), 3, 0F, 1.0F, 1.0F, 70, t);
ParticleHandler.spawnCustomParticle(particle3, 250);
}
if (timer > 1000){
float red;
float green;
float blue;
float f = rand.nextFloat() * 0.6F + 0.4F;
red = green = blue = 1.0F * f;
green *= 0.3F;
red *= 0.9F;
AdvancedSeekerParticle particle4 = new AdvancedSeekerParticle(worldObj, xCoord + 0.5, yCoord + 3.5, zCoord + 0.5, xCoord + rand.nextFloat(), yCoord + 3 + rand.nextFloat(), zCoord + rand.nextFloat(), 1, red, green, blue, 100);
particle4.motionX = (rand.nextFloat()-0.5)*mM;
particle4.motionZ = (rand.nextFloat()-0.5)*mM;
ParticleHandler.spawnCustomParticle(particle4, 250);
}
}
}
/**Draconium = 0, Diamond = 1*/
private boolean isPillarValid(int type, int x, int y, int z){
if (type == 0)
{
if (worldObj.getBlock(x, y-1, z) == Blocks.quartz_block && worldObj.getBlock(x, y-2, z) == Blocks.quartz_block && worldObj.getBlockMetadata(x, y-1, z) == 2 && worldObj.getBlockMetadata(x, y-2, z) == 2) return true;
}else if (type == 1)
{
if (worldObj.getBlock(x, y-1, z) == Blocks.quartz_block && worldObj.getBlockMetadata(x, y-1, z) == 2) return true;
}
return false;
}
@Override
public void writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
compound.setBoolean("SpawnInProgress", spawnInProgress);
compound.setInteger("Timer", timer);
for (int i = 0; i < diamondPillars.length; i++){
if (diamondPillars[i] != null)
diamondPillars[i].writeToNBT(compound, String.valueOf(i));
}
for (int i = 0; i < draconiumPillars.length; i++){
if (draconiumPillars[i] != null)
draconiumPillars[i].writeToNBT(compound, "D"+String.valueOf(i));
}
}
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
spawnInProgress = compound.getBoolean("SpawnInProgress");
timer = compound.getInteger("Timer");
for (int i = 0; i < diamondPillars.length; i++){
if (diamondPillars[i] != null)
diamondPillars[i].readFromNBT(compound, String.valueOf(i));
}
for (int i = 0; i < draconiumPillars.length; i++){
if (draconiumPillars[i] != null)
draconiumPillars[i].readFromNBT(compound, "D"+String.valueOf(i));
}
}
@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());
}
}
@@ -62,10 +62,9 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {
public void onActivated(){
if (!active){
active = isValidStructure();
findMaster();
return;
}
findMaster();
if (input){
storage.setMaxReceive(0);
storage.setMaxExtract(500000);
@@ -83,7 +82,7 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {
int maxRecived = (int)Math.min(storage.getMaxEnergyStored() - storage.getEnergyStored(), getMaster().getEnergyStored());
storage.modifyEnergyStored(maxRecived);
getMaster().extractEnergy(maxRecived, false);
particleRate = maxRecived / 40;
particleRate = maxRecived / 80;
if (particleRate > 100) particleRate = 100;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}else {
@@ -110,7 +109,7 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {
int maxSent = (int)Math.min(getMaster().getMaxEnergyStored() - getMaster().getEnergyStored(), storage.getEnergyStored());
storage.modifyEnergyStored(-maxSent);
getMaster().receiveEnergy(maxSent, false);
particleRate = maxSent / 40;
particleRate = maxSent / 80;
if (particleRate > 100) particleRate = 100;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}else {
@@ -156,7 +155,7 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {
double targetX;
double targetY;
double targetZ;
if (particleRate > 100) particleRate = 100;
if (particleRate > 20) particleRate = 20;
if (input){
spawnX = x+0.5 - disMod + (rand.nextFloat() * (disMod*2));
spawnY = y+0.5 - disMod + (rand.nextFloat() * (disMod*2));
@@ -164,9 +163,9 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {
targetX = xCoord + 0.5;
targetY = cYCoord + 0.5;
targetZ = zCoord + 0.5;
if (rand.nextFloat() < 0.1F) {
if (rand.nextFloat() < 0.05F) {
Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle(worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, true);
ParticleHandler.spawnCustomParticle(passiveParticle, 50);
ParticleHandler.spawnCustomParticle(passiveParticle, 35);
}
if (particleRate > 0){
if (particleRate > 10) {
@@ -175,14 +174,14 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {
spawnY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2));
spawnZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2));
Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle(worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false);
ParticleHandler.spawnCustomParticle(passiveParticle, 50);
ParticleHandler.spawnCustomParticle(passiveParticle, 35);
}
}else if (rand.nextInt(Math.max(1, 10 - particleRate)) == 0){
spawnX = x + 0.5 - disMod + (rand.nextFloat() * (disMod * 2));
spawnY = y + 0.5 - disMod + (rand.nextFloat() * (disMod * 2));
spawnZ = z + 0.5 - disMod + (rand.nextFloat() * (disMod * 2));
Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle(worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false);
ParticleHandler.spawnCustomParticle(passiveParticle, 50);
ParticleHandler.spawnCustomParticle(passiveParticle, 35);
}
}
@@ -193,9 +192,9 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {
spawnX = xCoord + 0.5;
spawnY = cYCoord + 0.5;
spawnZ = zCoord + 0.5;
if (rand.nextFloat() < 0.1F) {
if (rand.nextFloat() < 0.05F) {
Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle(worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, true);
ParticleHandler.spawnCustomParticle(passiveParticle, 50);
ParticleHandler.spawnCustomParticle(passiveParticle, 35);
}
if (particleRate > 0){
@@ -205,14 +204,14 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {
targetY = y+0.5 - disMod + (rand.nextFloat() * (disMod*2));
targetZ = z+0.5 - disMod + (rand.nextFloat() * (disMod*2));
Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle(worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false);
ParticleHandler.spawnCustomParticle(passiveParticle, 50);
ParticleHandler.spawnCustomParticle(passiveParticle, 35);
}
}else if (rand.nextInt(Math.max(1, 10 - particleRate)) == 0){
targetX = x+0.5 - disMod + (rand.nextFloat() * (disMod*2));
targetY = y+0.5 - disMod + (rand.nextFloat() * (disMod*2));
targetZ = z+0.5 - disMod + (rand.nextFloat() * (disMod*2));
Particles.EnergyTransferParticle passiveParticle = new Particles.EnergyTransferParticle(worldObj, spawnX, spawnY, spawnZ, targetX, targetY, targetZ, false);
ParticleHandler.spawnCustomParticle(passiveParticle, 50);
ParticleHandler.spawnCustomParticle(passiveParticle, 35);
}
}
}
@@ -234,6 +233,13 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {
input = compound.getBoolean("Input");
masterLocation.readFromNBT(compound, "Master");
particleRate = compound.getShort("ParticleRate");
if (input){
storage.setMaxReceive(0);
storage.setMaxExtract(500000);
}else{
storage.setMaxReceive(500000);
storage.setMaxExtract(0);
}
}
@Override
@@ -28,7 +28,7 @@ public class TileEnergyStorageCore extends TileEntity {
private double capacity = 0;
private int maxReceive = 1000000;
private int maxExtract = 1000000;
private boolean loaded = false;
public TileEnergyStorageCore(){
for (int i = 0; i < stabilizers.length; i++)