04/16/2015

This commit is contained in:
brandon3055 committed 2015-04-16 10:56:19 +10:00
1 parent b2999e3653
commit a18098e7cb
17 files changed
+110 -30

No files matched your search

@@ -15,7 +15,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.resources.FolderResourcePack;
import net.minecraft.util.ResourceLocation;
import scala.actors.threadpool.Arrays;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
@@ -23,10 +22,7 @@ import java.io.*;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* Created by Brandon on 8/02/2015.
@@ -88,6 +84,7 @@ public class ResourceHandler {
for (String s : imageURLs)
{
LogHelper.info("Checking Image: " + s);
boolean success = true;
if (!checkExistence(s)) downloadImage(s);
if (checkExistence(s))
@@ -47,6 +47,8 @@ public class ModItems {
public static Item wyvernLeggs;
public static Item wyvernBoots;
public static Item dezilsMarshmallow;
public static ItemDE wyvernCore;
public static ItemDE draconiumDust;
public static ItemDE draconiumIngot;
@@ -122,6 +124,8 @@ public class ModItems {
draconiumFluxCapacitor = new DraconiumFluxCapacitor();
wrench = new Wrench();
dezilsMarshmallow = new DezilsMarshmallow();
//Custom ItemStacks
wyvernEnergyCore = new ItemStack(ModItems.draconiumEnergyCore, 1, 0);
draconicEnergyCore = new ItemStack(ModItems.draconiumEnergyCore, 1, 1);
@@ -14,6 +14,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.Random;
@@ -51,7 +52,8 @@ public class DraconiumOre extends BlockDE {
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
int dim = Minecraft.getMinecraft().theWorld.provider.dimensionId;
World world = Minecraft.getMinecraft().theWorld;
int dim = world != null && world.provider != null ? world.provider.dimensionId : 0;
if (dim == -1)
return iconNether;
@@ -2,8 +2,8 @@ package com.brandon3055.draconicevolution.common.blocks.machine;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.gui.GuiHandler;
import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.lib.Strings;
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
@@ -84,7 +84,7 @@ public class Grinder extends BlockCustomDrop
IIcon back;
IIcon front;
if (!tile.disabled && tile.hasPower)
{
back = icon_back;
@@ -37,9 +37,9 @@ public class ConfigHandler {
public static List<String> disabledNamesList = new ArrayList<String>();
public static double maxPlayerSpeed;
private static int[] speedDimBlackList;
public static List<Integer> speedLimitDimList = new ArrayList<Integer>();
public static List<Integer> speedLimitDimList = new ArrayList<Integer>();
public static boolean speedLimitops;
public static boolean rapidlyDespawnMinedItems;
//spawner
public static String[] spawnerList;
public static boolean spawnerListType;
@@ -98,6 +98,7 @@ public static List<Integer> speedLimitDimList = new ArrayList<Integer>();
maxPlayerSpeed = config.get(Configuration.CATEGORY_GENERAL, "Player speed cap", 10D, "Limits the max speed of players. Recommend between 0.5 - 1.0 for servers").getDouble(10D);
speedDimBlackList = config.get(Configuration.CATEGORY_GENERAL, "Speed limit Dim black lack list", new int[] {1}, "A list of dimensions the speed limit will not effect (speed limit is not so really required in the end)").getIntList();
speedLimitops = config.get(Configuration.CATEGORY_GENERAL, "Speed limit effects ops", false, "Dose the speed limit effect ops").getBoolean(false);
rapidlyDespawnMinedItems = config.get(Configuration.CATEGORY_GENERAL, "Rapidly despawn aoe mined items", false, "If true items dropped by a tool in aoe mode will despawn after 5 seconds").getBoolean(false);
//Spawner
spawnerListType = config.get("spawner", "listType", false, "Sets weather the spawner list is a white list or a black list (true = white list false = black list)").getBoolean(false);
@@ -1,15 +1,20 @@
package com.brandon3055.draconicevolution.common.handler;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.items.armor.ArmorEffectHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerCapabilities;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import java.lang.reflect.Field;
import java.util.*;
@@ -19,6 +24,7 @@ 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
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
@@ -103,4 +109,15 @@ public class FMLEventHandler {
}
}
}
@SubscribeEvent
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event)
{
if (!mmGiven && event.player.getCommandSenderName().toLowerCase().equals("dezil_nz"))
{
mmGiven = true;
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)));
}
}
}
@@ -0,0 +1,45 @@
package com.brandon3055.draconicevolution.common.items;
import com.brandon3055.draconicevolution.common.lib.References;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
/**
* Created by Brandon on 4/15/2015.
*/
public class DezilsMarshmallow extends ItemFood {
public DezilsMarshmallow() {
super(100, 100F, true);
this.setUnlocalizedName("draconicevolution:dezilsMarshmallow");
this.setAlwaysEdible();
GameRegistry.registerItem(this, "dezilsMarshmallow");
}
@Override
public boolean hasEffect(ItemStack par1ItemStack, int pass) {
return true;
}
@Override
protected void onFoodEaten(ItemStack p_77849_1_, World p_77849_2_, EntityPlayer player) {
player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 20*60*10, 5));
player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 20*60*10, 5));
player.addPotionEffect(new PotionEffect(Potion.jump.id, 20*60*10, 5));
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20*60*10, 5));
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 20*60*10, 4));
player.addPotionEffect(new PotionEffect(Potion.resistance.id, 20*60*10, 4));
player.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 20*60*10, 0));
super.onFoodEaten(p_77849_1_, p_77849_2_, player);
}
@Override
public void registerIcons(IIconRegister iconRegister) {
itemIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "dezilsMarshmallow");
}
}
@@ -9,7 +9,6 @@ import com.brandon3055.draconicevolution.common.tileentities.energynet.TileRemot
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
import com.brandon3055.draconicevolution.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
@@ -117,12 +116,12 @@ public class Wrench extends ItemDE implements IHudDisplayItem {
int xCoord = linkData.getInteger("XCoord");
int yCoord = linkData.getInteger("YCoord");
int zCoord = linkData.getInteger("ZCoord");
LogHelper.info("side");
if (world.getTileEntity(xCoord, yCoord, zCoord) instanceof TileWirelessEnergyTransceiver)
{
((TileWirelessEnergyTransceiver)world.getTileEntity(xCoord, yCoord, zCoord)).linkDevice(x, y, z, side, player, ItemNBTHelper.getString(stack, "Mode", "bind"));
linkData.setBoolean("Bound", false);
//linkData.setBoolean("Bound", false);
return true;
}
else return false;
@@ -1,12 +1,15 @@
package com.brandon3055.draconicevolution.common.items.tools.baseclasses;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.*;
import net.minecraft.block.Block;
import net.minecraft.block.material.MaterialLiquid;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
@@ -189,6 +192,7 @@ public abstract class MiningTool extends ToolBase {//todo add custom information
item.setLocationAndAngles(player.posX, player.posY, player.posZ, 0, 0);
((EntityPlayerMP)player).playerNetServerHandler.sendPacket(new S18PacketEntityTeleport(item));
item.delayBeforeCanPickup = 0;
if (ConfigHandler.rapidlyDespawnMinedItems) item.lifespan = 100;
}
}
@@ -252,9 +256,14 @@ public abstract class MiningTool extends ToolBase {//todo add custom information
if(block.removedByPlayer(world, player, x,y,z, true))
{
block.onBlockDestroyedByPlayer( world, x,y,z, meta);
block.onBlockDestroyedByPlayer(world, x,y,z, meta);
block.harvestBlock(world, player, x,y,z, meta);
player.addExhaustion(-0.025F);
if (block.getExpDrop(world, meta, EnchantmentHelper.getFortuneModifier(player)) > 0) {
EntityXPOrb xp = new EntityXPOrb(world, player.posX, player.posY, player.posZ, block.getExpDrop(world, meta, EnchantmentHelper.getFortuneModifier(player)));
xp.xpOrbAge = 5400;
world.spawnEntityInWorld(xp);
}
}
EntityPlayerMP mpPlayer = (EntityPlayerMP) player;
@@ -14,7 +14,6 @@ import net.minecraft.item.ItemStack;
*/
public class NEIDraconicevolutionConfig implements IConfigureNEI
{
@Override
public void loadConfig() {
@@ -25,6 +24,7 @@ public class NEIDraconicevolutionConfig implements IConfigureNEI
API.hideItem(new ItemStack(ModBlocks.safetyFlame));
API.hideItem(new ItemStack(ModItems.tclogo));
API.hideItem(new ItemStack(ModItems.creativeStructureSpawner));
API.hideItem(new ItemStack(ModItems.dezilsMarshmallow));
API.hideItem(new ItemStack(ModItems.creativeStructureSpawner, 1, 1));
LogHelper.info("Added NEI integration");
}
@@ -9,7 +9,6 @@ import com.brandon3055.draconicevolution.common.lib.OreDoublingRegistry;
import com.brandon3055.draconicevolution.common.utills.EnergyStorage;
import com.brandon3055.draconicevolution.common.utills.ICustomItemData;
import com.brandon3055.draconicevolution.common.utills.InventoryUtils;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
@@ -129,7 +128,6 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I
if (requiresUpdate && numUsingPlayers > 0)
{
if (!smeltInProgress && !updateSuspended) {
LogHelper.info("update");
if (getFill() || getLock() || getAll()) feedNextItem();
smeltInProgress = canFurnaceRun();
}
@@ -11,6 +11,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -28,7 +29,6 @@ import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.common.util.ForgeDirection;
import java.lang.reflect.Field;
import java.util.List;
import java.util.UUID;
@@ -52,7 +52,6 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne
public EnergyStorage internalGenBuffer = new EnergyStorage(20000, 32000, 0);
public EnergyStorage externalInputBuffer = new EnergyStorage(100000, 32000, 0);
public int energyPerKill = 1000;
private static Field recentlyHit;
public static FakePlayer fakePlayer;
public void updateVariables() {
@@ -81,7 +80,6 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne
break;
}
}
hasPower = getActiveBuffer().getEnergyStored() >= energyPerKill;
}
//##################################//
@@ -91,10 +89,11 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne
@Override
public void updateEntity() {
updateVariables();
if (worldObj.isRemote) return;
hasPower = getActiveBuffer().getEnergyStored() >= energyPerKill;
int burnSpeed = 2;
int EPBT = 10;
@@ -122,10 +121,6 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne
return isExternallyPowered() ? externalInputBuffer : internalGenBuffer;
}
public void checkSignal() {
disabled = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
}
public boolean isExternallyPowered()
{
return externalInputBuffer.getEnergyStored() > energyPerKill;
@@ -155,6 +150,8 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne
killBox = AxisAlignedBB.getBoundingBox(centreX - 4.5, centreY - 4.5, centreZ - 4.5, centreX + 4.5, centreY + 4.5, centreZ + 4.5);
killList = worldObj.getEntitiesWithinAABB(EntityLiving.class, killBox);
List<EntityXPOrb> xp = worldObj.getEntitiesWithinAABB(EntityXPOrb.class, killBox.expand(4, 4, 4));
for (EntityXPOrb orb : xp) if (orb.xpOrbAge < 5400) orb.xpOrbAge = 5400;
if (killList.size() > 0) {
EntityLiving mob = killList.get(worldObj.rand.nextInt(killList.size()));
@@ -382,11 +379,11 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne
public void receiveObject(int index, Object object) {
if (index == 0 && disabled != (Boolean) object) {
disabled = (Boolean) object;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}
else if (hasPower != (Boolean) object){
hasPower = (Boolean) object;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}
}
@@ -419,7 +416,6 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne
@Override
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
return externalInputBuffer.receiveEnergy(maxReceive, simulate);
}