13/12/2014

This commit is contained in:
brandon3055 committed 2014-12-13 05:16:42 +11:00
1 parent fa0a6bbcd5
commit 91317dbeca
22 files changed
+289 -245

No files matched your search

@@ -30,7 +30,7 @@ public class DraconicEvolution { // TODO Update Licence and add change log to gi
public static final String networkChannelName = "DraconicEvolution";
public static SimpleNetworkWrapper network;
public static boolean debug = true;
public static boolean debug = false;//todo
public static Enchantment reaperEnchant;
@@ -49,7 +49,7 @@ public class DraconicEvolution { // TODO Update Licence and add change log to gi
event.getModMetadata().description = "This is a mod originally made for the Tolkiencraft mod pack";
event.getModMetadata().authorList = Arrays.asList("brandon3055");
event.getModMetadata().logoFile = "banner.png";
event.getModMetadata().url = "http://dragontalk.net/draconic_evolution";
event.getModMetadata().url = "http://www.tolkiencraft.com/draconic-evolution/";
event.getModMetadata().version = References.VERSION + "-MC1.7.10";
proxy.preInit(event);
@@ -16,7 +16,7 @@ public class DETab extends CreativeTabs {
static ItemStack iconStackStaff;
public static void initialize() {
iconStackStaff = ItemNBTHelper.setInteger(new ItemStack(ModItems.draconicDestructionStaff), "Energy", 100000000);
iconStackStaff = ItemNBTHelper.setInteger(new ItemStack(ModItems.draconicDestructionStaff), "Energy", 30000000);
}
public DETab(int id, String modid, String label, int tab) {
@@ -112,7 +112,7 @@ public class CraftingInfoPage extends TitledPage {
int offset = 0;
for (String s : getFormattedText(fontRendererObj)) {
if (s == null) break;
if (s.substring(0,2).equals("\\%")){
if (s.contains("\\%") && s.substring(0,2).equals("\\%")){
s = s.substring(2);
offset += fontRendererObj.FONT_HEIGHT/2;
}
@@ -11,7 +11,7 @@ import java.util.List;
/**
* Created by Brandon on 20/09/2014.
*/
public class EnergyCoreTutorialPage extends TutorialPage {
public class EnergyCoreTutorialPage extends TutorialPage {
public static final ResourceLocation Energy_Core = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/T5_Energy_Core.png");
public static final ResourceLocation Stabilizer_Placement = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Stabilizer_Placement.png");
public static final ResourceLocation Core_Tiers = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Core_Tiers.png");
@@ -20,7 +20,7 @@ public class EnergyCoreTutorialPage extends TutorialPage {
public static final ResourceLocation Pylon_Particles_2 = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Energy_Pylon_Particles_2.png");
public static final ResourceLocation Pylon_y_Placement = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/images/Pylon_y_Placement.png");
@SuppressWarnings("unchecked")
public EnergyCoreTutorialPage(String name, PageCollection collection) {
super(name, collection, StatCollector.translateToLocal("manual.de.ecth.txt"));
this.lastPage = 11;
@@ -106,8 +106,8 @@ public class EnergyCoreTutorialPage extends TutorialPage {
GL11.glScaled(imageScale, imageScale, 1D);
double scaleMult = 0.21;
int yOffset = (int)((minecraft.getSystemTime()/2000 % 2)*22);
drawTexturedModalRect((int)((offsetX+49)*scaleMult), (int)((offsetY+15)*scaleMult), 180, 0+yOffset, 30, 20);
int yOffset = (int)((Minecraft.getSystemTime()/2000 % 2)*22);
drawTexturedModalRect((int)((offsetX+49)*scaleMult), (int)((offsetY+15)*scaleMult), 180, yOffset, 30, 20);
GL11.glPopMatrix();
drawCenteredString(fontRendererObj, "Tier 1", offsetX+128, offsetY+107, 0xff0000);
addDescription(minecraft, offsetX, offsetY+45, getFormattedText(fontRendererObj, ttl("manual.de.ectdpage2.txt"), 4));
@@ -102,6 +102,7 @@ public class GuiManual extends GuiScreen {
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.potentiometer), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.rainSensor), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconiumBlock), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconicBlock), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.energyStorageCore), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.energyPylon), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconiumBlock, 1, 1), ""));
@@ -110,10 +111,10 @@ public class GuiManual extends GuiScreen {
pageCollection.addPage(new EnergyCoreTutorialPage("TUTORIAL."+getNextPageIndex(), pageCollection).setIndexName(StatCollector.translateToLocal("manual.de.ecth.txt")));
pageCollection.addPage(new EnderResurrectionTutorialPage("TUTORIAL."+getNextPageIndex(), pageCollection).setIndexName("manual.de.roerth.txt"));
pageCollection.addPage(new DescriptionPage("INFO"+getNextPageIndex(), pageCollection, "manual.de.endercomet.description").setIndexName("manual.de.endercomet.txt"));
pageCollection.addPage(new DescriptionPage("INFO"+getNextPageIndex(), pageCollection, "manual.de.chaosisland.description").setIndexName("manual.de.enderisland.txt"));
pageCollection.addPage(new DescriptionPage("INFO"+getNextPageIndex(), pageCollection, "manual.de.placeditems.description").setIndexName("manual.de.placeditems.txt"));
pageCollection.addPage(new DescriptionPage("INFO"+getNextPageIndex(), pageCollection, "manual.de.pigmenBloodRage.description").setIndexName("manual.de.pigmenBloodRage.txt"));
pageCollection.addPage(new DescriptionPage("INFO."+getNextPageIndex(), pageCollection, "manual.de.endercomet.description").setIndexName("manual.de.endercomet.txt"));
pageCollection.addPage(new DescriptionPage("INFO."+getNextPageIndex(), pageCollection, "manual.de.chaosisland.description").setIndexName("manual.de.enderisland.txt"));
pageCollection.addPage(new DescriptionPage("INFO."+getNextPageIndex(), pageCollection, "manual.de.placeditems.description").setIndexName("manual.de.placeditems.txt"));
pageCollection.addPage(new DescriptionPage("INFO."+getNextPageIndex(), pageCollection, "manual.de.pigmenBloodRage.description").setIndexName("manual.de.pigmenBloodRage.txt"));
pageCollection.addPage(new IndexPage("INDEX", pageCollection));
return pageCollection;
@@ -36,7 +36,11 @@ public class IntroPage extends BasePage {
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(2.5F, 2.5F, 1F);
drawCenteredString(minecraft.fontRenderer, ttl("manual.de.userGuide.txt"), (int) ((offsetX + 128) / 2.5), (int) ((offsetY + 128) / 2.5), 0x00b400);
drawCenteredString(fontRendererObj, ttl("manual.de.userGuide.txt"), (int) ((offsetX + 128) / 2.5), (int) ((offsetY + 128) / 2.5), 0x00b400);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(0.5F, 0.5F, 0.5F);
fontRendererObj.drawString("This gui is a work in progress", (offsetX + 4)*2, (offsetY + 194)*2, 0x000000);
GL11.glPopMatrix();
}
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.client.interfaces.manual;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.Minecraft;
@@ -62,32 +63,39 @@ public class TutorialPage extends TitledPage {
}
@SuppressWarnings("unchecked")
public List<String> getFormattedText(FontRenderer fr, String raw, int descriptionIndex) {
public List<String> getFormattedText(FontRenderer fr, String rawDescription, int descriptionIndex) {
if (formattedDescription[descriptionIndex] == null) {
if (Strings.isNullOrEmpty(raw)) formattedDescription[descriptionIndex] = ImmutableList.of();
else formattedDescription[descriptionIndex] = ImmutableList.copyOf(fr.listFormattedStringToWidth(raw, 370));
List<String> modified = new ArrayList();
for (int i = 0; i < formattedDescription[descriptionIndex].size(); i++){
String line = formattedDescription[descriptionIndex].get(i);
if (!line.contains("\\n")) modified.add(line);
else {
String joinedLine = "";
for (i=i; i < formattedDescription[descriptionIndex].size(); i++) joinedLine = joinedLine + formattedDescription[descriptionIndex].get(i);
int escape = 0;
while (!joinedLine.isEmpty() && escape < 20) {
int index = 0;
if (joinedLine.contains("\\n")) index = joinedLine.indexOf("\\n");
else index = joinedLine.length();
String s = joinedLine.substring(0, index);
modified.add(s);
joinedLine = joinedLine.substring(index);
joinedLine = joinedLine.replaceFirst("\\n", "");
escape++;
}
formattedDescription[descriptionIndex] = new ArrayList<String>();
if (Strings.isNullOrEmpty(rawDescription)) {
formattedDescription[descriptionIndex] = ImmutableList.of();
return formattedDescription[descriptionIndex];
}
if (!rawDescription.contains("\\n")) {
formattedDescription[descriptionIndex] = ImmutableList.copyOf(fr.listFormattedStringToWidth(rawDescription, 370));
return formattedDescription[descriptionIndex];
}
List<String> segments = new ArrayList(); //Each separate string that is separated by a \n
String raw = rawDescription;
int escape = 0;
while (raw.contains("\\n")) {
segments.add(raw.substring(0, raw.indexOf("\\n")));
raw = raw.substring(raw.indexOf("\\n") + 2);
if (!raw.contains("\\n")) segments.add(raw);
escape++;
if (escape > 100) {
LogHelper.error("Bailing Out!");
break;
}
}
formattedDescription[descriptionIndex] = modified;
for (String s : segments)
formattedDescription[descriptionIndex].addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370)));
}
return formattedDescription[descriptionIndex];
}
@@ -15,7 +15,7 @@ import org.lwjgl.opengl.GL11;
/**
* Created by Brandon on 27/07/2014.
*/
public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {
public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {//todo give core antygravirt
private static final ResourceLocation iner_model_texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_1.png");
private static final ResourceLocation outer_model_texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/models/power_sphere_layer_2.png");
@@ -71,7 +71,7 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {
//float colour = (float)(Minecraft.getSystemTime()%10000) / 10000f;
//double colour = Math.sin((float)Minecraft.getSystemTime() / 10000f);
double colour = ((TileEnergyStorageCore) tile).getEnergyStored() / ((TileEnergyStorageCore) tile).getMaxEnergyStored();
float brightness = (float)Math.abs(Math.sin((float) Minecraft.getSystemTime() / 3000f) * 150f);
float brightness = (float)Math.abs(Math.sin((float) Minecraft.getSystemTime() / 3000f) * 100f);
colour = 1f - colour;
//LogHelper.info(colour + " " + ((TileEnergyStorageCore) tile).getEnergyStored() +" "+ ((TileEnergyStorageCore) tile).getMaxEnergyStored());
@@ -80,20 +80,20 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {
GL11.glPushMatrix();
GL11.glRotatef(rotation, 0F, 1F, 0.5F);
GL11.glColor4d(1F, colour * 0.3f, colour * 0.7f, 1F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 50f + brightness, 50f + brightness);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 80f + brightness, 80f + brightness);
iner_model.renderAll();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(0.8F, 0.8F, 0.8F);
GL11.glColor4f(0.5F, 1F, 1F, 1F);
GL11.glColor4d(1F, 1f, 0.2f, 1F);
GL11.glRotatef(rotation, 0F, 1F, 0.5F);
iner_model.renderAll();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(0.9F, 0.9F, 0.9F);
GL11.glColor4f(0F, 1F, 1F, 1F);
GL11.glColor4d(1F, 0f, 0.2f, 1F);
GL11.glRotatef(rotation, 0F, 1F, 0.5F);
iner_model.renderAll();
GL11.glPopMatrix();
@@ -10,7 +10,7 @@ import net.minecraft.util.IIcon;
/**
* Created by Brandon on 21/11/2014.
*/
public class DraconicBlock extends BlockDE{//todo new description
public class DraconicBlock extends BlockDE{
IIcon top;
public DraconicBlock() {
this.setHardness(20F);
@@ -1,9 +1,8 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
@@ -14,13 +13,10 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
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 net.minecraftforge.common.util.ForgeDirection;
/**
* Created by Brandon on 28/07/2014.
@@ -118,12 +114,9 @@ public class EnergyPylon extends BlockDE {//todo fix sphere renderer
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) return false;
TileEnergyPylon thisTile = (world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof TileEnergyPylon) ? (TileEnergyPylon) world.getTileEntity(x, y, z) : null;
if (player.getHeldItem() != null && player.getHeldItem().isItemEqual(new ItemStack(Items.stick)) && thisTile != null && world.isRemote)
{
LogHelper.info(thisTile.getEnergyStored(ForgeDirection.UP));
}
if (thisTile != null) {
thisTile.onActivated();
if (!player.isSneaking()) thisTile.onActivated();
else thisTile.nextCore();
return true;
}
return false;
@@ -50,11 +50,11 @@ public class ContainerEnergyInfuser extends ContainerDataSync {
ItemStack stack = slot.getStack();
ItemStack result = stack.copy();
if (i >= 36){
if (i >= 36){ //To player
if (!mergeItemStack(stack, 0, 36, false)){
return null;
}
}else if (!(stack.getItem() instanceof IEnergyContainerItem) || !mergeItemStack(stack, 36, 36 + tile.getSizeInventory(), false)){
}else if (stack.stackSize != 1 || !(stack.getItem() instanceof IEnergyContainerItem) || !mergeItemStack(stack, 36, 37, false)){
return null;
}
@@ -4,6 +4,7 @@ import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.brandon3055.draconicevolution.common.utills.ShapedOreEnergyRecipe;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
@@ -13,6 +14,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class CraftingHandler {
public static void init()
@@ -48,20 +50,20 @@ public class CraftingHandler {
//Draconic Tools
add(ModItems.draconicFluxCapacitor, "CMC", "SPS", "CSC", 'C', ModItems.draconicIngot, 'S', ModItems.draconicEnergyCore, 'M', ModItems.awakenedCore, 'P', ModItems.wyvernFluxCapacitor);
addEnergy(ModItems.draconicFluxCapacitor, "CMC", "SPS", "CSC", 'C', ModItems.draconicIngot, 'S', ModItems.draconicEnergyCore, 'M', ModItems.awakenedCore, 'P', ModItems.wyvernFluxCapacitor);
//tools
add(ModItems.draconicPickaxe, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernPickaxe, 'E', ModItems.draconicEnergyCore);
add(ModItems.draconicShovel, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernShovel, 'E', ModItems.draconicEnergyCore);
addEnergy(ModItems.draconicPickaxe, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernPickaxe, 'E', ModItems.draconicEnergyCore);
addEnergy(ModItems.draconicShovel, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernShovel, 'E', ModItems.draconicEnergyCore);
add(ModItems.draconicAxe, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', Items.diamond_axe, 'E', ModItems.draconicEnergyCore);
add(ModItems.draconicHoe, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', Items.diamond_hoe, 'E', ModItems.draconicEnergyCore);
add(ModItems.draconicSword, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernSword, 'E', ModItems.draconicEnergyCore);
addEnergy(ModItems.draconicSword, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernSword, 'E', ModItems.draconicEnergyCore);
add(ModItems.draconicBow, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'T', ModItems.wyvernBow, 'E', ModItems.draconicEnergyCore);
add(ModItems.draconicDestructionStaff, "IAI", "PIS", "IWI", 'I', ModItems.draconicIngot, 'A', ModItems.awakenedCore, 'P', ModItems.draconicPickaxe, 'S', ModItems.draconicShovel, 'W', ModItems.draconicSword);
addEnergy(ModItems.draconicDestructionStaff, "IAI", "PIS", "IWI", 'I', ModItems.draconicIngot, 'A', ModItems.awakenedCore, 'P', ModItems.draconicPickaxe, 'S', ModItems.draconicShovel, 'W', ModItems.draconicSword);
//armor
add(ModItems.draconicHelm, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernHelm, 'E', ModItems.draconicEnergyCore);
add(ModItems.draconicChest, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernChest, 'E', ModItems.draconicEnergyCore);
add(ModItems.draconicLeggs, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernLeggs, 'E', ModItems.draconicEnergyCore);
add(ModItems.draconicBoots, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernBoots, 'E', ModItems.draconicEnergyCore);
addEnergy(ModItems.draconicHelm, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernHelm, 'E', ModItems.draconicEnergyCore);
addEnergy(ModItems.draconicChest, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernChest, 'E', ModItems.draconicEnergyCore);
addEnergy(ModItems.draconicLeggs, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernLeggs, 'E', ModItems.draconicEnergyCore);
addEnergy(ModItems.draconicBoots, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', ModItems.draconicIngot, 'A', ModItems.wyvernBoots, 'E', ModItems.draconicEnergyCore);
@@ -103,6 +105,8 @@ public class CraftingHandler {
//Other
addOre(ModItems.infoTablet, "SSS", "SDS", "SSS", 'S', "stone", 'D', ModItems.draconiumDust);
CraftingManager.getInstance().addShapelessRecipe(new ItemStack(ModItems.enderArrow), Items.arrow, Items.ender_pearl);
addShaplessOre(new ItemStack(Blocks.dirt), Item.getItemFromBlock(Blocks.sand), Items.rotten_flesh, "treeSapling", "treeSapling", "treeSapling");
addShaplessOre(new ItemStack(Blocks.dirt), Item.getItemFromBlock(Blocks.sand), Items.rotten_flesh, "treeLeaves", "treeLeaves", "treeLeaves");
//Disable able
@@ -128,9 +132,21 @@ public class CraftingHandler {
private static void addOre(ItemStack result, Object... recipe){
GameRegistry.addRecipe(new ShapedOreRecipe(result, recipe));
}
private static void addShaplessOre(ItemStack result, Object... recipe){
GameRegistry.addRecipe(new ShapelessOreRecipe(result, recipe));
}
private static void add(Block result, Object... recipe){ add(new ItemStack(result), recipe); }
private static void add(Item result, Object... recipe){ add(new ItemStack(result), recipe); }
private static void add(ItemStack result, Object... recipe){
GameRegistry.addRecipe(result, recipe);
}
private static void addEnergy(Block result, Object... recipe){ addEnergy(new ItemStack(result), recipe); }
private static void addEnergy(Item result, Object... recipe){ addEnergy(new ItemStack(result), recipe); }
private static void addEnergy(ItemStack result, Object... recipe){
GameRegistry.addRecipe(new ShapedOreEnergyRecipe(result, recipe));
}
}
@@ -17,6 +17,7 @@ import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
@@ -44,6 +45,7 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
import java.lang.reflect.InvocationTargetException;
@@ -269,4 +271,21 @@ public class MinecraftForgeEventHandler {
DraconicEvolution.network.sendToServer(new MountUpdatePacket(0));
}
}
@SubscribeEvent
public void getBreakSpeed(PlayerEvent.BreakSpeed event){
if (event.entityPlayer != null )
{
float newDigSpeed = event.originalSpeed;
if (event.entityPlayer.isInsideOfMaterial(Material.water))
{
if (ArmorEffectHandler.isDraconicArmor(event.entityPlayer, 4)) newDigSpeed *= 5f;
}
if (!event.entityPlayer.onGround)
{
if (ArmorEffectHandler.isDraconicArmor(event.entityPlayer, 3)) newDigSpeed *= 5f;
}
event.newSpeed = newDigSpeed;
}
}
}
@@ -1,35 +1,17 @@
package com.brandon3055.draconicevolution.common.items;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.ClientProxy;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.achievements.Achievements;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.network.MountUpdatePacket;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.MobSpawnerBaseLogic;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.util.List;
public class Tclogo extends ItemDE {
@@ -90,105 +72,59 @@ public class Tclogo extends ItemDE {
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
LogHelper.info(player.ridingEntity);
if (!world.isRemote)DraconicEvolution.network.sendTo(new MountUpdatePacket(player.ridingEntity.getEntityId()), (EntityPlayerMP)player);
if (1==1) return stack;
// Set<String> set = Achievements.achievementsList.keySet();
// for (String s : set) Achievements.triggerAchievement(player, s);
if (!player.isSneaking())
{
player.capabilities.allowFlying = true;
//player.setPosition(player.posX, player.posY+1, player.posZ);
player.onGround = false;
player.capabilities.isFlying = true;
player.noClip = !player.noClip;
LogHelper.info("Downloading Image");
try {
URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg");
String fileName = url.getFile();
String destName = ClientProxy.downloadLocation + fileName.substring(fileName.lastIndexOf("/"));
System.out.println(destName);
InputStream is = url.openStream();
OutputStream os = new FileOutputStream(destName);
byte[] b = new byte[2048];
int length;
while ((length = is.read(b)) != -1) {
os.write(b, 0, length);
}
is.close();
os.close();
}catch (IOException e){
LogHelper.info(e);
}
else{
int xi = (int)player.posX;
int yi = (int)player.posY;
int zi = (int)player.posZ;
int rad = 100;
if (world.isRemote) return stack;
if (1 == 1) return stack;
int x = (int)player.posX;
int y = (int)player.posY;
int z = (int)player.posZ;
world.setBlock(x, y, z, Blocks.mob_spawner);
TileEntity spawner = world.getTileEntity(x, y, z);
if (spawner instanceof TileEntityMobSpawner){
MobSpawnerBaseLogic logic = ((TileEntityMobSpawner)spawner).func_145881_a();
logic.setEntityName("Zombie");
EntityZombie zombie = new EntityZombie(world);
zombie.setChild(true);
zombie.setCurrentItemOrArmor(0, new ItemStack(Items.diamond_axe));
NBTTagCompound compound = new NBTTagCompound();
zombie.writeEntityToNBT(compound);
NBTTagCompound compound2 = new NBTTagCompound();
logic.writeToNBT(compound2);
compound2.setTag("SpawnData", compound);
logic.readFromNBT(compound2);
LogHelper.info(compound2);
}
//if (!world.isRemote)OreDoublingRegistry.getOreResult(GameRegistry.findItemStack("ThermalFoundation", "oreCopper", 1));
player.triggerAchievement(Achievements.getAchievement("Draconium Ore"));
//player.fallDistance = 0;
//player.motionY+=1;
//player.moveFlying(0f, 0f, 1f);
float horizontal = 0f;
float forward = 1f;
float acceleration = 1f;
float f3 = forward * forward;
if (f3 >= 1.0E-4F)
{
f3 = MathHelper.sqrt_float(f3);
if (f3 < 1.0F)
{
f3 = 1.0F;
for (int x = xi-rad; x < xi+rad; x++){
for (int y = yi-10; y < yi+30; y++){
for (int z = zi-rad; z < zi+rad; z++){
world.markBlockForUpdate(x, y, z);
}
f3 = acceleration / f3;
horizontal *= f3;
forward *= f3;
float f4 = MathHelper.sin(player.rotationYaw * (float)Math.PI / 180.0F);
float f5 = MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F);
float f6 = (player.rotationPitch-20) * (float) Math.PI / 180.0F;
player.motionX += (double)( - forward * f4);
player.motionY += (double)(f6*-1);
player.motionZ += (double)(forward * f5);
}
}
world.markBlockRangeForRenderUpdate(xi-rad, yi-20, zi-rad, xi+rad, yi+20, zi+rad);
}
//
// LogHelper.info("Downloading Image");
//
// try {
// URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg");
// String fileName = url.getFile();
// String destName = ClientProxy.downloadLocation + fileName.substring(fileName.lastIndexOf("/"));
// System.out.println(destName);
//
// InputStream is = url.openStream();
// OutputStream os = new FileOutputStream(destName);
//
// byte[] b = new byte[2048];
// int length;
//
// while ((length = is.read(b)) != -1) {
// os.write(b, 0, length);
// }
//
// is.close();
// os.close();
// }catch (IOException e){
// LogHelper.info(e);
// }
// player.addPotionEffect(new PotionEffect(PotionHandler.potionFlight.id, 100, 0));
@@ -185,7 +185,7 @@ public class DraconiumFluxCapacitor extends ItemDE implements IEnergyContainerIt
InfoHelper.addEnergyInfo(stack, list);
list.add(StatCollector.translateToLocal("info.de.changwMode.txt"));
list.add(InfoHelper.ITC()+StatCollector.translateToLocal("info.de.capacitorMode.txt")+": "+InfoHelper.HITC()+StatCollector.translateToLocal("info.de.capacitorMode"+ItemNBTHelper.getShort(stack, "Mode", (short)0)+".txt"));
InfoHelper.addLore(stack, list);
//InfoHelper.addLore(stack, list);
}
}
@@ -122,7 +122,7 @@ public class ToolHandler {
if ((silk) && (block.canSilkHarvest(world, player, x, y, z, meta))) {
if (block == Blocks.lit_redstone_ore)
items.add(new ItemStack(Item.getItemFromBlock(Blocks.redstone_ore)));
else items.add(new ItemStack(block.getItem(world, x, y, z), 1, meta));
else items.add(new ItemStack(block, 1, meta));
} else {
items.addAll(block.getDrops(world, x, y, z, meta, fortune));
//block.dropXpOnBlockBreak(world, (int)player.posX, (int)player.posY, (int)player.posZ, block.getExpDrop(world, meta, fortune));
@@ -57,8 +57,9 @@ public class TileParticleGenerator extends TileEntity {
@SideOnly(Side.CLIENT)
@Override
public void updateEntity() {
if (!worldObj.isRemote) return;
if (stabalizerMode && worldObj.isRemote) {
if (stabalizerMode) {
rotation += 0.5F;
spawnStabilizerParticle();
}
@@ -70,7 +71,7 @@ public class TileParticleGenerator extends TileEntity {
if (tick >= spawn_rate && active) {
tick = 0;
if (worldObj.isRemote) {
Random rand = worldObj.rand;
float MX = motion_x + (random_motion_x * rand.nextFloat());
@@ -91,7 +92,7 @@ public class TileParticleGenerator extends TileEntity {
particle.gravity = this.gravity;
ParticleHandler.spawnCustomParticle(particle);
}
} else tick++;
}
@@ -18,21 +18,22 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Created by Brandon on 28/07/2014.
*/
public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler {//todo make it possible to select which core to to link to
//todo make core change color as it fuills
//protected EnergyStorage storage = new EnergyStorage(500000, 0, 0);
public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler {
public boolean active = false;
public boolean lastTickActive = false;
public boolean reciveEnergy = false; //Power Flow to system
public boolean lastTickReciveEnergy = false;
public float modelRotation = 0;
public float modelScale = 0;
private TileLocation masterLocation = new TileLocation();
private List<TileLocation> coreLocatios = new ArrayList<TileLocation>();
private int selectedCore = 0;
private byte particleRate = 0;
private byte lastTickParticleRate = 0;
@@ -66,39 +67,57 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler {/
if (!active){
active = isValidStructure();
}
findMaster();
findCores();
}
private TileEnergyStorageCore getMaster(){
return (worldObj.getTileEntity(masterLocation.getXCoord(), masterLocation.getYCoord(), masterLocation.getZCoord()) != null && worldObj.getTileEntity(masterLocation.getXCoord(), masterLocation.getYCoord(), masterLocation.getZCoord()) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore)worldObj.getTileEntity(masterLocation.getXCoord(), masterLocation.getYCoord(), masterLocation.getZCoord()) : null;
if (coreLocatios.isEmpty()) return null;
if (selectedCore >= coreLocatios.size()) selectedCore = coreLocatios.size() - 1;
TileLocation core = coreLocatios.get(selectedCore);
if (core == null || !(worldObj.getTileEntity(core.getXCoord(), core.getYCoord(), core.getZCoord()) instanceof TileEnergyStorageCore)) return null;
return (TileEnergyStorageCore) worldObj.getTileEntity(core.getXCoord(), core.getYCoord(), core.getZCoord());
}
private void findMaster(){
private void findCores(){
int yMod = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 ? 3 : -3;
int range = 15;
List<TileLocation> locations = new ArrayList<TileLocation>();
for (int x = xCoord-range; x <= xCoord+range; x++){
for (int y = yCoord+yMod-(range/4); y <= yCoord+yMod+(range/4); y++){
for (int z = zCoord-range; z <= zCoord+range; z++){
if (worldObj.getBlock(x, y, z) == ModBlocks.energyStorageCore){
masterLocation = new TileLocation(x, y, z);
return;
locations.add(new TileLocation(x, y, z));
}
}
}
}
if (locations != coreLocatios){
coreLocatios.clear();
coreLocatios.addAll(locations);
selectedCore = selectedCore >= coreLocatios.size() ? 0 : selectedCore;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
public void nextCore(){
findCores();
selectedCore++;
if (selectedCore >= coreLocatios.size()) selectedCore = 0;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@SideOnly(Side.CLIENT)
private void spawnParticles(){
Random rand = new Random();
int x = masterLocation.getXCoord();
int y = masterLocation.getYCoord();
int z = masterLocation.getZCoord();
if (getMaster() == null || !getMaster().isOnline()) return;
int x = getMaster().xCoord;
int y = getMaster().yCoord;
int z = getMaster().zCoord;
int cYCoord = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 ? yCoord+1 : yCoord-1;
TileEnergyStorageCore master = (worldObj.getTileEntity(x, y, z) != null && worldObj.getTileEntity(x, y, z) instanceof TileEnergyStorageCore) ? (TileEnergyStorageCore) worldObj.getTileEntity(x, y, z) : null;
if (master == null || !master.isOnline()) return;
float disMod = master.getTier()==0 ? 0.5F : master.getTier()==1 ? 1F: master.getTier()==2 ? 1F : master.getTier()==3 ? 2F : master.getTier()==4 ? 2F : master.getTier()==5 ? 3F : 4F;
float disMod = getMaster().getTier()==0 ? 0.5F : getMaster().getTier()==1 ? 1F: getMaster().getTier()==2 ? 1F : getMaster().getTier()==3 ? 2F : getMaster().getTier()==4 ? 2F : getMaster().getTier()==5 ? 3F : 4F;
double spawnX;
double spawnY;
double spawnZ;
@@ -180,7 +199,14 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler {/
super.readFromNBT(compound);
active = compound.getBoolean("Active");
reciveEnergy = compound.getBoolean("Input");
masterLocation.readFromNBT(compound, "Master");
int i = compound.getInteger("Cores");
List<TileLocation> list = new ArrayList<TileLocation>();
for (int j = 0; j < i; j++){
TileLocation l = new TileLocation();
l.readFromNBT(compound, "Core" + j);
list.add(l);
}
coreLocatios = list;
particleRate = compound.getByte("ParticleRate");
}
@@ -190,7 +216,12 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler {/
super.writeToNBT(compound);
compound.setBoolean("Active", active);
compound.setBoolean("Input", reciveEnergy);
masterLocation.writeToNBT(compound, "Master");
int i = coreLocatios.size();
compound.setInteger("Cores", i);
for (int j = 0; j < i; j++){
coreLocatios.get(j).writeToNBT(compound, "Core" + j);
}
compound.setInteger("SelectedCore", selectedCore);
compound.setByte("ParticleRate", particleRate);
}
@@ -38,7 +38,7 @@ public class TileEnergyStorageCore extends TileObjectSync {
public void updateEntity() {
if (!online) return;
if (worldObj.isRemote) modelRotation += 0.5;
detectAndRendChanges();
if (!worldObj.isRemote) detectAndRendChanges();
tick++;
}
@@ -0,0 +1,35 @@
package com.brandon3055.draconicevolution.common.utills;
import cofh.api.energy.IEnergyContainerItem;
import net.minecraft.block.Block;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
/**
* Created by Brandon on 8/12/2014.
*/
public class ShapedOreEnergyRecipe extends ShapedOreRecipe {
public ShapedOreEnergyRecipe(Block result, Object... recipe){ this(new ItemStack(result), recipe); }
public ShapedOreEnergyRecipe(Item result, Object... recipe){ this(new ItemStack(result), recipe); }
public ShapedOreEnergyRecipe(ItemStack result, Object... recipe) {super(result, recipe);}
@Override
public ItemStack getCraftingResult(InventoryCrafting var1) {
ItemStack result = super.getCraftingResult(var1);
int energy = 0;
for (int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if (stack != null && stack.getItem() instanceof IEnergyContainerItem) {
energy += ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack);
}
}
if (energy > 0 && result != null && result.getItem() instanceof IEnergyContainerItem) ItemNBTHelper.setInteger(result, "Energy", energy);
return result;
}
}