mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-20 20:22:10 +00:00
Finishing up some work on 1.0.2-snapshot 10 and added language localisation support to info tablet
This commit is contained in:
1 parent
d8c902af38
commit
2a2b6fbf66
61 files changed
+5049
-678
No files matched your search
@@ -209,4 +209,12 @@ public class GuiHudConfig extends GuiScreen {
|
||||
public boolean doesGuiPauseGame() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char keyChar, int keyInt) {
|
||||
if (keyInt == 1) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(parent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
+42
-3
@@ -3,17 +3,21 @@ package com.brandon3055.draconicevolution.client.gui.componentguis;
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
|
||||
import com.brandon3055.brandonscore.client.utills.ClientUtills;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.draconicevolution.client.gui.guicomponents.*;
|
||||
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentContributorsPage;
|
||||
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentIndexButton;
|
||||
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentManualPage;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.common.container.DummyContainer;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiConfirmOpenLink;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
@@ -35,6 +39,7 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback {
|
||||
private static ManualPage currentPage = null;
|
||||
private int previousScale = -1;
|
||||
private int worldUpdateIn = -1;
|
||||
private static String lang;
|
||||
|
||||
|
||||
public GUIManual() {
|
||||
@@ -54,6 +59,8 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback {
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
if (previousScale == -1) adjustGuiScale();
|
||||
|
||||
if (!Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode().equals(lang)) loadPages();
|
||||
}
|
||||
|
||||
private void adjustGuiScale(){
|
||||
@@ -192,7 +199,7 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback {
|
||||
ComponentContributorsPage page = (ComponentContributorsPage)collection.getComponent("CONTRIBUTORS");
|
||||
barPosition = (int)(((double)page.scrollOffset/page.scrollLimit) * 247D);
|
||||
}
|
||||
else if (collection.getComponent("OPEN_PAGE") != null && collection.getComponent("OPEN_PAGE").isEnabled()) {
|
||||
else if (!scrollPressed && collection.getComponent("OPEN_PAGE") != null && collection.getComponent("OPEN_PAGE").isEnabled()) {
|
||||
ComponentManualPage page = (ComponentManualPage)collection.getComponent("OPEN_PAGE");
|
||||
barPosition = (int)(((double)page.scrollOffset/page.scrollLimit) * 247D);
|
||||
}
|
||||
@@ -284,11 +291,43 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback {
|
||||
|
||||
public static void loadPages()
|
||||
{
|
||||
lang = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode();
|
||||
|
||||
ResourceLocation rsLocation = new ResourceLocation(References.RESOURCESPREFIX + "manual-"+lang+".json");
|
||||
IResource resource = null;
|
||||
|
||||
try {
|
||||
resource = Minecraft.getMinecraft().getResourceManager().getResource(rsLocation);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LogHelper.warn("##################################################################################");
|
||||
LogHelper.warn("");
|
||||
LogHelper.warn("Info Tablet language localisation is not available for the selected language: "+lang);
|
||||
LogHelper.warn("The default language (en_US) will be loaded instead");
|
||||
LogHelper.warn("");
|
||||
LogHelper.warn("##################################################################################");
|
||||
|
||||
rsLocation = new ResourceLocation(References.RESOURCESPREFIX + "manual-en_US.json");
|
||||
try {
|
||||
resource = Minecraft.getMinecraft().getResourceManager().getResource(rsLocation);
|
||||
}
|
||||
catch (IOException e1) {
|
||||
LogHelper.error("Well that didn't work... ");
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (resource == null){
|
||||
LogHelper.error("Something went wrong while loading the Info Tablet json file");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
File manualJSON = new File(ResourceHandler.getConfigFolder(), "manual.json");
|
||||
|
||||
InputStream is = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation(References.RESOURCESPREFIX + "manual.json")).getInputStream();
|
||||
InputStream is = resource.getInputStream();
|
||||
OutputStream os = new FileOutputStream(manualJSON);
|
||||
IOUtils.copy(is, os);
|
||||
is.close();
|
||||
|
||||
+44
-5
@@ -1,12 +1,15 @@
|
||||
package com.brandon3055.draconicevolution.client.gui.componentguis;
|
||||
|
||||
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.gui.GuiHudConfig;
|
||||
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentConfigItemButton;
|
||||
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentFieldAdjuster;
|
||||
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentFieldButton;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerAdvTool;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.network.ItemConfigPacket;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
@@ -16,6 +19,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 26/12/2014.
|
||||
@@ -27,6 +31,7 @@ public class GUIToolConfig extends GUIBase {
|
||||
private int screenLevel = 0;
|
||||
private ItemStack editingItem;
|
||||
private ContainerAdvTool container;
|
||||
private int slot;
|
||||
|
||||
public GUIToolConfig(EntityPlayer player, ContainerAdvTool container) {
|
||||
super(container, 198, 89);
|
||||
@@ -49,12 +54,16 @@ public class GUIToolConfig extends GUIBase {
|
||||
|
||||
@Override
|
||||
protected ComponentCollection assembleComponents() {
|
||||
ComponentCollection c = new ComponentCollection(0, 0, xSize, ySize+14, this);
|
||||
ComponentCollection c = new ComponentCollection(0, 0, xSize, ySize, this).setOpenBoarders();
|
||||
c.addComponent(new ComponentTexturedRect(0, -15, 198, 20, inventoryTexture)).setGroup("TEXT_TAB");
|
||||
c.addComponent(new ComponentTexturedRect(0, 0, 198, 89, inventoryTexture)).setGroup("BACKGROUND");
|
||||
c.addComponent(new ComponentButton(3, 26, 20, 12, 0, this, "<=", StatCollector.translateToLocal("gui.back"))).setGroup("BUTTONS").setName("BACK_BUTTON");
|
||||
c.addComponent(new ComponentButton(3, 39, 20, 12, 1, this, "Inv", StatCollector.translateToLocal("gui.de.itemInventory.txt"))).setGroup("BUTTONS").setName("INVENTORY_BUTTON");
|
||||
c.addComponent(new ComponentFieldAdjuster(4, 34, null, this)).setGroup("FIELD_BUTTONS").setName("FIELD_CONFIG_BUTTON_ARRAY");
|
||||
c.addComponent(new ComponentButton(0, ySize, xSize, 14, 2, this, StatCollector.translateToLocal("gui.de.configureGuiElements.txt")).setGroup("INV_SCREEN"));
|
||||
|
||||
ComponentTextField textField = (ComponentTextField) new ComponentTextField(this, 3, -12, 191, 12).setLabel(StatCollector.translateToLocal("gui.de.profile.txt")+":", 0xE0E0E0).setGroup("TEXT_TAB").setName("PROFILE_TEXT_FIELD");
|
||||
c.addComponent(textField);
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -76,8 +85,7 @@ public class GUIToolConfig extends GUIBase {
|
||||
setLevel(0);
|
||||
}
|
||||
|
||||
public void updateItemButtons()
|
||||
{
|
||||
public void updateItemButtons() {
|
||||
for (ComponentBase component : collection.getComponents())
|
||||
{
|
||||
if (component instanceof ComponentConfigItemButton)
|
||||
@@ -93,7 +101,6 @@ public class GUIToolConfig extends GUIBase {
|
||||
|
||||
if (buttonPressed) return;
|
||||
|
||||
|
||||
int fieldOffsetX = 24;
|
||||
int fieldOffsetY = 5;
|
||||
|
||||
@@ -111,12 +118,21 @@ public class GUIToolConfig extends GUIBase {
|
||||
fieldOffsetY += 12;
|
||||
}
|
||||
|
||||
if (collection.getComponent("PROFILE_TEXT_FIELD") instanceof ComponentTextField) {
|
||||
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
|
||||
String presetName = ItemNBTHelper.getString(stack, "ProfileName" + preset, "Profile " + preset);
|
||||
((ComponentTextField)collection.getComponent("PROFILE_TEXT_FIELD")).textField.setText(presetName);
|
||||
}
|
||||
|
||||
collection.addComponent(new ComponentItemRenderer(3, 5, stack)).setGroup("LIST_SCREEN");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (collection.getComponent("PROFILE_TEXT_FIELD") instanceof ComponentTextField && !collection.getComponent("PROFILE_TEXT_FIELD").isMouseOver(x- guiLeft, y - guiTop)){
|
||||
((ComponentTextField)collection.getComponent("PROFILE_TEXT_FIELD")).textField.setFocused(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonClicked(int id, int button) {
|
||||
@@ -144,10 +160,12 @@ public class GUIToolConfig extends GUIBase {
|
||||
collection.setOnlyGroupEnabled("INV_SCREEN");
|
||||
collection.setGroupEnabled("BACKGROUND", true);
|
||||
collection.setComponentEnabled("BACK_BUTTON", false);
|
||||
slot = -1;
|
||||
}
|
||||
else if (level == 1){//list screen
|
||||
collection.setOnlyGroupEnabled("LIST_SCREEN");
|
||||
collection.setGroupEnabled("BACKGROUND", true);
|
||||
if (editingItem != null && editingItem.getItem() instanceof IConfigurableItem && ((IConfigurableItem)editingItem.getItem()).hasProfiles()) collection.setGroupEnabled("TEXT_TAB", true);
|
||||
collection.setComponentEnabled("BACK_BUTTON", true);
|
||||
if (editingItem != null && editingItem.getItem() instanceof IInventoryTool) collection.setComponentEnabled("INVENTORY_BUTTON", true);
|
||||
if (collection.getComponent("BACK_BUTTON") != null) collection.getComponent("BACK_BUTTON").setY(26);
|
||||
@@ -157,6 +175,7 @@ public class GUIToolConfig extends GUIBase {
|
||||
collection.setGroupEnabled("BACKGROUND", true);
|
||||
collection.setComponentEnabled("BACK_BUTTON", true);
|
||||
if (collection.getComponent("BACK_BUTTON") != null) collection.getComponent("BACK_BUTTON").setY(3);
|
||||
slot = -1;
|
||||
}
|
||||
else if (level == 3){//inventory screen
|
||||
|
||||
@@ -171,10 +190,30 @@ public class GUIToolConfig extends GUIBase {
|
||||
public void setEditingItem(ItemStack stack, int slot) {
|
||||
this.editingItem = stack;
|
||||
container.updateInventoryStack(slot);
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkHotbarKeys(int p_146983_1_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char par1, int par2) {
|
||||
if (collection.getComponent("PROFILE_TEXT_FIELD") instanceof ComponentTextField && ((ComponentTextField)collection.getComponent("PROFILE_TEXT_FIELD")).isFocused() && par2 != 1) {
|
||||
collection.keyTyped(par1, par2);
|
||||
return;
|
||||
}
|
||||
super.keyTyped(par1, par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentCallBack(ComponentBase component) {
|
||||
if (component instanceof ComponentTextField && editingItem != null && slot != -1){
|
||||
ComponentTextField textField = (ComponentTextField) component;
|
||||
if (!StringUtils.isNullOrEmpty(textField.textField.getText())){
|
||||
DraconicEvolution.network.sendToServer(new ItemConfigPacket(slot, textField.textField.getText()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
-18
@@ -49,13 +49,13 @@ public class ComponentFieldAdjuster extends ComponentBase {
|
||||
renderButton((getWidth() / 2) - 30, 0, 60, 20, GuiHelper.isInRect(x + (getWidth() / 2) - 30, y, 60, 20, mouseX - offsetX, mouseY - offsetY));
|
||||
}else if (isDecimal() || isNonDecimal())
|
||||
{
|
||||
renderButton((getWidth() / 2) - 39, 3, 26, 14, GuiHelper.isInRect(x + (getWidth() / 2) - 39, y + 3, 26, 14, mouseX - offsetX, mouseY - offsetY));
|
||||
renderButton((getWidth() / 2) - 67, 3, 26, 14, GuiHelper.isInRect(x + (getWidth() / 2) - 67, y + 3, 26, 14, mouseX - offsetX, mouseY - offsetY));
|
||||
renderButton((getWidth() / 2) - 95, 3, 26, 14, GuiHelper.isInRect(x + (getWidth() / 2) - 95, y + 3, 26, 14, mouseX - offsetX, mouseY - offsetY));
|
||||
renderButton((getWidth() / 2) - 43, 3, 24, 14, GuiHelper.isInRect(x + (getWidth() / 2) - 43, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY));
|
||||
renderButton((getWidth() / 2) - 69, 3, 24, 14, GuiHelper.isInRect(x + (getWidth() / 2) - 69, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY));
|
||||
renderButton((getWidth() / 2) - 95, 3, 24, 14, GuiHelper.isInRect(x + (getWidth() / 2) - 95, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY));
|
||||
|
||||
renderButton((getWidth() / 2) + 12, 3, 26, 14, GuiHelper.isInRect(x + (getWidth() / 2) + 12, y + 3, 26, 14, mouseX - offsetX, mouseY - offsetY));
|
||||
renderButton((getWidth() / 2) + 40, 3, 26, 14, GuiHelper.isInRect(x + (getWidth() / 2) + 40, y + 3, 26, 14, mouseX - offsetX, mouseY - offsetY));
|
||||
renderButton((getWidth() / 2) + 68, 3, 26, 14, GuiHelper.isInRect(x + (getWidth() / 2) + 68, y + 3, 26, 14, mouseX - offsetX, mouseY - offsetY));
|
||||
renderButton((getWidth() / 2) + 19, 3, 24, 14, GuiHelper.isInRect(x + (getWidth() / 2) + 19, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY));
|
||||
renderButton((getWidth() / 2) + 45, 3, 24, 14, GuiHelper.isInRect(x + (getWidth() / 2) + 45, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY));
|
||||
renderButton((getWidth() / 2) + 71, 3, 24, 14, GuiHelper.isInRect(x + (getWidth() / 2) + 71, y + 3, 24, 14, mouseX - offsetX, mouseY - offsetY));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,12 +80,12 @@ public class ComponentFieldAdjuster extends ComponentBase {
|
||||
|
||||
if (isDecimal() || isNonDecimal())
|
||||
{
|
||||
fontRendererObj.drawString("---", 8, y + 6, 0x000000);
|
||||
fontRendererObj.drawString("--", 40, y + 6, 0x000000);
|
||||
fontRendererObj.drawString("-", 70, y + 6, 0x000000);
|
||||
fontRendererObj.drawString("+", 121, y + 6, 0x000000);
|
||||
fontRendererObj.drawString("++", 147, y + 6, 0x000000);
|
||||
fontRendererObj.drawString("+++", 172, y + 6, 0x000000);
|
||||
fontRendererObj.drawString("---", 7, y + 6, 0x000000);
|
||||
fontRendererObj.drawString("--", 37, y + 6, 0x000000);
|
||||
fontRendererObj.drawString("-", 66, y + 6, 0x000000);
|
||||
fontRendererObj.drawString("+", 127, y + 6, 0x000000);
|
||||
fontRendererObj.drawString("++", 151, y + 6, 0x000000);
|
||||
fontRendererObj.drawString("+++", 174, y + 6, 0x000000);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -101,22 +101,22 @@ public class ComponentFieldAdjuster extends ComponentBase {
|
||||
|
||||
if (!isBoolean())
|
||||
{
|
||||
if (GuiHelper.isInRect(this.x + (getWidth() / 2) - 39, this.y + 3, 26, 14, x, y))
|
||||
if (GuiHelper.isInRect(this.x + (getWidth() / 2) - 43, this.y + 3, 26, 14, x, y))
|
||||
{//-
|
||||
incroment(-1);
|
||||
} else if (GuiHelper.isInRect(this.x + (getWidth() / 2) - 67, this.y + 3, 26, 14, x, y))
|
||||
} else if (GuiHelper.isInRect(this.x + (getWidth() / 2) - 69, this.y + 3, 26, 14, x, y))
|
||||
{//--
|
||||
incroment(-10);
|
||||
} else if (GuiHelper.isInRect(this.x + (getWidth() / 2) - 95, this.y + 3, 26, 14, x, y))
|
||||
{//---
|
||||
incroment(-100);
|
||||
} else if (GuiHelper.isInRect(this.x + (getWidth() / 2) + 12, this.y + 3, 26, 14, x, y))
|
||||
} else if (GuiHelper.isInRect(this.x + (getWidth() / 2) + 19, this.y + 3, 26, 14, x, y))
|
||||
{//+
|
||||
incroment(1);
|
||||
} else if (GuiHelper.isInRect(this.x + (getWidth() / 2) + 40, this.y + 3, 26, 14, x, y))
|
||||
} else if (GuiHelper.isInRect(this.x + (getWidth() / 2) + 45, this.y + 3, 26, 14, x, y))
|
||||
{//++
|
||||
incroment(10);
|
||||
} else if (GuiHelper.isInRect(this.x + (getWidth() / 2) + 68, this.y + 3, 26, 14, x, y))
|
||||
} else if (GuiHelper.isInRect(this.x + (getWidth() / 2) + 71, this.y + 3, 26, 14, x, y))
|
||||
{//+++
|
||||
incroment(100);
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public class ComponentFieldAdjuster extends ComponentBase {
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
ItemStack stack = gui.player.inventory.getStackInSlot(field.slot);
|
||||
if (stack != null && stack.getItem() instanceof IConfigurableItem){
|
||||
DataUtills.writeObjectToItem(stack, field.value, field.datatype, field.name);
|
||||
DataUtills.writeObjectToCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, field.name);
|
||||
}
|
||||
field.sendChanges();
|
||||
}
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ public class ComponentFieldButton extends ComponentBase {
|
||||
field.sendChanges();
|
||||
ItemStack stack = gui.player.inventory.getStackInSlot(field.slot);
|
||||
if (stack != null && stack.getItem() instanceof IConfigurableItem){
|
||||
DataUtills.writeObjectToItem(stack, field.value, field.datatype, field.name);
|
||||
DataUtills.writeObjectToCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, field.name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
+84
-4
@@ -1,9 +1,11 @@
|
||||
package com.brandon3055.draconicevolution.client.handler;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.DataUtills.XZPair;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.DraconicArmor;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.WyvernArmor;
|
||||
import com.brandon3055.draconicevolution.common.items.weapons.DraconicBow;
|
||||
@@ -16,16 +18,26 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraftforge.client.event.FOVUpdateEvent;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 28/10/2014.
|
||||
*/
|
||||
public class ClientEventHandler {
|
||||
public static Map<EntityPlayer, XZPair<Float, Integer>> playerShieldStatus = new HashMap<EntityPlayer, XZPair<Float, Integer>>();
|
||||
|
||||
public static int elapsedTicks;
|
||||
private static float previousFOB = 0f;
|
||||
@@ -40,16 +52,25 @@ public class ClientEventHandler {
|
||||
public static boolean playerHoldingWrench = false;
|
||||
public static Minecraft mc;
|
||||
private static Random rand = new Random();
|
||||
private static IModelCustom shieldSphere;
|
||||
|
||||
public ClientEventHandler(){
|
||||
shieldSphere = AdvancedModelLoader.loadModel(ResourceHandler.getResource("models/shieldSphere.obj"));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void tickEnd(TickEvent event) {
|
||||
if (event.phase != TickEvent.Phase.START || event.type != TickEvent.Type.CLIENT || event.side != Side.CLIENT) return;
|
||||
|
||||
for (Iterator<Map.Entry<EntityPlayer, XZPair<Float, Integer>>> i = playerShieldStatus.entrySet().iterator(); i.hasNext(); ){
|
||||
Map.Entry<EntityPlayer, XZPair<Float, Integer>> entry = i.next();
|
||||
if (elapsedTicks - entry.getValue().getValue() > 5) i.remove();
|
||||
}
|
||||
|
||||
|
||||
if (mc == null) mc = Minecraft.getMinecraft();
|
||||
else if (mc.theWorld != null)
|
||||
{
|
||||
mc.theWorld.theProfiler.startSection("DE Client Tick Handler");
|
||||
|
||||
elapsedTicks++;
|
||||
HudHandler.clientTick();
|
||||
|
||||
@@ -73,13 +94,13 @@ public class ClientEventHandler {
|
||||
playerHoldingWrench = mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() == ModItems.wrench;
|
||||
|
||||
searchForPlayerMount();
|
||||
|
||||
mc.theWorld.theProfiler.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void fovUpdate(FOVUpdateEvent event){
|
||||
|
||||
//region Bow FOV Update
|
||||
if (event.entity.getItemInUse() != null && (event.entity.getItemInUse().getItem() instanceof WyvernBow || event.entity.getItemInUse().getItem() instanceof DraconicBow)){
|
||||
float f = 1f;
|
||||
int i = event.entity.getItemInUseDuration();
|
||||
@@ -106,6 +127,18 @@ public class ClientEventHandler {
|
||||
f *= 1.0F - f1 * 0.15F;
|
||||
event.newfov = f;
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region Armor move speed FOV effect cancellation
|
||||
CustomArmorHandler.ArmorSummery summery = new CustomArmorHandler.ArmorSummery().getSummery(event.entity);
|
||||
|
||||
if (summery != null && summery.speedModifier > 0){
|
||||
IAttributeInstance iattributeinstance = event.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
|
||||
float f = (float)((iattributeinstance.getAttributeValue() / (double)event.entity.capabilities.getWalkSpeed() + 1.0D) / 2.0D);
|
||||
event.newfov /= f;
|
||||
}
|
||||
|
||||
//endregion
|
||||
}
|
||||
|
||||
|
||||
@@ -147,4 +180,51 @@ public class ClientEventHandler {
|
||||
event.result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void renderPlayerEvent(RenderPlayerEvent.Post event) {
|
||||
if (playerShieldStatus.containsKey(event.entityPlayer)) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
ResourceHandler.bindResource("textures/models/shieldSphere.png");
|
||||
|
||||
float p = playerShieldStatus.get(event.entityPlayer).getKey();
|
||||
|
||||
EntityPlayer viewingPlayer = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
int i = 5 - (elapsedTicks - playerShieldStatus.get(event.entityPlayer).getValue());
|
||||
|
||||
GL11.glColor4f(1F - p, 0F, p, i / 5F);
|
||||
|
||||
if (viewingPlayer != event.entityPlayer){
|
||||
double translationXLT = event.entityPlayer.prevPosX - viewingPlayer.prevPosX;
|
||||
double translationYLT = event.entityPlayer.prevPosY - viewingPlayer.prevPosY;
|
||||
double translationZLT = event.entityPlayer.prevPosZ - viewingPlayer.prevPosZ;
|
||||
|
||||
double translationX = translationXLT + (((event.entityPlayer.posX - viewingPlayer.posX) - translationXLT) * event.partialRenderTick);
|
||||
double translationY = translationYLT + (((event.entityPlayer.posY - viewingPlayer.posY) - translationYLT) * event.partialRenderTick);
|
||||
double translationZ = translationZLT + (((event.entityPlayer.posZ - viewingPlayer.posZ) - translationZLT) * event.partialRenderTick);
|
||||
|
||||
GL11.glTranslated(translationX, translationY + 1.1, translationZ);
|
||||
}
|
||||
else{
|
||||
GL11.glTranslated(0, -0.5, 0);
|
||||
}
|
||||
|
||||
GL11.glScaled(1, 1.5, 1);
|
||||
|
||||
shieldSphere.renderAll();
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.brandon3055.draconicevolution.client.handler;
|
||||
|
||||
import com.brandon3055.brandonscore.client.utills.GuiHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.client.gui.GuiHudConfig;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.ICustomArmor;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -13,7 +13,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
@@ -36,8 +36,8 @@ public class HudHandler {
|
||||
private static float shieldPoints = 0F;
|
||||
private static float maxShieldPoints = 0F;
|
||||
private static float shieldEntropy = 0F;
|
||||
private static float ltShieldPoints = 0F;
|
||||
private static float ltEntropy = 0F;
|
||||
private static int rfCharge = 0;
|
||||
private static int rfTotal = 0;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
@@ -74,18 +74,18 @@ public class HudHandler {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void clientTick() {
|
||||
if (ConfigHandler.hudSettings[6] > 0 && toolTipFadeOut > 1F - ((float)ConfigHandler.hudSettings[6] * 0.25F)) {
|
||||
|
||||
toolTipFadeOut-=0.1F;
|
||||
}
|
||||
if (hudList != null && (ltHudList == null || !hudList.equals(ltHudList))) toolTipFadeOut = 5F;
|
||||
//if (armorStatsFadeOut > 0 && fadeArmorStats) armorStatsFadeOut-=0.1F;
|
||||
//if (hudList != null && (ltHudList == null || !hudList.equals(ltHudList))) armorStatsFadeOut = 10F;todo armor refresh condition
|
||||
if (ConfigHandler.hudSettings[7] > 0 && armorStatsFadeOut > 1F - ((float)ConfigHandler.hudSettings[7] * 0.25F)) {
|
||||
armorStatsFadeOut-=0.1F;
|
||||
if (armorStatsFadeOut < 0) armorStatsFadeOut = 0;
|
||||
}
|
||||
|
||||
ltHudList = hudList;
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if (mc == null || mc.thePlayer == null) return;
|
||||
ItemStack[] armorSlots = mc.thePlayer.inventory.armorInventory;
|
||||
|
||||
hudList = null;
|
||||
|
||||
@@ -113,57 +113,69 @@ public class HudHandler {
|
||||
hudList = ((IHudDisplayBlock)mc.theWorld.getBlock(mop.blockX, mop.blockY, mop.blockZ)).getDisplayData(mc.theWorld, mop.blockX, mop.blockY, mop.blockZ);
|
||||
}
|
||||
|
||||
showShieldHud = false;
|
||||
maxShieldPoints = 0;
|
||||
shieldPoints = 0;
|
||||
shieldEntropy = 0;
|
||||
int peaces = 0;
|
||||
for (ItemStack stack : armorSlots){
|
||||
if (stack == null || !(stack.getItem() instanceof ICustomArmor)) continue;
|
||||
peaces++;
|
||||
showShieldHud = true;
|
||||
ICustomArmor armor = (ICustomArmor) stack.getItem();
|
||||
maxShieldPoints += armor.getProtectionPoints(stack);
|
||||
shieldPoints += ItemNBTHelper.getFloat(stack, "ProtectionPoints", 0);
|
||||
shieldEntropy += ItemNBTHelper.getFloat(stack, "ShieldEntropy", 0);
|
||||
}
|
||||
if (shieldPoints > 0 && maxShieldPoints > 0) shieldPercentCharge = Math.round((shieldPoints / maxShieldPoints) * 100F);
|
||||
else shieldPercentCharge = 0;
|
||||
if (shieldEntropy > 0 && peaces > 0) shieldEntropy /= peaces;
|
||||
CustomArmorHandler.ArmorSummery summery = new CustomArmorHandler.ArmorSummery().getSummery(mc.thePlayer);
|
||||
|
||||
if (summery == null){
|
||||
showShieldHud = false;
|
||||
return;
|
||||
}
|
||||
showShieldHud = armorStatsFadeOut > 0F;
|
||||
|
||||
if (maxShieldPoints != summery.maxProtectionPoints || shieldPoints != summery.protectionPoints || shieldEntropy != summery.entropy || rfTotal != summery.totalEnergyStored) armorStatsFadeOut = 5F;
|
||||
|
||||
maxShieldPoints = summery.maxProtectionPoints;
|
||||
shieldPoints = summery.protectionPoints;
|
||||
shieldPercentCharge = (int) (summery.protectionPoints / summery.maxProtectionPoints * 100D);
|
||||
shieldEntropy = summery.entropy;
|
||||
rfCharge = (int) ((double) summery.totalEnergyStored / Math.max((double) summery.maxTotalEnergyStorage, 1D) * 100D);
|
||||
rfTotal = summery.totalEnergyStored;
|
||||
}
|
||||
|
||||
|
||||
private void drawArmorHUD(int x, int y, boolean rotated, double scale){
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
ResourceHandler.bindResource("textures/gui/HUD.png");
|
||||
|
||||
GL11.glTranslated(x, y, 0);
|
||||
GL11.glScaled(scale, scale, 1);
|
||||
GL11.glTranslated(-x, -y, 0);
|
||||
GL11.glColor4f(1F, 1F, 1F, Math.min(armorStatsFadeOut, 1F));
|
||||
|
||||
if (rotated){
|
||||
GuiHelper.drawTexturedRect(x-(12*scale), y+scale, (int)(11*scale), (int)(13*scale), 2, 0, 11, 13, 0, GuiHelper.PXL128);
|
||||
x+=(104*scale);
|
||||
GuiHelper.drawTexturedRect(x-15, y+1, 14, 16, 2, 0, 13, 15, 0, GuiHelper.PXL128);
|
||||
x+=104;
|
||||
GL11.glTranslated(x, y, 0);
|
||||
GL11.glRotated(-90, 0, 0, -1);
|
||||
GL11.glTranslated(-x, -y, 0);
|
||||
}
|
||||
else GuiHelper.drawTexturedRect(x+(1*scale), y+(104*scale)+1, (int)(13*scale), (int)(15*scale), 2, 0, 11, 13, 0, GuiHelper.PXL128);
|
||||
else GuiHelper.drawTexturedRect(x+1, y+105, 15, 17, 2, 0, 13, 15, 0, GuiHelper.PXL128);
|
||||
|
||||
GuiHelper.drawTexturedRect(x, y, 17, 104, 0, 15, 17, 104, 0, GuiHelper.PXL128);
|
||||
GuiHelper.drawTexturedRect(x+2, y+2+(100-shieldPercentCharge), 7, shieldPercentCharge, 17, 100-shieldPercentCharge, 7, shieldPercentCharge, 0, GuiHelper.PXL128);
|
||||
GuiHelper.drawTexturedRect(x+10, y+2+100-(int)shieldEntropy, 2, (int)shieldEntropy, 25, 100-(int)shieldEntropy, 2, (int)shieldEntropy, 0, GuiHelper.PXL128);
|
||||
GuiHelper.drawTexturedRect(x+13, y+2+100-rfCharge, 2, rfCharge, 28, 100-rfCharge, 2, rfCharge, 0, GuiHelper.PXL128);
|
||||
|
||||
GuiHelper.drawTexturedRect(x, y, (int)(15*scale), (int)(104*scale), 0, 14, 15, 104, 0, GuiHelper.PXL128);
|
||||
GuiHelper.drawTexturedRect(x+2, y+2+(100- shieldPercentCharge), (int)(8*scale), shieldPercentCharge *scale, 15, 100-shieldPercentCharge, 8, shieldPercentCharge, 0, GuiHelper.PXL128);
|
||||
GuiHelper.drawTexturedRect(x+11, y+2+(100-(int)shieldEntropy), (int)(2*scale), (int)shieldEntropy * scale, 24, 100-(int)shieldEntropy, 2, (int)shieldEntropy, 0, GuiHelper.PXL128);
|
||||
|
||||
if (ConfigHandler.hudSettings[9] == 1) {
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
GL11.glTranslated(x, y, 0);
|
||||
GL11.glScaled(scale, scale, 1);
|
||||
if (rotated) GL11.glRotated(90, 0, 0, -1);
|
||||
GL11.glTranslated(-x, -y, 0);
|
||||
String shield = Math.round(shieldPoints) + "/" + (int)maxShieldPoints;
|
||||
String entropy = "EN: "+(int)shieldEntropy + "%";
|
||||
String energy = "RF: "+ Utills.formatNumber(rfTotal);
|
||||
float fade = Math.min(armorStatsFadeOut, 1F);
|
||||
if (!rotated) {
|
||||
fontRenderer.drawStringWithShadow(Math.round(shieldPoints) + "/" + (int)maxShieldPoints, x + 16, y + 84, 0xFFFFFF);
|
||||
fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x + 16, y + 94, 0xFFFFFF);
|
||||
fontRenderer.drawStringWithShadow(shield, x + 18, y + 74, ((int)(fade*240F)+0x10 << 24) | 0x00FFFFFF);
|
||||
fontRenderer.drawStringWithShadow(energy, x + 18, y + 84, ((int)(fade*240F)+0x10 << 24) | 0x00FFFFFF);
|
||||
fontRenderer.drawStringWithShadow(entropy, x + 18, y + 94, ((int)(fade*240F)+0x10 << 24) | 0x00FFFFFF);
|
||||
}else {
|
||||
fontRenderer.drawStringWithShadow(Math.round(shieldPoints) + "/" + (int)maxShieldPoints, x - 102, y + 16, 0xFFFFFF);
|
||||
fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x - fontRenderer.getStringWidth((int)shieldEntropy + "%"), y + 16, 0xFFFFFF);
|
||||
fontRenderer.drawString(shield, x - 52 - fontRenderer.getStringWidth(shield)/2, y + 2, ((int)(fade*240F)+0x10 << 24) | 0x000000FF);
|
||||
fontRenderer.drawStringWithShadow(entropy, x - fontRenderer.getStringWidth(entropy), y + 18, ((int)(fade*240F)+0x10 << 24) | 0x00FFFFFF);
|
||||
fontRenderer.drawStringWithShadow(energy, x - 102, y + 18, ((int)(fade*240F)+0x10 << 24) | 0x00FFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,3 +184,40 @@ public class HudHandler {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//GL11.glPushMatrix();
|
||||
// GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
// ResourceHandler.bindResource("textures/gui/HUD.png");
|
||||
//
|
||||
// if (rotated){
|
||||
// GuiHelper.drawTexturedRect(x-(12*scale), y+scale, (int)(11*scale), (int)(13*scale), 2, 0, 11, 13, 0, GuiHelper.PXL128);
|
||||
// x+=(104*scale);
|
||||
// GL11.glTranslated(x, y, 0);
|
||||
// GL11.glRotated(-90, 0, 0, -1);
|
||||
// GL11.glTranslated(-x, -y, 0);
|
||||
// }
|
||||
// else GuiHelper.drawTexturedRect(x+(1*scale), y+(104*scale)+1, (int)(13*scale), (int)(15*scale), 2, 0, 11, 13, 0, GuiHelper.PXL128);
|
||||
//
|
||||
// GuiHelper.drawTexturedRect(x, y, (int)(17*scale), (int)(104*scale), 0, 15, 17, 104, 0, GuiHelper.PXL128);
|
||||
// GuiHelper.drawTexturedRect(x+(2*scale), y+(2*scale)+(100-shieldPercentCharge), (int)(7*scale), shieldPercentCharge *scale, 17, 100-shieldPercentCharge, 7, shieldPercentCharge, 0, GuiHelper.PXL128);
|
||||
// GuiHelper.drawTexturedRect(x+(10*scale), y+(2+(100-(int)shieldEntropy) * scale), (int)(2*scale), (int)shieldEntropy * scale, 25, 100-(int)shieldEntropy, 2, (int)shieldEntropy, 0, GuiHelper.PXL128);
|
||||
//
|
||||
// if (ConfigHandler.hudSettings[9] == 1) {
|
||||
// FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
// GL11.glTranslated(x, y, 0);
|
||||
// GL11.glScaled(scale, scale, 1);
|
||||
// if (rotated) GL11.glRotated(90, 0, 0, -1);
|
||||
// GL11.glTranslated(-x, -y, 0);
|
||||
// if (!rotated) {
|
||||
// fontRenderer.drawStringWithShadow(Math.round(shieldPoints) + "/" + (int)maxShieldPoints, x + 16, y + 84, 0xFFFFFF);
|
||||
// fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x + 16, y + 94, 0xFFFFFF);
|
||||
// }else {
|
||||
// fontRenderer.drawStringWithShadow(Math.round(shieldPoints) + "/" + (int)maxShieldPoints, x - 102, y + 16, 0xFFFFFF);
|
||||
// fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x - fontRenderer.getStringWidth((int)shieldEntropy + "%"), y + 16, 0xFFFFFF);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// ResourceHandler.bindTexture(ResourceHandler.getResourceWOP("minecraft:textures/gui/icons.png"));
|
||||
// GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
// GL11.glPopMatrix();
|
||||
@@ -14,11 +14,14 @@ import org.lwjgl.input.Keyboard;
|
||||
public class KeyBindings {
|
||||
public static KeyBinding placeItem;
|
||||
public static KeyBinding toolConfig;
|
||||
public static KeyBinding toolProfileChange;
|
||||
|
||||
public static void init() {
|
||||
placeItem = new KeyBinding("key.placeItem", Keyboard.KEY_P, References.MODNAME);
|
||||
toolConfig = new KeyBinding("key.toolConfig", Keyboard.KEY_C, References.MODNAME);
|
||||
toolProfileChange = new KeyBinding("key.toolProfileChange", Keyboard.KEY_BACKSLASH, References.MODNAME);
|
||||
ClientRegistry.registerKeyBinding(placeItem);
|
||||
ClientRegistry.registerKeyBinding(toolConfig);
|
||||
ClientRegistry.registerKeyBinding(toolProfileChange);
|
||||
}
|
||||
}
|
||||
+28
-3
@@ -1,11 +1,13 @@
|
||||
package com.brandon3055.draconicevolution.client.keybinding;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler;
|
||||
import com.brandon3055.draconicevolution.common.network.ButtonPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.PlacedItemPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.TeleporterPacket;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -27,10 +29,18 @@ public class KeyInputHandler {
|
||||
@SubscribeEvent
|
||||
public void onKeyInput(InputEvent.KeyInputEvent event) {
|
||||
if(KeyBindings.placeItem.isPressed()) handlePlaceItemKey();
|
||||
if(KeyBindings.toolConfig.isPressed()) {
|
||||
else if(KeyBindings.toolConfig.isPressed()) {
|
||||
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
|
||||
//EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
//player.openGui(DraconicEvolution.instance, GuiHandler.GUIID_TOOL_CONFIG, Minecraft.getMinecraft().theWorld, (int)player.posX, (int)player.posY, (int)player.posZ);
|
||||
}
|
||||
else if (KeyBindings.toolProfileChange.isPressed() && Minecraft.getMinecraft().thePlayer != null){
|
||||
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false));
|
||||
|
||||
ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem();
|
||||
if (stack != null && stack.getItem() instanceof IConfigurableItem && ((IConfigurableItem)stack.getItem()).hasProfiles()){
|
||||
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
|
||||
if (++preset >= 5) preset = 0;
|
||||
ItemNBTHelper.setInteger(stack, "ConfigProfile", preset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +55,21 @@ public class KeyInputHandler {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onMouseInput(InputEvent.MouseInputEvent event) {
|
||||
if(KeyBindings.placeItem.isPressed()) handlePlaceItemKey();
|
||||
else if(KeyBindings.toolConfig.isPressed()) {
|
||||
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLCONFIG, false));
|
||||
}
|
||||
else if (KeyBindings.toolProfileChange.isPressed() && Minecraft.getMinecraft().thePlayer != null){
|
||||
DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOL_PROFILE_CHANGE, false));
|
||||
|
||||
ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem();
|
||||
if (stack != null && stack.getItem() instanceof IConfigurableItem && ((IConfigurableItem)stack.getItem()).hasProfiles()){
|
||||
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
|
||||
if (++preset >= 5) preset = 0;
|
||||
ItemNBTHelper.setInteger(stack, "ConfigProfile", preset);
|
||||
}
|
||||
}
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
int change = Mouse.getEventDWheel();
|
||||
if (change == 0 || !player.isSneaking()) return;
|
||||
|
||||
+81
-75
@@ -6,8 +6,9 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 25/5/2015.
|
||||
@@ -21,122 +22,127 @@ public class RenderPortal implements ISimpleBlockRenderingHandler {
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
IIcon c = Blocks.obsidian.getIcon(0, 0);
|
||||
float u = c.getMinU();
|
||||
float v = c.getMinV();
|
||||
float U = c.getMaxU();
|
||||
float V = c.getMaxV();
|
||||
|
||||
tess.setColorRGBA(0, 0, 0, 256);
|
||||
switch (meta){
|
||||
case 1:
|
||||
tess.addVertex(x-0.01, y-0.01, z+0.75);
|
||||
tess.addVertex(x-0.01, y+1.01, z+0.75);
|
||||
tess.addVertex(x+1.01, y+1.01, z+0.75);
|
||||
tess.addVertex(x+1.01, y-0.01, z+0.75);
|
||||
tess.addVertexWithUV(x - 0.01, y - 0.01, z + 0.75, u, v);
|
||||
tess.addVertexWithUV(x - 0.01, y + 1.01, z + 0.75, u, V);
|
||||
tess.addVertexWithUV(x + 1.01, y + 1.01, z + 0.75, U, V);
|
||||
tess.addVertexWithUV(x + 1.01, y - 0.01, z + 0.75, U, v);
|
||||
|
||||
tess.addVertex(x+1.01, y-0.01, z+0.25);
|
||||
tess.addVertex(x+1.01, y+1.01, z+0.25);
|
||||
tess.addVertex(x-0.01, y+1.01, z+0.25);
|
||||
tess.addVertex(x-0.01, y-0.01, z+0.25);
|
||||
tess.addVertexWithUV(x + 1.01, y - 0.01, z + 0.25, U, v);
|
||||
tess.addVertexWithUV(x + 1.01, y + 1.01, z + 0.25, U, V);
|
||||
tess.addVertexWithUV(x - 0.01, y + 1.01, z + 0.25, u, V);
|
||||
tess.addVertexWithUV(x - 0.01, y - 0.01, z + 0.25, u, v);
|
||||
|
||||
if (isFrame(world, x+1, y, z)){
|
||||
tess.addVertex(x+0.99, y-0.01, z+0.25);
|
||||
tess.addVertex(x+0.99, y-0.01, z+0.75);
|
||||
tess.addVertex(x+0.99, y+1.01, z+0.75);
|
||||
tess.addVertex(x+0.99, y+1.01, z+0.25);
|
||||
tess.addVertexWithUV(x + 0.99, y - 0.01, z + 0.25, u, v);
|
||||
tess.addVertexWithUV(x + 0.99, y - 0.01, z + 0.75, u, V);
|
||||
tess.addVertexWithUV(x + 0.99, y + 1.01, z + 0.75, U, V);
|
||||
tess.addVertexWithUV(x + 0.99, y + 1.01, z + 0.25, U, v);
|
||||
}
|
||||
if (isFrame(world, x-1, y, z)){
|
||||
tess.addVertex(x+0.01, y+1.01, z+0.25);
|
||||
tess.addVertex(x+0.01, y+1.01, z+0.75);
|
||||
tess.addVertex(x+0.01, y-0.01, z+0.75);
|
||||
tess.addVertex(x+0.01, y-0.01, z+0.25);
|
||||
tess.addVertexWithUV(x + 0.01, y + 1.01, z + 0.25, U, v);
|
||||
tess.addVertexWithUV(x + 0.01, y + 1.01, z + 0.75, U, V);
|
||||
tess.addVertexWithUV(x + 0.01, y - 0.01, z + 0.75, u, V);
|
||||
tess.addVertexWithUV(x + 0.01, y - 0.01, z + 0.25, u, v);
|
||||
}
|
||||
if (isFrame(world, x, y-1, z)){
|
||||
tess.addVertex(x-0.01, y+0.01,z+0.25);
|
||||
tess.addVertex(x-0.01, y+0.01,z+0.75);
|
||||
tess.addVertex(x+1.01, y+0.01,z+0.75);
|
||||
tess.addVertex(x+1.01, y+0.01,z+0.25);
|
||||
tess.addVertexWithUV(x - 0.01, y + 0.01, z + 0.25, u, v);
|
||||
tess.addVertexWithUV(x - 0.01, y + 0.01, z + 0.75, u, V);
|
||||
tess.addVertexWithUV(x + 1.01, y + 0.01, z + 0.75, U, V);
|
||||
tess.addVertexWithUV(x + 1.01, y + 0.01, z + 0.25, U, v);
|
||||
}
|
||||
if (isFrame(world, x, y+1, z)){
|
||||
tess.addVertex(x+1.01, y+0.99,z+0.25);
|
||||
tess.addVertex(x+1.01, y+0.99,z+0.75);
|
||||
tess.addVertex(x-0.01, y+0.99,z+0.75);
|
||||
tess.addVertex(x-0.01, y+0.99,z+0.25);
|
||||
tess.addVertexWithUV(x + 1.01, y + 0.99, z + 0.25, U, v);
|
||||
tess.addVertexWithUV(x + 1.01, y + 0.99, z + 0.75, U, V);
|
||||
tess.addVertexWithUV(x - 0.01, y + 0.99, z + 0.75, u, V);
|
||||
tess.addVertexWithUV(x - 0.01, y + 0.99, z + 0.25, u, v);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
tess.addVertex(x+0.75, y-0.01, z-0.01);
|
||||
tess.addVertex(x+0.75, y-0.01, z+1.01);
|
||||
tess.addVertex(x+0.75, y+1.01, z+1.01);
|
||||
tess.addVertex(x+0.75, y+1.01, z-0.01);
|
||||
tess.addVertexWithUV(x + 0.75, y - 0.01, z - 0.01, u, v);
|
||||
tess.addVertexWithUV(x + 0.75, y - 0.01, z + 1.01, u, V);
|
||||
tess.addVertexWithUV(x + 0.75, y + 1.01, z + 1.01, U, V);
|
||||
tess.addVertexWithUV(x + 0.75, y + 1.01, z - 0.01, U, v);
|
||||
|
||||
tess.addVertex(x+0.25, y+1.01, z-0.01);
|
||||
tess.addVertex(x+0.25, y+1.01, z+1.01);
|
||||
tess.addVertex(x+0.25, y-0.01, z+1.01);
|
||||
tess.addVertex(x+0.25, y-0.01, z-0.01);
|
||||
tess.addVertexWithUV(x + 0.25, y + 1.01, z - 0.01, U, v);
|
||||
tess.addVertexWithUV(x + 0.25, y + 1.01, z + 1.01, U, V);
|
||||
tess.addVertexWithUV(x + 0.25, y - 0.01, z + 1.01, u, V);
|
||||
tess.addVertexWithUV(x + 0.25, y - 0.01, z - 0.01, u, v);
|
||||
|
||||
if (isFrame(world, x, y, z+1)){
|
||||
tess.addVertex(x+0.25, y-0.01, z+0.99);
|
||||
tess.addVertex(x+0.25, y+1.01, z+0.99);
|
||||
tess.addVertex(x+0.75, y+1.01, z+0.99);
|
||||
tess.addVertex(x+0.75, y-0.01, z+0.99);
|
||||
tess.addVertexWithUV(x + 0.25, y - 0.01, z + 0.99, u, v);
|
||||
tess.addVertexWithUV(x + 0.25, y + 1.01, z + 0.99, U, V);
|
||||
tess.addVertexWithUV(x + 0.75, y + 1.01, z + 0.99, U, V);
|
||||
tess.addVertexWithUV(x + 0.75, y - 0.01, z + 0.99, u, v);
|
||||
}
|
||||
if (isFrame(world, x, y, z-1)){
|
||||
tess.addVertex(x+0.75, y-0.01, z+0.01);
|
||||
tess.addVertex(x+0.75, y+1.01, z+0.01);
|
||||
tess.addVertex(x+0.25, y+1.01, z+0.01);
|
||||
tess.addVertex(x+0.25, y-0.01, z+0.01);
|
||||
tess.addVertexWithUV(x + 0.75, y - 0.01, z + 0.01, u, v);
|
||||
tess.addVertexWithUV(x + 0.75, y + 1.01, z + 0.01, U, V);
|
||||
tess.addVertexWithUV(x + 0.25, y + 1.01, z + 0.01, U, V);
|
||||
tess.addVertexWithUV(x + 0.25, y - 0.01, z + 0.01, u, v);
|
||||
}
|
||||
if (isFrame(world, x, y-1, z)){
|
||||
tess.addVertex(x+0.25, y+0.01, z-0.01);
|
||||
tess.addVertex(x+0.25, y+0.01, z+1.01);
|
||||
tess.addVertex(x+0.75, y+0.01, z+1.01);
|
||||
tess.addVertex(x+0.75, y+0.01, z-0.01);
|
||||
tess.addVertexWithUV(x + 0.25, y + 0.01, z - 0.01, u, v);
|
||||
tess.addVertexWithUV(x + 0.25, y + 0.01, z + 1.01, u, V);
|
||||
tess.addVertexWithUV(x + 0.75, y + 0.01, z + 1.01, U, V);
|
||||
tess.addVertexWithUV(x + 0.75, y + 0.01, z - 0.01, U, v);
|
||||
}
|
||||
if (isFrame(world, x, y+1, z)){
|
||||
tess.addVertex(x+0.75, y+0.99, z-0.01);
|
||||
tess.addVertex(x+0.75, y+0.99, z+1.01);
|
||||
tess.addVertex(x+0.25, y+0.99, z+1.01);
|
||||
tess.addVertex(x+0.25, y+0.99, z-0.01);
|
||||
tess.addVertexWithUV(x + 0.75, y + 0.99, z - 0.01, U, v);
|
||||
tess.addVertexWithUV(x + 0.75, y + 0.99, z + 1.01, U, V);
|
||||
tess.addVertexWithUV(x + 0.25, y + 0.99, z + 1.01, u, V);
|
||||
tess.addVertexWithUV(x + 0.25, y + 0.99, z - 0.01, u, v);
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
tess.addVertex(x-0.01, y+0.25, z-0.01);
|
||||
tess.addVertex(x-0.01, y+0.25, z+1.01);
|
||||
tess.addVertex(x+1.01, y+0.25, z+1.01);
|
||||
tess.addVertex(x+1.01, y+0.25, z-0.01);
|
||||
tess.addVertexWithUV(x - 0.01, y + 0.25, z - 0.01, u, v);
|
||||
tess.addVertexWithUV(x - 0.01, y + 0.25, z + 1.01, u, V);
|
||||
tess.addVertexWithUV(x + 1.01, y + 0.25, z + 1.01, U, V);
|
||||
tess.addVertexWithUV(x + 1.01, y + 0.25, z - 0.01, U, v);
|
||||
|
||||
tess.addVertex(x+1.01, y+0.75, z-0.01);
|
||||
tess.addVertex(x+1.01, y+0.75, z+1.01);
|
||||
tess.addVertex(x-0.01, y+0.75, z+1.01);
|
||||
tess.addVertex(x-0.01, y+0.75, z-0.01);
|
||||
tess.addVertexWithUV(x + 1.01, y + 0.75, z - 0.01, U, v);
|
||||
tess.addVertexWithUV(x + 1.01, y + 0.75, z + 1.01, U, V);
|
||||
tess.addVertexWithUV(x - 0.01, y + 0.75, z + 1.01, u, V);
|
||||
tess.addVertexWithUV(x - 0.01, y + 0.75, z - 0.01, u, v);
|
||||
|
||||
if (isFrame(world, x, y, z+1)){
|
||||
tess.addVertex(x-0.01, y+0.25, z+0.99);
|
||||
tess.addVertex(x-0.01, y+0.75, z+0.99);
|
||||
tess.addVertex(x+1.01, y+0.75, z+0.99);
|
||||
tess.addVertex(x+1.01, y+0.25, z+0.99);
|
||||
tess.addVertexWithUV(x - 0.01, y + 0.25, z + 0.99, u, v);
|
||||
tess.addVertexWithUV(x - 0.01, y + 0.75, z + 0.99, u, V);
|
||||
tess.addVertexWithUV(x + 1.01, y + 0.75, z + 0.99, U, V);
|
||||
tess.addVertexWithUV(x + 1.01, y + 0.25, z + 0.99, U, v);
|
||||
}
|
||||
if (isFrame(world, x, y, z-1)){
|
||||
tess.addVertex(x+1.01, y+0.25, z+0.01);
|
||||
tess.addVertex(x+1.01, y+0.75, z+0.01);
|
||||
tess.addVertex(x-0.01, y+0.75, z+0.01);
|
||||
tess.addVertex(x-0.01, y+0.25, z+0.01);
|
||||
tess.addVertexWithUV(x + 1.01, y + 0.25, z + 0.01, U, v);
|
||||
tess.addVertexWithUV(x + 1.01, y + 0.75, z + 0.01, U, V);
|
||||
tess.addVertexWithUV(x - 0.01, y + 0.75, z + 0.01, u, V);
|
||||
tess.addVertexWithUV(x - 0.01, y + 0.25, z + 0.01, u, v);
|
||||
}
|
||||
if (isFrame(world, x+1, y, z)){
|
||||
tess.addVertex(x+0.99, y+0.25, z-0.01);
|
||||
tess.addVertex(x+0.99, y+0.25, z+1.01);
|
||||
tess.addVertex(x+0.99, y+0.75, z+1.01);
|
||||
tess.addVertex(x+0.99, y+0.75, z-0.01);
|
||||
tess.addVertexWithUV(x + 0.99, y + 0.25, z - 0.01, u, v);
|
||||
tess.addVertexWithUV(x + 0.99, y + 0.25, z + 1.01, u, V);
|
||||
tess.addVertexWithUV(x + 0.99, y + 0.75, z + 1.01, U, V);
|
||||
tess.addVertexWithUV(x + 0.99, y + 0.75, z - 0.01, U, v);
|
||||
}
|
||||
if (isFrame(world, x-1, y, z)){
|
||||
tess.addVertex(x+0.01, y+0.75, z-0.01);
|
||||
tess.addVertex(x+0.01, y+0.75, z+1.01);
|
||||
tess.addVertex(x+0.01, y+0.25, z+1.01);
|
||||
tess.addVertex(x+0.01, y+0.25, z-0.01);
|
||||
tess.addVertexWithUV(x + 0.01, y + 0.75, z - 0.01, U, v);
|
||||
tess.addVertexWithUV(x + 0.01, y + 0.75, z + 1.01, U, V);
|
||||
tess.addVertexWithUV(x + 0.01, y + 0.25, z + 1.01, u, V);
|
||||
tess.addVertexWithUV(x + 0.01, y + 0.25, z - 0.01, u, v);
|
||||
}
|
||||
}
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ public class CommonProxy {
|
||||
DraconicEvolution.network.registerMessage(SpeedRequestPacket.Handler.class, SpeedRequestPacket.class, 13, Side.CLIENT);
|
||||
DraconicEvolution.network.registerMessage(ToolModePacket.Handler.class, ToolModePacket.class, 14, Side.SERVER);
|
||||
DraconicEvolution.network.registerMessage(GenericParticlePacket.Handler.class, GenericParticlePacket.class, 15, Side.CLIENT);
|
||||
DraconicEvolution.network.registerMessage(ShieldHitPacket.Handler.class, ShieldHitPacket.class, 15, Side.CLIENT);
|
||||
}
|
||||
|
||||
public void registerTileEntities() {
|
||||
|
||||
@@ -21,11 +21,11 @@ import net.minecraftforge.common.util.EnumHelper;
|
||||
|
||||
@GameRegistry.ObjectHolder(References.MODID)
|
||||
public class ModItems {
|
||||
public static ArmorMaterial DRACONIUMARMOR_T1 = EnumHelper.addArmorMaterial("DRACONIUMARMOR_T1", -1, new int[] { 3, 8, 6, 3 }, 30);
|
||||
public static ArmorMaterial DRACONIUMARMOR_T2 = EnumHelper.addArmorMaterial("DRACONIUMARMOR_T2", -1, new int[] { 3, 8, 6, 3 }, 30);
|
||||
public static ToolMaterial DRACONIUM_T1 = EnumHelper.addToolMaterial("DRACONIUM_T1", 10, -1, 12.0F, 20.0F, 35);
|
||||
public static ToolMaterial DRACONIUM_T2 = EnumHelper.addToolMaterial("DRACONIUM_T2", 10, -1, 16.0F, 40.0F, 40);
|
||||
public static ToolMaterial DRACONIUM_T3 = EnumHelper.addToolMaterial("DRACONIUM_T3", 10, -1, 400.0F, 60.0F, 45);
|
||||
public static ArmorMaterial WYVERN_ARMOR = EnumHelper.addArmorMaterial("WYVERN_ARMOR", -1, new int[] { 3, 8, 6, 3 }, 30);
|
||||
public static ArmorMaterial DRACONIC_ARMOR = EnumHelper.addArmorMaterial("DRACONIC_ARMOR", -1, new int[] { 3, 8, 6, 3 }, 30);
|
||||
public static ToolMaterial WYVERN = EnumHelper.addToolMaterial("WYVERN", 10, -1, 12.0F, 20.0F, 35);
|
||||
public static ToolMaterial AWAKENED = EnumHelper.addToolMaterial("AWAKENED", 10, -1, 16.0F, 40.0F, 40);
|
||||
public static ToolMaterial CHAOTIC = EnumHelper.addToolMaterial("CHAOTIC", 10, -1, 400.0F, 60.0F, 45);
|
||||
|
||||
public static Item draconicPickaxe;
|
||||
public static Item draconicShovel;
|
||||
@@ -102,19 +102,19 @@ public class ModItems {
|
||||
draconicHoe = new DraconicHoe();
|
||||
draconicSword = new DraconicSword();
|
||||
draconicBow = new DraconicBow();
|
||||
draconicHelm = new DraconicArmor(DRACONIUMARMOR_T2, 0, Strings.draconicHelmName);
|
||||
draconicChest = new DraconicArmor(DRACONIUMARMOR_T2, 1, Strings.draconicChestName);
|
||||
draconicLeggs = new DraconicArmor(DRACONIUMARMOR_T2, 2, Strings.draconicLeggsName);
|
||||
draconicBoots = new DraconicArmor(DRACONIUMARMOR_T2, 3, Strings.draconicBootsName);
|
||||
draconicHelm = new DraconicArmor(DRACONIC_ARMOR, 0, Strings.draconicHelmName);
|
||||
draconicChest = new DraconicArmor(DRACONIC_ARMOR, 1, Strings.draconicChestName);
|
||||
draconicLeggs = new DraconicArmor(DRACONIC_ARMOR, 2, Strings.draconicLeggsName);
|
||||
draconicBoots = new DraconicArmor(DRACONIC_ARMOR, 3, Strings.draconicBootsName);
|
||||
|
||||
wyvernPickaxe = new WyvernPickaxe();
|
||||
wyvernShovel = new WyvernShovel();
|
||||
wyvernSword = new WyvernSword();
|
||||
wyvernBow = new WyvernBow();
|
||||
wyvernHelm = new WyvernArmor(DRACONIUMARMOR_T1, 0, Strings.wyvernHelmName);
|
||||
wyvernChest = new WyvernArmor(DRACONIUMARMOR_T1, 1, Strings.wyvernChestName);
|
||||
wyvernLeggs = new WyvernArmor(DRACONIUMARMOR_T1, 2, Strings.wyvernLeggsName);
|
||||
wyvernBoots = new WyvernArmor(DRACONIUMARMOR_T1, 3, Strings.wyvernBootsName);
|
||||
wyvernHelm = new WyvernArmor(WYVERN_ARMOR, 0, Strings.wyvernHelmName);
|
||||
wyvernChest = new WyvernArmor(WYVERN_ARMOR, 1, Strings.wyvernChestName);
|
||||
wyvernLeggs = new WyvernArmor(WYVERN_ARMOR, 2, Strings.wyvernLeggsName);
|
||||
wyvernBoots = new WyvernArmor(WYVERN_ARMOR, 3, Strings.wyvernBootsName);
|
||||
|
||||
draconicCore = new DraconicCore();
|
||||
wyvernCore = new WyvernCore();
|
||||
|
||||
@@ -33,6 +33,11 @@ public class DraconicBlock extends BlockDE {
|
||||
@Override
|
||||
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {}
|
||||
|
||||
@Override
|
||||
public boolean canDropFromExplosion(Explosion p_149659_1_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconic_block");
|
||||
|
||||
@@ -47,6 +47,11 @@ public class DraconiumBlock extends BlockDE {
|
||||
@Override
|
||||
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {}
|
||||
|
||||
@Override
|
||||
public boolean canDropFromExplosion(Explosion p_149659_1_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
|
||||
@@ -55,6 +55,11 @@ public class InfusedObsidian extends BlockDE {
|
||||
return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDropFromExplosion(Explosion p_149659_1_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class InfusedObsidianItemBlock extends ItemBlock {
|
||||
|
||||
public InfusedObsidianItemBlock(Block p_i45328_1_) {
|
||||
|
||||
+4
-2
@@ -84,7 +84,7 @@ public class EntityChaosCrystal extends EntityLivingBase {
|
||||
int j = MathHelper.floor_double(this.posY);
|
||||
int k = MathHelper.floor_double(this.posZ);
|
||||
|
||||
if (this.worldObj.provider instanceof WorldProviderEnd && this.worldObj.getBlock(i, j, k) != Blocks.fire) this.worldObj.setBlock(i, j, k, Blocks.fire);
|
||||
if (this.worldObj.provider instanceof WorldProviderEnd && this.worldObj.getBlock(i, j, k).isBlockSolid(this.worldObj, i, j, k, 0) && this.worldObj.getBlock(i, j, k) != Blocks.fire) this.worldObj.setBlock(i, j, k, Blocks.fire);
|
||||
|
||||
}else if (deathAnimation > 0) deathAnimation -= 0.1F;
|
||||
|
||||
@@ -189,7 +189,9 @@ public class EntityChaosCrystal extends EntityLivingBase {
|
||||
if (getGuardian() != null) getGuardian().updateCrystals();
|
||||
}
|
||||
|
||||
public boolean isAlive() { return health > 0F; }
|
||||
public boolean isAlive() {
|
||||
return getHealth() > 0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getHeldItem() {
|
||||
|
||||
+3
-4
@@ -463,7 +463,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
|
||||
|
||||
if (ticksExisted % 1000 == 0 && rand.nextBoolean()) selectNewBehaviour();
|
||||
|
||||
if (ignitionChargeTimer > 1 || (ignitionChargeTimer == 1 && ticksExisted % 20 == 0))ignitionChargeTimer--;
|
||||
if (ignitionChargeTimer > 1 || (ignitionChargeTimer == 1 && ticksExisted % 20 == 0) && !ConfigHandler.disableGuardianCrystalRespawn)ignitionChargeTimer--;
|
||||
if (ignitionChargeTimer <= 0 && !worldObj.isRemote){
|
||||
if ((ticksExisted - 19) % 20 == 0) ignitionChargeTimer = (behaviour == EnumBehaviour.LOW_HEALTH_STRATEGY ? 1000 : 2000) + rand.nextInt(600);
|
||||
|
||||
@@ -478,7 +478,6 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
updateAttack();
|
||||
}
|
||||
|
||||
@@ -560,7 +559,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
|
||||
break;
|
||||
case ATTACK_FIREBALL_CHASER:
|
||||
if (attackTimer % 10 == 0) {
|
||||
EntityDragonProjectile projectile = new EntityDragonProjectile(worldObj, EntityDragonProjectile.FIRE_CHASER, attackTarget instanceof EntityLivingBase ? (EntityLivingBase)attackTarget : null, 5F + (rand.nextFloat() * 8F), this);
|
||||
EntityDragonProjectile projectile = new EntityDragonProjectile(worldObj, EntityDragonProjectile.FIRE_CHASER, attackTarget instanceof EntityLivingBase ? (EntityLivingBase)attackTarget : null, 5F + (rand.nextFloat() * 2F), this);
|
||||
projectile.setPosition(dragonPartHead.posX, dragonPartHead.posY, dragonPartHead.posZ);
|
||||
worldObj.spawnEntityInWorld(projectile);
|
||||
}
|
||||
@@ -574,7 +573,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio
|
||||
break;
|
||||
case ATTACK_CHAOS_CHASER:
|
||||
if (attackTimer % 10 == 0) {
|
||||
EntityDragonProjectile projectile = new EntityDragonProjectile(worldObj, EntityDragonProjectile.CHAOS_CHASER, attackTarget instanceof EntityLivingBase ? (EntityLivingBase)attackTarget : null, 5F + (rand.nextFloat() * 12F), this);
|
||||
EntityDragonProjectile projectile = new EntityDragonProjectile(worldObj, EntityDragonProjectile.CHAOS_CHASER, attackTarget instanceof EntityLivingBase ? (EntityLivingBase)attackTarget : null, 5F + (rand.nextFloat() * 10F), this);
|
||||
projectile.setPosition(dragonPartHead.posX, dragonPartHead.posY, dragonPartHead.posZ);
|
||||
worldObj.spawnEntityInWorld(projectile);
|
||||
}
|
||||
|
||||
+1
-1
@@ -273,7 +273,7 @@ public class EntityDragonProjectile extends Entity {
|
||||
if (source == damageChaos && entityLivingBase instanceof EntityPlayer){
|
||||
for (ItemStack stack : ((EntityPlayer) entityLivingBase).inventory.armorInventory) {
|
||||
if (stack != null && stack.getItem() instanceof IEnergyContainerItem){
|
||||
((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, ((IEnergyContainerItem) stack.getItem()).getMaxEnergyStored(stack) / (50 + rand.nextInt(50)), false);
|
||||
((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, 30000 + rand.nextInt(10000), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public class ConfigHandler {
|
||||
public static boolean useOldArmorModel;
|
||||
public static boolean useOriginal3DArmorModel;
|
||||
public static boolean useOldD2DToolTextures;
|
||||
public static boolean disableGuardianCrystalRespawn;
|
||||
|
||||
//spawner
|
||||
public static String[] spawnerList;
|
||||
@@ -113,6 +114,7 @@ public class ConfigHandler {
|
||||
useOldD2DToolTextures = config.get(Configuration.CATEGORY_GENERAL, "Use old 2D tool textures", false, "If true the 3D tool models will be replaced with standard 2D textures").getBoolean(false);
|
||||
chaosIslandSeparation = config.get(Configuration.CATEGORY_GENERAL, "Chaos Island Separation", 10000, "This sets how far apart the chaos islands will spawn. The islands spawn in a grid pattern.").getInt(10000);
|
||||
useOriginal3DArmorModel = config.get(Configuration.CATEGORY_GENERAL, "Use the original 3D armor models", false, "If true the original 3D armor models created by Skeletonpunk will be used instead of the current ones").getBoolean(false);
|
||||
disableGuardianCrystalRespawn = config.get(Configuration.CATEGORY_GENERAL, "Disable Guardian Crystal Respawn", false, "(Wuss mode) Setting this to true will disable the chaos guardians ability to respawn healing crystals. Under certain circumstances such as on a Spigot server where entity render distance is significantly lower this may be required.").getBoolean(false);
|
||||
|
||||
|
||||
//Spawner
|
||||
|
||||
@@ -102,7 +102,7 @@ public class CraftingHandler {
|
||||
addOre(ModBlocks.rainSensor, " ", "RBR", "SPS", 'R', "dustRedstone", 'B', Items.bucket, 'S', Blocks.stone_slab, 'P', Blocks.heavy_weighted_pressure_plate);
|
||||
addOre(ModBlocks.teleporterStand, " P ", " S ", "HBH", 'P', Blocks.stone_pressure_plate, 'S', "stone", 'H', new ItemStack(Blocks.stone_slab, 1, 0), 'B', Items.blaze_powder);
|
||||
addOre(ModBlocks.dislocatorReceptacle, "ICI", " O ", "ISI", 'I', "ingotIron", 'C', ModItems.draconicCore, 'O', ModBlocks.infusedObsidian, 'S', ModBlocks.teleporterStand);
|
||||
|
||||
addOre(ModBlocks.upgradeModifier, " ", "DCD", "III", 'I', "ingotIron", 'D', "ingotDraconium", 'C', ModItems.draconicCore);
|
||||
|
||||
//machines adv
|
||||
addOre(ModBlocks.resurrectionStone, "CSC", "SMS", "CSC", 'C', mobSoul, 'S', ModItems.wyvernCore, 'M', "blockDraconium");
|
||||
|
||||
+8
-113
@@ -10,21 +10,11 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
public class FMLEventHandler {
|
||||
|
||||
public static Map<EntityPlayer, Boolean> playersWithFlight = new WeakHashMap<EntityPlayer, Boolean>();
|
||||
public static List<String> playersWithUphillStep = new ArrayList<String>();
|
||||
public static Field walkSpeed;
|
||||
private static boolean mmGiven = false;
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -40,109 +30,6 @@ public class FMLEventHandler {
|
||||
if (event.phase != TickEvent.Phase.START) return;
|
||||
|
||||
CustomArmorHandler.onPlayerTick(event);
|
||||
|
||||
// EntityPlayer player = event.player;
|
||||
// //Reset Walk Speed----------------------------------------------------------------------------------------------
|
||||
//
|
||||
// if (walkSpeed == null){
|
||||
// walkSpeed = ReflectionHelper.findField(PlayerCapabilities.class, "walkSpeed", "g", "field_75097_g");
|
||||
// walkSpeed.setAccessible(true);
|
||||
// }
|
||||
// if (walkSpeed != null) {
|
||||
// try {
|
||||
// walkSpeed.setFloat(player.capabilities, 0.1f);
|
||||
// }
|
||||
// catch (IllegalAccessException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// catch (ConcurrentModificationException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Apply Hill Step-----------------------------------------------------------------------------------------------
|
||||
//
|
||||
// if (player.worldObj.isRemote) {
|
||||
// boolean highStepListed = playersWithUphillStep.contains(player.getDisplayName()) && player.stepHeight >= 1f;
|
||||
// boolean hasHighStep = CustomArmorHandler.getHasHighStep(player);
|
||||
//
|
||||
// if (hasHighStep && !highStepListed) {
|
||||
// playersWithUphillStep.add(player.getDisplayName());
|
||||
// player.stepHeight = 1f;
|
||||
// }
|
||||
//
|
||||
// if (!hasHighStep && highStepListed) {
|
||||
// playersWithUphillStep.remove(player.getDisplayName());
|
||||
// player.stepHeight = 0.5F;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Apply Swiftness-----------------------------------------------------------------------------------------------
|
||||
//
|
||||
// if (CustomArmorHandler.getHasSwiftness(player)) {
|
||||
// int i = CustomArmorHandler.getSwiftnessLevel(player);
|
||||
//
|
||||
// float percentIncrease = CustomArmorHandler.getSwiftnessMultiplier(player) * ((i + 1) * 0.05f);
|
||||
// //LogHelper.info(player.capabilities.getWalkSpeed()+" "+percentIncrease);
|
||||
//
|
||||
// if (player.capabilities.isFlying && player.moveForward > 0F)
|
||||
// {
|
||||
// player.moveFlying(0F, 1F, percentIncrease / 2F);
|
||||
// }
|
||||
//
|
||||
// if (!player.onGround && player.ridingEntity == null) player.jumpMovementFactor = 0.02F + (percentIncrease * 0.2F);
|
||||
//
|
||||
// if (walkSpeed != null) {
|
||||
// try {
|
||||
// walkSpeed.setFloat(player.capabilities, 0.1f + percentIncrease);
|
||||
// }
|
||||
// catch (IllegalAccessException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// catch (ConcurrentModificationException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Apply Flight--------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// if (CustomArmorHandler.getHasFlight(player)) {
|
||||
// playersWithFlight.put(player, true);
|
||||
// player.capabilities.allowFlying = true;
|
||||
// if (CustomArmorHandler.getFlightLock(player)) player.capabilities.isFlying = true;
|
||||
//
|
||||
// if ((!player.onGround && player.capabilities.isFlying) && player.motionY != 0 && ((CustomArmorHandler.getVAccSprint(player) && BrandonsCore.proxy.isCtrlDown()) || (!CustomArmorHandler.getVAccSprint(player))))
|
||||
// {
|
||||
// float percentIncrease = CustomArmorHandler.getVAccel(player);
|
||||
//
|
||||
// if (BrandonsCore.proxy.isSpaceDown() && !BrandonsCore.proxy.isShiftDown())
|
||||
// {
|
||||
// player.motionY =(double)(percentIncrease * 2F);
|
||||
// }
|
||||
//
|
||||
// if (BrandonsCore.proxy.isShiftDown() && !BrandonsCore.proxy.isSpaceDown())
|
||||
// {
|
||||
// player.motionY = -(double)(percentIncrease * 2F);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
//
|
||||
// if (!playersWithFlight.containsKey(player)) {
|
||||
// playersWithFlight.put(player, false);
|
||||
// }
|
||||
//
|
||||
// if (playersWithFlight.get(player) && !player.worldObj.isRemote) {
|
||||
// playersWithFlight.put(player, false);
|
||||
//
|
||||
// if (!player.capabilities.isCreativeMode) {
|
||||
// player.capabilities.allowFlying = false;
|
||||
// player.capabilities.isFlying = false;
|
||||
// player.sendPlayerAbilities();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -150,6 +37,14 @@ public class FMLEventHandler {
|
||||
@SubscribeEvent
|
||||
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event)
|
||||
{
|
||||
if (!event.player.onGround){
|
||||
CustomArmorHandler.ArmorSummery summery = new CustomArmorHandler.ArmorSummery().getSummery(event.player);
|
||||
if (summery != null && summery.flight[0]) {
|
||||
event.player.capabilities.isFlying = true;
|
||||
event.player.sendPlayerAbilities();
|
||||
}
|
||||
}
|
||||
|
||||
if (!mmGiven && event.player.getCommandSenderName().toLowerCase().equals("dezil_nz"))
|
||||
{
|
||||
mmGiven = true;
|
||||
|
||||
+10
-24
@@ -148,11 +148,11 @@ public class MinecraftForgeEventHandler {
|
||||
public void onLivingJumpEvent(LivingEvent.LivingJumpEvent event) {
|
||||
if (!(event.entityLiving instanceof EntityPlayer)) return;
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
CustomArmorHandler.ArmorSummery summery = new CustomArmorHandler.ArmorSummery().getSummery(player);
|
||||
|
||||
if (CustomArmorHandler.getHasJumpBoost(player))
|
||||
if (summery != null && summery.jumpModifier > 0)
|
||||
{
|
||||
int i = CustomArmorHandler.getJumpLevel(player);
|
||||
event.entityLiving.motionY += CustomArmorHandler.getJumpMultiplier(player) * ((0.1f) * (2 + i));
|
||||
player.motionY += (double)(summery.jumpModifier * 0.1F);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,24 +161,6 @@ public class MinecraftForgeEventHandler {
|
||||
if (!(event.entityLiving instanceof EntityPlayer)) return;
|
||||
|
||||
CustomArmorHandler.onPlayerAttacked(event);
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
if (event.source.isFireDamage() && CustomArmorHandler.getFireImunity(player))
|
||||
{
|
||||
event.setCanceled(true);
|
||||
event.entityLiving.extinguish();
|
||||
}
|
||||
|
||||
if (event.source.damageType.equals("fall") && CustomArmorHandler.getHasJumpBoost(player))
|
||||
{
|
||||
if (event.ammount < (CustomArmorHandler.getJumpLevel(player) + 1) * 2) event.setCanceled(true);
|
||||
}
|
||||
|
||||
if ((event.source.damageType.equals("inWall") || event.source.damageType.equals("drown")) && (CustomArmorHandler.isWyvernArmor(player, 4) || CustomArmorHandler.isDraconicArmor(player, 4)))
|
||||
{
|
||||
if (event.ammount <= 2f) event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -388,18 +370,22 @@ public class MinecraftForgeEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void getBreakSpeed(PlayerEvent.BreakSpeed event) {
|
||||
if (event.entityPlayer != null)
|
||||
{
|
||||
float newDigSpeed = event.originalSpeed;
|
||||
CustomArmorHandler.ArmorSummery summery = new CustomArmorHandler.ArmorSummery().getSummery(event.entityPlayer);
|
||||
if (summery == null) return;
|
||||
|
||||
if (event.entityPlayer.isInsideOfMaterial(Material.water))
|
||||
{
|
||||
if (CustomArmorHandler.isDraconicArmor(event.entityPlayer, 4)) newDigSpeed *= 5f;
|
||||
if (summery.flight[0]) newDigSpeed *= 5f;
|
||||
}
|
||||
|
||||
if (!event.entityPlayer.onGround)
|
||||
{
|
||||
if (CustomArmorHandler.isDraconicArmor(event.entityPlayer, 3)) newDigSpeed *= 5f;
|
||||
if (summery.flight[0]) newDigSpeed *= 5f;
|
||||
}
|
||||
event.newSpeed = newDigSpeed;
|
||||
}
|
||||
|
||||
@@ -3,22 +3,24 @@ package com.brandon3055.draconicevolution.common.items;
|
||||
import com.brandon3055.draconicevolution.client.render.particle.Particles;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class Tclogo extends ItemDE {
|
||||
@@ -113,7 +115,16 @@ public class Tclogo extends ItemDE {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
|
||||
LogHelper.info(Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode());
|
||||
|
||||
ResourceLocation rs = new ResourceLocation(References.RESOURCESPREFIX + "manual-en_US.json");
|
||||
|
||||
try {
|
||||
LogHelper.info(Minecraft.getMinecraft().getResourceManager().getResource(rs));
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
// if ((int)System.currentTimeMillis() < lts + 10) return stack;
|
||||
@@ -137,35 +148,35 @@ public class Tclogo extends ItemDE {
|
||||
//projectile.setPosition(player.posX, player.posY, player.posZ);
|
||||
|
||||
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
int x = 45622;
|
||||
LogHelper.info("45622".hashCode());
|
||||
|
||||
|
||||
File file = new File("C:/Users/Brandon/Desktop/0to"+String.valueOf(Integer.MAX_VALUE)+".txt");
|
||||
|
||||
try {
|
||||
FileWriter writer = new FileWriter(file);
|
||||
for (int i = 0; i < Integer.MAX_VALUE; i++) writer.write(i+",");
|
||||
writer.close();
|
||||
LogHelper.info("Done");
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
int xCoord = 0;
|
||||
int yCoord = 0;
|
||||
int zCoord = 0;
|
||||
|
||||
|
||||
|
||||
int locationHash = (String.valueOf(xCoord)+String.valueOf(yCoord)+String.valueOf(zCoord)).hashCode();
|
||||
|
||||
|
||||
//
|
||||
// if (!world.isRemote)
|
||||
// {
|
||||
// int x = 45622;
|
||||
// LogHelper.info("45622".hashCode());
|
||||
//
|
||||
//
|
||||
// File file = new File("C:/Users/Brandon/Desktop/0to"+String.valueOf(Integer.MAX_VALUE)+".txt");
|
||||
//
|
||||
// try {
|
||||
// FileWriter writer = new FileWriter(file);
|
||||
// for (int i = 0; i < Integer.MAX_VALUE; i++) writer.write(i+",");
|
||||
// writer.close();
|
||||
// LogHelper.info("Done");
|
||||
// }
|
||||
// catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// int xCoord = 0;
|
||||
// int yCoord = 0;
|
||||
// int zCoord = 0;
|
||||
//
|
||||
//
|
||||
//
|
||||
// int locationHash = (String.valueOf(xCoord)+String.valueOf(yCoord)+String.valueOf(zCoord)).hashCode();
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
|
||||
@@ -337,12 +348,12 @@ public class Tclogo extends ItemDE {
|
||||
//
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
//List<Entity> l = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ, player.posX, player.posY, player.posZ).expand(500, 500, 500));
|
||||
//for (Entity e : l) if (!(e instanceof EntityPlayer)) e.setDead();
|
||||
|
||||
if (1==1) return stack;
|
||||
//if (1==1) return stack;
|
||||
/*if (player instanceof EntityPlayerMP) {
|
||||
for (int i = 0; i < 10; i++)
|
||||
((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(player.posX + 1, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
|
||||
|
||||
+173
-107
@@ -1,9 +1,17 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.brandonscore.BrandonsCore;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.network.ShieldHitPacket;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.ai.attributes.IAttribute;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
@@ -14,15 +22,22 @@ import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 13/11/2014.
|
||||
*/
|
||||
public class CustomArmorHandler {
|
||||
public static final UUID WALK_SPEED_UUID = UUID.fromString("0ea6ce8e-d2e8-11e5-ab30-625662870761");
|
||||
private static final DamageSource ADMIN_KILL = new DamageSource("administrative.kill");
|
||||
public static Map<EntityPlayer, Boolean> playersWithFlight = new WeakHashMap<EntityPlayer, Boolean>();
|
||||
public static List<String> playersWithUphillStep = new ArrayList<String>();
|
||||
public static Field walkSpeed;
|
||||
|
||||
public static void onPlayerHurt(LivingHurtEvent event) {
|
||||
// EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
// ShieldSummery summery = new ShieldSummery().getSummery(player);
|
||||
// ArmorSummery summery = new ArmorSummery().getSummery(player);
|
||||
// if (summery == null || summery.protectionPoints <= 0) return;
|
||||
// float newEntropy = Math.min(summery.entropy + Math.min(3, event.ammount/5) + player.worldObj.rand.nextFloat(), 100F);
|
||||
//
|
||||
@@ -62,7 +77,9 @@ public class CustomArmorHandler {
|
||||
|
||||
public static void onPlayerAttacked(LivingAttackEvent event){
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
ShieldSummery summery = new ShieldSummery().getSummery(player);
|
||||
ArmorSummery summery = new ArmorSummery().getSummery(player);
|
||||
|
||||
if (applyArmorDamageBlocking(event, summery)) return;
|
||||
|
||||
if (summery == null || summery.protectionPoints <= 0 || event.source == ADMIN_KILL) return;
|
||||
event.setCanceled(true);
|
||||
@@ -93,6 +110,11 @@ public class CustomArmorHandler {
|
||||
ItemNBTHelper.setFloat(armorPeace, "ShieldEntropy", newEntropy);
|
||||
}
|
||||
|
||||
if (summery.protectionPoints > 0){
|
||||
DraconicEvolution.network.sendToAllAround(new ShieldHitPacket(player, summery.protectionPoints / summery.maxProtectionPoints), new NetworkRegistry.TargetPoint(player.dimension, player.posX, player.posY, player.posZ, 64));
|
||||
player.worldObj.playSoundEffect(player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, "draconicevolution:shieldStrike", 10.0F, player.worldObj.rand.nextFloat() * 0.1F + 1.055F);
|
||||
}
|
||||
|
||||
if (remainingPoints > 0) {
|
||||
player.hurtResistantTime = 20;
|
||||
}
|
||||
@@ -103,10 +125,19 @@ public class CustomArmorHandler {
|
||||
|
||||
public static void onPlayerDeath(LivingDeathEvent event) {
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
ShieldSummery summery = new ShieldSummery().getSummery(player);
|
||||
ArmorSummery summery = new ArmorSummery().getSummery(player);
|
||||
|
||||
if (summery == null || event.source == ADMIN_KILL) return;
|
||||
|
||||
if (summery.protectionPoints > 20){
|
||||
event.setCanceled(true);
|
||||
event.entityLiving.setHealth(10);
|
||||
LogHelper.warn("Something is trying to bypass the draconic shield. [Culprit: {Damage Type=" + event.source.damageType + ", Damage Class=" + event.source.toString() + "]");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!summery.hasDraconic) return;
|
||||
|
||||
int[] charge = new int[summery.armorStacks.length];
|
||||
int totalCharge = 0;
|
||||
for (int i = 0; i < summery.armorStacks.length; i++){
|
||||
@@ -131,7 +162,13 @@ public class CustomArmorHandler {
|
||||
|
||||
public static void onPlayerTick(TickEvent.PlayerTickEvent event) {
|
||||
EntityPlayer player = event.player;
|
||||
ShieldSummery summery = new ShieldSummery().getSummery(player);
|
||||
ArmorSummery summery = new ArmorSummery().getSummery(player);
|
||||
|
||||
tickShield(summery, player);
|
||||
tickArmorEffects(summery, player);
|
||||
}
|
||||
|
||||
public static void tickShield(ArmorSummery summery, EntityPlayer player){
|
||||
if (summery == null || (summery.maxProtectionPoints - summery.protectionPoints < 0.01 && summery.entropy == 0) || player.worldObj.isRemote) return;
|
||||
|
||||
float totalPointsToAdd = Math.min(summery.maxProtectionPoints - summery.protectionPoints, summery.maxProtectionPoints / 60F);
|
||||
@@ -155,172 +192,201 @@ public class CustomArmorHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static void tickArmorEffects(ArmorSummery summery, EntityPlayer player){
|
||||
|
||||
//region/*----------------- Flight ------------------*/
|
||||
|
||||
if (summery != null && summery.flight[0]) {
|
||||
playersWithFlight.put(player, true);
|
||||
player.capabilities.allowFlying = true;
|
||||
if (summery.flight[1]) player.capabilities.isFlying = true;
|
||||
|
||||
player.capabilities.setFlySpeed(0.05F + (0.05F * summery.flightSpeedModifier));
|
||||
|
||||
if ((!player.onGround && player.capabilities.isFlying) && player.motionY != 0 && summery.flightVModifier > 0)
|
||||
{
|
||||
float percentIncrease = summery.flightVModifier;
|
||||
|
||||
if (BrandonsCore.proxy.isSpaceDown() && !BrandonsCore.proxy.isShiftDown())
|
||||
{
|
||||
//LogHelper.info(player.motionY);
|
||||
player.motionY = 0.225F * summery.flightVModifier;
|
||||
}
|
||||
|
||||
if (BrandonsCore.proxy.isShiftDown() && !BrandonsCore.proxy.isSpaceDown())
|
||||
{
|
||||
player.motionY = -0.225F * summery.flightVModifier;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (!playersWithFlight.containsKey(player)) {
|
||||
playersWithFlight.put(player, false);
|
||||
}
|
||||
|
||||
if (playersWithFlight.get(player) && !player.worldObj.isRemote) {
|
||||
playersWithFlight.put(player, false);
|
||||
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
player.sendPlayerAbilities();
|
||||
}
|
||||
|
||||
player.capabilities.setFlySpeed(0.05F);
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region/*---------------- Swiftness ----------------*/
|
||||
|
||||
IAttribute speedAttr = SharedMonsterAttributes.movementSpeed;
|
||||
if (summery != null && summery.speedModifier > 0)
|
||||
{
|
||||
double value = summery.speedModifier;
|
||||
if (player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID) == null) {
|
||||
player.getEntityAttribute(speedAttr).applyModifier(new AttributeModifier(WALK_SPEED_UUID, speedAttr.getAttributeUnlocalizedName(), value, 1));
|
||||
}
|
||||
else if (player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID).getAmount() != value){
|
||||
player.getEntityAttribute(speedAttr).removeModifier(player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID));
|
||||
player.getEntityAttribute(speedAttr).applyModifier(new AttributeModifier(WALK_SPEED_UUID, speedAttr.getAttributeUnlocalizedName(), value, 1));
|
||||
}
|
||||
|
||||
if (!player.onGround && player.ridingEntity == null) player.jumpMovementFactor = 0.02F + (0.02F * summery.speedModifier);
|
||||
}
|
||||
else if (player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID) != null)
|
||||
{
|
||||
player.getEntityAttribute(speedAttr).removeModifier(player.getEntityAttribute(speedAttr).getModifier(WALK_SPEED_UUID));
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
//region/*---------------- HillStep -----------------*/
|
||||
if (summery != null && player.worldObj.isRemote) {
|
||||
boolean highStepListed = playersWithUphillStep.contains(player.getDisplayName()) && player.stepHeight >= 1f;
|
||||
boolean hasHighStep = summery.hasHillStep;
|
||||
|
||||
if (hasHighStep && !highStepListed) {
|
||||
playersWithUphillStep.add(player.getDisplayName());
|
||||
player.stepHeight = 1f;
|
||||
}
|
||||
|
||||
|
||||
//Re Add the armor effects!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// slotHelm = 4;
|
||||
// slotChest = 3;
|
||||
// slotLeggs = 2;
|
||||
// slotBoots = 1;
|
||||
|
||||
//Flight------------------------------------------------------------------------------------------------------------
|
||||
public static boolean getHasFlight(EntityPlayer player){
|
||||
return isDraconicArmor(player, 3);// && ((IEnergyContainerItem)player.getEquipmentInSlot(3).getItem()).extractEnergy(player.getEquipmentInSlot(3), 80, !player.capabilities.isFlying) == 80;
|
||||
if (!hasHighStep && highStepListed) {
|
||||
playersWithUphillStep.remove(player.getDisplayName());
|
||||
player.stepHeight = 0.5F;
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
}
|
||||
|
||||
public static float getVAccel(EntityPlayer player){
|
||||
return ItemNBTHelper.getFloat(player.getEquipmentInSlot(3), "VerticalAcceleration", 0.3F);
|
||||
}
|
||||
|
||||
public static boolean getVAccSprint(EntityPlayer player){
|
||||
return ItemNBTHelper.getBoolean(player.getEquipmentInSlot(3), "EffectiveOnSprint", false);
|
||||
}
|
||||
|
||||
public static boolean getFlightLock(EntityPlayer player){
|
||||
return ItemNBTHelper.getBoolean(player.getEquipmentInSlot(3), "ArmorFlightLock", false);
|
||||
}
|
||||
private static boolean applyArmorDamageBlocking(LivingAttackEvent event, ArmorSummery summery){
|
||||
if (summery == null) return false;
|
||||
|
||||
//Swiftness---------------------------------------------------------------------------------------------------------
|
||||
public static boolean getHasSwiftness(EntityPlayer player){
|
||||
return isDraconicArmor(player, 2) || isWyvernArmor(player, 2);
|
||||
}
|
||||
if (event.source.isFireDamage() && summery.fireResistance >= 1)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
event.entityLiving.extinguish();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int getSwiftnessLevel(EntityPlayer player){
|
||||
int i = isWyvernArmor(player, 2) ? 2 : isDraconicArmor(player, 2) ? 4 : 0;
|
||||
return (player.isSprinting() || !ItemNBTHelper.getBoolean(player.getEquipmentInSlot(2), "ArmorSprintOnly", false)) ? i * 2 : i;
|
||||
}
|
||||
if (event.source.damageType.equals("fall") && summery.jumpModifier > 0)
|
||||
{
|
||||
if (event.ammount < summery.jumpModifier * 5F) event.setCanceled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static float getSwiftnessMultiplier(EntityPlayer player){
|
||||
return ItemNBTHelper.getFloat(player.getEquipmentInSlot(2), "ArmorSpeedMult", 1f);
|
||||
}
|
||||
if ((event.source.damageType.equals("inWall") || event.source.damageType.equals("drown")) && summery.armorStacks[3] != null)
|
||||
{
|
||||
if (event.ammount <= 2f) event.setCanceled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
//Jump Boost--------------------------------------------------------------------------------------------------------
|
||||
public static boolean getHasJumpBoost(EntityPlayer player){
|
||||
return (isDraconicArmor(player, 1) || isWyvernArmor(player, 1)) && extractEnergy(player, (getJumpLevel(player)+1)*80, 1);
|
||||
}
|
||||
|
||||
public static int getJumpLevel(EntityPlayer player){
|
||||
int i = isWyvernArmor(player, 1) ? 2 : isDraconicArmor(player, 1) ? 4 : 0;
|
||||
return (player.isSprinting() || !ItemNBTHelper.getBoolean(player.getEquipmentInSlot(1), "ArmorSprintOnly", false)) ? i * 2 : i;
|
||||
}
|
||||
|
||||
public static float getJumpMultiplier(EntityPlayer player){
|
||||
return ItemNBTHelper.getFloat(player.getEquipmentInSlot(1), "ArmorJumpMult", 1f);
|
||||
}
|
||||
|
||||
//Fire Immunity-----------------------------------------------------------------------------------------------------
|
||||
public static boolean getFireImunity(EntityPlayer player){
|
||||
if (isDraconicArmor(player, 3) && extractEnergy(player, 80, 3)) return true;
|
||||
return (isWyvernArmor(player, 1) && isWyvernArmor(player, 2) && isWyvernArmor(player, 3) && isWyvernArmor(player, 4));
|
||||
}
|
||||
|
||||
//Hill Step---------------------------------------------------------------------------------------------------------
|
||||
public static boolean getHasHighStep(EntityPlayer player){
|
||||
return isDraconicArmor(player, 1) && ItemNBTHelper.getBoolean(player.getEquipmentInSlot(1), "ArmorHillStep", true);
|
||||
}
|
||||
|
||||
//Armor & Energy----------------------------------------------------------------------------------------------------
|
||||
public static boolean isWyvernArmor(EntityPlayer player, int slot){
|
||||
int slotType = 4 - slot;
|
||||
ItemStack armor = player.getEquipmentInSlot(slot);
|
||||
return armor != null && armor.getItem() instanceof WyvernArmor && ((WyvernArmor)armor.getItem()).armorType == slotType;
|
||||
}
|
||||
|
||||
public static boolean isDraconicArmor(EntityPlayer player, int slot){
|
||||
int slotType = 4 - slot;
|
||||
ItemStack armor = player.getEquipmentInSlot(slot);
|
||||
return armor != null && armor.getItem() instanceof DraconicArmor && ((DraconicArmor)armor.getItem()).armorType == slotType;
|
||||
}
|
||||
|
||||
public static boolean extractEnergy(EntityPlayer player, int amount, int slot){
|
||||
if (player.getEquipmentInSlot(slot).getItem() instanceof IEnergyContainerItem) return ((IEnergyContainerItem)player.getEquipmentInSlot(slot).getItem()).extractEnergy(player.getEquipmentInSlot(slot), amount, false) == amount;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static class ShieldSummery {
|
||||
public static class ArmorSummery {
|
||||
/*---- Shield ----*/
|
||||
/**Max protection points from all equipped armor peaces*/
|
||||
public float maxProtectionPoints;
|
||||
public float maxProtectionPoints = 0F;
|
||||
/**Total protection points from all equipped armor peaces*/
|
||||
public float protectionPoints;
|
||||
public float protectionPoints = 0F;
|
||||
/**Number of quipped armor peaces*/
|
||||
public int peaces;
|
||||
public int peaces = 0;
|
||||
/**Point Allocation, The number of points on each peace*/
|
||||
public float[] allocation;
|
||||
/***/
|
||||
/**How many points have been drained from each armor peace*/
|
||||
public float[] pointsDown;
|
||||
/**The armor peaces (Index will contain null if peace is not present)*/
|
||||
public ItemStack[] armorStacks;
|
||||
/**Mean Fatigue*/
|
||||
public float entropy;
|
||||
public float entropy = 0F;
|
||||
/**Mean Recovery Points*/
|
||||
public int meanRecoveryPoints;
|
||||
public int meanRecoveryPoints = 0;
|
||||
/**Total RF stored in the armor*/
|
||||
public int totalEnergyStored;
|
||||
public int totalEnergyStored = 0;
|
||||
/**Total Max RF storage for the armor*/
|
||||
public int maxTotalEnergyStorage = 0;
|
||||
/**RF stored in each armor peace*/
|
||||
public int[] energyAllocation;
|
||||
/*---- Effects ----*/
|
||||
public boolean[] flight = new boolean[] {false, false};
|
||||
public float flightVModifier = 0F;
|
||||
public float speedModifier = 0F;
|
||||
public float jumpModifier = 0F;
|
||||
public float fireResistance = 0F;
|
||||
public float flightSpeedModifier = 0;
|
||||
public boolean hasHillStep = false;
|
||||
public boolean hasDraconic = false;
|
||||
|
||||
public ShieldSummery getSummery(EntityPlayer player){
|
||||
public ArmorSummery getSummery(EntityPlayer player){
|
||||
ItemStack[] armorSlots = player.inventory.armorInventory;
|
||||
protectionPoints = 0;
|
||||
peaces = 0;
|
||||
float totalEntropy = 0;
|
||||
int totalRecoveryPoints = 0;
|
||||
meanRecoveryPoints = 0;
|
||||
|
||||
allocation = new float[armorSlots.length];
|
||||
armorStacks = new ItemStack[armorSlots.length];
|
||||
pointsDown = new float[armorSlots.length];
|
||||
energyAllocation = new int[armorSlots.length];
|
||||
totalEnergyStored = 0;
|
||||
|
||||
for (int i = 0; i < armorSlots.length; i++){
|
||||
ItemStack stack = armorSlots[i];
|
||||
if (stack == null || !(stack.getItem() instanceof ICustomArmor)) continue;
|
||||
ICustomArmor armor = (ICustomArmor)stack.getItem();
|
||||
peaces++;
|
||||
allocation[i] = ItemNBTHelper.getFloat(stack, "ProtectionPoints", 0);
|
||||
protectionPoints += allocation[i];
|
||||
totalEntropy += ItemNBTHelper.getFloat(stack, "ShieldEntropy", 0);
|
||||
armorStacks[i] = stack;
|
||||
totalRecoveryPoints += IUpgradableItem.EnumUpgrade.SHIELD_RECOVERY.getUpgradePoints(stack);
|
||||
float maxPoints = ((ICustomArmor)stack.getItem()).getProtectionPoints(stack);
|
||||
float maxPoints = armor.getProtectionPoints(stack);
|
||||
pointsDown[i] = maxPoints - allocation[i];
|
||||
maxProtectionPoints += maxPoints;
|
||||
energyAllocation[i] = ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack);
|
||||
energyAllocation[i] = armor.getEnergyStored(stack);
|
||||
totalEnergyStored += energyAllocation[i];
|
||||
maxTotalEnergyStorage += armor.getMaxEnergyStored(stack);
|
||||
if (stack.getItem() instanceof DraconicArmor) hasDraconic = true;
|
||||
|
||||
fireResistance += armor.getFireResistance(stack);
|
||||
|
||||
switch (i){
|
||||
case 2:
|
||||
flight = armor.hasFlight(stack);
|
||||
if (flight[0]) {
|
||||
flightVModifier = armor.getFlightVModifier(stack, player);
|
||||
flightSpeedModifier = armor.getFlightSpeedModifier(stack, player);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
speedModifier = armor.getSpeedModifier(stack, player);
|
||||
hasHillStep = armor.hasHillStep(stack, player);
|
||||
break;
|
||||
case 0:
|
||||
jumpModifier = armor.getJumpModifier(stack, player);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (peaces == 0) return null;
|
||||
|
||||
+84
-25
@@ -1,11 +1,12 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.brandonscore.BrandonsCore;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.model.ModelDraconicArmorOld;
|
||||
import com.brandon3055.draconicevolution.client.model.ModelDraconicArmor;
|
||||
import com.brandon3055.draconicevolution.client.model.ModelDraconicArmorOld;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
@@ -52,7 +53,7 @@ import java.util.List;
|
||||
@Optional.Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"),
|
||||
@Optional.Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft")
|
||||
})
|
||||
public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem, IConfigurableItem, IInventoryTool, IGoggles, IRevealer, IUpgradableItem, ICustomArmor {//TODO Wings
|
||||
public class DraconicArmor extends ItemArmor implements ISpecialArmor, IConfigurableItem, IInventoryTool, IGoggles, IRevealer, IUpgradableItem, ICustomArmor {//TODO Wings
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon helmIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -62,10 +63,8 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bootsIcon;
|
||||
|
||||
private double totalAbsorption = 2; // 1=100%
|
||||
private int maxTransfer = References.DRACONICTRANSFER;
|
||||
private int maxEnergy = References.DRACONICCAPACITY;
|
||||
private int energyPerDamage = 80;
|
||||
|
||||
public DraconicArmor(ArmorMaterial material, int armorType, String name) {
|
||||
super(material, 0, armorType);
|
||||
@@ -163,25 +162,22 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ISpecialArmor */
|
||||
|
||||
//region ISpecialArmor
|
||||
@Override
|
||||
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
|
||||
int maxAbsorption = 0;//25 * getEnergyStored(armor) / energyPerDamage;
|
||||
if (source.damageType.equals(DamageSource.fall.damageType) && armor.getItem() == ModItems.draconicBoots) return new ArmorProperties(0, 1D, maxAbsorption);
|
||||
if (source.isUnblockable()) return new ArmorProperties(0, (getProtectionShare()*totalAbsorption)/2, maxAbsorption);
|
||||
return new ArmorProperties(0, getProtectionShare()*totalAbsorption, maxAbsorption);
|
||||
if (source.isUnblockable() || source.isDamageAbsolute() || source.isMagicDamage()) return new ArmorProperties(0, damageReduceAmount / 100D, 15);
|
||||
return new ArmorProperties(0, damageReduceAmount / 24.5D, 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
|
||||
return this.getEnergyStored(armor) > 10000 ? (int)(getProtectionShare() * 20D) : (int) ((float)this.getEnergyStored(armor) / 10000F * (float)(getProtectionShare() * 20D));
|
||||
return (int)(getProtectionShare() * 20D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
|
||||
//extractEnergy(stack, damage * energyPerDamage, false);
|
||||
}
|
||||
//endregion
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
|
||||
@@ -189,17 +185,14 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
|
||||
if (stack.getItem() == ModItems.draconicHelm) {
|
||||
if (world.isRemote) return;
|
||||
if (this.getEnergyStored(stack) >= 5000 && clearNegativeEffects(player)) this.extractEnergy(stack, 5000, false);
|
||||
if (player.worldObj.getBlockLightValue((int)Math.floor(player.posX), (int) player.posY + 1, (int)Math.floor(player.posZ)) < 5 && ItemNBTHelper.getBoolean(stack, "ArmorNVActive", false))
|
||||
if (player.worldObj.getBlockLightValue((int)Math.floor(player.posX), (int) player.posY + 1, (int)Math.floor(player.posZ)) < 5 && IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorNVActive", false))
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(16, 419, 0, true));
|
||||
}
|
||||
else if ( ItemNBTHelper.getBoolean(stack, "ArmorNVActive", false) && ItemNBTHelper.getBoolean(stack, "ArmorNVLock", true)) player.addPotionEffect(new PotionEffect(16, 419, 0, true));
|
||||
else if ( IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorNVActive", false) && IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorNVLock", true)) player.addPotionEffect(new PotionEffect(16, 419, 0, true));
|
||||
else if (player.isPotionActive(16)) player.removePotionEffect(16);
|
||||
|
||||
}
|
||||
if (stack.getItem() == ModItems.draconicLeggs && player.isSprinting() && !player.capabilities.isCreativeMode) {
|
||||
this.extractEnergy(stack, player.capabilities.isFlying ? 160 : 80, false);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -297,18 +290,19 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
|
||||
}
|
||||
else if (armorType == 1)
|
||||
{
|
||||
list.add(new ItemConfigField(References.FLOAT_ID, slot, "VerticalAcceleration").setMinMaxAndIncromente(0f, 1f, 0.01f).readFromItem(stack, 0.3F).setModifier("PERCENT"));
|
||||
list.add(new ItemConfigField(References.FLOAT_ID, slot, "VerticalAcceleration").setMinMaxAndIncromente(0f, 8f, 0.1f).readFromItem(stack, 0F).setModifier("PLUSPERCENT"));
|
||||
list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorFlightSpeedMult").setMinMaxAndIncromente(0f, 6f, 0.1f).readFromItem(stack, 0F).setModifier("PLUSPERCENT"));
|
||||
list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "EffectiveOnSprint").readFromItem(stack, false));
|
||||
list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorFlightLock").readFromItem(stack, false));
|
||||
}
|
||||
else if (armorType == 2)
|
||||
{
|
||||
list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorSpeedMult").setMinMaxAndIncromente(0f, 1f, 0.01f).readFromItem(stack, 1F).setModifier("PERCENT"));
|
||||
list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorSpeedMult").setMinMaxAndIncromente(0f, 8f, 0.1f).readFromItem(stack, 0F).setModifier("PLUSPERCENT"));
|
||||
list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false));
|
||||
}
|
||||
else if (armorType == 3)
|
||||
{
|
||||
list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorJumpMult").setMinMaxAndIncromente(0f, 1f, 0.01f).readFromItem(stack, 1f).setModifier("PERCENT"));
|
||||
list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorJumpMult").setMinMaxAndIncromente(0f, 15f, 0.1f).readFromItem(stack, 0f).setModifier("PLUSPERCENT"));
|
||||
list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false));
|
||||
list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorHillStep").readFromItem(stack, true));
|
||||
}
|
||||
@@ -333,13 +327,13 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
|
||||
@Optional.Method(modid = "Thaumcraft")
|
||||
@Override
|
||||
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player) {
|
||||
return ItemNBTHelper.getBoolean(itemstack, "GogglesOfRevealing", true);
|
||||
return IConfigurableItem.ProfileHelper.getBoolean(itemstack, "GogglesOfRevealing", true);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Thaumcraft")
|
||||
@Override
|
||||
public boolean showNodes(ItemStack itemstack, EntityLivingBase player) {
|
||||
return ItemNBTHelper.getBoolean(itemstack, "GogglesOfRevealing", true);
|
||||
return IConfigurableItem.ProfileHelper.getBoolean(itemstack, "GogglesOfRevealing", true);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -432,8 +426,14 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUpgradeStats(ItemStack itemstack) {//todo List Upgrades
|
||||
return new ArrayList<String>();
|
||||
public List<String> getUpgradeStats(ItemStack stack) {
|
||||
List<String> strings = new ArrayList<String>();
|
||||
|
||||
strings.add(InfoHelper.ITC()+StatCollector.translateToLocal("gui.de.RFCapacity.txt")+": "+InfoHelper.HITC()+ Utills.formatNumber(getMaxEnergyStored(stack)));
|
||||
strings.add(InfoHelper.ITC()+StatCollector.translateToLocal("gui.de.ShieldCapacity.txt")+": "+InfoHelper.HITC()+ (int)getProtectionPoints(stack));
|
||||
strings.add(InfoHelper.ITC()+StatCollector.translateToLocal("gui.de.ShieldRecovery.txt") + ": " + InfoHelper.HITC() + Utills.round(getRecoveryPoints(stack) * 0.2D, 10)+" EPS");
|
||||
|
||||
return strings;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -449,6 +449,8 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
|
||||
return 0;
|
||||
}
|
||||
|
||||
//region//----------------- ICustomArmor Start -----------------//
|
||||
|
||||
@Override
|
||||
public float getProtectionPoints(ItemStack stack) {
|
||||
return EnumUpgrade.SHIELD_CAPACITY.getUpgradePoints(stack) * 20;
|
||||
@@ -458,4 +460,61 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
|
||||
public int getRecoveryPoints(ItemStack stack) {
|
||||
return EnumUpgrade.SHIELD_RECOVERY.getUpgradePoints(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeedModifier(ItemStack stack, EntityPlayer player) {
|
||||
if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)){
|
||||
return player.isSprinting() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) / 5F;
|
||||
}
|
||||
else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getJumpModifier(ItemStack stack, EntityPlayer player) {
|
||||
if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)){
|
||||
return player.isSprinting() || BrandonsCore.proxy.isCtrlDown() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) / 5F;
|
||||
}
|
||||
else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasHillStep(ItemStack stack, EntityPlayer player) {
|
||||
if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)){
|
||||
return (player.isSprinting() || BrandonsCore.proxy.isCtrlDown()) && IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorHillStep", true);
|
||||
}
|
||||
else return IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorHillStep", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFireResistance(ItemStack stack) {
|
||||
return 1F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] hasFlight(ItemStack stack) {
|
||||
return new boolean[] {true, IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorFlightLock", false)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFlightSpeedModifier(ItemStack stack, EntityPlayer player) {
|
||||
if (IConfigurableItem.ProfileHelper.getBoolean(stack, "EffectiveOnSprint", false)){
|
||||
return player.isSprinting() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorFlightSpeedMult", 0f) : 0F;
|
||||
}
|
||||
else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorFlightSpeedMult", 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFlightVModifier(ItemStack stack, EntityPlayer player) {
|
||||
if (IConfigurableItem.ProfileHelper.getBoolean(stack, "EffectiveOnSprint", false)){
|
||||
return BrandonsCore.proxy.isCtrlDown() ? IConfigurableItem.ProfileHelper.getFloat(stack, "VerticalAcceleration", 0F) : 0F;
|
||||
}
|
||||
else return IConfigurableItem.ProfileHelper.getFloat(stack, "VerticalAcceleration", 0F);
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+23
-10
@@ -1,11 +1,13 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 5/2/2016.
|
||||
*/
|
||||
public interface ICustomArmor {
|
||||
public interface ICustomArmor extends IEnergyContainerItem {
|
||||
|
||||
/**Returns the max number of protection points this armor piece can provide
|
||||
* 1 protection point equals 1 half heart of protection.
|
||||
@@ -15,16 +17,27 @@ public interface ICustomArmor {
|
||||
/**Reruns the number of Upgrade points applied to shield recovery*/
|
||||
public int getRecoveryPoints(ItemStack stack);
|
||||
|
||||
/*
|
||||
TODO
|
||||
\
|
||||
Create a damage event handler
|
||||
Handle all the damage calculations and save the current remaining protection points directly to the item from the damage handler
|
||||
When player is hit save the ticks till regen can start and the new entropy value directly to the armor
|
||||
Work out overall recovery by averaging the recovery points
|
||||
use a player tick handler to regen the armor and save tick down the entropy
|
||||
/**Returns the movement speed modifier for this armor*/
|
||||
public float getSpeedModifier(ItemStack stack, EntityPlayer player);
|
||||
|
||||
*/
|
||||
/**Returns the jump height modifier for this armor*/
|
||||
public float getJumpModifier(ItemStack stack, EntityPlayer player);
|
||||
|
||||
/**Returns true if this armor has up-hill step enabled*/
|
||||
public boolean hasHillStep(ItemStack stack, EntityPlayer player);
|
||||
|
||||
/**Returns the fire resistance modifier for this armor
|
||||
* This is the percentage of fire damage this armor should absorb
|
||||
* If the total resistance for all armor peaces the player is wearing is >= 1 the player will not be damaged by fire.
|
||||
* Should return a number between 0 and 1*/
|
||||
public float getFireResistance(ItemStack stack);
|
||||
|
||||
/**Returns {true, false} if this armor gives the player flight
|
||||
* Returns {true, true} if flight lock is also enables on this armor*/
|
||||
public boolean[] hasFlight(ItemStack stack);
|
||||
|
||||
public float getFlightSpeedModifier(ItemStack stack, EntityPlayer player);
|
||||
|
||||
/**Returns the vertical acceleration speed*/
|
||||
public float getFlightVModifier(ItemStack stack, EntityPlayer player);
|
||||
}
|
||||
+68
-22
@@ -1,8 +1,9 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.brandonscore.BrandonsCore;
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.model.ModelDraconicArmorOld;
|
||||
import com.brandon3055.draconicevolution.client.model.ModelWyvernArmor;
|
||||
@@ -11,10 +12,7 @@ import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.*;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -39,16 +37,14 @@ import java.util.List;
|
||||
/**
|
||||
* Created by Brandon on 3/07/2014.
|
||||
*/
|
||||
public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem, IConfigurableItem, IInventoryTool, IUpgradableItem, ICustomArmor {
|
||||
public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurableItem, IInventoryTool, IUpgradableItem, ICustomArmor {
|
||||
private IIcon helmIcon;
|
||||
private IIcon chestIcon;
|
||||
private IIcon leggsIcon;
|
||||
private IIcon bootsIcon;
|
||||
|
||||
private double totalAbsorption = 1; // 1=100%
|
||||
private int maxTransfer = References.WYVERNTRANSFER;
|
||||
private int maxEnergy = References.WYVERNCAPACITY;
|
||||
private int energyPerDamage = 80;
|
||||
|
||||
public WyvernArmor(ArmorMaterial material, int armorType, String name) {
|
||||
super(material, 0, armorType);
|
||||
@@ -146,27 +142,22 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyCont
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ISpecialArmor */
|
||||
|
||||
//region ISpecialArmor
|
||||
@Override
|
||||
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
|
||||
int maxAbsorption = 0;//25 * getEnergyStored(armor) / energyPerDamage;
|
||||
if (source.damageType.equals(DamageSource.fall.damageType) && armor.getItem() == ModItems.wyvernBoots) return new ArmorProperties(0, 0.8D, maxAbsorption);
|
||||
if (source.isUnblockable()) return new ArmorProperties(0, (getProtectionShare()*totalAbsorption)/4, maxAbsorption);
|
||||
return new ArmorProperties(0, getProtectionShare()*totalAbsorption, maxAbsorption);
|
||||
if (source.isUnblockable() || source.isDamageAbsolute() || source.isMagicDamage()) return new ArmorProperties(0, damageReduceAmount / 100D, 15);
|
||||
return new ArmorProperties(0, damageReduceAmount / 25D, 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
|
||||
return this.getEnergyStored(armor) > 10000 ? (int)(getProtectionShare() * 20D) : (int) ((float)this.getEnergyStored(armor) / 10000F * (float)(getProtectionShare() * 20D));
|
||||
|
||||
// return (int)(getProtectionShare() * 20D);
|
||||
return (int)(getProtectionShare() * 20D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
|
||||
//extractEnergy(stack, damage * energyPerDamage, false);
|
||||
}
|
||||
//endregion
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
|
||||
@@ -243,12 +234,12 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyCont
|
||||
List<ItemConfigField> list = new ArrayList<ItemConfigField>();
|
||||
if (armorType == 2)
|
||||
{
|
||||
list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorSpeedMult").setMinMaxAndIncromente(0f, 1f, 0.01f).readFromItem(stack, 1F).setModifier("PERCENT"));
|
||||
list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorSpeedMult").setMinMaxAndIncromente(0f, 5f, 0.1f).readFromItem(stack, 0F).setModifier("PLUSPERCENT"));
|
||||
list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false));
|
||||
}
|
||||
else if (armorType == 3)
|
||||
{
|
||||
list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorJumpMult").setMinMaxAndIncromente(0f, 1f, 0.01f).readFromItem(stack, 1f).setModifier("PERCENT"));
|
||||
list.add(new ItemConfigField(References.FLOAT_ID, slot, "ArmorJumpMult").setMinMaxAndIncromente(0f, 5f, 0.1f).readFromItem(stack, 0f).setModifier("PLUSPERCENT"));
|
||||
list.add(new ItemConfigField(References.BOOLEAN_ID, slot, "ArmorSprintOnly").readFromItem(stack, false));
|
||||
}
|
||||
return list;
|
||||
@@ -358,8 +349,14 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyCont
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUpgradeStats(ItemStack itemstack) {//todo List Upgrades
|
||||
return new ArrayList<String>();
|
||||
public List<String> getUpgradeStats(ItemStack stack) {
|
||||
List<String> strings = new ArrayList<String>();
|
||||
|
||||
strings.add(InfoHelper.ITC()+StatCollector.translateToLocal("gui.de.RFCapacity.txt")+": "+InfoHelper.HITC()+ Utills.formatNumber(getMaxEnergyStored(stack)));
|
||||
strings.add(InfoHelper.ITC()+StatCollector.translateToLocal("gui.de.ShieldCapacity.txt")+": "+InfoHelper.HITC()+ (int)getProtectionPoints(stack));
|
||||
strings.add(InfoHelper.ITC() + StatCollector.translateToLocal("gui.de.ShieldRecovery.txt") + ": " + InfoHelper.HITC() + Utills.round(getRecoveryPoints(stack) * 0.2D, 10)+" EPS");
|
||||
|
||||
return strings;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -375,6 +372,7 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyCont
|
||||
return 0;
|
||||
}
|
||||
|
||||
//region//----------------- ICustomArmor Start -----------------//
|
||||
@Override
|
||||
public float getProtectionPoints(ItemStack stack) {
|
||||
return EnumUpgrade.SHIELD_CAPACITY.getUpgradePoints(stack) * 20F;
|
||||
@@ -384,4 +382,52 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyCont
|
||||
public int getRecoveryPoints(ItemStack stack) {
|
||||
return EnumUpgrade.SHIELD_RECOVERY.getUpgradePoints(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeedModifier(ItemStack stack, EntityPlayer player) {
|
||||
if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)){
|
||||
return player.isSprinting() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f) / 5F;
|
||||
}
|
||||
else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorSpeedMult", 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getJumpModifier(ItemStack stack, EntityPlayer player) {
|
||||
if (IConfigurableItem.ProfileHelper.getBoolean(stack, "ArmorSprintOnly", false)){
|
||||
return player.isSprinting() || BrandonsCore.proxy.isCtrlDown() ? IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) : IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f) / 5F;
|
||||
}
|
||||
else return IConfigurableItem.ProfileHelper.getFloat(stack, "ArmorJumpMult", 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasHillStep(ItemStack stack, EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFireResistance(ItemStack stack) {
|
||||
return getProtectionShare();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] hasFlight(ItemStack stack) {
|
||||
return new boolean[] {false, false};
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFlightSpeedModifier(ItemStack stack, EntityPlayer player) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFlightVModifier(ItemStack stack, EntityPlayer player) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTweak {//todo axe & fields
|
||||
|
||||
public DraconicAxe() {
|
||||
super(ModItems.DRACONIUM_T1);
|
||||
super(ModItems.WYVERN);
|
||||
this.setHarvestLevel("axe", 10);
|
||||
this.setUnlocalizedName(Strings.draconicAxeName);
|
||||
this.setCapacity(References.DRACONICCAPACITY);
|
||||
@@ -62,7 +62,7 @@ public class DraconicAxe extends MiningTool implements IInventoryTool, IRenderTw
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
if (ItemNBTHelper.getBoolean(stack, References.TREE_MODE, false) && isTree(player.worldObj, x, y, z)) {
|
||||
if (IConfigurableItem.ProfileHelper.getBoolean(stack, References.TREE_MODE, false) && isTree(player.worldObj, x, y, z)) {
|
||||
trimLeavs(x, y, z, player, player.worldObj, stack);
|
||||
for (int i = 0; i < 9; i++) player.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(player.worldObj.getBlock(x, y, z)) + (player.worldObj.getBlockMetadata(x, y, z) << 12));
|
||||
chopTree(x, y, z, player, player.worldObj, stack);
|
||||
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.InfoHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.MiningTool;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -30,7 +30,7 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo
|
||||
|
||||
|
||||
public DraconicDistructionStaff() {
|
||||
super(ModItems.DRACONIUM_T3);
|
||||
super(ModItems.CHAOTIC);
|
||||
this.setUnlocalizedName(Strings.draconicDStaffName);
|
||||
this.setHarvestLevel("pickaxe", 10);
|
||||
this.setHarvestLevel("shovel", 10);
|
||||
@@ -76,7 +76,7 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
ToolHandler.damageEntityBasedOnHealth(entity, player, 0.3F);
|
||||
ToolHandler.AOEAttack(player, entity, stack, ItemNBTHelper.getInteger(stack, References.ATTACK_AOE, 0));
|
||||
ToolHandler.AOEAttack(player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+20
-6
@@ -11,9 +11,7 @@ import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
|
||||
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.*;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -40,14 +38,14 @@ import org.lwjgl.opengl.GL11;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRenderTweak, IUpgradableItem, IConfigurableItem {
|
||||
public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRenderTweak, IUpgradableItem, IConfigurableItem, IHudDisplayItem {
|
||||
|
||||
protected int capacity = References.DRACONICCAPACITY;
|
||||
protected int maxReceive = References.DRACONICTRANSFER;
|
||||
protected int maxExtract = References.DRACONICTRANSFER;
|
||||
|
||||
public DraconicHoe() {
|
||||
super(ModItems.DRACONIUM_T1);
|
||||
super(ModItems.WYVERN);
|
||||
this.setUnlocalizedName(Strings.draconicHoeName);
|
||||
this.setCreativeTab(DraconicEvolution.tabToolsWeapons);
|
||||
if (ModItems.isEnabled(this)) GameRegistry.registerItem(this, Strings.draconicHoeName);
|
||||
@@ -95,7 +93,8 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende
|
||||
boolean successfull = false;
|
||||
Block clicked = world.getBlock(x, y, z);
|
||||
if (!player.isSneaking() && player.canPlayerEdit(x, y, z, par7, stack) && (clicked == Blocks.dirt || clicked == Blocks.grass || clicked == Blocks.farmland) && par7 == 1) {
|
||||
int size = 4;
|
||||
int size = IConfigurableItem.ProfileHelper.getInteger(stack, References.DIG_AOE, 0);
|
||||
LogHelper.info(size);
|
||||
for (int x1 = -size; x1 <= size; x1++) {
|
||||
for (int z1 = -size; z1 <= size; z1++) {
|
||||
if (!(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
@@ -319,4 +318,19 @@ public class DraconicHoe extends ItemHoe implements IEnergyContainerItem, IRende
|
||||
|
||||
return strings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDisplayData(ItemStack stack) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
||||
for (ItemConfigField field : getFields(stack, 0)) list.add(field.getTooltipInfo());//list.add(field.getLocalizedName() + ": " + field.getFormattedValue());
|
||||
if (capacity > 0) list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(capacity));
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -20,7 +20,7 @@ public class DraconicPickaxe extends MiningTool implements IInventoryTool, IRend
|
||||
|
||||
|
||||
public DraconicPickaxe() {
|
||||
super(ModItems.DRACONIUM_T2);
|
||||
super(ModItems.AWAKENED);
|
||||
this.setHarvestLevel("pickaxe", 10);
|
||||
this.setUnlocalizedName(Strings.draconicPickaxeName);
|
||||
this.setCapacity(References.DRACONICCAPACITY);
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class DraconicShovel extends MiningTool implements IInventoryTool, IRende
|
||||
protected int maxExtract = References.DRACONICTRANSFER;
|
||||
|
||||
public DraconicShovel() {
|
||||
super(ModItems.DRACONIUM_T2);
|
||||
super(ModItems.AWAKENED);
|
||||
this.setHarvestLevel("shovel", 10);
|
||||
this.setUnlocalizedName(Strings.draconicShovelName);
|
||||
this.setCapacity(References.DRACONICCAPACITY);
|
||||
|
||||
+8
-2
@@ -72,12 +72,12 @@ public class DraconiumFluxCapacitor extends RFItemBase {
|
||||
|
||||
@Override
|
||||
public int getMaxExtract(ItemStack stack){
|
||||
return stack.getItemDamage() == 0 ? 100000 : stack.getItemDamage() == 1 ? 1000000 : 0;
|
||||
return stack.getItemDamage() == 0 ? 100000 : stack.getItemDamage() == 1 ? 100000000 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxReceive(ItemStack stack){
|
||||
return stack.getItemDamage() == 0 ? 100000 : stack.getItemDamage() == 1 ? 1000000 : 0;
|
||||
return stack.getItemDamage() == 0 ? 100000 : stack.getItemDamage() == 1 ? 10000000 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -204,4 +204,10 @@ public class DraconiumFluxCapacitor extends RFItemBase {
|
||||
// public Entity createEntity(World world, Entity location, ItemStack itemstack) {
|
||||
// return new EntityPersistentItem(world, location, itemstack);
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
public class WyvernPickaxe extends MiningTool implements IInventoryTool, IRenderTweak {
|
||||
|
||||
public WyvernPickaxe() {
|
||||
super(ModItems.DRACONIUM_T1);
|
||||
super(ModItems.WYVERN);
|
||||
this.setUnlocalizedName(Strings.wyvernPickaxeName);
|
||||
this.setHarvestLevel("pickaxe", 10);
|
||||
this.setCapacity(References.WYVERNCAPACITY);
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public class WyvernShovel extends MiningTool implements IInventoryTool, IRenderT
|
||||
|
||||
|
||||
public WyvernShovel() {
|
||||
super(ModItems.DRACONIUM_T1);
|
||||
super(ModItems.WYVERN);
|
||||
this.setHarvestLevel("shovel", 10);
|
||||
this.setUnlocalizedName(Strings.wyvernShovelName);
|
||||
this.setCapacity(References.WYVERNCAPACITY);
|
||||
|
||||
+9
-10
@@ -5,6 +5,7 @@ import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -67,15 +68,15 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem {//
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
|
||||
int radius = ItemNBTHelper.getInteger(stack, References.DIG_AOE, 0);
|
||||
int depth = ItemNBTHelper.getInteger(stack, References.DIG_DEPTH, 1) - 1;
|
||||
int radius = IConfigurableItem.ProfileHelper.getInteger(stack, References.DIG_AOE, 0);
|
||||
int depth = IConfigurableItem.ProfileHelper.getInteger(stack, References.DIG_DEPTH, 1) - 1;
|
||||
|
||||
return getEnergyStored(stack) >= energyPerOperation && (radius > 0) ? breakAOEBlocks(stack, x, y, z, radius, depth, player) : super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World p_150894_2_, Block p_150894_3_, int p_150894_4_, int p_150894_5_, int p_150894_6_, EntityLivingBase p_150894_7_) {
|
||||
if (ItemNBTHelper.getInteger(stack, References.DIG_AOE, 0) == 0) extractEnergy(stack, References.ENERGYPERBLOCK, false);
|
||||
if (IConfigurableItem.ProfileHelper.getInteger(stack, References.DIG_AOE, 0) == 0) extractEnergy(stack, References.ENERGYPERBLOCK, false);
|
||||
return super.onBlockDestroyed(stack, p_150894_2_, p_150894_3_, p_150894_4_, p_150894_5_, p_150894_6_, p_150894_7_);
|
||||
}
|
||||
|
||||
@@ -85,10 +86,9 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem {//
|
||||
return super.onItemRightClick(stack, world, player);
|
||||
}
|
||||
|
||||
//todo attack, hoe, textures
|
||||
public boolean breakAOEBlocks(ItemStack stack, int x, int y, int z, int breakRadius, int breakDepth, EntityPlayer player)
|
||||
{
|
||||
Map<Block, Integer> blockMap = ItemNBTHelper.getBoolean(stack, References.OBLITERATE, false) ? getObliterationList(stack) : new HashMap<Block, Integer>();
|
||||
Map<Block, Integer> blockMap = IConfigurableItem.ProfileHelper.getBoolean(stack, References.OBLITERATE, false) ? getObliterationList(stack) : new HashMap<Block, Integer>();
|
||||
Block block = player.worldObj.getBlock(x,y,z);
|
||||
int meta = player.worldObj.getBlockMetadata(x,y,z);
|
||||
boolean effective = false;
|
||||
@@ -159,7 +159,7 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem {//
|
||||
break;
|
||||
}
|
||||
|
||||
if (ItemNBTHelper.getBoolean(stack, References.BASE_SAFE_AOE, false))
|
||||
if (IConfigurableItem.ProfileHelper.getBoolean(stack, References.BASE_SAFE_AOE, false))
|
||||
{
|
||||
for (int xPos = x - xMin; xPos <= x + xMax; xPos++)
|
||||
{
|
||||
@@ -225,6 +225,9 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem {//
|
||||
|
||||
float strength = ForgeHooks.blockStrength(block, player, world, x,y,z);
|
||||
|
||||
if (!player.canHarvestBlock(block) || !ForgeHooks.canHarvestBlock(block, player, meta) || refStrength/strength > 10f && !player.capabilities.isCreativeMode)
|
||||
return;
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world, world.getWorldInfo().getGameType(), (EntityPlayerMP) player, x, y, z);
|
||||
@@ -234,9 +237,6 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem {//
|
||||
}
|
||||
}
|
||||
|
||||
if (!player.canHarvestBlock(block) || !ForgeHooks.canHarvestBlock(block, player, meta) || refStrength/strength > 10f && !player.capabilities.isCreativeMode)
|
||||
return;
|
||||
|
||||
int scaledPower = energyPerOperation + (totalSize * (energyPerOperation / 10));
|
||||
|
||||
if (player.capabilities.isCreativeMode || (blockMap.containsKey(block) && blockMap.get(block) == meta)) {
|
||||
@@ -307,7 +307,6 @@ public abstract class MiningTool extends ToolBase implements IUpgradableItem {//
|
||||
|
||||
@Override
|
||||
public List<String> getUpgradeStats(ItemStack stack) {
|
||||
List<ItemConfigField> fields = getFields(stack, 0);
|
||||
List<String> strings = new ArrayList<String>();
|
||||
int digaoe = 0;
|
||||
int depth = 0;
|
||||
|
||||
+9
@@ -14,6 +14,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -132,10 +133,18 @@ public class RFItemBase extends ItemDE implements IEnergyContainerItem, IConfigu
|
||||
@Override
|
||||
public List<String> getDisplayData(ItemStack stack) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
if (hasProfiles()) {
|
||||
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
|
||||
list.add(EnumChatFormatting.DARK_PURPLE+StatCollector.translateToLocal("info.de.capacitorMode.txt")+": "+ItemNBTHelper.getString(stack, "ProfileName"+preset, "Profile "+preset));
|
||||
}
|
||||
for (ItemConfigField field : getFields(stack, 0)) list.add(field.getTooltipInfo());//list.add(field.getLocalizedName() + ": " + field.getFormattedValue());
|
||||
if (capacity > 0) list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(capacity));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+17
-6
@@ -10,7 +10,9 @@ import com.brandon3055.draconicevolution.client.keybinding.KeyBindings;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.network.ToolModePacket;
|
||||
import com.brandon3055.draconicevolution.common.utills.*;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.google.common.collect.Sets;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -26,6 +28,7 @@ import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -123,7 +126,7 @@ public class ToolBase extends RFItemBase {
|
||||
|
||||
if (getEnergyStored(stack) >= energyPerOperation)
|
||||
{
|
||||
float f = ItemNBTHelper.getFloat(stack, References.DIG_SPEED_MULTIPLIER, 1f);
|
||||
float f = IConfigurableItem.ProfileHelper.getFloat(stack, References.DIG_SPEED_MULTIPLIER, 1f);
|
||||
if (speed > 50f) f *= f;
|
||||
return f * speed;
|
||||
}
|
||||
@@ -146,6 +149,10 @@ public class ToolBase extends RFItemBase {
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean extended) {
|
||||
boolean show = InfoHelper.holdShiftForDetails(list);
|
||||
if (show){
|
||||
if (hasProfiles()) {
|
||||
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
|
||||
list.add(EnumChatFormatting.DARK_PURPLE+StatCollector.translateToLocal("info.de.capacitorMode.txt")+": "+ItemNBTHelper.getString(stack, "ProfileName"+preset, "Profile "+preset));
|
||||
}
|
||||
List<ItemConfigField> l = getFields(stack, 0);
|
||||
for (ItemConfigField f : l) list.add(f.getTooltipInfo());
|
||||
if (getCapacity(stack) > 0) list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(getCapacity(stack)));
|
||||
@@ -159,7 +166,11 @@ public class ToolBase extends RFItemBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addAditionalInformation(ItemStack stack, EntityPlayer player, List list, boolean extended) {
|
||||
list.add(StatCollector.translateToLocal("info.de.press.txt") + " " + Keyboard.getKeyName(KeyBindings.toolConfig.getKeyCode()) + " " + StatCollector.translateToLocal("info.de.toOpenConfigGUI.txt"));
|
||||
String key;
|
||||
if (KeyBindings.toolConfig.getKeyCode() >= 0 && KeyBindings.toolConfig.getKeyCode() < Keyboard.KEYBOARD_SIZE) key = Keyboard.getKeyName(KeyBindings.toolConfig.getKeyCode());
|
||||
else key = Mouse.getButtonName(KeyBindings.toolConfig.getKeyCode()+101);
|
||||
|
||||
list.add(StatCollector.translateToLocal("info.de.press.txt") + " " + key + " " + StatCollector.translateToLocal("info.de.toOpenConfigGUI.txt"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -200,7 +211,7 @@ public class ToolBase extends RFItemBase {
|
||||
aoe++;
|
||||
if (aoe > (Integer) field.max) aoe = (Integer) field.min;
|
||||
field.value = aoe;
|
||||
DataUtills.writeObjectToItem(stack, field.value, field.datatype, field.name);
|
||||
DataUtills.writeObjectToCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, field.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,7 +225,7 @@ public class ToolBase extends RFItemBase {
|
||||
aoe++;
|
||||
if (aoe > (Integer) field.max) aoe = (Integer) field.min;
|
||||
field.value = aoe;
|
||||
DataUtills.writeObjectToItem(stack, field.value, field.datatype, field.name);
|
||||
DataUtills.writeObjectToCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, field.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,7 +239,7 @@ public class ToolBase extends RFItemBase {
|
||||
aoe++;
|
||||
if (aoe > (Integer) field.max) aoe = (Integer) field.min;
|
||||
field.value = aoe;
|
||||
DataUtills.writeObjectToItem(stack, field.value, field.datatype, field.name);
|
||||
DataUtills.writeObjectToCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), field.value, field.datatype, field.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+119
-118
@@ -1,13 +1,11 @@
|
||||
package com.brandon3055.draconicevolution.common.items.tools.baseclasses;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityDragonProjectile;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -15,132 +13,128 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.boss.EntityDragonPart;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntitySpider;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.network.play.server.S23PacketBlockChange;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ToolHandler {
|
||||
public static Block[] destroyList = {Blocks.cobblestone, Blocks.stone, Blocks.dirt, Blocks.gravel, Blocks.sand, Blocks.grass, Blocks.netherrack};
|
||||
|
||||
public static boolean isRightMaterial(final Material material, final Material[] materialsListing) {
|
||||
for (final Material mat : materialsListing) {
|
||||
if (material == mat) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkDestroyList(Block curBlock) {
|
||||
for (Block block : destroyList) {
|
||||
if (curBlock == block) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean disSquare(int x, int y, int z, final EntityPlayer player, final World world, final boolean silk, final int fortune, Material[] materialsListing, ItemStack stack) {
|
||||
int size = stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0);
|
||||
MovingObjectPosition mop = raytraceFromEntity(world, player, 4.5D);
|
||||
if (mop == null) {
|
||||
updateGhostBlocks(player, world);
|
||||
return false;
|
||||
}
|
||||
|
||||
int sizeX = size;
|
||||
int sizeY = size;
|
||||
int sizeZ = size;
|
||||
int yOff = (size * -1);
|
||||
Block targetBlock = world.getBlock(x, y, z);
|
||||
if (size > 0) yOff++;
|
||||
//if (size == 0) return false;
|
||||
int side = (stack.getItem().equals(ModItems.draconicAxe)) ? 6 : mop.sideHit;
|
||||
switch (side) {
|
||||
case 0:
|
||||
case 1:
|
||||
sizeY = 0;
|
||||
yOff = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
sizeZ = 0;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
sizeX = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int x1 = x - sizeX; x1 <= x + sizeX; x1++) {
|
||||
for (int y1 = y - (sizeY + yOff); y1 <= y + (sizeY - yOff); y1++) {
|
||||
for (int z1 = z - sizeZ; z1 <= z + sizeZ; z1++) {
|
||||
mineBlock(x1, y1, z1, player, world, silk, fortune, materialsListing, stack);
|
||||
//player.worldObj.scheduleBlockUpdate(x1, y1, z1, Blocks.stone, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, targetBlock.stepSound.getStepResourcePath(), (targetBlock.stepSound.getVolume() + 1.0F) / 2.0F, targetBlock.stepSound.getPitch() * 0.8F);
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static void mineBlock(final int x, final int y, final int z, final EntityPlayer player, final World world, final boolean silk, final int fortune, Material[] materialsListing, ItemStack stack) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
Material mat = block.getMaterial();
|
||||
if ((block != null) && (!block.isAir(world, x, y, z)) && (block.getPlayerRelativeBlockHardness(player, world, x, y, z) != 0.0F)) {
|
||||
List<ItemStack> items = new ArrayList();
|
||||
|
||||
if ((!block.canHarvestBlock(player, meta)) || (!isRightMaterial(mat, materialsListing))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
if (!player.capabilities.isCreativeMode) return;
|
||||
} else {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERBLOCK, false);
|
||||
}
|
||||
|
||||
if (checkDestroyList(block) && (ItemNBTHelper.getBoolean(stack, "obliterate", false))) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0)) == 0) return;
|
||||
|
||||
if ((silk) && (block.canSilkHarvest(world, player, x, y, z, meta))) {
|
||||
if (block == Blocks.lit_redstone_ore)
|
||||
items.add(new ItemStack(Item.getItemFromBlock(Blocks.redstone_ore)));
|
||||
else items.add(new ItemStack(block, 1, meta));
|
||||
} else {
|
||||
items.addAll(block.getDrops(world, x, y, z, meta, fortune));
|
||||
//block.dropXpOnBlockBreak(world, (int)player.posX, (int)player.posY, (int)player.posZ, block.getExpDrop(world, meta, fortune));
|
||||
int xp = block.getExpDrop(world, meta, fortune);
|
||||
player.addExperience(xp);
|
||||
}
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
|
||||
if (!world.isRemote && !player.capabilities.isCreativeMode && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
|
||||
for (ItemStack item : items) {
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, item));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// public static Block[] destroyList = {Blocks.cobblestone, Blocks.stone, Blocks.dirt, Blocks.gravel, Blocks.sand, Blocks.grass, Blocks.netherrack};
|
||||
//
|
||||
// public static boolean isRightMaterial(final Material material, final Material[] materialsListing) {
|
||||
// for (final Material mat : materialsListing) {
|
||||
// if (material == mat) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// public static boolean checkDestroyList(Block curBlock) {
|
||||
// for (Block block : destroyList) {
|
||||
// if (curBlock == block) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// public static boolean disSquare(int x, int y, int z, final EntityPlayer player, final World world, final boolean silk, final int fortune, Material[] materialsListing, ItemStack stack) {
|
||||
// int size = stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0);
|
||||
// MovingObjectPosition mop = raytraceFromEntity(world, player, 4.5D);
|
||||
// if (mop == null) {
|
||||
// updateGhostBlocks(player, world);
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// int sizeX = size;
|
||||
// int sizeY = size;
|
||||
// int sizeZ = size;
|
||||
// int yOff = (size * -1);
|
||||
// Block targetBlock = world.getBlock(x, y, z);
|
||||
// if (size > 0) yOff++;
|
||||
// //if (size == 0) return false;
|
||||
// int side = (stack.getItem().equals(ModItems.draconicAxe)) ? 6 : mop.sideHit;
|
||||
// switch (side) {
|
||||
// case 0:
|
||||
// case 1:
|
||||
// sizeY = 0;
|
||||
// yOff = 0;
|
||||
// break;
|
||||
// case 2:
|
||||
// case 3:
|
||||
// sizeZ = 0;
|
||||
// break;
|
||||
// case 4:
|
||||
// case 5:
|
||||
// sizeX = 0;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// for (int x1 = x - sizeX; x1 <= x + sizeX; x1++) {
|
||||
// for (int y1 = y - (sizeY + yOff); y1 <= y + (sizeY - yOff); y1++) {
|
||||
// for (int z1 = z - sizeZ; z1 <= z + sizeZ; z1++) {
|
||||
// mineBlock(x1, y1, z1, player, world, silk, fortune, materialsListing, stack);
|
||||
// //player.worldObj.scheduleBlockUpdate(x1, y1, z1, Blocks.stone, 100);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, targetBlock.stepSound.getStepResourcePath(), (targetBlock.stepSound.getVolume() + 1.0F) / 2.0F, targetBlock.stepSound.getPitch() * 0.8F);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @SuppressWarnings({"rawtypes", "unchecked"})
|
||||
// public static void mineBlock(final int x, final int y, final int z, final EntityPlayer player, final World world, final boolean silk, final int fortune, Material[] materialsListing, ItemStack stack) {
|
||||
// Block block = world.getBlock(x, y, z);
|
||||
// int meta = world.getBlockMetadata(x, y, z);
|
||||
// Material mat = block.getMaterial();
|
||||
// if ((block != null) && (!block.isAir(world, x, y, z)) && (block.getPlayerRelativeBlockHardness(player, world, x, y, z) != 0.0F)) {
|
||||
// List<ItemStack> items = new ArrayList();
|
||||
//
|
||||
// if ((!block.canHarvestBlock(player, meta)) || (!isRightMaterial(mat, materialsListing))) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (!(stack.getItem() instanceof IEnergyContainerItem) || ((IEnergyContainerItem) stack.getItem()).getEnergyStored(stack) < References.ENERGYPERBLOCK) {
|
||||
// if (!player.capabilities.isCreativeMode) return;
|
||||
// } else {
|
||||
// if (!player.capabilities.isCreativeMode)
|
||||
// ((IEnergyContainerItem) stack.getItem()).extractEnergy(stack, References.ENERGYPERBLOCK, false);
|
||||
// }
|
||||
//
|
||||
// if (checkDestroyList(block) && (IConfigurableItem.ProfileHelper.getBoolean(stack, "obliterate", false))) {
|
||||
// world.setBlockToAir(x, y, z);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if ((stack.getItem().equals(ModItems.draconicAxe) ? 2 : ItemNBTHelper.getShort(stack, "size", (short) 0)) == 0) return;
|
||||
//
|
||||
// if ((silk) && (block.canSilkHarvest(world, player, x, y, z, meta))) {
|
||||
// if (block == Blocks.lit_redstone_ore)
|
||||
// items.add(new ItemStack(Item.getItemFromBlock(Blocks.redstone_ore)));
|
||||
// else items.add(new ItemStack(block, 1, meta));
|
||||
// } else {
|
||||
// items.addAll(block.getDrops(world, x, y, z, meta, fortune));
|
||||
// //block.dropXpOnBlockBreak(world, (int)player.posX, (int)player.posY, (int)player.posZ, block.getExpDrop(world, meta, fortune));
|
||||
// int xp = block.getExpDrop(world, meta, fortune);
|
||||
// player.addExperience(xp);
|
||||
// }
|
||||
//
|
||||
// world.setBlockToAir(x, y, z);
|
||||
//
|
||||
// if (!world.isRemote && !player.capabilities.isCreativeMode && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
|
||||
// for (ItemStack item : items) {
|
||||
// world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, item));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public static void damageEntityBasedOnHealth(Entity entity, EntityPlayer player, float dmgMult) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
@@ -256,6 +250,13 @@ public class ToolHandler {
|
||||
}
|
||||
entityLivingBase.attackTime = 0;
|
||||
}
|
||||
else if (entityObject instanceof EntityDragonProjectile) {
|
||||
float dmg = getDamageAgainstEntity(stack, ((Entity)entityObject));
|
||||
int rf = (int)dmg * References.ENERGYPERATTACK;
|
||||
if (rf > item.getEnergyStored(stack)) dmg = item.getEnergyStored(stack) / References.ENERGYPERATTACK;
|
||||
|
||||
((Entity)entityObject).attackEntityFrom(DamageSource.causePlayerDamage(player), dmg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -306,7 +307,7 @@ public class ToolHandler {
|
||||
|
||||
float sharpMod = (float)EnchantmentHelper.getEnchantmentLevel(Enchantment.sharpness.effectId, stack) * 4F;
|
||||
|
||||
if (stack.getItem() == ModItems.draconicDestructionStaff) dmg = (ModItems.DRACONIUM_T3.getDamageVsEntity()) + sharpMod;
|
||||
if (stack.getItem() == ModItems.draconicDestructionStaff) dmg = (ModItems.CHAOTIC.getDamageVsEntity()) + sharpMod;
|
||||
else if (stack.getItem() instanceof ItemSword) dmg = (((ItemSword)stack.getItem()).func_150931_i()) + sharpMod;
|
||||
|
||||
dmg += (IUpgradableItem.EnumUpgrade.ATTACK_DAMAGE.getUpgradePoints(stack) * 5);
|
||||
|
||||
@@ -285,4 +285,9 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI
|
||||
|
||||
return strings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+8
-6
@@ -14,10 +14,7 @@ import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHand
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.network.ToolModePacket;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.*;
|
||||
import com.google.common.collect.Multimap;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -48,7 +45,7 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem, II
|
||||
protected int maxExtract = References.DRACONICTRANSFER * 50;
|
||||
|
||||
public DraconicSword() {
|
||||
super(ModItems.DRACONIUM_T2);
|
||||
super(ModItems.AWAKENED);
|
||||
this.setUnlocalizedName(Strings.draconicSwordName);
|
||||
this.setCreativeTab(DraconicEvolution.tabToolsWeapons);
|
||||
if (ModItems.isEnabled(this)) GameRegistry.registerItem(this, Strings.draconicSwordName);
|
||||
@@ -87,7 +84,7 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem, II
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
ToolHandler.AOEAttack(player, entity, stack, ItemNBTHelper.getInteger(stack, References.ATTACK_AOE, 0));
|
||||
ToolHandler.AOEAttack(player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0));
|
||||
ToolHandler.damageEntityBasedOnHealth(entity, player, 0.2F);
|
||||
return true;
|
||||
}
|
||||
@@ -301,4 +298,9 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem, II
|
||||
}
|
||||
return super.onItemRightClick(stack, world, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -212,6 +212,11 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte
|
||||
return new ArrayList<ItemConfigField>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnumUpgrade> getUpgrades(ItemStack itemstack) {
|
||||
return new ArrayList<EnumUpgrade>(){{
|
||||
|
||||
+8
-6
@@ -14,10 +14,7 @@ import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolHand
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.network.ToolModePacket;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import com.brandon3055.draconicevolution.common.utills.*;
|
||||
import com.google.common.collect.Multimap;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -50,7 +47,7 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem, IInv
|
||||
protected int maxExtract = References.WYVERNTRANSFER;
|
||||
|
||||
public WyvernSword() {
|
||||
super(ModItems.DRACONIUM_T1);
|
||||
super(ModItems.WYVERN);
|
||||
this.setUnlocalizedName(Strings.wyvernSwordName);
|
||||
this.setCreativeTab(DraconicEvolution.tabToolsWeapons);
|
||||
if (ModItems.isEnabled(this)) GameRegistry.registerItem(this, Strings.wyvernSwordName);
|
||||
@@ -91,7 +88,7 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem, IInv
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
ToolHandler.AOEAttack(player, entity, stack, ItemNBTHelper.getInteger(stack, References.ATTACK_AOE, 0));
|
||||
ToolHandler.AOEAttack(player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0));
|
||||
ToolHandler.damageEntityBasedOnHealth(entity, player, 0.1F);
|
||||
return true;
|
||||
}
|
||||
@@ -308,5 +305,10 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem, IInv
|
||||
}
|
||||
return super.onItemRightClick(stack, world, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasProfiles() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.brandon3055.draconicevolution.common.network;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.gui.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerDissEnchanter;
|
||||
@@ -8,11 +9,13 @@ import com.brandon3055.draconicevolution.common.container.ContainerWeatherContro
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileWeatherController;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ButtonPacket implements IMessage
|
||||
{
|
||||
@@ -24,6 +27,7 @@ public class ButtonPacket implements IMessage
|
||||
public static final byte ID_DRACONIUMCHEST3 = 5;
|
||||
public static final byte ID_TOOLCONFIG = 7;
|
||||
public static final byte ID_DRACONIUMCHEST4 = 8;
|
||||
public static final byte ID_TOOL_PROFILE_CHANGE = 9;
|
||||
byte buttonId = 0;
|
||||
boolean state = false;
|
||||
|
||||
@@ -117,6 +121,17 @@ public class ButtonPacket implements IMessage
|
||||
case ID_TOOLCONFIG:
|
||||
{
|
||||
ctx.getServerHandler().playerEntity.openGui(DraconicEvolution.instance, GuiHandler.GUIID_TOOL_CONFIG, ctx.getServerHandler().playerEntity.worldObj, (int)ctx.getServerHandler().playerEntity.posX, (int)ctx.getServerHandler().playerEntity.posY, (int)ctx.getServerHandler().playerEntity.posZ);
|
||||
break;
|
||||
}
|
||||
case ID_TOOL_PROFILE_CHANGE:
|
||||
{
|
||||
ItemStack stack = ctx.getServerHandler().playerEntity.getHeldItem();
|
||||
if (stack != null && stack.getItem() instanceof IConfigurableItem && ((IConfigurableItem)stack.getItem()).hasProfiles()){
|
||||
int preset = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
|
||||
if (++preset >= 5) preset = 0;
|
||||
ItemNBTHelper.setInteger(stack, "ConfigProfile", preset);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
+23
-1
@@ -1,6 +1,8 @@
|
||||
package com.brandon3055.draconicevolution.common.network;
|
||||
|
||||
import com.brandon3055.brandonscore.common.lib.References;
|
||||
import com.brandon3055.brandonscore.common.utills.DataUtills;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
@@ -19,6 +21,7 @@ public class ItemConfigPacket implements IMessage
|
||||
public int slot;
|
||||
public Object value;
|
||||
public String name;
|
||||
public boolean renameProfile = false;
|
||||
|
||||
public ItemConfigPacket() {}
|
||||
|
||||
@@ -29,12 +32,21 @@ public class ItemConfigPacket implements IMessage
|
||||
this.name = field.name;
|
||||
}
|
||||
|
||||
public ItemConfigPacket(int slot, String name) {
|
||||
this.datatype = References.BOOLEAN_ID;
|
||||
this.slot = slot;
|
||||
this.value = false;
|
||||
this.name = name;
|
||||
this.renameProfile = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf bytes){
|
||||
this.datatype = bytes.readByte();
|
||||
this.slot = bytes.readInt();
|
||||
this.name = ByteBufUtils.readUTF8String(bytes);
|
||||
this.value = DataUtills.instance.readObjectFromBytes(bytes, datatype);
|
||||
this.renameProfile = bytes.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,6 +55,7 @@ public class ItemConfigPacket implements IMessage
|
||||
bytes.writeInt(slot);
|
||||
ByteBufUtils.writeUTF8String(bytes, name);
|
||||
DataUtills.instance.writeObjectToBytes(bytes, datatype, value);
|
||||
bytes.writeBoolean(renameProfile);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<ItemConfigPacket, IMessage> {
|
||||
@@ -50,9 +63,18 @@ public class ItemConfigPacket implements IMessage
|
||||
@Override
|
||||
public IMessage onMessage(ItemConfigPacket message, MessageContext ctx) {
|
||||
EntityPlayer player = ctx.getServerHandler().playerEntity;
|
||||
|
||||
if (message.slot >= player.inventory.getSizeInventory() || message.slot < 0) return null;
|
||||
|
||||
ItemStack stack = player.inventory.getStackInSlot(message.slot);
|
||||
|
||||
if (stack != null && stack.getItem() instanceof IConfigurableItem) {
|
||||
|
||||
if (message.renameProfile){
|
||||
ItemNBTHelper.setString(stack, "ProfileName" + ItemNBTHelper.getInteger(stack, "ConfigProfile", 0), message.name);
|
||||
return null;
|
||||
}
|
||||
|
||||
IConfigurableItem item = (IConfigurableItem) stack.getItem();
|
||||
List<ItemConfigField> fields = item.getFields(stack, message.slot);
|
||||
|
||||
@@ -61,7 +83,7 @@ public class ItemConfigPacket implements IMessage
|
||||
ItemConfigField newValue = new ItemConfigField(message.datatype, message.value, message.slot, message.name);
|
||||
|
||||
if (newValue.castToDouble() <= field.castMaxToDouble() && newValue.castToDouble() >= field.castMinToDouble()){
|
||||
DataUtills.writeObjectToItem(stack, message.value, message.datatype, message.name);
|
||||
DataUtills.writeObjectToCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), message.value, message.datatype, message.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.brandon3055.draconicevolution.common.network;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.DataUtills;
|
||||
import com.brandon3055.draconicevolution.client.handler.ClientEventHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 15/2/2016.
|
||||
*/
|
||||
public class ShieldHitPacket implements IMessage
|
||||
{
|
||||
public int playerID;
|
||||
public byte shieldPowerB;
|
||||
public float shieldPowerF;
|
||||
|
||||
public ShieldHitPacket() {}
|
||||
|
||||
public ShieldHitPacket(EntityPlayer playerHit, float shieldPower) {
|
||||
this.playerID = playerHit.getEntityId();
|
||||
this.shieldPowerB = (byte)(shieldPower * (float)Byte.MAX_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf bytes){
|
||||
playerID = bytes.readInt();
|
||||
shieldPowerB = bytes.readByte();
|
||||
shieldPowerF = (float)shieldPowerB / (float)Byte.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf bytes){
|
||||
bytes.writeInt(playerID);
|
||||
bytes.writeByte(shieldPowerB);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<ShieldHitPacket, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(ShieldHitPacket message, MessageContext ctx) {
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(message.playerID);
|
||||
if (entity instanceof EntityPlayer) ClientEventHandler.playerShieldStatus.put((EntityPlayer)entity, new DataUtills.XZPair<Float, Integer>(message.shieldPowerF, ClientEventHandler.elapsedTicks));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,6 @@ public class SpeedRequestPacket implements IMessage
|
||||
if (ctx.side == Side.SERVER)
|
||||
{
|
||||
if (ConfigHandler.speedLimitDimList.contains(ctx.getServerHandler().playerEntity.dimension) || (BrandonsCore.proxy.isOp(ctx.getServerHandler().playerEntity.getCommandSenderName()) && !ConfigHandler.speedLimitops)) return new SpeedRequestPacket(20F);
|
||||
LogHelper.info(ConfigHandler.speedLimitops);
|
||||
return new SpeedRequestPacket(ConfigHandler.maxPlayerSpeed);
|
||||
}
|
||||
else {
|
||||
|
||||
+34
-1
@@ -11,12 +11,45 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
*/
|
||||
public class TileFluxGate extends TileGate implements IEnergyReceiver {
|
||||
|
||||
private int transferredThisTick = 0;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
transferredThisTick = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
IEnergyReceiver target = getOutputTarget();
|
||||
return target == null ? 0 : target.receiveEnergy(from, Math.min(getActualFlow(), target.receiveEnergy(from, maxReceive, true)), simulate);
|
||||
// int i = buffer.receiveEnergy(Math.max(0, Math.min(maxReceive, Math.min(getActualFlow(), getActualFlow() - buffer.getEnergyStored()))), simulate);
|
||||
// return i;
|
||||
int transfer = target == null ? 0 : target.receiveEnergy(from, Math.min(Math.max(0, getActualFlow()-transferredThisTick), target.receiveEnergy(from, maxReceive, true)), simulate);
|
||||
transferredThisTick += transfer;
|
||||
return transfer;
|
||||
}
|
||||
|
||||
// private EnergyStorage buffer = new EnergyStorage(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
//
|
||||
// @Override
|
||||
// public void updateEntity() {
|
||||
// super.updateEntity();
|
||||
//
|
||||
// IEnergyReceiver receiver = getOutputTarget();
|
||||
// if (receiver != null && !worldObj.isRemote){
|
||||
// buffer.extractEnergy(receiver.receiveEnergy(output.getOpposite(), getActualFlow(), false), false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
// if (buffer.getEnergyStored() > 0) return 0;
|
||||
// int i = buffer.receiveEnergy(Math.max(0, Math.min(maxReceive, Math.min(getActualFlow(), getActualFlow() - buffer.getEnergyStored()))), simulate);
|
||||
// return i;
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
IEnergyReceiver target = getOutputTarget();
|
||||
|
||||
+1
-2
@@ -789,8 +789,7 @@ public class TileEnergyStorageCore extends TileObjectSync {
|
||||
}
|
||||
|
||||
private void detectAndRendChanges(){
|
||||
int diff = (int)Math.abs(lastTickCapacity - energy);
|
||||
if (diff > 1000) lastTickCapacity = (Long) sendObjectToClient(References.LONG_ID, 0, energy, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 20));
|
||||
if (lastTickCapacity != energy) lastTickCapacity = (Long) sendObjectToClient(References.LONG_ID, 0, energy, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 20));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.brandon3055.draconicevolution.common.utills;
|
||||
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -9,4 +12,62 @@ import java.util.List;
|
||||
*/
|
||||
public interface IConfigurableItem {
|
||||
List<ItemConfigField> getFields(ItemStack stack, int slot);
|
||||
|
||||
public boolean hasProfiles();
|
||||
|
||||
public static class ProfileHelper {
|
||||
|
||||
public static NBTTagCompound getProfileCompound(ItemStack stack){
|
||||
int profile = ItemNBTHelper.getInteger(stack, "ConfigProfile", 0);
|
||||
NBTTagCompound stackCompound = ItemNBTHelper.getCompound(stack);
|
||||
if (!stackCompound.hasKey("ConfigProfiles") && stackCompound.getTagList("ConfigProfiles", 10).tagCount() < 5){
|
||||
NBTTagList profileList = new NBTTagList();
|
||||
for (int i = 0; i < 5; i++) profileList.appendTag(new NBTTagCompound());
|
||||
stackCompound.setTag("ConfigProfiles", profileList);
|
||||
}
|
||||
|
||||
return stackCompound.getTagList("ConfigProfiles", 10).getCompoundTagAt(profile);
|
||||
}
|
||||
|
||||
public static void setBoolean(ItemStack stack, String tag, boolean b) {
|
||||
getProfileCompound(stack).setBoolean(tag, b);
|
||||
}
|
||||
|
||||
public static void setInteger(ItemStack stack, String tag, int i) {
|
||||
getProfileCompound(stack).setInteger(tag, i);
|
||||
}
|
||||
|
||||
public static void setFloat(ItemStack stack, String tag, float f) {
|
||||
getProfileCompound(stack).setFloat(tag, f);
|
||||
}
|
||||
|
||||
public static void setDouble(ItemStack stack, String tag, double d) {
|
||||
getProfileCompound(stack).setDouble(tag, d);
|
||||
}
|
||||
|
||||
public static void setString(ItemStack stack, String tag, String s) {
|
||||
getProfileCompound(stack).setString(tag, s);
|
||||
}
|
||||
|
||||
|
||||
public static boolean getBoolean(ItemStack stack, String tag, boolean defaultExpected){
|
||||
return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getBoolean(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static int getInteger(ItemStack stack, String tag, int defaultExpected){
|
||||
return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getInteger(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static float getFloat(ItemStack stack, String tag, float defaultExpected){
|
||||
return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getFloat(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static double getDouble(ItemStack stack, String tag, double defaultExpected) {
|
||||
return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getDouble(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static String getString(ItemStack stack, String tag, String defaultExpected){
|
||||
return getProfileCompound(stack).hasKey(tag) ? getProfileCompound(stack).getString(tag) : defaultExpected;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,20 +49,41 @@ public interface IUpgradableItem {
|
||||
DIG_AOE (2, 4, "DigAOE"){
|
||||
@Override
|
||||
public void onRemovedFromItem(ItemStack itemStack) {
|
||||
if (ItemNBTHelper.getInteger(itemStack, References.DIG_AOE, 0) > getUpgradePoints(itemStack)) ItemNBTHelper.setInteger(itemStack, References.DIG_AOE, getUpgradePoints(itemStack));
|
||||
int profile = ItemNBTHelper.getInteger(itemStack, "ConfigProfile", 0);
|
||||
|
||||
for (int i = 0; i < 5; i++){
|
||||
ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i);
|
||||
if (IConfigurableItem.ProfileHelper.getInteger(itemStack, References.DIG_AOE, 0) > getUpgradePoints(itemStack)) IConfigurableItem.ProfileHelper.setInteger(itemStack, References.DIG_AOE, getUpgradePoints(itemStack));
|
||||
}
|
||||
|
||||
ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile);
|
||||
}
|
||||
},
|
||||
DIG_DEPTH (3, 2, "DigDepth"){
|
||||
@Override
|
||||
public void onRemovedFromItem(ItemStack itemStack) {
|
||||
if (ItemNBTHelper.getInteger(itemStack, References.DIG_DEPTH, 0) > getUpgradePoints(itemStack)) ItemNBTHelper.setInteger(itemStack, References.DIG_DEPTH, getUpgradePoints(itemStack));
|
||||
int profile = ItemNBTHelper.getInteger(itemStack, "ConfigProfile", 0);
|
||||
|
||||
for (int i = 0; i < 5; i++){
|
||||
ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i);
|
||||
if (IConfigurableItem.ProfileHelper.getInteger(itemStack, References.DIG_DEPTH, 0) > getUpgradePoints(itemStack)) IConfigurableItem.ProfileHelper.setInteger(itemStack, References.DIG_DEPTH, getUpgradePoints(itemStack));
|
||||
}
|
||||
|
||||
ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile);
|
||||
}
|
||||
},
|
||||
ATTACK_DAMAGE (4, 1, "AttackDamage"),
|
||||
ATTACK_AOE (5, 2, "AttackAOE"){
|
||||
@Override
|
||||
public void onRemovedFromItem(ItemStack itemStack) {
|
||||
if (ItemNBTHelper.getInteger(itemStack, References.ATTACK_AOE, 0) > getUpgradePoints(itemStack)) ItemNBTHelper.setInteger(itemStack, References.ATTACK_AOE, getUpgradePoints(itemStack));
|
||||
int profile = ItemNBTHelper.getInteger(itemStack, "ConfigProfile", 0);
|
||||
|
||||
for (int i = 0; i < 5; i++){
|
||||
ItemNBTHelper.setInteger(itemStack, "ConfigProfile", i);
|
||||
if (IConfigurableItem.ProfileHelper.getInteger(itemStack, References.ATTACK_AOE, 0) > getUpgradePoints(itemStack)) IConfigurableItem.ProfileHelper.setInteger(itemStack, References.ATTACK_AOE, getUpgradePoints(itemStack));
|
||||
}
|
||||
|
||||
ItemNBTHelper.setInteger(itemStack, "ConfigProfile", profile);
|
||||
}
|
||||
},
|
||||
ARROW_DAMAGE (6, 1, "ArrowDamage"),
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ItemConfigField {
|
||||
// }
|
||||
|
||||
public ItemConfigField readFromItem(ItemStack stack, Object defaultExpected){
|
||||
value = DataUtills.readObjectFromItem(stack, datatype, name, defaultExpected);
|
||||
value = DataUtills.readObjectFromCompound(IConfigurableItem.ProfileHelper.getProfileCompound(stack), datatype, name, defaultExpected);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,9 @@ public class ItemConfigField {
|
||||
else if (datatype == References.FLOAT_ID && !StringUtils.isNullOrEmpty(modifier) && modifier.equals("PERCENT")){
|
||||
return Math.round((Float)value * 100D) + "%";
|
||||
}
|
||||
else if (datatype == References.FLOAT_ID && !StringUtils.isNullOrEmpty(modifier) && modifier.equals("PLUSPERCENT")) {
|
||||
return "+"+Math.round((Float)value * 100D) + "%";
|
||||
}
|
||||
else
|
||||
{
|
||||
return String.valueOf(value);
|
||||
|
||||
Reference in new issue
Block a user