1.0.2 RC2

This commit is contained in:
brandon3055 committed 2016-03-11 18:34:20 +11:00
1 parent 0e64cd4eae
commit aa6ec72ae9
39 files changed
+838 -306

No files matched your search

@@ -1,14 +1,16 @@
package com.brandon3055.draconicevolution.client;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.handler.*;
import com.brandon3055.draconicevolution.client.handler.ClientEventHandler;
import com.brandon3055.draconicevolution.client.handler.HudHandler;
import com.brandon3055.draconicevolution.client.handler.ParticleHandler;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.keybinding.KeyBindings;
import com.brandon3055.draconicevolution.client.keybinding.KeyInputHandler;
import com.brandon3055.draconicevolution.client.render.IRenderTweak;
import com.brandon3055.draconicevolution.client.render.block.*;
import com.brandon3055.draconicevolution.client.render.entity.*;
import com.brandon3055.draconicevolution.client.render.item.*;
import com.brandon3055.draconicevolution.client.render.item.RenderTool;
import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyBeam;
import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyField;
import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam;
@@ -57,7 +59,6 @@ public class ClientProxy extends CommonProxy {
super.preInit(event);
ResourceHandler.init(event);
ContributorHandler.init();
// downloadLocation = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + "/mods/derspack";
// downloadLocation = downloadLocation.replaceAll("\\\\", "/");
@@ -58,6 +58,7 @@ public class GUIManual extends GUIScrollingBase implements GuiYesNoCallback {
@Override
public void initGui() {
super.initGui();
loadPages();
if (previousScale == -1) adjustGuiScale();
if (!Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode().equals(lang)) loadPages();
@@ -9,8 +9,10 @@ import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentConfi
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.handler.ContributorHandler;
import com.brandon3055.draconicevolution.common.items.weapons.BowHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.network.ContributorPacket;
import com.brandon3055.draconicevolution.common.network.ItemConfigPacket;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
@@ -50,11 +52,35 @@ public class GUIToolConfig extends GUIBase {
@Override
public void initGui() {
super.initGui();
if (ContributorHandler.contributors.containsKey(player.getCommandSenderName())){
ContributorHandler.Contributor contributor = ContributorHandler.contributors.get(player.getCommandSenderName());
if (!contributor.isUserValid(player)) return;
buttonList.clear();
if (contributor.contributionLevel >= 1) buttonList.add(new GuiButton(0, guiLeft - 150, guiTop, 150, 20, "Contributor Wings: " + (contributor.contributorWingsEnabled ? "Enabled" : "Disabled")));
if (contributor.contribution.toLowerCase().contains("patreon")) buttonList.add(new GuiButton(1, guiLeft - 150, guiTop + 22, 150, 20, "Patreon Badge: " + (contributor.patreonBadgeEnabled ? "Enabled" : "Disabled")));
}
}
@Override
protected void actionPerformed(GuiButton button) {
super.actionPerformed(button);
if (ContributorHandler.contributors.containsKey(player.getCommandSenderName())) {
ContributorHandler.Contributor contributor = ContributorHandler.contributors.get(player.getCommandSenderName());
if (!contributor.isUserValid(player)) return;
if (button.id == 0) {
contributor.contributorWingsEnabled = !contributor.contributorWingsEnabled;
button.displayString = "Contributor Wings: " + (contributor.contributorWingsEnabled ? "Enabled" : "Disabled");
} else if (button.id == 1) {
contributor.patreonBadgeEnabled = !contributor.patreonBadgeEnabled;
button.displayString = "Patreon Badge: " + (contributor.patreonBadgeEnabled ? "Enabled" : "Disabled");
}
DraconicEvolution.network.sendToServer(new ContributorPacket(player.getCommandSenderName(), contributor.contributorWingsEnabled, contributor.patreonBadgeEnabled));
}
}
@Override
@@ -1,9 +1,8 @@
package com.brandon3055.draconicevolution.client.gui.componentguis;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import net.minecraft.util.StatCollector;
import java.net.MalformedURLException;
import java.net.URL;
import org.apache.commons.io.FilenameUtils;
/**
* Created by Brandon on 7/03/2015.
@@ -33,16 +32,18 @@ public class ManualPage {
public String getImageResourceName(String url)
{
try
{
String fileName = new URL(url).getFile();
return fileName.substring(fileName.indexOf("/") + 1);
}
catch (MalformedURLException e)
{
e.printStackTrace();
return "";
}
// try
// {
LogHelper.info(url);
return FilenameUtils.getName(url);
//String fileName = new URL(url).getFile();
//return fileName.substring(fileName.indexOf("/") + 1);
// }
// catch (MalformedURLException e)
// {
// e.printStackTrace();
// return "";
// }
}
public String getLocalizedName()
@@ -4,8 +4,8 @@ import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingB
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase;
import com.brandon3055.brandonscore.client.utills.ClientUtills;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.draconicevolution.client.handler.ContributorHandler;
import com.brandon3055.draconicevolution.client.handler.ContributorHandler.Contributor;
import com.brandon3055.draconicevolution.common.handler.ContributorHandler;
import com.brandon3055.draconicevolution.common.handler.ContributorHandler.Contributor;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
@@ -73,7 +73,8 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements
boolean patreonButtonHighlighted = mouseX >= 140 && mouseY >= 290;
for (Contributor contributor : ContributorHandler.contributors){
for (Contributor contributor : ContributorHandler.contributors.values()){
if (!StringUtils.isNullOrEmpty(contributor.details) && contributor.details.contains("[UNLISTED]")) continue;
yOffset += 30;
if (!(yOffset > 25 && yOffset < 324)) continue;
@@ -103,7 +104,8 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements
boolean patreonButtonHighlighted = mouseX >= 140 && mouseY >= 290;
for (Contributor contributor : ContributorHandler.contributors){
for (Contributor contributor : ContributorHandler.contributors.values()){
if (!StringUtils.isNullOrEmpty(contributor.details) && contributor.details.contains("[UNLISTED]")) continue;
yOffset += 30;
if (!(yOffset > 20 && yOffset < 330)) continue;
@@ -152,7 +154,8 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements
boolean patreonButtonHighlighted = x >= 140 && y >= 290;
for (Contributor contributor : ContributorHandler.contributors){
for (Contributor contributor : ContributorHandler.contributors.values()){
if (!StringUtils.isNullOrEmpty(contributor.details) && contributor.details.contains("[UNLISTED]")) continue;
yOffset += 30;
if (!(yOffset > 20 && yOffset < 330) || patreonButtonHighlighted) continue;
@@ -182,8 +185,9 @@ public class ComponentContributorsPage extends ComponentScrollingBase implements
private static ResourceLocation getSkin(String username){
if (!skinCashInitialized){
for (Contributor contributor : ContributorHandler.contributors)
for (Contributor contributor : ContributorHandler.contributors.values())
{
if (!StringUtils.isNullOrEmpty(contributor.details) && contributor.details.contains("[UNLISTED]")) continue;
ResourceLocation skin = AbstractClientPlayer.getLocationSkin(contributor.ign);
AbstractClientPlayer.getDownloadImageSkin(skin, contributor.ign);
skinCache.put(contributor.ign, skin);
@@ -2,12 +2,12 @@ package com.brandon3055.draconicevolution.client.gui.guicomponents;
import com.brandon3055.brandonscore.client.gui.guicomponents.ComponentScrollingBase;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIScrollingBase;
import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.utill.CustomResourceLocation;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.InfoHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.gui.componentguis.ManualPage;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.utill.CustomResourceLocation;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
@@ -15,6 +15,7 @@ import net.minecraft.item.crafting.*;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.apache.commons.io.FilenameUtils;
import org.lwjgl.opengl.GL11;
import java.lang.reflect.Field;
@@ -125,7 +126,8 @@ public class ComponentManualPage extends ComponentScrollingBase {
{
isTitle = content != null && content.contains("title.");
type = content.contains("http://") ? 1 : content.contains("[c]") ? 2 : 0;
type = content.contains(".png") ? 1 : content.contains("[c]") ? 2 : 0;
slide = (type == 1) && content.contains("[>]");
if (slide)
{
@@ -195,9 +197,9 @@ public class ComponentManualPage extends ComponentScrollingBase {
public int getHeight()
{
if (type == 1 && (ResourceHandler.downloadedImages.containsKey(content) || (slide && ResourceHandler.downloadedImages.containsKey(content.substring(0, content.indexOf("[>]"))))))
if (type == 1 && (ResourceHandler.downloadedImages.containsKey(FilenameUtils.getName(content)) || (slide && ResourceHandler.downloadedImages.containsKey(FilenameUtils.getName(content)))))
{
CustomResourceLocation texture = slide ? ResourceHandler.downloadedImages.get(content.substring(0, content.indexOf("[>]"))) : ResourceHandler.downloadedImages.get(content);
CustomResourceLocation texture = slide ? ResourceHandler.downloadedImages.get(FilenameUtils.getName(content)) : ResourceHandler.downloadedImages.get(FilenameUtils.getName(content));
return (int)((double)texture.getHeight() / (double)texture.getWidth() * 220D) + 5;
}
else if (type == 2)
@@ -250,9 +252,12 @@ public class ComponentManualPage extends ComponentScrollingBase {
if (slide)
{
int index = (page.slideTick / 20) % (slides.size());
image = (slides.size() > index) ? ResourceHandler.downloadedImages.get(slides.get(index)) : null;
image = (slides.size() > index) ? ResourceHandler.downloadedImages.get(FilenameUtils.getName(slides.get(index))) : null;
}
else if (ResourceHandler.downloadedImages.containsKey(content)) image = ResourceHandler.downloadedImages.get(content);
else if (ResourceHandler.downloadedImages.containsKey(FilenameUtils.getName(content))) {
image = ResourceHandler.downloadedImages.get(FilenameUtils.getName(content));
}
if (image != null)
{
@@ -4,6 +4,7 @@ import com.brandon3055.brandonscore.common.utills.DataUtills.XZPair;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.handler.ContributorHandler;
import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler;
import com.brandon3055.draconicevolution.common.items.armor.DraconicArmor;
import com.brandon3055.draconicevolution.common.items.armor.WyvernArmor;
@@ -59,7 +60,7 @@ public class ClientEventHandler {
}
@SubscribeEvent
public void tickEnd(TickEvent event) {
public void tickEnd(TickEvent.ClientTickEvent 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(); ){
@@ -154,6 +155,11 @@ public class ClientEventHandler {
LogHelper.info("Started checking for player mount");
}
@SubscribeEvent
public void renderPlayerEvent(RenderPlayerEvent.Specials.Post event) {
ContributorHandler.render(event);
}
@SubscribeEvent
public void renderArmorEvent(RenderPlayerEvent.SetArmorModel event) {
if (ConfigHandler.useOriginal3DArmorModel || ConfigHandler.useOldArmorModel) return;
@@ -1,158 +0,0 @@
package com.brandon3055.draconicevolution.client.handler;
import com.brandon3055.brandonscore.common.handlers.FileHandler;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.google.gson.stream.JsonReader;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import org.apache.commons.io.IOUtils;
import java.io.*;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
/**
* Created by brandon3055 on 5/11/2015.
*/
public class ContributorHandler {
public static List<Contributor> contributors = new ArrayList<Contributor>();
public static boolean successfulLoad = false;
private static DLThread thread;
public static void init(){
thread = new DLThread();
thread.start();
FMLCommonHandler.instance().bus().register(new ContributorHandler());
}
private static void readFile(){
File cFile = new File(FileHandler.configFolder, "/draconicevolution/contributors.json");
if (!cFile.exists()){
LogHelper.error("Could not find contributors file");
return;
}
try
{
JsonReader reader = new JsonReader(new FileReader(cFile));
reader.setLenient(true);
reader.beginArray();
while (reader.hasNext())
{
reader.beginObject();
Contributor contributor = new Contributor();
while (reader.hasNext())
{
String name = reader.nextName();
if (name.equals("name")) contributor.name = reader.nextString();
else if (name.equals("ign")) contributor.ign = reader.nextString();
else if (name.equals("contribution")) contributor.contribution = reader.nextString();
else if (name.equals("details")) contributor.details = reader.nextString();
else if (name.equals("website")) contributor.website = reader.nextString();
else if (name.equals("contributionLevel")) contributor.contributionLevel = reader.nextInt();
}
contributors.add(contributor);
reader.endObject();
}
reader.endArray();
reader.close();
cFile.delete();
}
catch (Exception e)
{
e.printStackTrace();
}
}
@SubscribeEvent
public void tick(TickEvent.ClientTickEvent event){
if (thread == null) {
FMLCommonHandler.instance().bus().unregister(this);
return;
}
if (thread.isFinished()){
thread = null;
readFile();
successfulLoad = true;
}
else if (thread.isFailed()){
thread = null;
}
}
public static class Contributor {
public String name;
public String ign;
public String contribution;
public String details;
public String website;
public int contributionLevel;
public Contributor() {}
@Override
public String toString() {
return "[Contributor: "+name+", Contribution: "+contribution+", Details: "+details+", Website: "+website+"]";
}
}
public static class DLThread extends Thread {
private boolean finished = false;
private boolean failed = false;
public DLThread(){
super("DE Contributors DL Thread");
}
@Override
public void run() {
super.run();
try
{
URL url = new URL("http://www.brandon3055.com/json/DEContributors.json");
File cFile = new File(FileHandler.configFolder, "/draconicevolution/contributors.json");
InputStream is = url.openStream();
OutputStream os = new FileOutputStream(cFile);
IOUtils.copy(is, os);
is.close();
os.close();
finished = true;
}
catch (Exception e)
{
failed = true;
e.printStackTrace();
}
}
public boolean isFinished() {
return finished;
}
public boolean isFailed() {
return failed;
}
}
}
@@ -15,6 +15,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.resources.FolderResourcePack;
import net.minecraft.util.ResourceLocation;
import org.apache.commons.io.FilenameUtils;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
@@ -94,8 +95,8 @@ public class ResourceHandler {
URL url = new URL(s);
String fileName = url.getFile();
BufferedImage bi = ImageIO.read(new File(getImagesFolder(), fileName));
downloadedImages.put(s, new CustomResourceLocation(fileName.substring(fileName.indexOf("/") + 1), bi.getWidth(), bi.getHeight()));
BufferedImage bi = ImageIO.read(new File(getImagesFolder(), FilenameUtils.getName(fileName)));
downloadedImages.put(FilenameUtils.getName(fileName), new CustomResourceLocation(FilenameUtils.getName(fileName), bi.getWidth(), bi.getHeight()));
}
catch (MalformedURLException e)
{
@@ -119,9 +120,9 @@ public class ResourceHandler {
URL url = new URL(urlString);
String fileName = url.getFile();
LogHelper.info("Downloading Image " + fileName);
LogHelper.info("Downloading Image " + FilenameUtils.getName(fileName));
File dll = new File(getImagesFolder(), fileName);
File dll = new File(getImagesFolder(), FilenameUtils.getName(fileName));
InputStream is = url.openStream();
OutputStream os = new FileOutputStream(dll);
@@ -145,7 +146,7 @@ public class ResourceHandler {
{
URL url = new URL(urlS);
String fileName = url.getFile();
return Arrays.asList(getImagesFolder().list()).contains(fileName.substring(fileName.indexOf("/") + 1));
return Arrays.asList(getImagesFolder().list()).contains(FilenameUtils.getName(fileName));
}
catch (MalformedURLException e)
{
@@ -0,0 +1,101 @@
package com.brandon3055.draconicevolution.client.model.special;
import com.brandon3055.draconicevolution.client.handler.ClientEventHandler;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11;
/**
* DragonWings - brandon3055
* Created using Tabula 5.0.0
*/
public class ModelContributorWings extends ModelBase {
public ModelRenderer rightBaseStem;
public ModelRenderer leftBaseStem;
public ModelRenderer rightOuterStem;
public ModelRenderer rightWingInner;
public ModelRenderer rightWingOuter;
public ModelRenderer leftOuterStem;
public ModelRenderer leftWingInner;
public ModelRenderer leftWingOuter;
public ModelContributorWings() {
this.textureWidth = 32;
this.textureHeight = 32;
this.leftWingOuter = new ModelRenderer(this, 0, 18);
this.leftWingOuter.mirror = true;
this.leftWingOuter.setRotationPoint(0.5F, 0.0F, 0.0F);
this.leftWingOuter.addBox(-0.5F, 0.5F, 0.0F, 15, 14, 0, 0.0F);
this.rightOuterStem = new ModelRenderer(this, 0, 2);
this.rightOuterStem.setRotationPoint(-12.5F, 0.0F, 0.0F);
this.rightOuterStem.addBox(-15.0F, -0.5F, -0.5F, 15, 1, 1, 0.0F);
this.setRotateAngle(rightOuterStem, 0.0F, -0.6108652381980153F, 0.0F);
this.leftWingInner = new ModelRenderer(this, 0, 4);
this.leftWingInner.setRotationPoint(0.0F, 0.0F, 0.0F);
this.leftWingInner.addBox(-0.5F, 0.5F, 0.0F, 13, 14, 0, 0.0F);
this.rightWingInner = new ModelRenderer(this, 0, 4);
this.rightWingInner.mirror = true;
this.rightWingInner.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rightWingInner.addBox(-12.5F, 0.5F, 0.0F, 13, 14, 0, 0.0F);
this.rightWingOuter = new ModelRenderer(this, 0, 18);
this.rightWingOuter.setRotationPoint(-0.5F, 0.0F, 0.0F);
this.rightWingOuter.addBox(-14.5F, 0.5F, 0.0F, 15, 14, 0, 0.0F);
this.leftBaseStem = new ModelRenderer(this, 0, 0);
this.leftBaseStem.setRotationPoint(0.5F, 1.0F, 2.0F);
this.leftBaseStem.addBox(-0.5F, -0.5F, -0.5F, 13, 1, 1, 0.0F);
this.setRotateAngle(leftBaseStem, 0.0F, -0.3490658503988659F, 0.0F);
this.leftOuterStem = new ModelRenderer(this, 0, 2);
this.leftOuterStem.setRotationPoint(12.5F, 0.0F, 0.0F);
this.leftOuterStem.addBox(0.0F, -0.5F, -0.5F, 15, 1, 1, 0.0F);
this.setRotateAngle(leftOuterStem, 0.0F, 0.6108652381980153F, 0.0F);
this.rightBaseStem = new ModelRenderer(this, 0, 0);
this.rightBaseStem.setRotationPoint(-0.5F, 1.0F, 2.0F);
this.rightBaseStem.addBox(-12.5F, -0.5F, -0.5F, 13, 1, 1, 0.0F);
this.setRotateAngle(rightBaseStem, 0.0F, 0.3490658503988659F, 0.0F);
this.leftOuterStem.addChild(this.leftWingOuter);
this.rightBaseStem.addChild(this.rightOuterStem);
this.leftBaseStem.addChild(this.leftWingInner);
this.rightBaseStem.addChild(this.rightWingInner);
this.rightOuterStem.addChild(this.rightWingOuter);
this.leftBaseStem.addChild(this.leftOuterStem);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float partialTick, float scale) {
GL11.glPushMatrix();
float baseRot = 0.45906584F;
float outerRot = 0.61086524F;
float animation = (float)Math.sin(((float)ClientEventHandler.elapsedTicks + partialTick) / 20);
if (entity.isSneaking()){
this.leftBaseStem.rotateAngleX = 0.5F;
this.rightBaseStem.rotateAngleX = 0.5F;
}
else {
this.leftBaseStem.rotateAngleX = 0F;
this.rightBaseStem.rotateAngleX = 0F;
}
this.leftBaseStem.rotateAngleY = -baseRot + (animation * 0.15F);
this.leftOuterStem.rotateAngleY = outerRot + (animation * 0.3F);
this.rightBaseStem.rotateAngleY = baseRot - (animation * 0.15F);
this.rightOuterStem.rotateAngleY = -outerRot - (animation * 0.3F);
this.leftBaseStem.render(scale);
this.rightBaseStem.render(scale);
GL11.glPopMatrix();
}
/**
* This is a helper function from Tabula to set the rotation of model parts
*/
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -8,10 +8,7 @@ import com.brandon3055.draconicevolution.client.render.particle.ParticleEnergyFi
import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam;
import com.brandon3055.draconicevolution.common.achievements.Achievements;
import com.brandon3055.draconicevolution.common.entity.*;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.handler.CraftingHandler;
import com.brandon3055.draconicevolution.common.handler.FMLEventHandler;
import com.brandon3055.draconicevolution.common.handler.MinecraftForgeEventHandler;
import com.brandon3055.draconicevolution.common.handler.*;
import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.magic.EnchantmentReaper;
@@ -54,6 +51,7 @@ public class CommonProxy {
registerEventListeners(event.getSide());
ModBlocks.init();
ModItems.init();
ContributorHandler.init();
registerTileEntities();
initializeNetwork();
registerOres();
@@ -126,6 +124,9 @@ public class CommonProxy {
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, 16, Side.CLIENT);
DraconicEvolution.network.registerMessage(ContributorPacket.Handler.class, ContributorPacket.class, 17, Side.CLIENT);
DraconicEvolution.network.registerMessage(ContributorPacket.Handler.class, ContributorPacket.class, 18, Side.SERVER);
}
public void registerTileEntities() {
@@ -75,6 +75,7 @@ public class ModItems {
public static ItemDE chaoticCore;
public static ItemDE nugget;
public static ItemDE chaosFragment;
public static ItemDE magnet;
public static ItemDE teleporterMKI;
public static ItemDE teleporterMKII;
@@ -143,6 +144,7 @@ public class ModItems {
reactorStabilizerParts = new ReactorStabiliserPart();
nugget = new Nugget();
chaosFragment = new ChaosFragment();
magnet = new Magnet();
dezilsMarshmallow = new DezilsMarshmallow();
@@ -26,8 +26,8 @@ public class ReactorStabilizer extends BlockDE {
public ReactorStabilizer() {
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
this.setBlockName("reactorStabilizer");
this.setResistance(10000F);
this.setResistance(10F);
this.setHardness(10F);
ModBlocks.register(this);
}
@@ -6,6 +6,8 @@ import com.brandon3055.draconicevolution.client.render.particle.Particles;
import com.brandon3055.draconicevolution.common.items.weapons.BowHandler;
import com.brandon3055.draconicevolution.common.network.GenericParticlePacket;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
@@ -290,15 +292,10 @@ public class EntityCustomArrow extends EntityArrow {
//endregion
//region Motion
if (this.getIsCritical() || bowProperties.energyBolt) {
if ((this.getIsCritical() || bowProperties.energyBolt) && worldObj.isRemote) {
for (i = 0; i < 4; ++i) {
if (bowProperties.energyBolt) {
Particles.ArrowParticle particle = new Particles.ArrowParticle(worldObj, posX - 0.25 + rand.nextDouble() * 0.5, posY + rand.nextDouble() * 0.5, posZ - 0.25 + rand.nextDouble() * 0.5, 0xff6000, 0.2F+rand.nextFloat()*0.5f);
double mm = 0.2;
particle.motionX = (rand.nextDouble() - 0.5) * mm;
particle.motionY = (rand.nextDouble() - 0.5) * mm;
particle.motionZ = (rand.nextDouble() - 0.5) * mm;
ParticleHandler.spawnCustomParticle(particle, 64);
spawnArrowParticles();
}
else {
this.worldObj.spawnParticle("crit", this.posX + this.motionX * i / 4.0D, this.posY + this.motionY * i / 4.0D, this.posZ + this.motionZ * i / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ);
@@ -356,6 +353,16 @@ public class EntityCustomArrow extends EntityArrow {
}
}
@SideOnly(Side.CLIENT)
private void spawnArrowParticles(){
Particles.ArrowParticle particle = new Particles.ArrowParticle(worldObj, posX - 0.25 + rand.nextDouble() * 0.5, posY + rand.nextDouble() * 0.5, posZ - 0.25 + rand.nextDouble() * 0.5, 0xff6000, 0.2F+rand.nextFloat()*0.5f);
double mm = 0.2;
particle.motionX = (rand.nextDouble() - 0.5) * mm;
particle.motionY = (rand.nextDouble() - 0.5) * mm;
particle.motionZ = (rand.nextDouble() - 0.5) * mm;
ParticleHandler.spawnCustomParticle(particle, 64);
}
@Override
public void writeEntityToNBT(NBTTagCompound compound)
{
@@ -425,7 +432,7 @@ public class EntityCustomArrow extends EntityArrow {
double range = (double)bowProperties.shockWavePower + 5;
List<Entity> list = worldObj.getEntitiesWithinAABB(Entity.class, boundingBox.expand(range, range, range));
float damage = 20F * bowProperties.shockWavePower;
float damage = 40F * bowProperties.shockWavePower;
for (Entity e : list) {
if (e instanceof EntityLivingBase) {
@@ -0,0 +1,282 @@
package com.brandon3055.draconicevolution.common.handler;
import com.brandon3055.brandonscore.common.handlers.FileHandler;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.model.special.ModelContributorWings;
import com.brandon3055.draconicevolution.common.network.ContributorPacket;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.google.common.base.Charsets;
import com.google.gson.stream.JsonReader;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.client.event.RenderPlayerEvent;
import org.apache.commons.io.IOUtils;
import org.lwjgl.opengl.GL11;
import java.io.*;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* Created by brandon3055 on 5/11/2015.
*/
public class ContributorHandler {
public static Map<String, Contributor> contributors = new HashMap<String, Contributor>();
public static boolean successfulLoad = false;
private static DLThread thread;
private static ModelContributorWings wings = new ModelContributorWings();
public static void init(){
thread = new DLThread();
thread.start();
}
public static void render(RenderPlayerEvent.Specials event) {
if (isPlayerContributor(event.entityPlayer)){
Contributor contributor = contributors.get(event.entityPlayer.getCommandSenderName());
if (contributor.contributionLevel >= 1 && (contributor.contributorWingsEnabled)) renderWings(event);
if (contributor.contribution != null && contributor.contribution.toLowerCase().contains("patreon") && contributor.patreonBadgeEnabled) renderBadge(event);
}
}
public static boolean isPlayerContributor(EntityPlayer player) {
return contributors.containsKey(player.getCommandSenderName()) && contributors.get(player.getCommandSenderName()).isUserValid(player);
}
private static void renderWings(RenderPlayerEvent event){
ResourceHandler.bindResource("textures/models/ContributorWings.png");
GL11.glColor4f(1F, 1F, 1F, 1F);
wings.render(event.entityPlayer, 0F, 0F, 0F, 0F, event.partialRenderTick, 1F / 16F);
}
private static void renderBadge(RenderPlayerEvent event){
ResourceHandler.bindResource("textures/special/PatreonBadge.png");
Tessellator tess = Tessellator.instance;
GL11.glPushMatrix();
if (event.entityPlayer.isSneaking()){
GL11.glRotatef(29.0F, 1.0F, 0.0F, 0F);
}
double x = 0.01;
double y = 0.04;
double z = -0.13;
double xSize = 0.22;
double ySize = 0.22;
tess.startDrawingQuads();
tess.setColorRGBA_F(1F, 1F, 1F, 1F);
tess.addVertexWithUV(x, y, z, 0, 0);
tess.addVertexWithUV(x, y+ySize, z, 0, 1);
tess.addVertexWithUV(x+xSize, y+ySize, z, 1, 1);
tess.addVertexWithUV(x+xSize, y, z, 1, 0);
tess.draw();
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
ResourceHandler.bindTexture(ResourceHandler.getResourceWOP("textures/misc/enchanted_item_glint.png"));
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f11 = 0.76F;
GL11.glColor4f(0.9F * f11, 0.8F * f11, 0.1F * f11, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float f12 = 0.125F;
GL11.glScalef(f12, f12, f12);
float f13 = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(f13, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
tess.startDrawingQuads();
tess.addVertexWithUV(x, y, z, 0, 0);
tess.addVertexWithUV(x, y+ySize, z, 0, 1);
tess.addVertexWithUV(x+xSize, y+ySize, z, 1, 1);
tess.addVertexWithUV(x+xSize, y, z, 1, 0);
tess.draw();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(f12, f12, f12);
f13 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-f13, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
tess.startDrawingQuads();
tess.addVertexWithUV(x, y, z, 0, 0);
tess.addVertexWithUV(x, y+ySize, z, 0, 1);
tess.addVertexWithUV(x+xSize, y+ySize, z, 1, 1);
tess.addVertexWithUV(x+xSize, y, z, 1, 0);
tess.draw();
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glPopMatrix();
}
public static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
if (event.player instanceof EntityPlayerMP) {
for (String contribName : ContributorHandler.contributors.keySet()) {
for (String name : FMLCommonHandler.instance().getMinecraftServerInstance().getAllUsernames()) {
if (name.equals(contribName)) {
ContributorHandler.Contributor contributor = ContributorHandler.contributors.get(contribName);
DraconicEvolution.network.sendTo(new ContributorPacket(contribName, contributor.contributorWingsEnabled, contributor.patreonBadgeEnabled), (EntityPlayerMP) event.player);
}
}
}
}
}
//region Reading online contributors list
private static void readFile(){
File cFile = new File(FileHandler.configFolder, "/draconicevolution/contributors.json");
if (!cFile.exists()){
LogHelper.error("Could not find contributors file");
return;
}
try
{
JsonReader reader = new JsonReader(new FileReader(cFile));
reader.setLenient(true);
reader.beginArray();
while (reader.hasNext())
{
reader.beginObject();
Contributor contributor = new Contributor();
while (reader.hasNext())
{
String name = reader.nextName();
if (name.equals("name")) contributor.name = reader.nextString();
else if (name.equals("ign")) contributor.ign = reader.nextString();
else if (name.equals("contribution")) contributor.contribution = reader.nextString();
else if (name.equals("details")) contributor.details = reader.nextString();
else if (name.equals("website")) contributor.website = reader.nextString();
else if (name.equals("contributionLevel")) contributor.contributionLevel = reader.nextInt();
}
contributors.put(contributor.ign, contributor);
reader.endObject();
}
reader.endArray();
reader.close();
cFile.delete();
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static void tick(){
if (thread == null) {
return;
}
if (thread.isFinished()){
thread = null;
readFile();
successfulLoad = true;
}
else if (thread.isFailed()){
thread = null;
}
}
public static class DLThread extends Thread {
private boolean finished = false;
private boolean failed = false;
public DLThread(){
super("DE Contributors DL Thread");
}
@Override
public void run() {
super.run();
try
{
URL url = new URL("http://www.brandon3055.com/json/DEContributors.json");
File cFile = new File(FileHandler.configFolder, "/draconicevolution/contributors.json");
InputStream is = url.openStream();
OutputStream os = new FileOutputStream(cFile);
IOUtils.copy(is, os);
is.close();
os.close();
finished = true;
}
catch (Exception e)
{
LogHelper.error("Failed to download contributors list");
failed = true;
e.printStackTrace();
}
}
public boolean isFinished() {
return finished;
}
public boolean isFailed() {
return failed;
}
}
//endregion
public static class Contributor {
public String name;
public String ign;
public String contribution;
public String details;
public String website;
public int contributionLevel;
/**0=Disabled, 1=Enabled when flying, 2=Always Enabled*/
public boolean contributorWingsEnabled = true;
public boolean patreonBadgeEnabled = true;
private boolean validated = false;
private boolean isValid;
public Contributor() {}
public boolean isUserValid(EntityPlayer player){
if (!validated){
isValid = !UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getCommandSenderName()).getBytes(Charsets.UTF_8)).equals(player.getUniqueID());
validated = true;
}
return isValid;
}
@Override
public String toString() {
return "[Contributor: "+name+", Contribution: "+contribution+", Details: "+details+", Website: "+website+"]";
}
}
}
@@ -63,6 +63,8 @@ public class CraftingHandler {
add(ModItems.wyvernShovel, " W ", "ITI", " E ", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'T', Items.diamond_shovel, 'E', ModItems.wyvernEnergyCore);
add(ModItems.wyvernSword, " W ", "ITI", " E ", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'T', Items.diamond_sword, 'E', ModItems.wyvernEnergyCore);
add(ModItems.wyvernBow, " W ", "ITI", " E ", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'T', Items.bow, 'E', ModItems.wyvernEnergyCore);
addOre(new ItemStack(ModItems.magnet, 1, 0), "RII", " C", "RII", 'R', Blocks.redstone_block, 'I', "ingotIron", 'C', ModItems.teleporterMKI);
//armor
add(ModItems.wyvernHelm, "IWI", "IAI", "IEI", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'A', Items.diamond_helmet, 'E', ModItems.wyvernEnergyCore);
add(ModItems.wyvernChest, "IWI", "IAI", "IEI", 'W', ModItems.wyvernCore, 'I', ModItems.draconiumIngot, 'A', Items.diamond_chestplate, 'E', ModItems.wyvernEnergyCore);
@@ -80,6 +82,8 @@ public class CraftingHandler {
addEnergy(ModItems.draconicSword, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'T', ModItems.wyvernSword, 'E', ModItems.draconicEnergyCore);
addOre(ModItems.draconicBow, " C ", "ITI", " E ", 'C', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'T', ModItems.wyvernBow, 'E', ModItems.draconicEnergyCore);
addEnergy(ModItems.draconicDestructionStaff, "IAI", "PIS", "IWI", 'I', "ingotDraconiumAwakened", 'A', ModItems.awakenedCore, 'P', ModItems.draconicPickaxe, 'S', ModItems.draconicShovel, 'W', ModItems.draconicSword);
addOre(new ItemStack(ModItems.magnet, 1, 1), "RII", " C", "RII", 'R', new ItemStack(ModBlocks.draconiumBlock, 1, 2), 'I', "ingotDraconiumAwakened", 'C', new ItemStack(ModItems.magnet, 1, 0));
//armor
addEnergy(ModItems.draconicHelm, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'A', ModItems.wyvernHelm, 'E', ModItems.draconicEnergyCore);
addEnergy(ModItems.draconicChest, "IWI", "IAI", "IEI", 'W', ModItems.awakenedCore, 'I', "ingotDraconiumAwakened", 'A', ModItems.wyvernChest, 'E', ModItems.draconicEnergyCore);
@@ -32,7 +32,10 @@ public class FMLEventHandler {
CustomArmorHandler.onPlayerTick(event);
}
@SubscribeEvent
public void serverTickEvent(TickEvent event){
ContributorHandler.tick();
}
@SubscribeEvent
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event)
@@ -51,5 +54,7 @@ public class FMLEventHandler {
event.player.addChatComponentMessage(new ChatComponentText("Hello Dez! Here have a Marshmallow"));
event.player.worldObj.spawnEntityInWorld(new EntityItem(event.player.worldObj, event.player.posX, event.player.posY, event.player.posZ, new ItemStack(ModItems.dezilsMarshmallow)));
}
ContributorHandler.onPlayerLogin(event);
}
}
@@ -2,25 +2,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.entity.ExtendedPlayer;
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.FMLCommonHandler;
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.server.integrated.IntegratedServer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import java.io.IOException;
import java.util.List;
public class Tclogo extends ItemDE {
@@ -115,17 +114,37 @@ 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));
try
{
if (!world.isRemote) {
//ExtendedPlayer.get(player).setSpawnCount(6);
LogHelper.info(ExtendedPlayer.get(player).getSpawnCount());
// player.getEntityData().setTag("Tag", new NBTTagCompound());
} else LogHelper.info(ExtendedPlayer.get(player).getSpawnCount());
//LogHelper.info(FMLCommonHandler.instance().getMinecraftServerInstance().func_152358_ax().func_152655_a(player.getCommandSenderName()).getId());
//LogHelper.info(player.getUniqueID());
//LogHelper.info(UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getCommandSenderName()).getBytes(Charsets.UTF_8)));
//LogHelper.info(UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getCommandSenderName()).getBytes(Charsets.UTF_8)).equals(player.getUniqueID()));
if (FMLCommonHandler.instance().getMinecraftServerInstance() instanceof IntegratedServer){
// LogHelper.info(FMLClientHandler.instance().getClient().getSession().getToken());
// LogHelper.info(((YggdrasilMinecraftSessionService)FMLCommonHandler.instance().getMinecraftServerInstance().func_147130_as()).getAuthenticationService().);
}
}
catch (IOException e) {
catch (Exception e){
e.printStackTrace();
}
// 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;
// else lts = (int)System.currentTimeMillis();
@@ -240,7 +240,7 @@ public class CustomArmorHandler {
player.sendPlayerAbilities();
}
player.capabilities.setFlySpeed(0.05F);
if (player.worldObj.isRemote)setPlayerFlySpeed(player, 0.05F);
}
}
//endregion
@@ -161,18 +161,7 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IConfigurab
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
// if(stack != null && stack.getItem() == ModItems.wyvernLeggs) {
// if (player.isSprinting())
// player.addPotionEffect(new PotionEffect(PotionHandler.potionSpeed.id, 10, 1, true));
// else
// player.addPotionEffect(new PotionEffect(PotionHandler.potionSpeed.id, 10, 0, true));
// }
// if(stack != null && stack.getItem() == ModItems.wyvernBoots) {
// if (player.isSprinting())
// player.addPotionEffect(new PotionEffect(PotionHandler.potionJumpBoost.id, 10, 1, true));
// else
// player.addPotionEffect(new PotionEffect(PotionHandler.potionJumpBoost.id, 10, 0, true));
// }
}
@Override
@@ -139,12 +139,13 @@ public class DraconiumFluxCapacitor extends RFItemBase implements IUpgradableIte
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation)
{
if (InfoHelper.holdShiftForDetails(list)){
InfoHelper.addEnergyInfo(stack, list);
list.add(StatCollector.translateToLocal("info.de.changwMode.txt"));
list.add(InfoHelper.ITC()+StatCollector.translateToLocal("info.de.capacitorMode.txt")+": "+InfoHelper.HITC()+StatCollector.translateToLocal("info.de.capacitorMode"+ItemNBTHelper.getShort(stack, "Mode", (short)0)+".txt"));
//InfoHelper.addLore(stack, list);
}
ToolBase.holdCTRLForUpgrades(list, stack);
InfoHelper.addEnergyInfo(stack, list);
}
@Override
@@ -0,0 +1,106 @@
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.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.ItemDE;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
/**
* Created by brandon3055 on 9/3/2016.
*/
public class Magnet extends ItemDE {
private IIcon draconium;
private IIcon awakened;
public Magnet(){
this.setUnlocalizedName("magnet");
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
ModItems.register(this);
}
@Override
public void registerIcons(IIconRegister iconRegister) {
draconium = iconRegister.registerIcon(References.RESOURCESPREFIX+"magnetWyvern");
awakened = iconRegister.registerIcon(References.RESOURCESPREFIX+"magnetDraconic");
}
@Override
public IIcon getIconFromDamage(int dmg) {
return dmg == 0 ? draconium : awakened;
}
@Override
public boolean getHasSubtypes() {
return true;
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("unchecked")
@Override
public void getSubItems(Item item, CreativeTabs p_150895_2_, List list) {
list.add(new ItemStack(item, 1, 0));
list.add(new ItemStack(item, 1, 1));
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
return super.getUnlocalizedName(itemStack)+(itemStack.getItemDamage() == 0 ? ".wyvern" : ".draconic");
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack stack, int pass) {
return ItemNBTHelper.getBoolean(stack, "MagnetEnabled", false);
}
@SuppressWarnings("unchecked")
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int damage, boolean hotbar) {
if (!entity.isSneaking() && entity.ticksExisted % 5 == 0 && ItemNBTHelper.getBoolean(stack, "MagnetEnabled", false)){
int range = damage == 0 ? 8 : 32;
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(entity.posX, entity.posY, entity.posZ, entity.posX, entity.posY, entity.posZ).expand(range, range, range));
boolean flag = false;
for (EntityItem item : items) {
flag = true;
if (item.delayBeforeCanPickup > 0) item.delayBeforeCanPickup = 0;
item.motionX = item.motionY = item.motionZ = 0;
item.setPosition(entity.posX-0.2+(world.rand.nextDouble()*0.4), entity.posY-0.6, entity.posZ-0.2+(world.rand.nextDouble()*0.4));
}
if (flag) world.playSoundAtEntity(entity, "random.orb", 0.1F, 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 2F));
}
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (player.isSneaking()) ItemNBTHelper.setBoolean(stack, "MagnetEnabled", !ItemNBTHelper.getBoolean(stack, "MagnetEnabled", false));
return stack;
}
@SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack stack, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) {
list.add(StatCollector.translateToLocal("info.de.shiftRightClickToActivate.txt"));
int range = stack.getItemDamage() == 0 ? 8 : 32;
list.add(InfoHelper.HITC()+range+InfoHelper.ITC()+" "+StatCollector.translateToLocal("info.de.blockRange.txt"));
}
}
@@ -4,7 +4,6 @@ import com.brandon3055.brandonscore.BrandonsCore;
import com.brandon3055.brandonscore.common.utills.DataUtills;
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.keybinding.KeyBindings;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
@@ -155,13 +154,13 @@ public class ToolBase extends RFItemBase {
}
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)));
// if (getCapacity(stack) > 0) list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.charge.txt") + ": " + InfoHelper.HITC() + Utills.formatNumber(getEnergyStored(stack)) + " / " + Utills.formatNumber(getCapacity(stack)));
}
holdCTRLForUpgrades(list, stack);
addAditionalInformation(stack, player, list, extended);
if (show && !ConfigHandler.disableLore) InfoHelper.addLore(stack, list, true);
InfoHelper.addEnergyInfo(stack, list);
if (show && !ConfigHandler.disableLore) InfoHelper.addLore(stack, list, true);
}
@SideOnly(Side.CLIENT)
@@ -184,7 +184,7 @@ public class BowHandler {
cantFireMessage = "msg.de.explosiveNotForEnergyBolts.txt";
return false;
}
else if (calculateEnergyCost() > ((IEnergyContainerItem)bow.getItem()).getEnergyStored(bow)){
else if (calculateEnergyCost() > ((IEnergyContainerItem)bow.getItem()).getEnergyStored(bow) && !player.capabilities.isCreativeMode){
cantFireMessage = "msg.de.insufficientPowerToFire.txt";
return false;
}
@@ -215,7 +215,7 @@ public class BowHandler {
public boolean consumeArrowAndEnergy(){
((IEnergyContainerItem)bow.getItem()).extractEnergy(bow, calculateEnergyCost(), false);
if (!player.capabilities.isCreativeMode)((IEnergyContainerItem)bow.getItem()).extractEnergy(bow, calculateEnergyCost(), false);
if (!energyBolt && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, bow) == 0 && !player.capabilities.isCreativeMode) {
player.inventory.consumeInventoryItem(Items.arrow);
@@ -8,6 +8,7 @@ import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
@@ -114,11 +115,16 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI
@SuppressWarnings({ "unchecked", "rawtypes" })
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation)
{
if (InfoHelper.holdShiftForDetails(list)) {
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.bowEnchants.txt"));
InfoHelper.addLore(stack, list);
boolean show = InfoHelper.holdShiftForDetails(list);
if (show){
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());
}
ToolBase.holdCTRLForUpgrades(list, stack);
InfoHelper.addEnergyInfo(stack, list);
if (show && !ConfigHandler.disableLore) InfoHelper.addLore(stack, list, true);
}
@SideOnly(Side.CLIENT)
@@ -210,7 +216,7 @@ public class DraconicBow extends ItemBow implements IInventoryTool, IUpgradableI
@Override
public List<EnumUpgrade> getUpgrades(ItemStack itemstack) {
return new ArrayList<EnumUpgrade>(){{
// add(EnumUpgrade.RF_CAPACITY);
add(EnumUpgrade.RF_CAPACITY);
add(EnumUpgrade.DRAW_SPEED);
add(EnumUpgrade.ARROW_SPEED);
add(EnumUpgrade.ARROW_DAMAGE);
@@ -8,6 +8,7 @@ import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.entity.EntityPersistentItem;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.items.tools.baseclasses.ToolBase;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
@@ -123,11 +124,16 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte
@SuppressWarnings({ "unchecked", "rawtypes" })
public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation)
{
if (InfoHelper.holdShiftForDetails(list)) {
list.add(InfoHelper.ITC() + StatCollector.translateToLocal("info.de.bowEnchants.txt"));
InfoHelper.addLore(stack, list);
boolean show = InfoHelper.holdShiftForDetails(list);
if (show){
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());
}
ToolBase.holdCTRLForUpgrades(list, stack);
InfoHelper.addEnergyInfo(stack, list);
if (show && !ConfigHandler.disableLore) InfoHelper.addLore(stack, list, true);
}
@SideOnly(Side.CLIENT)
@@ -210,8 +216,8 @@ public class WyvernBow extends ItemBow implements IInventoryTool, IUpgradableIte
@Override
public List<EnumUpgrade> getUpgrades(ItemStack itemstack) {
return new ArrayList<EnumUpgrade>(){{
// add(EnumUpgrade.RF_CAPACITY);
return new ArrayList<EnumUpgrade>() {{
add(EnumUpgrade.RF_CAPACITY);
add(EnumUpgrade.DRAW_SPEED);
add(EnumUpgrade.ARROW_SPEED);
add(EnumUpgrade.ARROW_DAMAGE);
@@ -6,7 +6,7 @@ package com.brandon3055.draconicevolution.common.lib;
public class VersionHandler
{
public static final String VERSION = "1.0.2";
public static final int SNAPSHOT = 10;
public static final int SNAPSHOT = 12;
public static final String MCVERSION = "1.7.10";
public static final String FULL_VERSION = VERSION + (SNAPSHOT > 0 ? "-snapshot_" + SNAPSHOT : "");
@@ -0,0 +1,69 @@
package com.brandon3055.draconicevolution.common.network;
import com.brandon3055.brandonscore.BrandonsCore;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.handler.ContributorHandler;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
public class ContributorPacket implements IMessage
{
public String contributor;
public boolean wings;
public boolean badge;
public ContributorPacket() {}
public ContributorPacket(String contributor, boolean wings, boolean badge) {
this.contributor = contributor;
this.wings = wings;
this.badge = badge;
}
@Override
public void fromBytes(ByteBuf bytes){
this.contributor = ByteBufUtils.readUTF8String(bytes);
this.wings = bytes.readBoolean();
this.badge = bytes.readBoolean();
}
@Override
public void toBytes(ByteBuf bytes){
ByteBufUtils.writeUTF8String(bytes, contributor);
bytes.writeBoolean(wings);
bytes.writeBoolean(badge);
}
public static class Handler implements IMessageHandler<ContributorPacket, IMessage> {
@Override
public IMessage onMessage(ContributorPacket message, MessageContext ctx) {
if (ContributorHandler.contributors.containsKey(message.contributor)){
ContributorHandler.Contributor contributor1 = ContributorHandler.contributors.get(message.contributor);
if (ctx.side == Side.SERVER){
if (!contributor1.isUserValid(ctx.getServerHandler().playerEntity)) return null;
contributor1.contributorWingsEnabled = message.wings;
contributor1.patreonBadgeEnabled = message.badge;
DraconicEvolution.network.sendToAll(message);
}
else {
EntityPlayer player = BrandonsCore.proxy.getClientPlayer();
if (!contributor1.isUserValid(player) || message.contributor.equals(player.getCommandSenderName())) return null;
contributor1.contributorWingsEnabled = message.wings;
contributor1.patreonBadgeEnabled = message.badge;
}
}
return null;
}
}
}
@@ -211,7 +211,7 @@ public class TileReactorEnergyInjector extends TileEntity implements IReactorPar
map.put("maxFuelConversion", reactor.reactorFuel + reactor.convertedFuel);
map.put("generationRate", (int)reactor.generationRate);
map.put("fieldDrainRate", reactor.fieldDrain);
map.put("fuelConversionRateN", (int)Math.round(reactor.fuelUseRate * 1000000D));
map.put("fuelConversionRate", (int)Math.round(reactor.fuelUseRate * 1000000D));
map.put("status", reactor.reactorState == 0 ? "offline" : reactor.reactorState == 1 && !reactor.canStart() ? "charging" : reactor.reactorState == 1 && reactor.canStart() ? "charged" : reactor.reactorState == 2 ? "online" : reactor.reactorState == 3 ? "stopping" : "invalid");
return new Object[]{ map };
}
@@ -55,6 +55,7 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I
coreSpeed = 30F * core.renderSpeed;
ringSpeed = 5F * core.renderSpeed;
modelIllumination = core.renderSpeed;
if (tick % 100 == 0) beam = null;
if (isValid) beam = DraconicEvolution.proxy.reactorBeam(this, beam, true);
return;
}
@@ -238,7 +239,7 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I
map.put("maxFuelConversion", reactor.reactorFuel + reactor.convertedFuel);
map.put("generationRate", (int)reactor.generationRate);
map.put("fieldDrainRate", reactor.fieldDrain);
map.put("fuelConversionRateN", (int)Math.round(reactor.fuelUseRate * 1000000D));
map.put("fuelConversionRate", (int)Math.round(reactor.fuelUseRate * 1000000D));
map.put("status", reactor.reactorState == 0 ? "offline" : reactor.reactorState == 1 && !reactor.canStart() ? "charging" : reactor.reactorState == 1 && reactor.canStart() ? "charged" : reactor.reactorState == 2 ? "online" : reactor.reactorState == 3 ? "stopping" : "invalid");
return new Object[]{ map };
}