Changed 19/09/2014

This commit is contained in:
brandon3055 committed 2014-09-19 21:41:45 +10:00
1 parent c9f3e01b17
commit 23df8dd2ff
70 files changed
+2163 -300

No files matched your search

@@ -1,15 +1,24 @@
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.core.utills.EnergyHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class DETab extends CreativeTabs {
private String label;
private int tab;
static ItemStack iconStackStaff;
public static void initialize() {
iconStackStaff = EnergyHelper.setDefaultEnergyTag(new ItemStack(ModItems.draconicDistructionStaff), 100000000);
}
public DETab(int id, String modid, String label, int tab) {
super(id, modid);
this.label = label;
@@ -17,14 +26,18 @@ public class DETab extends CreativeTabs {
}
@Override
@SideOnly(Side.CLIENT)
public ItemStack getIconItemStack() {
if (tab == 0) return iconStackStaff;
else return new ItemStack(ModBlocks.energyInfuser);
}
@Override
@SideOnly(Side.CLIENT)
public Item getTabIconItem()
{
if (tab == 0){
return ModItems.draconicBow;
}else if (tab == 1){
return Item.getItemFromBlock(ModBlocks.energyInfuser);
}else
return Items.apple;
return getIconItemStack().getItem();
}
@Override
@@ -1,5 +1,14 @@
package com.brandon3055.draconicevolution.client.interfaces;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.core.network.TeleporterPacket;
import com.brandon3055.draconicevolution.common.core.network.TeleporterStringPacket;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
@@ -10,20 +19,9 @@ import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.WorldProvider;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.core.network.TeleporterPacket;
import com.brandon3055.draconicevolution.common.core.network.TeleporterStringPacket;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
@SideOnly(Side.CLIENT)
public class GUITeleporter extends GuiScreen
{
@@ -1,6 +1,7 @@
package com.brandon3055.draconicevolution.client.interfaces;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.interfaces.manual.GuiManual;
import com.brandon3055.draconicevolution.common.container.*;
import com.brandon3055.draconicevolution.common.tileentities.*;
import net.minecraft.entity.player.EntityPlayer;
@@ -21,6 +22,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUIID_PLAYERDETECTOR = 6;
public static final int GUIID_ENERGY_INFUSER = 7;
public static final int GUIID_GENERATOR = 8;
public static final int GUIID_MANUAL = 9;
public GuiHandler() {
NetworkRegistry.INSTANCE.registerGuiHandler(DraconicEvolution.instance, this);
@@ -115,6 +117,9 @@ public class GuiHandler implements IGuiHandler {
if (generator != null && generator instanceof TileGenerator) {
return new GUIGenerator(player.inventory, (TileGenerator) generator);
}
case GUIID_MANUAL:
return new GuiManual();
}
return null;
@@ -0,0 +1,95 @@
package com.brandon3055.draconicevolution.client.interfaces.manual;
import com.brandon3055.draconicevolution.common.lib.References;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
/**
* Created by Brandon on 16/09/2014.
*/
public class BasePage extends GuiScreen {
/**Name used to reference the page*/
private String REFERENCE_NAME;
/**Name Displayed in the index page*/
public String INDEX_NAME;
public boolean hasIndexButton = false;
public static final ResourceLocation PAGE_TEXTURE = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/InfoGui.png");
private final int xSize = 256;
private final int ySize = 202;
protected PageCollection collection;
public BasePage(String referenceName, PageCollection collection) {
this.REFERENCE_NAME = referenceName;
this.mc = Minecraft.getMinecraft();
this.collection = collection;
initGui();
}
public BasePage(String referenceName, boolean showInMenue, PageCollection collection) {
this(referenceName, collection);
this.hasIndexButton = showInMenue;
}
public int getXMin(){
return (this.width - xSize) / 2;
}
public int getYMin(){
return (this.height - ySize) / 2;
}
public void setXMin(int x){
this.width = x;
}
public void setYMin(int y){
this.height = y;
}
/**Unlocalized Index Page Name*/
public BasePage setIndexName(String unlocalizedName){
this.INDEX_NAME = ttl(unlocalizedName);
return this;
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
buttonList.add(new GuiButtonAHeight(0, getXMin()+88, getYMin()+181, 80, 16, ttl("button.de.backToIndex.txt")));
}
public void setReferenceName(String name){
REFERENCE_NAME = name;}
public String getReferenceName(){ return REFERENCE_NAME;}
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(PAGE_TEXTURE);
drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize);
}
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
}
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(mouseX+offsetX, mouseY+offsetY, 0);
renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void actionPerformed(GuiButton button) {
collection.changeActivePage("INDEX");
}
@Override
public void mouseMovedOrUp(int par1, int par2, int par3){super.mouseMovedOrUp(par1, par2, par3);}
@Override
public void mouseClicked(int par1, int par2, int par3){super.mouseClicked(par1, par2, par3);}
/**Translate To Local*/
public String ttl(String unlocalizedName){return StatCollector.translateToLocal(unlocalizedName);}
}
@@ -0,0 +1,243 @@
package com.brandon3055.draconicevolution.client.interfaces.manual;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.*;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.lwjgl.opengl.GL11;
import java.lang.reflect.Field;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Created by Brandon on 18/09/2014.
*/
public class CraftingPage extends TitledPage {
protected static RenderItem itemRenderer = new RenderItem();
public ItemStack result;
private boolean isSmelting = false;
private ItemStack[] recipe = new ItemStack[9];
private boolean hasRecipe = false;
private String rawDescription;
private List<String> formattedDescription;
private float descriptionScale = 0.66f;
public CraftingPage(String name, PageCollection collection, ItemStack itemStack, String unlocalizedDescription) {
super(name, true, collection, itemStack.getUnlocalizedName()+".name", 0x00ff00);
this.result = itemStack;
this.recipe = getFirstRecipeForItem(itemStack);
for (ItemStack stack : recipe) if (stack != null) hasRecipe = true;
if (unlocalizedDescription == "") rawDescription = ttl(itemStack.getUnlocalizedName()+".description");
else rawDescription = ttl(unlocalizedDescription);
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
GL11.glPushMatrix();
if (isSmelting){
drawTexturedModalRect(offsetX + 87, offsetY + 15, 116, 202, 82, 54);
}else {
drawTexturedModalRect(offsetX + 70, offsetY + 15, 0, 202, 116, 54);
if (!hasRecipe) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
drawTexturedModalRect(offsetX + 70, offsetY + 15, 198, 202, 54, 54);
GL11.glPopMatrix();
drawString(fontRendererObj, "No Recipe", offsetX + 149, offsetY + 60, 0xff0000);
}
}
GL11.glPopMatrix();
}
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
int relativeMouseX = mouseX + offsetX;
int relativeMouseY = mouseY + offsetY;
int gridOffsetX = isSmelting ? 88 : 71;
int gridOffsetY = 16;
int itemBoxSize = 18;
ItemStack tooltip = null;
int i = 0;
for (ItemStack input : recipe) {
if (input != null) {
int row = (i % 3);
int column = i / 3;
int itemX = offsetX + gridOffsetX + (row * itemBoxSize);
int itemY = offsetY + gridOffsetY + (column * itemBoxSize);
drawItemStack(input, itemX, itemY, "");
if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize &&
relativeMouseY > itemY - 2 && relativeMouseY < itemY - 2 + itemBoxSize) {
tooltip = input;
}
}
i++;
}
int itemX = offsetX + (isSmelting ? 148 : 165);
int itemY = offsetY + 34;
drawItemStack(result, itemX, itemY, "");
if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize &&
relativeMouseY > itemY - 2 && relativeMouseY < itemY - 2 + itemBoxSize) {
tooltip = result;
}
if (tooltip != null) {
drawItemStackTooltip(tooltip, relativeMouseX, relativeMouseY);
}
addDescription(minecraft, offsetX, offsetY);
}
public void addDescription(Minecraft minecraft, int offsetX, int offsetY){
GL11.glPushMatrix();
GL11.glTranslated(offsetX+5, offsetY+75, 1);
GL11.glScalef(descriptionScale, descriptionScale, descriptionScale);
int offset = 0;
for (String s : getFormattedText(fontRendererObj)) {
if (s == null) break;
fontRendererObj.drawString(s, 0, offset, 4210752);
offset += fontRendererObj.FONT_HEIGHT;
}
GL11.glPopMatrix();
}
@SuppressWarnings("unchecked")
public List<String> getFormattedText(FontRenderer fr) {
if (formattedDescription == null) {
if (Strings.isNullOrEmpty(rawDescription)) formattedDescription = ImmutableList.of();
else formattedDescription = ImmutableList.copyOf(fr.listFormattedStringToWidth(rawDescription, 370));
}
return formattedDescription;
}
protected void drawItemStackTooltip(ItemStack stack, int x, int y) {
final Minecraft mc = Minecraft.getMinecraft();
FontRenderer font = Objects.firstNonNull(stack.getItem().getFontRenderer(stack), mc.fontRenderer);
@SuppressWarnings("unchecked")
List<String> list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
List<String> colored = Lists.newArrayListWithCapacity(list.size());
colored.add(stack.getRarity().rarityColor + list.get(0));
for (String line : list)
colored.add(EnumChatFormatting.GRAY + line);
if (colored.size() >= 2) colored.remove(1);
drawHoveringText(colored, x, y, font);
}
private void drawItemStack(ItemStack par1ItemStack, int par2, int par3, String par4Str) {
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
this.zLevel = 200.0F;
itemRenderer.zLevel = 200.0F;
RenderHelper.enableGUIStandardItemLighting();
GL11.glColor3f(1f, 1f, 1f);
GL11.glEnable(GL11.GL_NORMALIZE);
FontRenderer font = null;
if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack);
if (font == null) font = Minecraft.getMinecraft().fontRenderer;
itemRenderer.renderItemAndEffectIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3);
itemRenderer.renderItemOverlayIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3, par4Str);
this.zLevel = 0.0F;
itemRenderer.zLevel = 0.0F;
}
@SuppressWarnings("unchecked")
private ItemStack[] getFirstRecipeForItem(ItemStack resultingItem) {
ItemStack[] recipeItems = new ItemStack[9];
for (IRecipe recipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
if (recipe == null) continue;
ItemStack result = recipe.getRecipeOutput();
if (result == null || !result.isItemEqual(resultingItem)) continue;
Object[] input = getRecipeInput(recipe);
if (input == null) continue;
for (int i = 0; i < input.length; i++)
recipeItems[i] = convertToStack(input[i]);
break;
}
Iterator iterator = FurnaceRecipes.smelting().getSmeltingList().entrySet().iterator();
Map.Entry entry;
while (iterator.hasNext()){
entry = (Map.Entry)iterator.next();
if (entry.getKey() instanceof ItemStack && ((ItemStack)entry.getValue()).isItemEqual(result)){
isSmelting = true;
recipeItems[0] = (ItemStack)entry.getKey();
}
}
return recipeItems;
}
protected ItemStack convertToStack(Object obj) {
ItemStack entry = null;
if (obj instanceof ItemStack) {
entry = (ItemStack)obj;
} else if (obj instanceof List) {
@SuppressWarnings("unchecked")
List<ItemStack> list = (List<ItemStack>)obj;
if (list.size() > 0) entry = list.get(0);
}
if (entry == null) return null;
entry = entry.copy();
if (entry.getItemDamage() == OreDictionary.WILDCARD_VALUE) entry.setItemDamage(0);
return entry;
}
@SuppressWarnings("unchecked")
private Object[] getRecipeInput(IRecipe recipe) {
if (recipe instanceof ShapelessOreRecipe) return ((ShapelessOreRecipe)recipe).getInput().toArray();
else if (recipe instanceof ShapedOreRecipe) return getShapedOreRecipe((ShapedOreRecipe)recipe);
else if (recipe instanceof ShapedRecipes) return ((ShapedRecipes)recipe).recipeItems;
else if (recipe instanceof ShapelessRecipes) return ((ShapelessRecipes)recipe).recipeItems.toArray(new ItemStack[0]);
return null;
}
private Object[] getShapedOreRecipe(ShapedOreRecipe recipe) {
try {
Field field = ShapedOreRecipe.class.getDeclaredField("width");
if (field != null) {
field.setAccessible(true);
int width = field.getInt(recipe);
Object[] input = recipe.getInput();
Object[] grid = new Object[9];
for (int i = 0, offset = 0, y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++, i++) {
if (x < width && offset < input.length) {
grid[i] = input[offset];
offset++;
} else {
grid[i] = null;
}
}
}
return grid;
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
@@ -0,0 +1,14 @@
package com.brandon3055.draconicevolution.client.interfaces.manual;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
/**
* Created by Brandon on 16/09/2014.
*/
public class DummyContainer extends Container {
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
return true;
}
}
@@ -0,0 +1,56 @@
package com.brandon3055.draconicevolution.client.interfaces.manual;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import org.lwjgl.opengl.GL11;
/**
* Created by Brandon on 17/09/2014.
*/
public class GuiButtonAHeight extends GuiButton{
public GuiButtonAHeight(int id, int xPos, int yPos, int width, int hight, String displayString) {
super(id, xPos, yPos, width, hight, displayString);
}
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
if (this.visible)
{
FontRenderer fontrenderer = minecraft.fontRenderer;
minecraft.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height);
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height);
if (this.height < 20){
this.drawTexturedModalRect(xPosition, yPosition+3, 0, (46 + k * 20)+20-height+3, width / 2, height-3);
this.drawTexturedModalRect(xPosition + width / 2, yPosition+3, 200 - width / 2, (46 + k * 20)+20-height+3, width / 2, height-3);
}
this.mouseDragged(minecraft, mouseX, mouseY);
int l = 14737632;
if (packedFGColour != 0)
{
l = packedFGColour;
}
else if (!this.enabled)
{
l = 10526880;
}
else if (this.field_146123_n)
{
l = 16777120;
}
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
}
}
}
@@ -0,0 +1,63 @@
package com.brandon3055.draconicevolution.client.interfaces.manual;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.opengl.GL11;
/**
* Created by Brandon on 17/09/2014.
*/
public class GuiButtonTextOnly extends GuiButton{
public String LINKED_PAGE;
public GuiButtonTextOnly(int id, int xPos, int yPos, int width, int hight, String displayString, String linkedPage) {
super(id, xPos, yPos, width, hight, displayString);
this.LINKED_PAGE = linkedPage;
}
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
if (this.visible)
{
FontRenderer fontrenderer = minecraft.fontRenderer;
minecraft.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.mouseDragged(minecraft, mouseX, mouseY);
int l = 0x777777;
String trimmedDisplayString = displayString;
if (fontrenderer.getStringWidth(displayString) > width && !this.field_146123_n){
int energencyBreak = 0;
while (fontrenderer.getStringWidth(trimmedDisplayString)*0.7 > width-5){
trimmedDisplayString = trimmedDisplayString.substring(0, trimmedDisplayString.length()-1);
energencyBreak++;
if (energencyBreak > 100) break;
}
trimmedDisplayString+="...";
}
if (this.field_146123_n)
{
trimmedDisplayString = EnumChatFormatting.BOLD+""+EnumChatFormatting.ITALIC+trimmedDisplayString;
l = 0x000000;
} {
GL11.glPushMatrix();
GL11.glScalef(0.7F, 0.7F, 1);
fontrenderer.drawString(trimmedDisplayString, (int)(xPosition*1.45), (int)((yPosition + (height - 8) / 2)*1.45), l);
GL11.glPopMatrix();
}
}
}
public boolean getIsHovering(){return field_146123_n;}
}
@@ -0,0 +1,148 @@
package com.brandon3055.draconicevolution.client.interfaces.manual;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.items.ModItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
/**
* Created by Brandon on 16/09/2014.
*/
@SideOnly(Side.CLIENT)
public class GuiManual extends GuiContainer {
protected final PageCollection root;
protected int pageIndex = 0;
public GuiManual() {
super(new DummyContainer());
this.xSize = 256;
this.ySize = 202;
root = createRoot();
}
protected PageCollection createRoot() {
ItemStack mobSoul = new ItemStack(ModItems.mobSoul);
ItemNBTHelper.setString(mobSoul, "Name", "Any");
pageIndex = 0;
final PageCollection pageCollection = new PageCollection();
pageCollection.addPage(new IntroPage("INTRO", pageCollection));
//pageCollection.addPage(new TitledPage("TITLED_PAGE_1", true, pageCollection, "manual.de.Page Title.txt", 0xff0000).setIndexName("manual.de.TitledPage.txt"));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.draconiumOre), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconiumDust), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconiumBlend), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconiumIngot, 2), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicCore), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.infusedCompound), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.dragonHeart), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicCompound, 2), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.sunFocus), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernPickaxe), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernShovel), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernSword), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernBow), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicPickaxe), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicShovel), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicHoe), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicAxe), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicSword), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicBow), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicDistructionStaff), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernHelm), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernChest), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernLeggs), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.wyvernBoots), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicHelm), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicChest), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicLeggs), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.draconicBoots), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.teleporterMKI), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.teleporterMKII), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.enderArrow), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, new ItemStack(ModItems.safetyMatch), ""));
pageCollection.addPage(new CraftingPage("CRAFTING_PAGE_"+getNextPageIndex(), pageCollection, mobSoul, ""));
pageCollection.addPage(new IndexPage("INDEX", pageCollection));
return pageCollection;
}
private int getNextPageIndex(){
int i = pageIndex;
pageIndex++;
return i;
}
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
super.drawScreen(mouseX, mouseY, par3);
prepareRenderState();
GL11.glPushMatrix();
root.drawScreen(this.mc, this.guiLeft, this.guiTop, mouseX - this.guiLeft, mouseY - this.guiTop);
GL11.glPopMatrix();
restoreRenderState();
}
protected void prepareRenderState() {
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
}
protected void restoreRenderState() {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
RenderHelper.enableStandardItemLighting();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int mouseX, int mouseY) {
GL11.glPushMatrix();
GL11.glTranslated(this.guiLeft, this.guiTop, 0);
root.renderBackgroundLayer(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop);
GL11.glPopMatrix();
}
@Override
public void setWorldAndResolution(Minecraft minecraft, int x, int y) {
super.setWorldAndResolution(minecraft, x, y);
root.setWorldAndResolution(minecraft, x, y);
}
@Override
protected void actionPerformed(GuiButton button) {
root.actionPerformed(button);
}
@Override
protected void mouseMovedOrUp(int par1, int par2, int par3){
root.mouseMovedOrUp(par1, par2, par3);
}
@Override
protected void mouseClicked(int par1, int par2, int par3){
root.mouseClicked(par1, par2, par3);
}
@Override
public void handleInput() {
super.handleInput();
}
}
@@ -0,0 +1,57 @@
package com.brandon3055.draconicevolution.client.interfaces.manual;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
/**
* Created by Brandon on 17/09/2014.
*/
public class IndexPage extends TitledPage {
public IndexPage(String name, PageCollection collection) {
super(name, false, collection, "manual.de.indexTitle.txt", 0xffa600);
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
buttonList.add(new GuiButtonAHeight(0, getXMin() + 88, getYMin() + 181, 80, 16, ttl("button.de.back.txt")));
int row = 0;
int collum = 0;
for (BasePage page : collection.pages){
if (page.hasIndexButton){
String indexName = page.INDEX_NAME;
if (indexName==null && page instanceof CraftingPage) indexName = ttl(((CraftingPage)page).result.getUnlocalizedName()+".name");
else if (indexName==null) indexName = page.getReferenceName();
buttonList.add(new GuiButtonTextOnly(999, getXMin()+5+collum*60, getYMin()+20+(row*7), 60, 7, indexName, page.getReferenceName()));
row++;
if (row > 21){
row = 0;
collum++;
}
}
}
}
@Override
public void actionPerformed(GuiButton button) {
switch (button.id) {
case 0: collection.changeActivePage("INTRO"); break;
}
if (button instanceof GuiButtonTextOnly)
collection.changeActivePage(((GuiButtonTextOnly)button).LINKED_PAGE);
}
@Override
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
for (int k = 0; k < this.buttonList.size(); ++k)
{
if (buttonList.get(k) instanceof GuiButtonTextOnly && ((GuiButtonTextOnly) buttonList.get(k)).getIsHovering()) {
((GuiButtonTextOnly) this.buttonList.get(k)).drawButton(this.mc, mouseX+offsetX, mouseY+offsetY);
}
}
}
}
@@ -0,0 +1,47 @@
package com.brandon3055.draconicevolution.client.interfaces.manual;
import com.brandon3055.draconicevolution.common.lib.References;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
/**
* Created by Brandon on 17/09/2014.
*/
public class IntroPage extends BasePage {
public static final ResourceLocation logo = new ResourceLocation(References.RESOURCESPREFIX + "textures/gui/ManualIntro.png");
public IntroPage(String name, PageCollection collection) {
super(name, collection);
}
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
minecraft.renderEngine.bindTexture(logo);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glScalef(1F, 0.5F, 1F);
drawTexturedModalRect(offsetX + 1, offsetY + 10, 0, 0, 256, 256);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(2.5F, 2.5F, 1F);
drawCenteredString(minecraft.fontRenderer, ttl("manual.de.userGuide.txt"), (int) ((offsetX + 128) / 2.5), (int) ((offsetY + 128) / 2.5), 0x00b400);
GL11.glPopMatrix();
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
buttonList.add(new GuiButtonAHeight(0, getXMin()+88, getYMin()+181, 80, 16, ttl("button.de.goToIndex.txt")));
}
}
@@ -0,0 +1,85 @@
package com.brandon3055.draconicevolution.client.interfaces.manual;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import java.util.List;
/**
* Created by Brandon on 16/09/2014.
*/
public class PageCollection extends Gui {
protected final List<BasePage> pages = Lists.newArrayList();
private String ACTIVE_PAGE = "INTRO";
protected int x;
protected int y;
public PageCollection() {
this.x = 0;
this.y = 0;
}
public void addPage(BasePage page) {
pages.add(page);
}
public BasePage getPageByName(String name){
for (BasePage component : pages) {
if (component.getReferenceName().equals(ACTIVE_PAGE)) {
return component;
}
}
return null;
}
public BasePage getActivePage(){
for (BasePage component : pages) {
if (component.getReferenceName().equals(ACTIVE_PAGE)) {
return component;
}
}
return null;
}
public final void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (getActivePage() == null) return;
getActivePage().drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public final void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (getActivePage() == null) return;
getActivePage().renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public void changeActivePage(String newPage){
ACTIVE_PAGE = newPage;
if (getActivePage() == null) return;
getActivePage().setWorldAndResolution(Minecraft.getMinecraft(), x, y);
}
public void setWorldAndResolution(Minecraft minecraft, int x, int y) {
if (getActivePage() == null) return;
getActivePage().setWorldAndResolution(minecraft, x, y);
this.x = x;
this.y = y;
}
protected void actionPerformed(GuiButton button) {
if (getActivePage() == null) return;
getActivePage().actionPerformed(button);
}
protected void mouseMovedOrUp(int par1, int par2, int par3){
if (getActivePage() == null) return;
getActivePage().mouseMovedOrUp(par1, par2, par3);
}
protected void mouseClicked(int par1, int par2, int par3){
if (getActivePage() == null) return;
getActivePage().mouseClicked(par1, par2, par3);
}
}
@@ -0,0 +1,22 @@
package com.brandon3055.draconicevolution.client.interfaces.manual;
import net.minecraft.client.Minecraft;
/**
* Created by Brandon on 17/09/2014.
*/
public class TitledPage extends BasePage {
private String title;
private int colour;
public TitledPage(String name, boolean showInMenue, PageCollection collection, String unlocalizedTitle, int colour) {
super(name, showInMenue, collection);
this.title = unlocalizedTitle;
this.colour = colour;
}
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
drawCenteredString(minecraft.fontRenderer, ttl(title), offsetX + 128, offsetY + 5, colour);
}
}
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.client.render;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -12,7 +13,6 @@ 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;
@@ -29,6 +29,7 @@ public class CustomDragonRenderer extends RenderLiving
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");
private static final ResourceLocation enderDragonTextures2 = new ResourceLocation(References.RESOURCESPREFIX + "textures/entity/de_chaos_dragon.png");
/** An instance of the dragon model in RenderDragon */
protected ModelDragon modelDragon;
@@ -39,7 +40,7 @@ public class CustomDragonRenderer extends RenderLiving
this.setRenderPassModel(this.mainModel);
}
protected void rotateCorpse(EntityDragon p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_)
protected void rotateCorpse(EntityCustomDragon 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]);
@@ -64,7 +65,7 @@ public class CustomDragonRenderer extends RenderLiving
/**
* 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_)
protected void renderModel(EntityCustomDragon 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)
{
@@ -101,7 +102,7 @@ public class CustomDragonRenderer extends RenderLiving
* (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_)
public void doRender(EntityCustomDragon 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_);
@@ -152,12 +153,12 @@ public class CustomDragonRenderer extends RenderLiving
/**
* 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_)
protected ResourceLocation getEntityTexture(EntityCustomDragon dragon)
{
return enderDragonTextures;
return dragon.getDataWatcher().getWatchableObjectByte(12) == 1 ? enderDragonTextures2 : enderDragonTextures;
}
protected void renderEquippedItems(EntityDragon p_77029_1_, float p_77029_2_)
protected void renderEquippedItems(EntityCustomDragon p_77029_1_, float p_77029_2_)
{
super.renderEquippedItems(p_77029_1_, p_77029_2_);
Tessellator tessellator = Tessellator.instance;
@@ -220,7 +221,7 @@ public class CustomDragonRenderer extends RenderLiving
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityDragon p_77032_1_, int p_77032_2_, float p_77032_3_)
protected int shouldRenderPass(EntityCustomDragon p_77032_1_, int p_77032_2_, float p_77032_3_)
{
if (p_77032_2_ == 1)
{
@@ -257,7 +258,7 @@ public class CustomDragonRenderer extends RenderLiving
*/
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_);
this.doRender((EntityCustomDragon)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
@@ -265,17 +266,17 @@ public class CustomDragonRenderer extends RenderLiving
*/
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_);
return this.shouldRenderPass((EntityCustomDragon) 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_);
this.renderEquippedItems((EntityCustomDragon) 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_);
this.rotateCorpse((EntityCustomDragon) p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_);
}
/**
@@ -283,7 +284,7 @@ public class CustomDragonRenderer extends 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_);
this.renderModel((EntityCustomDragon) p_77036_1_, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_);
}
/**
@@ -294,7 +295,7 @@ public class CustomDragonRenderer extends RenderLiving
*/
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_);
this.doRender((EntityCustomDragon) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
@@ -302,7 +303,7 @@ public class CustomDragonRenderer extends RenderLiving
*/
protected ResourceLocation getEntityTexture(Entity p_110775_1_)
{
return this.getEntityTexture((EntityDragon)p_110775_1_);
return this.getEntityTexture((EntityCustomDragon)p_110775_1_);
}
/**
@@ -313,7 +314,7 @@ public class CustomDragonRenderer extends RenderLiving
*/
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_);
this.doRender((EntityCustomDragon) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
}
@@ -18,7 +18,7 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class CustonSpawnerRenderer extends TileEntitySpecialRenderer
public class CustomSpawnerRenderer extends TileEntitySpecialRenderer
{
private final ResourceLocation texture = new ResourceLocation(References.MODID.toLowerCase(), "textures/items/draconicCore.png");
@@ -0,0 +1,24 @@
package com.brandon3055.draconicevolution.client.render;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
/**
* Created by Brandon on 14/09/2014.
*/
@SideOnly(Side.CLIENT)
public class EntityChaosDrillRenderer extends Render {
@Override
public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return null;
}
}
@@ -6,12 +6,15 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
public class SoulItemRenderer implements IItemRenderer {
private Minecraft mc;
private Entity randomEntity = new EntityPig(Minecraft.getMinecraft().theWorld);
private String[] randomEntitys = new String[] {"Pig", "Sheep", "Enderman", "Zombie", "Creeper", "Cow", "Chicken", "Ozelot", "Witch", "Wolf", "MushroomCow", "Squid", "EntityHorse", "Spider", "Skeleton", "Blaze", "Bat", "Villager", "Silverfish"};
public SoulItemRenderer() {
this.mc = Minecraft.getMinecraft();
@@ -31,6 +34,10 @@ public class SoulItemRenderer implements IItemRenderer {
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
Entity mob = EntityList.createEntityByName(ItemNBTHelper.getString(item, "Name", "Pig"), mc.theWorld);
if (ItemNBTHelper.getString(item, "Name", "Pig").equals("Any")) mob = randomEntity;
randomEntity = EntityList.createEntityByName(randomEntitys[(int)((mc.getSystemTime() / 1000) % 18)], mc.theWorld);
if (mob == null) {
LogHelper.error("Invalid Mob Name:" + ItemNBTHelper.getString(item, "Name", "Pig"));
mob = EntityList.createEntityByName("Pig", mc.theWorld);
@@ -18,6 +18,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Created by Brandon on 27/08/2014.
@@ -110,5 +111,16 @@ public class CKeyStone extends BlockDE {
}
return null;
}
@Override
public boolean isBlockSolid(IBlockAccess p_149747_1_, int p_149747_2_, int p_149747_3_, int p_149747_4_, int p_149747_5_) {
return true;
}
@Override
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return true;
}
}
@@ -1,6 +1,5 @@
package com.brandon3055.draconicevolution.common.blocks;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import net.minecraft.block.BlockFire;
@@ -15,7 +14,6 @@ import java.util.Random;
public class SafetyFlame extends BlockFire{
public SafetyFlame(){
super();
this.setCreativeTab(DraconicEvolution.tolkienTabBlocksItems);
this.setBlockName(Strings.safetyFlameName);
this.setBlockTextureName("fire");
this.setLightLevel(1F);
@@ -71,7 +71,7 @@ public class DraconiumItemBlock extends ItemBlock implements IEnergyContainerIte
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
return 0;
}
return container.stackTagCompound.getInteger("EnergyHelper");
return container.stackTagCompound.getInteger("Energy");
}
@Override
@@ -17,7 +17,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import java.util.List;
@@ -111,7 +114,7 @@ public class LongRangeDislocator extends BlockDE {
break;
}
}
player.addChatComponentMessage(new ChatComponentText(""+ EnumChatFormatting.RED+"[WARNING]"+EnumChatFormatting.WHITE+" Do not move until the world loads!"));
if (world.getBlock(randX, y, randZ).isBlockSolid(world, randX, y, randZ, 0))
{
world.setBlock(randX, y, randZ, world.getBlock(randX, y, randZ));
@@ -153,4 +156,9 @@ public class LongRangeDislocator extends BlockDE {
}
return true;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
return new ItemStack(ModBlocks.longRangeDislocator, 1, world.getBlockMetadata(x, y, z));
}
}
@@ -25,6 +25,9 @@ public class ConfigHandler {
public static int disable_LRD;
public static boolean updateFix;
public static boolean showUnlocalizedNames;
public static int cometRarity;
public static boolean generateEnderComets;
public static boolean generateChaosIslands;
private static String[] defaultSpawnerList = new String[] {"ExampleMob1", "ExampleMob2", "ExampleMob3 (these examples can be deleted)"};
private static String[] defaultObliterationList = new String[] {"tile.stonebrick", "tile.gravel", "tile.dirt", "tile.stone", "tile.dirt", "tile.sandStone", "tile.sand", "tile.grass", "tile.hellrock"};
@@ -43,7 +46,7 @@ public class ConfigHandler {
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", 1, "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(1);
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", defaultSpawnerList, "List of names that will be ether accepted or rejected by the spawner depending on the list type");
@@ -51,6 +54,9 @@ public class ConfigHandler {
showUnlocalizedNames = config.get(Configuration.CATEGORY_GENERAL, "Show Unlocalized Names", false, "If set to true the unlocalized name of every block and item will be displayed in its tool tip").getBoolean(false);
soulDropChance = config.get(Configuration.CATEGORY_GENERAL, "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", false, "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(false);
cometRarity = config.get(Configuration.CATEGORY_GENERAL, "Ender Comet Rarity", 10000, "Ender Comet has a 1 in {this number} chance to spawn in each chunk").getInt(10000);
generateEnderComets = config.get(Configuration.CATEGORY_GENERAL, "Generate Ender Comets", true, "Should Ender comets be generated").getBoolean(true);
generateChaosIslands = config.get(Configuration.CATEGORY_GENERAL, "Generate Chaos Islands", true, "Should Chaos Islands be generated").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);
@@ -64,7 +70,7 @@ public class ConfigHandler {
e.printStackTrace();
}
finally {
config.save();
if (config.hasChanged()) config.save();
}
}
}
@@ -1,6 +1,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.items.ModItems;
import com.brandon3055.draconicevolution.common.items.armor.DraconicArmor;
import com.brandon3055.draconicevolution.common.items.armor.WyvernArmor;
@@ -55,6 +56,8 @@ public class CraftingHandler {
public static void registerShapedRecipes()
{
ItemStack mobSoul = new ItemStack(ModItems.mobSoul);
ItemNBTHelper.setString(mobSoul, "Name", "Any");
//GameRegistry.addRecipe(new ShapedOreRecipe(rodObsidianFlux, new Object[]{" O", " B ", "O ", 'B', rodObsidian, 'O', "gemCrystalFlux"}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.draconicCore), "GIG", "ISI", "GIG", 'S', "gemDiamond", 'G', "ingotGold", 'I', ModItems.draconiumIngot));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.infusedCompound, 2), "IDI", "DSD", "IDI", 'S', Items.nether_star, 'D', "gemDiamond", 'I', ModItems.draconiumIngot));
@@ -104,7 +107,7 @@ public class CraftingHandler {
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.energyStorageCore), "SRS", "DCD", "SRS", 'S', Items.nether_star, 'R', Blocks.redstone_block, 'C', ModItems.draconicCore, 'D', new ItemStack(ModBlocks.draconium, 1, 0));
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.draconium, 1, 1), "CSC", "SDS", "CSC", 'C', ModItems.draconicCompound, 'S', ModItems.sunFocus, 'D', new ItemStack(ModBlocks.draconium, 1, 0));
CraftingManager.getInstance().addRecipe(new ItemStack(ModBlocks.draconium, 1, 1), "CSC", "SDS", "CSC", 'C', mobSoul, 'S', ModItems.sunFocus, 'D', new ItemStack(ModBlocks.draconium, 1, 0));
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);
@@ -64,18 +64,20 @@ public class MinecraftForgeEventHandler {
if ((!hasFlight || !player.capabilities.allowFlying) && shouldHaveFlight)
{
if (!playersWithFlight.contains(player.getDisplayName()))
if (!playersWithFlight.contains(player.getDisplayName()) && !player.worldObj.isRemote)
playersWithFlight.add(player.getDisplayName());
player.capabilities.allowFlying = true;
}
if (player.worldObj.isRemote && hasFlight && player.capabilities.getFlySpeed() <= 0.05F) player.capabilities.setFlySpeed(player.capabilities.getFlySpeed() + 0.05F);
//if (!player.worldObj.isRemote) LogHelper.info(hasFlight);
if (hasFlight && !shouldHaveFlight)
{
playersWithFlight.remove(player.getDisplayName());
if (player.worldObj.isRemote && player.capabilities.getFlySpeed() > 0.05F) player.capabilities.setFlySpeed(0.05F);
if (!player.worldObj.isRemote)playersWithFlight.remove(player.getDisplayName());
player.capabilities.allowFlying = false;
player.capabilities.isFlying = false;
if (player.capabilities.isCreativeMode)
player.capabilities.allowFlying = true;
player.sendPlayerAbilities();
}
}
}
@@ -30,7 +30,6 @@ public class ClientProxy extends CommonProxy {
super.preInit(event);
//Client Only
FMLCommonHandler.instance().bus().register(new KeyInputHandler());
registerRendering();
}
@@ -39,8 +38,9 @@ public class ClientProxy extends CommonProxy {
{if(debug)
System.out.println("on Client side");
super.init(event);
KeyBindings.init();
//Client Only
FMLCommonHandler.instance().bus().register(new KeyInputHandler());
KeyBindings.init();
}
@Override
@@ -66,7 +66,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyInfuser.class, render);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.energyInfuser), new ItemEnergyInfuserRenderer(render, new TileEnergyInfuser()));
render = new CustonSpawnerRenderer();
render = new CustomSpawnerRenderer();
ClientRegistry.bindTileEntitySpecialRenderer(TileCustomSpawner.class, render);
render = new TestBlockRenderer();
@@ -81,6 +81,8 @@ public class ClientProxy extends CommonProxy {
render = new PlacedItemRenderer();
ClientRegistry.bindTileEntitySpecialRenderer(TilePlacedItem.class, render);
//RenderingRegistry.registerEntityRenderingHandler(EntityChaosDrill.class, new EntityChaosDrillRenderer());
RenderingRegistry.registerEntityRenderingHandler(EntityCustomDragon.class, new CustomDragonRenderer());
}
}
@@ -1,6 +1,7 @@
package com.brandon3055.draconicevolution.common.core.proxy;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.creativetab.DETab;
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
@@ -9,10 +10,7 @@ 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.entity.EntityDraconicArrow;
import com.brandon3055.draconicevolution.common.entity.EntityEnderArrow;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.entity.*;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.*;
@@ -48,6 +46,7 @@ public class CommonProxy {
DraconicEvolution.channelHandler.initialise();
registerPackets();
registerEntitys();
DETab.initialize();
}
public void postInit(FMLPostInitializationEvent event) {
@@ -101,7 +100,7 @@ public class CommonProxy {
}
public void registerWorldGen() {
GameRegistry.registerWorldGenerator(new DraconicWorldGenerator(), 1);
GameRegistry.registerWorldGenerator(new DraconicWorldGenerator(), 0);
}
public void registerEntitys() {
@@ -109,5 +108,6 @@ public class CommonProxy {
EntityRegistry.registerModEntity(EntityPersistentItem.class, "Persistent Item", 1, DraconicEvolution.instance, 32, 5, true);
EntityRegistry.registerModEntity(EntityDraconicArrow.class, "Arrow", 2, DraconicEvolution.instance, 32, 5, true);
EntityRegistry.registerModEntity(EntityEnderArrow.class, "Ender Arrow", 2, DraconicEvolution.instance, 32, 5, true);
EntityRegistry.registerModEntity(EntityChaosDrill.class, "Chaos Drill", 3, DraconicEvolution.instance, 10, 5, false);
}
}
@@ -0,0 +1,30 @@
package com.brandon3055.draconicevolution.common.core.utills;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.IChatComponent;
/**
* Created by Brandon on 1/09/2014.
*/
public class DamageSourceChaos extends EntityDamageSource {
public DamageSourceChaos(String s, Entity entity)
{
super(s, entity);
this.setDamageBypassesArmor();
}
@Override
public IChatComponent func_151519_b (EntityLivingBase par1EntityLivingBase)
{
return super.func_151519_b(par1EntityLivingBase);
//return new ChatComponentTranslation("death.attack.Chaos", par1EntityLivingBase.func_145748_c_());
}
@Override
public boolean isUnblockable() {
return true;
}
}
@@ -2,8 +2,7 @@ package com.brandon3055.draconicevolution.common.core.utills;
import cofh.api.energy.IEnergyContainerItem;
import net.minecraft.item.ItemStack;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
/**
* Created by Brandon on 28/06/2014.
@@ -15,6 +14,15 @@ public class EnergyHelper {
return (stack != null) && ((stack.getItem() instanceof IEnergyContainerItem));
}
public static ItemStack setDefaultEnergyTag(ItemStack container, int energy) {
if (container.stackTagCompound == null) {
container.setTagCompound(new NBTTagCompound());
}
container.stackTagCompound.setInteger("Energy", energy);
return container;
}
}
@@ -32,6 +32,23 @@ public class Utills {
return String.valueOf(Math.round(value/1000000000D)/1000D) + "T";
}
/**
* Calculates the exact distance between two points in 3D space
* @param x1 point A x
* @param y1 point A y
* @param z1 point A z
* @param x2 point B x
* @param y2 point B y
* @param z2 point B z
* @return The distance between point A and point B
*/
public static double getDistanceAtoB(double x1, double y1, double z1, double x2, double y2, double z2){
double dx = x1-x2;
double dy = y1-y2;
double dz = z1-z2;
return Math.sqrt((dx*dx + dy*dy + dz*dz ));
}
public static class BlockChanger extends Block{
public BlockDE block;
@@ -0,0 +1,97 @@
package com.brandon3055.draconicevolution.common.entity;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.core.utills.Utills;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import java.util.ArrayList;
/**
* Created by Brandon on 14/09/2014.
*/
public class EntityChaosDrill extends Entity {
public int MAX_AGE = 300;
private int ENTITY_AGE = 0;
private EntityPlayer PLAYER;
public EntityChaosDrill(World world) {
super(world);
}
public EntityChaosDrill(World world, EntityPlayer player){
super(world);
this.PLAYER = player;
this.setSize(0.1F, 0.1F);
this.setPosition(player.posX, player.posY, player.posZ);
}
@Override
public boolean canBePushed() {
return false;
}
@Override
protected void entityInit() {
LogHelper.info("entityInit");
}
@Override
public void onUpdate() {
//LogHelper.info("onUpdate");
mineNextBlockInPattern();
entityTick();
}
@Override
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
}
@Override
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
}
private void entityTick(){
if (ENTITY_AGE >= MAX_AGE) setDead();
ENTITY_AGE++;
}
private void mineNextBlockInPattern(){
ArrayList<MultiblockHelper.TileLocation> blocks = getBlocksInSphere(5);
LogHelper.info(blocks.size());
if (blocks.size() > 0) worldObj.setBlockToAir(blocks.get(1).getXCoord(), blocks.get(1).getYCoord(), blocks.get(1).getZCoord());
}
private ArrayList<MultiblockHelper.TileLocation> getBlocksInSphere(int r){
ArrayList<MultiblockHelper.TileLocation> blocks = new ArrayList<MultiblockHelper.TileLocation>();
int minDist = 100;
for( int x = (int)posX-r ; x <= (int)posX+r; x++){
for( int z = (int)posZ-r ; z <= (int)posZ+r; z++) {
for (int y = (int)posY-r; y <= (int)posY+r; y++) {
int dist = (int) (Utills.getDistanceAtoB(x, y, z, (int) posX, (int) posY, (int) posZ));
if (dist <= r) {
if (!worldObj.isAirBlock(x, y, z)) {
if (blocks.size() <= dist) {
blocks.add(new MultiblockHelper.TileLocation(x, y, z));
}
else {
blocks.set(dist, new MultiblockHelper.TileLocation(x, y, z));
}
if (dist < minDist) minDist = dist;
}
}
}
}
}
LogHelper.info("dist: " + minDist);
return blocks;
}
}
@@ -1,6 +1,6 @@
package com.brandon3055.draconicevolution.common.entity;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.core.utills.DamageSourceChaos;
import net.minecraft.block.Block;
import net.minecraft.block.BlockEndPortal;
import net.minecraft.entity.Entity;
@@ -30,25 +30,39 @@ import java.util.List;
public class EntityCustomDragon extends EntityDragon {
private Entity target;
private int portalX = 0;
private int portalY = 67;
private int portalZ = 0;
public int portalX = 0;
public int portalY = 67;
public int portalZ = 0;
private boolean createPortal = true;
public float attackDamage = 10F;
protected boolean isUber = false;
private boolean needsRenderUpdate = true;
public EntityCustomDragon(World par1World) {
super(par1World);
this.addPotionEffect(new PotionEffect(10, 600, 10, false));;
this.addPotionEffect(new PotionEffect(10, 600, 10, false));
}
public EntityCustomDragon(World world, double health, float attack){
this(world);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(health);
this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(health);
this.attackDamage = attack;
//LogHelper.info(attackDamage);
this.addPotionEffect(new PotionEffect(10, 600, 10, false));;
}
@Override
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(12, Byte.valueOf((isUber ? (byte)1 : (byte)0)));
}
@Override
public boolean isNoDespawnRequired() {
return true;
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
@@ -59,7 +73,6 @@ public class EntityCustomDragon extends EntityDragon {
public void onLivingUpdate() {
float f;
float f1;
if (this.worldObj.isRemote) {
f = MathHelper.cos(this.animTime * (float) Math.PI * 2.0F);
f1 = MathHelper.cos(this.prevAnimTime * (float) Math.PI * 2.0F);
@@ -79,7 +92,8 @@ public class EntityCustomDragon extends EntityDragon {
this.worldObj.spawnParticle("largeexplode", this.posX + (double) f, this.posY + 2.0D + (double) f1, this.posZ + (double) f2, 0.0D, 0.0D, 0.0D);
} else {
this.updateDragonEnderCrystal();
f = 0.2F / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + 1.0F);
if (isUber) f = 0.5F / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + 1.0F); //Wing Speed
else f = 0.2F / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + 1.0F);
f *= (float) Math.pow(2.0D, this.motionY);
if (this.slowed) {
@@ -150,7 +164,8 @@ public class EntityCustomDragon extends EntityDragon {
}
d0 /= (double) MathHelper.sqrt_double(d10 * d10 + d1 * d1);
f12 = 0.6F;
if (isUber) f12 = 1.0F;//Verticle Motion Speed
else f12 = 0.6F;
if (d0 < (double) (-f12)) {
d0 = (double) (-f12);
@@ -197,6 +212,8 @@ public class EntityCustomDragon extends EntityDragon {
if (this.slowed) {
this.moveEntity(this.motionX * 0.800000011920929D, this.motionY * 0.800000011920929D, this.motionZ * 0.800000011920929D);
} else if (isUber){
this.moveEntity(this.motionX * 2.5D, this.motionY * 1.5D, this.motionZ * 2.5D);
} else {
this.moveEntity(this.motionX, this.motionY, this.motionZ);
}
@@ -281,7 +298,7 @@ public class EntityCustomDragon extends EntityDragon {
@Override
protected void onDeathUpdate() {
if (deathTicks == 0)
if (deathTicks == 0 && !isUber)
{
for (int ix = -150; ix < 150; ix++) {
for (int iz = -150; iz < 150; iz++) {
@@ -367,19 +384,29 @@ public class EntityCustomDragon extends EntityDragon {
double d2 = entity.posX - d0;
double d3 = entity.posZ - d1;
double d4 = d2 * d2 + d3 * d3;
entity.addVelocity(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D);
entity.addVelocity(d2 / d4 * 8.0D, 5.20000000298023224D, d3 / d4 * 8.0D);
entity.velocityChanged = true;
((EntityLivingBase)entity).setLastAttacker(this);
}
if (entity instanceof EntityLivingBase && isUber){
((EntityLivingBase)entity).setLastAttacker(this);
entity.attackEntityFrom(new DamageSourceChaos("ChaosDragon", this), 20F);
}
}
}
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) {
if (entity instanceof EntityLivingBase && !isUber) {
((EntityLivingBase)entity).setLastAttacker(this);
entity.attackEntityFrom(DamageSource.causeMobDamage(this), attackDamage);
}
if (entity instanceof EntityLivingBase && isUber){
((EntityLivingBase)entity).setLastAttacker(this);
entity.attackEntityFrom(new DamageSourceChaos("ChaosDragon", this), 50F);
}
}
}
@@ -392,7 +419,8 @@ public class EntityCustomDragon extends EntityDragon {
this.healingEnderCrystal = null;
} else if (this.ticksExisted % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
this.setHealth(this.getHealth() + 1.0F);
if (isUber) this.setHealth(this.getHealth() + 10.0F);
else this.setHealth(this.getHealth() + 1.0F);
}
}
@@ -420,15 +448,15 @@ public class EntityCustomDragon extends EntityDragon {
private void setNewTarget() {
this.forceNewTarget = false;
if (this.rand.nextInt(2) == 0 && !this.worldObj.playerEntities.isEmpty()) {
if ((isUber || this.rand.nextInt(2) == 0) && (!isUber || 19 > this.rand.nextInt(20)) && !this.worldObj.playerEntities.isEmpty()) {
this.target = (Entity) this.worldObj.playerEntities.get(this.rand.nextInt(this.worldObj.playerEntities.size()));
} else {
boolean flag = false;
do {
this.targetX = 0.0D;
this.targetX = portalX;
this.targetY = (double) (70.0F + this.rand.nextFloat() * 50.0F);
this.targetZ = 0.0D;
this.targetZ = portalZ;
this.targetX += (double) (this.rand.nextFloat() * 120.0F - 60.0F);
this.targetZ += (double) (this.rand.nextFloat() * 120.0F - 60.0F);
double d0 = this.posX - this.targetX;
@@ -485,7 +513,7 @@ public class EntityCustomDragon extends EntityDragon {
{
BlockEndPortal.field_149948_a = true;
if (createPortal) {
if (createPortal || isUber) {
createEnderPortal(portalX, portalZ);
}
if (worldObj.getBlock(portalX, portalY + 1, portalZ) == Blocks.air) {
@@ -523,7 +551,7 @@ public class EntityCustomDragon extends EntityDragon {
private void createEnderPortal(int par1, int par2)
{
byte b0 = 64;
int b0 = portalY-3;
byte b1 = 4;
for (int k = b0 - 1; k <= b0 + 32; ++k)
@@ -568,11 +596,30 @@ public class EntityCustomDragon extends EntityDragon {
public void writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
compound.setFloat("AttackDamage", attackDamage);
compound.setBoolean("IsUber", isUber);
}
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
attackDamage = compound.getFloat("AttackDamage");
isUber = compound.getBoolean("IsUber");
this.dataWatcher.updateObject(12, isUber ? (byte)1: (byte)0);
}
@Override
protected boolean canDespawn() {
return false;
}
@Override
protected void despawnEntity() {
}
public void setUber(boolean b){
isUber = b;
this.dataWatcher.updateObject(12, b ? (byte)1: (byte)0);
}
}
@@ -8,6 +8,8 @@ import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityDragonPart;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -55,25 +57,6 @@ public class EntityDraconicArrow extends EntityArrow {
super(par1World, par2EntityLivingBase, par3);
}
/*public EntityDraconicArrow(World par1World, EntityLivingBase par2EntityLivingBase, float par3) {
super(par1World);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = par2EntityLivingBase;
world = par1World;
this.setSize(0.5F, 0.5F);
this.setLocationAndAngles(par2EntityLivingBase.posX, par2EntityLivingBase.posY + par2EntityLivingBase.getEyeHeight(), par2EntityLivingBase.posZ, par2EntityLivingBase.rotationYaw, par2EntityLivingBase.rotationPitch);
this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
this.posY -= 0.10000000149011612D;
this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
this.setPosition(this.posX, this.posY, this.posZ);
this.yOffset = 0.0F;
this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI));
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F);
}
*/
@Override
protected void entityInit()
{
@@ -269,7 +252,11 @@ public class EntityDraconicArrow extends EntityArrow {
}
movingobjectposition.entityHit.hurtResistantTime = 0;
if (movingobjectposition.entityHit instanceof EntityDragonPart)
{
((EntityDragon)((EntityDragonPart)movingobjectposition.entityHit).entityDragonObj).hurtResistantTime = 0;
}
if (movingobjectposition.entityHit.attackEntityFrom(damagesource, k)) {
if (movingobjectposition.entityHit instanceof EntityLivingBase) {
EntityLivingBase entitylivingbase = (EntityLivingBase) movingobjectposition.entityHit;
@@ -1,6 +1,6 @@
package com.brandon3055.draconicevolution.common.entity;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.core.utills.Utills;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@@ -114,9 +114,7 @@ public class EntityEnderArrow extends EntityDraconicArrow {
@Override
public void onUpdate()
{
this.worldObj.spawnParticle("portal", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - 0.25D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D);
for (int i=0; i < 10; i++) this.worldObj.spawnParticle("portal", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - 0.25D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D);
super.onEntityUpdate();
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
@@ -388,17 +386,22 @@ public class EntityEnderArrow extends EntityDraconicArrow {
protected void onImpact(Entity entityHit)
{
if (!(shootingEntity instanceof EntityPlayer) || shootingEntity.isDead) return;
if (entityHit != null)
{
entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), 0.0F);
}
if (shootingEntity == null) return;
double startX = shootingEntity.posX;
double startY = shootingEntity.posY;
double startZ = shootingEntity.posZ;
for (int i = 0; i < 32; ++i)
{
this.worldObj.spawnParticle("portal", this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian());
}
if (!(shootingEntity instanceof EntityPlayer) || shootingEntity.isDead) return;
if (entityHit != null)
{
entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), 0.0F);
}
if (!this.worldObj.isRemote)
{
if (this.shootingEntity != null && this.shootingEntity instanceof EntityPlayerMP)
@@ -407,23 +410,22 @@ public class EntityEnderArrow extends EntityDraconicArrow {
if (entityplayermp.playerNetServerHandler.func_147362_b().isChannelOpen() && entityplayermp.worldObj == this.worldObj)
{
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F);
int x = (int)Math.floor(posX);
int y = (int)Math.floor(posY);
int z = (int)Math.floor(posZ);
double travelDist = Utills.getDistanceAtoB(startX, startY, startZ, x, y, z);
float travelDmg = (float)(travelDist / 5D);
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x+0.5, y+0.5, z+0.5, travelDmg);
if (!MinecraftForge.EVENT_BUS.post(event))
{ // Don't indent to lower patch size
{
if (this.shootingEntity.isRiding())
{
shootingEntity.mountEntity((Entity)null);
}
((EntityPlayer)shootingEntity).setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
shootingEntity.fallDistance = 0.0F;
if (((EntityPlayer) shootingEntity).getHealth() < 18) {
((EntityPlayer) shootingEntity).setHealth(0.5F);
shootingEntity.attackEntityFrom(DamageSource.fall, Float.MAX_VALUE);
LogHelper.info("Kill");
}else {
((EntityPlayer) shootingEntity).setHealth(((EntityPlayer) shootingEntity).getHealth() - 18);
shootingEntity.attackEntityFrom(DamageSource.fall, 0.5F);
}
shootingEntity.attackEntityFrom(DamageSource.fall, (float)(travelDist / 5D));
}
}
}
@@ -1,8 +1,10 @@
package com.brandon3055.draconicevolution.common.items;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.interfaces.GuiHandler;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@@ -36,4 +38,10 @@ public class DraconicCore extends ItemDE {
}
return false;
}
@Override
public ItemStack onItemRightClick(ItemStack p_77659_1_, World world, EntityPlayer player) {
FMLNetworkHandler.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_MANUAL, world, (int) player.posX, (int) player.posY, (int) player.posZ);
return super.onItemRightClick(p_77659_1_, world, player);
}
}
@@ -1,6 +1,7 @@
package com.brandon3055.draconicevolution.common.items;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.lib.Strings;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -47,6 +48,10 @@ public class MobSoul extends ItemDE {
double sX = x + ForgeDirection.getOrientation(side).offsetX + 0.5;
double sY = y + ForgeDirection.getOrientation(side).offsetY + 0.5;
double sZ = z + ForgeDirection.getOrientation(side).offsetZ + 0.5;
if (entity == null) {
LogHelper.error("Mob Soul bound entity = null");
return false;
}
entity.setLocationAndAngles(sX, sY, sZ, player.rotationYaw, 0F);
if (entity instanceof EntityLivingBase && !world.isRemote) {
@@ -57,6 +57,8 @@ public class ModItems {
public static ItemDE enderArrow;
public static ItemDE safetyMatch;
public static ItemDE key;
public static ItemDE creativeStructureSpawner;
//public static ItemDE obliterationCatalyst;
public static ItemDE teleporterMKI;
public static ItemDE teleporterMKII;
@@ -100,6 +102,8 @@ public class ModItems {
enderArrow = new EnderArrow();
safetyMatch = new SafetyMatch();
key = new Key();
creativeStructureSpawner = new CreativeStructureSpawner();
//obliterationCatalyst = new ObliterationCatalyst();
}
@@ -1,19 +1,16 @@
package com.brandon3055.draconicevolution.common.items;
import java.util.List;
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.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.brandon3055.draconicevolution.common.lib.Strings;
import java.util.List;
public class Tclogo extends ItemDE {
public Tclogo() {
@@ -73,11 +70,20 @@ public class Tclogo extends ItemDE {
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
String name = References.MODID.toLowerCase() + ":" + getUnwrappedUnlocalizedName(getUnlocalizedName());
int xi = (int)player.posX;
int yi = (int)player.posY;
int zi = (int)player.posZ;
int rad = 100;
name = name.substring(name.indexOf(":") + 1);
for (int x = xi-rad; x < xi+rad; x++){
for (int y = yi-5; y < yi+5; y++){
for (int z = zi-rad; z < zi+rad; z++){
world.markBlockForUpdate(x, y, z);
}
}
}
world.markBlockRangeForRenderUpdate(xi-rad, yi-rad, zi-rad, xi+rad, yi+rad, zi+rad);
LogHelper.info(getUnlocalizedName());
return stack;
}
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.common.items.armor;
import com.brandon3055.draconicevolution.common.core.utills.DamageSourceChaos;
import com.brandon3055.draconicevolution.common.items.ModItems;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
@@ -12,7 +13,9 @@ import net.minecraftforge.common.ISpecialArmor;
public class ArmorPropertiesHandler {
public static ISpecialArmor.ArmorProperties draconicHelm(EntityLivingBase player, ItemStack armor, DamageSource source){
if (source == DamageSource.fallingBlock || source == DamageSource.anvil)
if (source instanceof DamageSourceChaos)
return new ISpecialArmor.ArmorProperties(1, 0, 0);
else if (source == DamageSource.fallingBlock || source == DamageSource.anvil)
return new ISpecialArmor.ArmorProperties(1, 1, Integer.MAX_VALUE);
else if (isFireDamage(source))
return new ISpecialArmor.ArmorProperties(1, 0.15, Integer.MAX_VALUE);
@@ -22,7 +25,9 @@ public class ArmorPropertiesHandler {
}
public static ISpecialArmor.ArmorProperties draconicChest(EntityLivingBase player, ItemStack armor, DamageSource source){
if (hasFullSetDraconic(player) && source == DamageSource.wither || source == DamageSource.magic)
if (source instanceof DamageSourceChaos)
return new ISpecialArmor.ArmorProperties(1, 0, 0);
else if (hasFullSetDraconic(player) && source == DamageSource.wither || source == DamageSource.magic)
return new ISpecialArmor.ArmorProperties(1, 1, Integer.MAX_VALUE);
else if (isFireDamage(source))
return new ISpecialArmor.ArmorProperties(1, 0.50, Integer.MAX_VALUE);
@@ -31,14 +36,18 @@ public class ArmorPropertiesHandler {
}
public static ISpecialArmor.ArmorProperties draconicLeggs(EntityLivingBase player, ItemStack armor, DamageSource source){
if (isFireDamage(source))
if (source instanceof DamageSourceChaos)
return new ISpecialArmor.ArmorProperties(1, 0, 0);
else if (isFireDamage(source))
return new ISpecialArmor.ArmorProperties(1, 0.20, Integer.MAX_VALUE);
else
return new ISpecialArmor.ArmorProperties(1, 0.18, Integer.MAX_VALUE);
}
public static ISpecialArmor.ArmorProperties draconicBoots(EntityLivingBase player, ItemStack armor, DamageSource source){
if (isFireDamage(source))
if (source instanceof DamageSourceChaos)
return new ISpecialArmor.ArmorProperties(1, 0, 0);
else if (isFireDamage(source))
return new ISpecialArmor.ArmorProperties(1, 0.15, Integer.MAX_VALUE);
else if (source == DamageSource.fall)
return new ISpecialArmor.ArmorProperties(1, 1, Integer.MAX_VALUE);
@@ -6,6 +6,7 @@ import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -15,6 +16,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
@@ -24,12 +26,13 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import org.lwjgl.input.Keyboard;
import java.util.Collection;
import java.util.List;
/**
* Created by Brandon on 3/07/2014.
*/
public class DraconicArmor extends ItemArmor implements ISpecialArmor{
public class DraconicArmor extends ItemArmor implements ISpecialArmor {
private IIcon helmIcon;
private IIcon chestIcon;
private IIcon leggsIcon;
@@ -43,13 +46,13 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor{
}
@Override
public String getUnlocalizedName(){
public String getUnlocalizedName() {
return String.format("item.%s%s", References.MODID.toLowerCase() + ":", super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1));
}
@Override
public String getUnlocalizedName(final ItemStack itemStack){
public String getUnlocalizedName(final ItemStack itemStack) {
return getUnlocalizedName();
}
@@ -93,7 +96,7 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor{
@Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
switch(slot){
switch (slot) {
case 0:
return ArmorPropertiesHandler.draconicBoots(player, armor, source);
case 1:
@@ -111,7 +114,7 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor{
@Override
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
switch(slot){
switch (slot) {
case 0:
return 3;
case 1:
@@ -135,44 +138,39 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor{
if (player.isBurning() && ArmorPropertiesHandler.hasFullSetDraconic(player)) {
player.addPotionEffect(new PotionEffect(12, 10, 0, true));
}
if(stack != null && stack.getItem() == ModItems.draconicHelm) {
if (player.worldObj.getBlockLightValue((int)player.posX, (int)player.posY, (int)player.posZ) < 5)
if (stack != null && stack.getItem() == ModItems.draconicHelm) {
if (world.isRemote) return;
clearNegativeEffects(player);
if (player.worldObj.getBlockLightValue((int) player.posX, (int) player.posY, (int) player.posZ) < 5)
player.addPotionEffect(new PotionEffect(16, 210, 0, true));
else if (player.isPotionActive(16))
player.removePotionEffect(16);
else if (player.isPotionActive(16)) player.removePotionEffect(16);
}
if(stack != null && stack.getItem() == ModItems.draconicLeggs) {
if (player.isSprinting())
player.addPotionEffect(new PotionEffect(1, 10, 3, true));
else
player.addPotionEffect(new PotionEffect(1, 10, 1, true));
if (stack != null && stack.getItem() == ModItems.draconicLeggs) {
if (player.isSprinting()) player.addPotionEffect(new PotionEffect(1, 10, 3, true));
else player.addPotionEffect(new PotionEffect(1, 10, 1, true));
}
if(stack != null && stack.getItem() == ModItems.draconicBoots) {
if (player.isSprinting())
player.addPotionEffect(new PotionEffect(8, 10, 3, true));
else
player.addPotionEffect(new PotionEffect(8, 10, 1, true));
if (stack != null && stack.getItem() == ModItems.draconicBoots) {
if (player.isSprinting()) player.addPotionEffect(new PotionEffect(8, 10, 3, true));
else player.addPotionEffect(new PotionEffect(8, 10, 1, true));
}
}
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) {
if ((!Keyboard.isKeyDown(42)) && (!Keyboard.isKeyDown(54))) {
list.add(EnumChatFormatting.DARK_GREEN + "Hold shift for information");
}else{
} else {
if (stack.getItem() == ModItems.draconicHelm) {
list.add(StatCollector.translateToLocal("info.draconicArmorInfoHelm.txt"));
}
else if (stack.getItem() == ModItems.draconicChest) {
} else if (stack.getItem() == ModItems.draconicChest) {
list.add(StatCollector.translateToLocal("info.draconicArmorInfoChest.txt"));
list.add(StatCollector.translateToLocal("info.draconicArmorInfoChest1.txt"));
list.add(StatCollector.translateToLocal("info.draconicArmorInfoChest2.txt"));
list.add(StatCollector.translateToLocal("info.draconicArmorInfoChest3.txt"));
}
else if (stack.getItem() == ModItems.draconicLeggs) {
} else if (stack.getItem() == ModItems.draconicLeggs) {
list.add(StatCollector.translateToLocal("info.draconicArmorInfoLeggs.txt"));
}
else if (stack.getItem() == ModItems.draconicBoots) {
} else if (stack.getItem() == ModItems.draconicBoots) {
list.add(StatCollector.translateToLocal("info.draconicArmorInfoBoots.txt"));
list.add(StatCollector.translateToLocal("info.draconicArmorInfoBoots1.txt"));
}
@@ -182,30 +180,14 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor{
}
}
public static void registerRecipe(){
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicHelm),
"ISI",
"DAD",
"CIC",
'I', ModItems.draconiumIngot, 'S', ModItems.sunFocus, 'D', ModItems.draconicCompound, 'C', ModItems.draconicCore, 'A', ModItems.wyvernHelm);
public static void registerRecipe() {
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicHelm), "ISI", "DAD", "CIC", 'I', ModItems.draconiumIngot, 'S', ModItems.sunFocus, 'D', ModItems.draconicCompound, 'C', ModItems.draconicCore, 'A', ModItems.wyvernHelm);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicChest),
"ISI",
"DAD",
"CDC",
'I', ModItems.draconiumIngot, 'S', ModItems.sunFocus, 'D', ModItems.draconicCompound, 'C', ModItems.draconicCore, 'A', ModItems.wyvernChest);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicChest), "ISI", "DAD", "CDC", 'I', ModItems.draconiumIngot, 'S', ModItems.sunFocus, 'D', ModItems.draconicCompound, 'C', ModItems.draconicCore, 'A', ModItems.wyvernChest);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicLeggs),
"ISI",
"DAD",
"CIC",
'I', ModItems.draconiumIngot, 'S', ModItems.sunFocus, 'D', ModItems.draconicCompound, 'C', ModItems.draconicCore, 'A', ModItems.wyvernLeggs);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicLeggs), "ISI", "DAD", "CIC", 'I', ModItems.draconiumIngot, 'S', ModItems.sunFocus, 'D', ModItems.draconicCompound, 'C', ModItems.draconicCore, 'A', ModItems.wyvernLeggs);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicBoots),
"ISI",
"DAD",
"CIC",
'I', ModItems.draconiumIngot, 'S', ModItems.sunFocus, 'D', ModItems.draconicCompound, 'C', ModItems.draconicCore, 'A', ModItems.wyvernBoots);
CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicBoots), "ISI", "DAD", "CIC", 'I', ModItems.draconiumIngot, 'S', ModItems.sunFocus, 'D', ModItems.draconicCompound, 'C', ModItems.draconicCore, 'A', ModItems.wyvernBoots);
}
@Override
@@ -217,4 +199,25 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor{
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
return new EntityPersistentItem(world, location, itemstack);
}
public void clearNegativeEffects(Entity par3Entity) {
if (par3Entity.ticksExisted % 20 == 0) {
if (par3Entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) par3Entity;
Collection<PotionEffect> potions = player.getActivePotionEffects();
if (player.isBurning()) {
player.extinguish();
} else for (PotionEffect potion : potions) {
int id = potion.getPotionID();
if (ReflectionHelper.getPrivateValue(Potion.class, Potion.potionTypes[id], new String[]{"isBadEffect", "field_76418_K", "J"})) {
if ((player.getHeldItem() == null || (player.getHeldItem().getItem() != ModItems.wyvernBow && player.getHeldItem().getItem() != ModItems.draconicBow)) || id != 2) player.removePotionEffect(id);
break;
}
}
}
}
}
}
@@ -0,0 +1,81 @@
package com.brandon3055.draconicevolution.common.items.tools;
import com.brandon3055.draconicevolution.common.items.ItemDE;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.world.WorldGenEnderComet;
import com.brandon3055.draconicevolution.common.world.WorldGenEnderIsland;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.List;
import java.util.Random;
/**
* Created by Brandon on 29/08/2014.
*/
public class CreativeStructureSpawner extends ItemDE {
public CreativeStructureSpawner() {
this.setUnlocalizedName(Strings.creativeStructureSpawnerName);
this.hasSubtypes = true;
ModItems.register(this);
}
@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));
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (world.isRemote) return stack;
switch (stack.getItemDamage()){
case 0:
new WorldGenEnderComet().generate(world, new Random(), (int)player.posX, (int)player.posY + 10, (int)player.posZ);
break;
case 1:
new WorldGenEnderIsland().generate(world, new Random(), (int)player.posX, (int)player.posY + 10, (int)player.posZ);
break;
case 2:
break;
case 3:
break;
}
return stack;
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
String name = "null";
switch (itemStack.getItemDamage()){
case 0:
name = "Comet";
break;
case 1:
name = "EnderIsland";
break;
case 2:
break;
case 3:
break;
}
return super.getUnlocalizedName(itemStack)+name;
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("all")
@Override
public void addInformation(ItemStack stack, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) {
if (stack.getItemDamage() == 1) list.add("Warning this will take between 5-10 minutes (maby longer) to generate");
if (stack.getItemDamage() == 1) list.add("depending on the speed of your pc");
}
}
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
@@ -13,10 +14,12 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
@@ -41,6 +44,13 @@ public class DraconicAxe extends ItemAxe implements IEnergyContainerItem{
GameRegistry.registerItem(this, Strings.draconicAxeName);
}
@SuppressWarnings("all")
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
}
@Override
public String getUnlocalizedName(){
@@ -193,12 +203,12 @@ public class DraconicAxe extends ItemAxe implements IEnergyContainerItem{
if (container.stackTagCompound == null) {
container.stackTagCompound = new NBTTagCompound();
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
if (!simulate) {
energy += energyReceived;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyReceived;
}
@@ -206,25 +216,25 @@ public class DraconicAxe extends ItemAxe implements IEnergyContainerItem{
@Override
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
if (!simulate) {
energy -= energyExtracted;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyExtracted;
}
@Override
public int getEnergyStored(ItemStack container) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
return container.stackTagCompound.getInteger("EnergyHelper");
return container.stackTagCompound.getInteger("Energy");
}
@Override
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
@@ -16,6 +17,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
@@ -23,6 +25,7 @@ import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.item.crafting.CraftingManager;
@@ -73,6 +76,13 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
GameRegistry.registerItem(this, Strings.draconicDStaffName);
}
@SuppressWarnings("all")
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
}
@Override
public String getUnlocalizedName(){
@@ -190,12 +200,12 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
if (container.stackTagCompound == null) {
container.stackTagCompound = new NBTTagCompound();
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
if (!simulate) {
energy += energyReceived;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyReceived;
}
@@ -203,25 +213,25 @@ public class DraconicDistructionStaff extends ItemTool implements IEnergyContain
@Override
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
if (!simulate) {
energy -= energyExtracted;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyExtracted;
}
@Override
public int getEnergyStored(ItemStack container) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
return container.stackTagCompound.getInteger("EnergyHelper");
return container.stackTagCompound.getInteger("Energy");
}
@Override
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
@@ -14,6 +15,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
@@ -45,6 +47,13 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem{
GameRegistry.registerItem(this, Strings.draconicHoeName);
}
@SuppressWarnings("all")
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
}
@Override
public String getUnlocalizedName(){
@@ -168,12 +177,12 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem{
if (container.stackTagCompound == null) {
container.stackTagCompound = new NBTTagCompound();
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
if (!simulate) {
energy += energyReceived;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyReceived;
}
@@ -181,25 +190,25 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem{
@Override
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
if (!simulate) {
energy -= energyExtracted;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyExtracted;
}
@Override
public int getEnergyStored(ItemStack container) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
return container.stackTagCompound.getInteger("EnergyHelper");
return container.stackTagCompound.getInteger("Energy");
}
@Override
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
@@ -14,10 +15,12 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
@@ -45,6 +48,13 @@ public class DraconicPickaxe extends ItemPickaxe implements IEnergyContainerItem
GameRegistry.registerItem(this, Strings.draconicPickaxeName);
}
@SuppressWarnings("all")
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
}
@Override
public String getUnlocalizedName(){
@@ -153,12 +163,12 @@ public class DraconicPickaxe extends ItemPickaxe implements IEnergyContainerItem
if (container.stackTagCompound == null) {
container.stackTagCompound = new NBTTagCompound();
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
if (!simulate) {
energy += energyReceived;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyReceived;
}
@@ -166,25 +176,25 @@ public class DraconicPickaxe extends ItemPickaxe implements IEnergyContainerItem
@Override
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
if (!simulate) {
energy -= energyExtracted;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyExtracted;
}
@Override
public int getEnergyStored(ItemStack container) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
return container.stackTagCompound.getInteger("EnergyHelper");
return container.stackTagCompound.getInteger("Energy");
}
@Override
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
@@ -14,10 +15,12 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
@@ -45,6 +48,13 @@ public class DraconicShovel extends ItemSpade implements IEnergyContainerItem{
GameRegistry.registerItem(this, Strings.draconicShovelName);
}
@SuppressWarnings("all")
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
}
@Override
public String getUnlocalizedName(){
@@ -153,12 +163,12 @@ public class DraconicShovel extends ItemSpade implements IEnergyContainerItem{
if (container.stackTagCompound == null) {
container.stackTagCompound = new NBTTagCompound();
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
if (!simulate) {
energy += energyReceived;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyReceived;
}
@@ -166,25 +176,25 @@ public class DraconicShovel extends ItemSpade implements IEnergyContainerItem{
@Override
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
if (!simulate) {
energy -= energyExtracted;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyExtracted;
}
@Override
public int getEnergyStored(ItemStack container) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
return container.stackTagCompound.getInteger("EnergyHelper");
return container.stackTagCompound.getInteger("Energy");
}
@Override
@@ -0,0 +1,65 @@
package com.brandon3055.draconicevolution.common.items.tools;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.LogHelper;
import com.brandon3055.draconicevolution.common.entity.EntityChaosDrill;
import com.brandon3055.draconicevolution.common.items.ItemDE;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.lib.Strings;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* Created by Brandon on 14/09/2014.
*/
public class ObliterationCatalyst extends ItemDE {
public ObliterationCatalyst(){
this.setUnlocalizedName(Strings.obliterationCatalystName);
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
this.setMaxStackSize(1);
ModItems.register(this);
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
LogHelper.info("onItemRightClick");
player.setItemInUse(stack, getMaxItemUseDuration(stack));
if (!world.isRemote) world.spawnEntityInWorld(new EntityChaosDrill(world, player));
return stack;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int i1, int i2, int i3, int i4, float f1, float f2, float f3) {
//LogHelper.info("onItemUse");
return false;
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int i1, boolean b1) {
}
@Override
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
//LogHelper.info("onUsingTick");
super.onUsingTick(stack, player, count);
}
@Override
public int getMaxItemUseDuration(ItemStack p_77626_1_) {
//LogHelper.info("getMaxItemUseDuration");
return 70000;
}
@Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int meta) {
//LogHelper.info("onPlayerStoppedUsing");
}
@Override
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
return stack;
}
}
@@ -8,7 +8,6 @@ import com.brandon3055.draconicevolution.common.items.ItemDE;
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;
@@ -36,7 +35,8 @@ public class TeleporterMKI extends ItemDE
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
this.setMaxDamage(19);
this.setMaxStackSize(1);
GameRegistry.registerItem(this, Strings.teleporterMKIName);
ModItems.register(this);
//GameRegistry.registerItem(this, Strings.teleporterMKIName);
}
@Override
@@ -10,7 +10,6 @@ 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.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.client.renderer.texture.IIconRegister;
@@ -35,7 +34,8 @@ public class TeleporterMKII extends ItemDE
this.setUnlocalizedName(Strings.teleporterMKIIName);
this.setCreativeTab(DraconicEvolution.tolkienTabToolsWeapons);
this.setMaxStackSize(1);
GameRegistry.registerItem(this, Strings.teleporterMKIIName);
ModItems.register(this);
//GameRegistry.registerItem(this, Strings.teleporterMKIIName);
}
@Override
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
@@ -14,11 +15,13 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
@@ -44,6 +47,13 @@ public class WyvernPickaxe extends ItemPickaxe implements IEnergyContainerItem{
GameRegistry.registerItem(this, Strings.wyvernPickaxeName);
}
@SuppressWarnings("all")
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
}
@Override
public String getUnlocalizedName(){
@@ -145,12 +155,12 @@ public class WyvernPickaxe extends ItemPickaxe implements IEnergyContainerItem{
if (container.stackTagCompound == null) {
container.stackTagCompound = new NBTTagCompound();
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
if (!simulate) {
energy += energyReceived;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyReceived;
}
@@ -158,25 +168,25 @@ public class WyvernPickaxe extends ItemPickaxe implements IEnergyContainerItem{
@Override
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
if (!simulate) {
energy -= energyExtracted;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyExtracted;
}
@Override
public int getEnergyStored(ItemStack container) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
return container.stackTagCompound.getInteger("EnergyHelper");
return container.stackTagCompound.getInteger("Energy");
}
@Override
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.tools;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
@@ -14,11 +15,13 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
@@ -44,6 +47,13 @@ public class WyvernShovel extends ItemSpade implements IEnergyContainerItem{
GameRegistry.registerItem(this, Strings.wyvernShovelName);
}
@SuppressWarnings("all")
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
}
@Override
public String getUnlocalizedName(){
@@ -144,12 +154,12 @@ public class WyvernShovel extends ItemSpade implements IEnergyContainerItem{
if (container.stackTagCompound == null) {
container.stackTagCompound = new NBTTagCompound();
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
if (!simulate) {
energy += energyReceived;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyReceived;
}
@@ -157,25 +167,25 @@ public class WyvernShovel extends ItemSpade implements IEnergyContainerItem{
@Override
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
if (!simulate) {
energy -= energyExtracted;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyExtracted;
}
@Override
public int getEnergyStored(ItemStack container) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
return container.stackTagCompound.getInteger("EnergyHelper");
return container.stackTagCompound.getInteger("Energy");
}
@Override
@@ -28,7 +28,7 @@ public class BowHandler {
boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
if (flag || player.inventory.hasItem(Items.arrow) || player.inventory.hasItem(ModItems.enderArrow)) {
if (flag || player.inventory.hasItem(Items.arrow)) {
float f = j / pullSpeedModifier;
f = (f * f + f * 2.0F) / 3.0F;
@@ -40,13 +40,7 @@ public class BowHandler {
f *= speedModifier;
EntityDraconicArrow entityArrow;
if (player.inventory.hasItem(ModItems.enderArrow))
/*EntityEnderArrow*/ entityArrow = new EntityEnderArrow(world, player, f * 2.0F);
else
/*EntityDraconicArrow*/ entityArrow = new EntityDraconicArrow(world, player, f * 2.0F);
EntityDraconicArrow entityArrow = new EntityDraconicArrow(world, player, f * 2.0F);//.setShooter(player);
if (f >= 1.0F)
entityArrow.setIsCritical(true);
@@ -86,10 +80,7 @@ public class BowHandler {
entityArrow.canBePickedUp = 2;
else {
entityArrow.canBePickedUp = 1;
if (player.inventory.hasItem(ModItems.enderArrow))
player.inventory.consumeInventoryItem(ModItems.enderArrow);
else
player.inventory.consumeInventoryItem(Items.arrow);
player.inventory.consumeInventoryItem(Items.arrow);
}
if (!world.isRemote)
@@ -97,6 +88,41 @@ public class BowHandler {
}
}
public static void enderShot(ItemStack stack, World world, EntityPlayer player, int count, Random itemRand, float pullSpeedModifier, float speedModifier, float soundPitchModifier, int minRelease)
{
int j = 72000 - count;
ArrowLooseEvent event = new ArrowLooseEvent(player, stack, j);
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled()) {
return;
}
j = event.charge;
if (player.inventory.hasItem(ModItems.enderArrow)) {
float f = j / pullSpeedModifier;
f = (f * f + f * 2.0F) / 3.0F;
if ((j < minRelease) || f < 0.1D)
return;
if (f > 1.0F)
f = 1.0F;
f *= speedModifier;
EntityEnderArrow entityArrow = new EntityEnderArrow(world, player, f * 2.0F);
stack.damageItem(1, player); //
world.playSoundAtEntity(player, "random.bow", 1.0F, soundPitchModifier * (1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.3F));
if (player.inventory.hasItem(ModItems.enderArrow)) player.inventory.consumeInventoryItem(ModItems.enderArrow);
//if (!world.isRemote)
world.spawnEntityInWorld(entityArrow);
}
}
public static void rapidFire(EntityPlayer player, int count, int speed)
{
int ticks = 72000 - count;
@@ -92,7 +92,7 @@ public class DraconicBow extends ItemBow
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int count)
{
String currentMode = ItemNBTHelper.getString(stack, "mode", "rapidfire");
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "rapidfire";
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "ender";
if (currentMode.equals("rapidfire"))
BowHandler.standerdShot(stack, world, player, count, itemRand, 5F, 1.5F, true, 9D, 1F, false, 0);
else if (currentMode.equals("sharpshooter"))
@@ -101,6 +101,8 @@ public class DraconicBow extends ItemBow
BowHandler.standerdShot(stack, world, player, count, itemRand, 5F, 0.5F, true, 0D, 1F, true, 80);
else if (currentMode.equals("devistation"))
BowHandler.standerdShot(stack, world, player, count, itemRand, 2F, 2.0F, true, 0D, 1F, true, 0);
else if (currentMode.equals("ender"))
BowHandler.enderShot(stack, world, player, count, itemRand, 21F, 1.5F, 1F, 0);
}
public void changeMode(ItemStack stack, EntityPlayer player)
@@ -141,7 +143,7 @@ public class DraconicBow extends ItemBow
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
String currentMode = ItemNBTHelper.getString(stack, "mode", "rapidfire");
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "rapidfire";
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "sharpshooter";
int j = stack.getMaxItemUseDuration() - useRemaining;
if (usingItem == null)
return this.itemIcon;
@@ -2,6 +2,7 @@ package com.brandon3055.draconicevolution.common.items.weapons;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
@@ -12,9 +13,11 @@ 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.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.crafting.CraftingManager;
@@ -36,6 +39,13 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem{
GameRegistry.registerItem(this, Strings.draconicSwordName);
}
@SuppressWarnings("all")
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
}
@Override
public String getUnlocalizedName(){
@@ -89,12 +99,12 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem{
if (container.stackTagCompound == null) {
container.stackTagCompound = new NBTTagCompound();
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
if (!simulate) {
energy += energyReceived;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyReceived;
}
@@ -102,25 +112,25 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem{
@Override
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
if (!simulate) {
energy -= energyExtracted;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyExtracted;
}
@Override
public int getEnergyStored(ItemStack container) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
return container.stackTagCompound.getInteger("EnergyHelper");
return container.stackTagCompound.getInteger("Energy");
}
@Override
@@ -85,11 +85,13 @@ public class WyvernBow extends ItemBow {
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int count)
{
String currentMode = ItemNBTHelper.getString(stack, "mode", "rapidfire");
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "rapidfire";
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "ender";
if (currentMode.equals("rapidfire"))
BowHandler.standerdShot(stack, world, player, count, itemRand, 19F, 1F, false, 0D, 1F, false, 0);
else if (currentMode.equals("sharpshooter"))
BowHandler.standerdShot(stack, world, player, count, itemRand, 30F, 5F, true, 20D, 0.7F, false, 30);
else if (currentMode.equals("ender"))
BowHandler.enderShot(stack, world, player, count, itemRand, 30, 1F, 1F, 0);
}
public void changeMode(ItemStack stack, EntityPlayer player)
@@ -126,7 +128,7 @@ public class WyvernBow extends ItemBow {
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
String currentMode = ItemNBTHelper.getString(stack, "mode", "rapidfire");
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "rapidfire";
if (player.inventory.hasItem(ModItems.enderArrow)) currentMode = "sharpshooter";
int j = stack.getMaxItemUseDuration() - useRemaining;
if (usingItem == null) {
return this.itemIcon;
@@ -2,6 +2,8 @@ package com.brandon3055.draconicevolution.common.items.weapons;
import cofh.api.energy.IEnergyContainerItem;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.core.utills.EnergyHelper;
import com.brandon3055.draconicevolution.common.core.utills.ItemInfoHelper;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.items.ModItems;
import com.brandon3055.draconicevolution.common.items.tools.ToolHandler;
@@ -11,11 +13,13 @@ 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.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.crafting.CraftingManager;
@@ -38,6 +42,13 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem{
GameRegistry.registerItem(this, Strings.wyvernSwordName);
}
@SuppressWarnings("all")
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), 0));
list.add(EnergyHelper.setDefaultEnergyTag(new ItemStack(item, 1, 0), capacity));
}
@Override
public String getUnlocalizedName(){
@@ -70,7 +81,7 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem{
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation)
{
list.add(EnumChatFormatting.DARK_RED + "Your enemy's strength will be their undoing");
list.add("");
ItemInfoHelper.energyDisplayInfo(stack, list);
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "Weary of plain tools you begin to understand");
list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "ways to use Draconic energy to upgrade");
}
@@ -100,12 +111,12 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem{
if (container.stackTagCompound == null) {
container.stackTagCompound = new NBTTagCompound();
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
if (!simulate) {
energy += energyReceived;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyReceived;
}
@@ -113,25 +124,25 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem{
@Override
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
int energy = container.stackTagCompound.getInteger("EnergyHelper");
int energy = container.stackTagCompound.getInteger("Energy");
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
if (!simulate) {
energy -= energyExtracted;
container.stackTagCompound.setInteger("EnergyHelper", energy);
container.stackTagCompound.setInteger("Energy", energy);
}
return energyExtracted;
}
@Override
public int getEnergyStored(ItemStack container) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("EnergyHelper")) {
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
return 0;
}
return container.stackTagCompound.getInteger("EnergyHelper");
return container.stackTagCompound.getInteger("Energy");
}
@Override
@@ -3,7 +3,7 @@ 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.4-Beta";
public static final String VERSION = "0.9.5-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";
@@ -57,4 +57,6 @@ public class Strings {// public sta
public static final String safetyMatchName = "safetyMatch";
public static final String cKeyStoneName = "cKeyStone";
public static final String keyName = "key";
public static final String creativeStructureSpawnerName = "creativeStructureSpawner";
public static final String obliterationCatalystName = "obliterationCatalyst";
}
@@ -157,12 +157,12 @@ public class TileCKeyStone extends TileEntity {
public void updateBlocks()
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, blockType);
worldObj.notifyBlocksOfNeighborChange(xCoord - 1, yCoord, zCoord, blockType);
worldObj.notifyBlocksOfNeighborChange(xCoord + 1, yCoord, zCoord, blockType);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord - 1, zCoord, blockType);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord + 1, zCoord, blockType);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord - 1, blockType);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord + 1, blockType);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.notifyBlocksOfNeighborChange(xCoord - 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.notifyBlocksOfNeighborChange(xCoord + 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord - 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord + 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord - 1, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord + 1, worldObj.getBlock(xCoord, yCoord, zCoord));
}
}
@@ -57,7 +57,7 @@ public class TilePlayerDetector extends TileEntity
public void updateBlocks()
{
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, blockType);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.notifyBlocksOfNeighborChange(xCoord - 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.notifyBlocksOfNeighborChange(xCoord + 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord - 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
@@ -1,16 +1,10 @@
package com.brandon3055.draconicevolution.common.tileentities;
import java.util.Iterator;
import java.util.List;
import com.brandon3055.draconicevolution.common.container.ContainerPlayerDetector;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -20,7 +14,9 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import com.brandon3055.draconicevolution.common.container.ContainerPlayerDetector;
import java.util.Iterator;
import java.util.List;
public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory
{
@@ -32,9 +28,8 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory
private int scanRate = 5;
public boolean output = false;
public boolean outputInverted = false;
List<EntityLiving> EntityList;
AxisAlignedBB ScanBox;
private List<EntityLiving> EntityList;
public TilePlayerDetectorAdvanced()
{
for (int i = 0; i < names.length; i++)
@@ -122,7 +117,7 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory
public void updateBlocks()
{
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, blockType);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.notifyBlocksOfNeighborChange(xCoord - 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.notifyBlocksOfNeighborChange(xCoord + 1, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord - 1, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
@@ -122,7 +122,7 @@ public class TileEnergyPylon extends TileEntity implements IEnergyHandler {
int yMod = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 ? 3 : -3;
int range = 15;
for (int x = xCoord-range; x <= xCoord+range; x++){
for (int y = yCoord+yMod-(range/2); y <= yCoord+yMod+(range/2); y++){
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);
@@ -1,18 +1,19 @@
package com.brandon3055.draconicevolution.common.world;
import java.util.Random;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.core.handler.ConfigHandler;
import cpw.mods.fml.common.IWorldGenerator;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import java.util.Random;
public class DraconicWorldGenerator implements IWorldGenerator {
@Override
public void generate(final Random random, final int chunkX, final int chunkZ, final World world, final IChunkProvider chunkGenerator, final IChunkProvider chunkProvider) {
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
switch (world.provider.dimensionId) {
case 0:
generateSurface(random, chunkX * 16, chunkZ * 16, world);
@@ -29,12 +30,19 @@ public class DraconicWorldGenerator implements IWorldGenerator {
}
public void generateSurface(final Random random, final int chunkX, final int chunkZ, final World world) {// minVainSise, maxVainSize, spawnChance(Def2), minY, maxY
addOreSpawn(ModBlocks.draconiumOre, world, random, chunkX, chunkZ, 3, 4, 2, 2, 8);
public void generateSurface(Random random, int x, int z, World world) {// minVainSise, maxVainSize, spawnChance(Def2), minY, maxY
addOreSpawn(ModBlocks.draconiumOre, world, random, x, z, 3, 4, 2, 2, 8);
}
public void generateEnd(final Random random, final int chunkX, final int chunkZ, final World world) {
addOreSpawn(ModBlocks.draconiumOre, world, random, chunkX, chunkZ, 4, 5, 10, 1, 70);
public void generateEnd(Random random, int x, int z, World world) {
int x1 = x + random.nextInt(16);
int y = 20 + random.nextInt(170);
int z1 = z + random.nextInt(16);
if (ConfigHandler.generateEnderComets && Math.sqrt(x*x + z*z) > 200 && random.nextInt(Math.max(1, ConfigHandler.cometRarity)) == 0) new WorldGenEnderComet().generate(world, random, x1, y , z1);
int cX = x/16;
int cZ = z/16;
if (ConfigHandler.generateChaosIslands && Math.sqrt(x*x + z*z) > 9000 && cX%625 == 0 && cZ%625 == 0) new WorldGenEnderIsland().generate(world, random, x1, 100 , z1);
addOreSpawn(ModBlocks.draconiumOre, world, random, x, z, 4, 5, 10, 1, 70);
}
public void generateNether(final Random random, final int chunkX, final int chunkZ, final World world) {
@@ -0,0 +1,111 @@
package com.brandon3055.draconicevolution.common.world;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import java.util.Random;
/**
* Created by Brandon on 28/08/2014.
*/
public class WorldGenEnderComet extends WorldGenerator {
private int spawnX;
private int spawnY;
private int spawnZ;
private int tailX;
private int tailY;
private int tailZ;
private int size;
private void initialize(Random rand, int x, int y, int z) {
spawnX = x;
spawnY = y;
spawnZ = z;
double rotation = rand.nextInt();
double xmod = Math.sin(rotation);
double zmod = Math.cos(rotation);
int distMod = 150 + rand.nextInt(50);
tailX = x + (int) (xmod * distMod);
tailY = y + 40 + rand.nextInt(40);
tailZ = z + (int) (zmod * distMod);
size = 2 + rand.nextInt(8);
}
@Override
public boolean generate(World world, Random random, int x, int y, int z) {
initialize(random, x, y, z);
generateCore(world, random, size);
generateTrail(world, random);
return true;
}
private void generateCore(World world, Random rand, int r) {
for( int x = spawnX-r ; x <= spawnX + r; x++){
for( int z = spawnZ-r ; z <= spawnZ + r; z++) {
for (int y = spawnY-r; y <= spawnY + r; y++) {
if ((int) (getDistance(x, y, z, spawnX, spawnY, spawnZ)) <= r) {
float genP = rand.nextFloat();
if (0.1F > genP){
world.setBlock(x, y, z, ModBlocks.draconiumOre, 0, 2);
}else if (0.4F > genP){
world.setBlock(x, y, z, Blocks.obsidian, 0, 2);
}else {
world.setBlock(x, y, z, Blocks.end_stone, 0, 2);
}
}
}
}
}
}
private void generateTrail(World world, Random rand) {
int xDiff = tailX - spawnX;
int yDiff = tailY - spawnY;
int zDiff = tailZ - spawnZ;
for (int p = 0; p < 100; p += 2) {
int cX = spawnX + (int) (((float) p / 100F) * xDiff);
int cY = spawnY + (int) (((float) p / 100F) * yDiff);
int cZ = spawnZ + (int) (((float) p / 100F) * zDiff);
float pc = (float)p / 100F;
int density = 500 - (int)(pc*550);
if (density < 20) density = 20;
generateTrailSphere(world, cX, cY, cZ, (size+3)-(int)(pc*(size-2)), density, rand);
density = 1000 - (int)(pc*10000);
generateTrailSphere(world, cX, cY, cZ, (size+3)-(int)(pc*(size-2)), density, rand);
}
}
public static void generateTrailSphere(World world, int xi, int yi, int zi, int r, int density, Random rand) {
if (density <= 0) return;
if (density > 10000) density = 10000;
for( int x = xi-r ; x <= xi + r; x++){
for( int z = zi-r ; z <= zi + r; z++) {
for (int y = yi-r; y <= yi + r; y++) {
if ((density >= rand.nextInt(10000)) && world.isAirBlock(x, y, z) && (int) (getDistance(x, y, z, xi, yi, zi)) == r) {
if (0.9F >= rand.nextFloat()) world.setBlock(x, y, z, Blocks.end_stone, 0, 2);
else if (rand.nextBoolean())world.setBlock(x, y, z, Blocks.obsidian, 0, 2);
else world.setBlock(x, y, z, ModBlocks.draconiumOre, 0, 2);
}
}
}
}
}
public static double getDistance(int x1, int y1, int z1, int x2, int y2, int z2){
int dx = x1-x2;
int dy = y1-y2;
int dz = z1-z2;
return Math.sqrt( (dx*dx + dy*dy + dz*dz ) );
}
}
@@ -0,0 +1,226 @@
package com.brandon3055.draconicevolution.common.world;
import com.brandon3055.draconicevolution.common.blocks.ModBlocks;
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
import net.minecraft.entity.item.EntityEnderCrystal;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import java.util.Random;
/**
* Created by Brandon on 29/08/2014.
*/
public class WorldGenEnderIsland extends WorldGenerator {
private int spawnX;
private int spawnY;
private int spawnZ;
private int size;
private void initialize(Random rand, int x, int y, int z) {
spawnX = x;
spawnY = y;
spawnZ = z;
size = 150;// + rand.nextInt(8);
}
@Override
public boolean generate(World world, Random random, int x, int y, int z) {
for (int y1 = y - 10; y1 < y + 10; y1++) {
if (world.getBlock(x, y1, z) == Blocks.end_stone) return false;
}
initialize(random, x, y, z);
generateCentre(world, random);
generateBelt(world, random, size + 50, size + 200);
generateObelisks(world, random);
EntityCustomDragon dragon = new EntityCustomDragon(world, 500F, 100F);
dragon.setPositionAndUpdate(x, 180, z);
dragon.setUber(true);
dragon.portalX = x;
dragon.portalY = y+20;
dragon.portalZ = z;
dragon.setCustomNameTag("Chaos Guardian");
//two dragons?dragon.onSpawnWithEgg(null);
world.spawnEntityInWorld(dragon);
return true;
}
private void generateCentre(World world, Random rand) {
int centreThikness = 10; //multiplied by 2 and + 1
int curve = 2;
int diffStart = 20;//(int)((double)size * 0.1D);
int r = size;
int offPoint = size * curve;
for (int x = spawnX - r; x <= spawnX + r; x++) {
for (int z = spawnZ - r; z <= spawnZ + r; z++) {
for (int y = spawnY - (r / 2); y <= spawnY + (r / 2); y++) {
if ((int) (getDistance(x, y, z, spawnX, spawnY + offPoint + centreThikness, spawnZ)) >= offPoint && (int) (getDistance(x, y, z, spawnX, spawnY - offPoint - centreThikness, spawnZ)) >= offPoint && (int) (getDistance(x, y, z, spawnX, spawnY, spawnZ)) <= r) {
int dist = (int) getDistance(x, y, z, spawnX, spawnY, spawnZ);
int diffusionPCt = getDiffusionPct(dist - diffStart, size - diffStart);
int yRand = (int) (Math.max(0, getDiffusionPctD(dist - 40, size - 40)) * (double) (40 - rand.nextInt(80)));
if (dist <= diffStart) {
if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2);
} else if (dist < (int) ((double) size * 0.3D) && diffusionPCt > rand.nextInt(3000)) {
if (0.95F > rand.nextFloat()) {
if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2);
} else if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2);
} else if (dist < (int) ((double) size * 0.4D) && diffusionPCt > rand.nextInt(4000)) {
if (0.95F > rand.nextFloat()) {
if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2);
} else if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2);
} else if (dist < (int) ((double) size * 0.5D) && diffusionPCt > rand.nextInt(5000)) {
if (0.95F > rand.nextFloat()) {
if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2);
} else if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2);
} else if (dist < (int) ((double) size * 0.6D) && diffusionPCt > rand.nextInt(6000)) {
if (0.95F > rand.nextFloat()) {
if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2);
} else if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2);
} else if (dist < (int) ((double) size * 0.7D) && diffusionPCt > rand.nextInt(7000)) {
if (0.95F > rand.nextFloat()) {
if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2);
} else if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2);
} else if (dist < (int) ((double) size * 0.8D) && diffusionPCt > rand.nextInt(8000)) {
if (0.95F > rand.nextFloat()) {
if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2);
} else if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2);
} else if (diffusionPCt > rand.nextInt(9000)) {
if (0.95F > rand.nextFloat()) {
if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.end_stone, 0, 2);
} else if (world.isAirBlock(x, y + yRand, z))
world.setBlock(x, y + yRand, z, Blocks.obsidian, 0, 2);
}
}
}
}
}
}
private int getDiffusionPct(int dist, int maxDist) {
double d = (double) dist / (double) maxDist;
int i = Math.max(1, (int) (d * 1000D));
return 1000 - i;
}
private double getDiffusionPctD(int dist, int maxDist) {
double d = (double) dist / (double) maxDist;
return d;
}
private void generateObelisks(World world, Random rand) {
for (int i = 0; i < 7; i++) {
double rotation = i * 0.9D;
int sX = spawnX + (int) (Math.sin(rotation) * 35D);
int sZ = spawnZ + (int) (Math.cos(rotation) * 35D);
generateObelisk(world, sX, spawnY + 10, sZ, false, rand);
}
for (int i = 0; i < 14; i++) {
double rotation = i * 0.45D;
int sX = spawnX + (int) (Math.sin(rotation) * 70D);
int sZ = spawnZ + (int) (Math.cos(rotation) * 70D);
generateObelisk(world, sX, spawnY + 10, sZ, true, rand);
}
}
private void generateObelisk(World world, int x1, int y1, int z1, boolean outer, Random rand) {
if (!outer) {
world.setBlock(x1, y1 + 20, z1, Blocks.bedrock, 0, 2);
if (!world.isRemote) world.spawnEntityInWorld(new EntityEnderCrystal(world, x1 + 0.5, y1 + 21, z1 + 0.5));
for (int y = y1; y < y1 + 20; y++) {
world.setBlock(x1, y, z1, Blocks.obsidian, 0, 2);
world.setBlock(x1 + 1, y, z1, Blocks.obsidian, 0, 2);
world.setBlock(x1 - 1, y, z1, Blocks.obsidian, 0, 2);
world.setBlock(x1, y, z1 + 1, Blocks.obsidian, 0, 2);
world.setBlock(x1, y, z1 - 1, Blocks.obsidian, 0, 2);
world.setBlock(x1 + 1, y, z1 + 1, Blocks.obsidian, 0, 2);
world.setBlock(x1 - 1, y, z1 - 1, Blocks.obsidian, 0, 2);
world.setBlock(x1 + 1, y, z1 - 1, Blocks.obsidian, 0, 2);
world.setBlock(x1 - 1, y, z1 + 1, Blocks.obsidian, 0, 2);
}
} else {
world.setBlock(x1, y1 + 40, z1, Blocks.bedrock, 0, 2);
if (!world.isRemote) world.spawnEntityInWorld(new EntityEnderCrystal(world, x1 + 0.5, y1 + 41, z1 + 0.5));
int diff = 0;
for (int y = y1 + 20; y < y1 + 40; y++) {
diff++;
double pct = (double) diff / 25D;
int r = 3;
for (int x = x1 - r; x <= x1 + r; x++) {
for (int z = z1 - r; z <= z1 + r; z++) {
if (getDistance(x, z, x1, z1) <= r) {
if (pct > rand.nextDouble()) world.setBlock(x, y, z, Blocks.obsidian, 0, 2);
}
}
}
}
int cageS = 2;
for (int x = x1 - cageS; x <= x1 + cageS; x++) {
for (int y = y1 - cageS; y <= y1 + cageS; y++) {
if (0.8F > rand.nextFloat()) world.setBlock(x, y + 41, z1 + cageS, Blocks.iron_bars, 0, 2);
if (0.8F > rand.nextFloat()) world.setBlock(x, y + 41, z1 - cageS, Blocks.iron_bars, 0, 2);
}
}
for (int z = z1 - cageS; z <= z1 + cageS; z++) {
for (int y = y1 - cageS; y <= y1 + cageS; y++) {
if (0.8F > rand.nextFloat()) world.setBlock(x1 + cageS, y + 41, z, Blocks.iron_bars, 0, 2);
if (0.8F > rand.nextFloat()) world.setBlock(x1 - cageS, y + 41, z, Blocks.iron_bars, 0, 2);
}
}
for (int z = z1 - cageS; z <= z1 + cageS; z++) {
for (int x = x1 - cageS; x <= x1 + cageS; x++) {
if (0.8F > rand.nextFloat()) world.setBlock(x, y1 + 44, z, Blocks.stone_slab, 6, 2);
}
}
}
}
private void generateBelt(World world, Random random, int innerRadius, int outerRadius) {
int r = outerRadius;
for (int x = spawnX - r; x <= spawnX + r; x++) {
for (int z = spawnZ - r; z <= spawnZ + r; z++) {
int dist = (int) (getDistance(x, z, spawnX, spawnZ));
if (dist < outerRadius && dist >= innerRadius) {
int y = spawnY + (int) ((double) (spawnX - x) * 0.2D) + (random.nextInt(10) - 5);
if (0.1F > random.nextFloat()) world.setBlock(x, y, z, Blocks.end_stone, 0, 2);
if (0.001F > random.nextFloat()) world.setBlock(x, y, z, ModBlocks.draconiumOre, 0, 2);
}
}
}
}
public static double getDistance(int x1, int y1, int z1, int x2, int y2, int z2) {
int dx = x1 - x2;
int dy = y1 - y2;
int dz = z1 - z2;
return Math.sqrt((dx * dx + dy * dy + dz * dz));
}
public static double getDistance(int x1, int z1, int x2, int z2) {
int dx = x1 - x2;
int dz = z1 - z2;
return Math.sqrt((dx * dx + dz * dz));
}
}