Donator capes, configurable Universal Cable rendering
This commit is contained in:
parent
1b592c851a
commit
8d618e7285
7 changed files with 135 additions and 11 deletions
75
src/minecraft/mekanism/client/CapeBufferDownload.java
Normal file
75
src/minecraft/mekanism/client/CapeBufferDownload.java
Normal file
|
@ -0,0 +1,75 @@
|
|||
package mekanism.client;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
|
||||
import net.minecraft.client.renderer.IImageBuffer;
|
||||
|
||||
public class CapeBufferDownload implements IImageBuffer
|
||||
{
|
||||
private int[] imageData;
|
||||
private int imageWidth;
|
||||
private int imageHeight;
|
||||
|
||||
@Override
|
||||
public BufferedImage parseUserSkin(BufferedImage bufferedImage)
|
||||
{
|
||||
if(bufferedImage == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
imageWidth = bufferedImage.getWidth(null);
|
||||
imageHeight = bufferedImage.getHeight(null);
|
||||
|
||||
BufferedImage imageBuffer = new BufferedImage(imageWidth, imageHeight, 2);
|
||||
|
||||
Graphics graphics = imageBuffer.getGraphics();
|
||||
graphics.drawImage(bufferedImage, 0, 0, null);
|
||||
graphics.dispose();
|
||||
|
||||
imageData = ((DataBufferInt)imageBuffer.getRaster().getDataBuffer()).getData();
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
|
||||
for(i = 32; i < 64; i++)
|
||||
{
|
||||
for(j = 0; j < 16; j++)
|
||||
{
|
||||
k = imageData[i + j * 64];
|
||||
|
||||
if((k >> 24 & 0xFF) >= 128)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!flag)
|
||||
{
|
||||
for(i = 32; i < 64; i++)
|
||||
{
|
||||
for(j = 0; j < 16; j++)
|
||||
{
|
||||
k = imageData[i + j * 64];
|
||||
|
||||
if((k >> 24 & 0xFF) >= 128)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return imageBuffer;
|
||||
}
|
||||
}
|
|
@ -71,6 +71,7 @@ public class ClientProxy extends CommonProxy
|
|||
|
||||
Mekanism.configuration.load();
|
||||
Mekanism.enableSounds = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableSounds", true).getBoolean(true);
|
||||
Mekanism.fancyUniversalCableRender = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "FancyUniversalCableRender", true).getBoolean(true);
|
||||
Mekanism.configuration.save();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
package mekanism.client;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.StringUtils;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.ITickHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
|
@ -20,14 +24,49 @@ public class ClientTickHandler implements ITickHandler
|
|||
{
|
||||
public boolean hasNotified = false;
|
||||
|
||||
public Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
|
||||
public static String MIKE_CAPE = "https://dl.dropboxusercontent.com/s/ji06yflixnszcby/cape.png";
|
||||
public static String DONATE_CAPE = "https://dl.dropboxusercontent.com/u/90411166/donate.png";
|
||||
public static String AIDAN_CAPE = "https://dl.dropboxusercontent.com/u/90411166/aidan.png";
|
||||
|
||||
@Override
|
||||
public void tickStart(EnumSet<TickType> type, Object... tickData)
|
||||
{
|
||||
if(!hasNotified && FMLClientHandler.instance().getClient().theWorld != null && FMLClientHandler.instance().getClient().thePlayer != null && Mekanism.latestVersionNumber != null && Mekanism.recentNews != null)
|
||||
if(!hasNotified && mc.theWorld != null && Mekanism.latestVersionNumber != null && Mekanism.recentNews != null)
|
||||
{
|
||||
MekanismUtils.checkForUpdates(FMLClientHandler.instance().getClient().thePlayer);
|
||||
MekanismUtils.checkForUpdates(mc.thePlayer);
|
||||
hasNotified = true;
|
||||
}
|
||||
|
||||
if(mc.theWorld != null)
|
||||
{
|
||||
for(EntityPlayer player : (List<EntityPlayer>)mc.theWorld.playerEntities)
|
||||
{
|
||||
String oldCloak = player.cloakUrl;
|
||||
|
||||
if(player.cloakUrl.startsWith("http://skins.minecraft.net/MinecraftCloaks/"))
|
||||
{
|
||||
if(StringUtils.stripControlCodes(player.username).equals("mikeacttck"))
|
||||
{
|
||||
player.cloakUrl = MIKE_CAPE;
|
||||
}
|
||||
else if(StringUtils.stripControlCodes(player.username).equals("aidancbrady"))
|
||||
{
|
||||
player.cloakUrl = AIDAN_CAPE;
|
||||
}
|
||||
else if(Mekanism.donators.contains(StringUtils.stripControlCodes(player.username)))
|
||||
{
|
||||
player.cloakUrl = DONATE_CAPE;
|
||||
}
|
||||
|
||||
if(!oldCloak.equals(player.cloakUrl))
|
||||
{
|
||||
mc.renderEngine.obtainImageData(player.cloakUrl, new CapeBufferDownload());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -153,18 +153,13 @@ public class BlockBasic extends Block
|
|||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
|
||||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(metadata == 2)
|
||||
{
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, 19, world, x, y, z);
|
||||
entityplayer.openGui(Mekanism.instance, 1, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +171,13 @@ public class BlockBasic extends Block
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if(metadata == 9 || metadata == 10 || metadata == 11)
|
||||
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(metadata == 9 || metadata == 10 || metadata == 11)
|
||||
{
|
||||
if(!entityplayer.isSneaking() && ((TileEntityDynamicTank)world.getBlockTileEntity(x, y, z)).structure != null)
|
||||
{
|
||||
|
|
|
@ -25,12 +25,12 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import thermalexpansion.api.item.IChargeableItem;
|
||||
import universalelectricity.core.item.ElectricItemHelper;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import codechicken.core.alg.MathHelper;
|
||||
|
||||
public class EntityRobit extends EntityCreature implements IInventory, ISustainedInventory, IEntityBreathable
|
||||
{
|
||||
|
|
|
@ -97,7 +97,7 @@ public class ItemConfigurator extends ItemEnergized
|
|||
Random random = new Random();
|
||||
TileEntityContainerBlock tileEntity = (TileEntityContainerBlock)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(!(tileEntity instanceof TileEntityElectricChest || (((TileEntityElectricChest)tileEntity).canAccess())))
|
||||
if(!(tileEntity instanceof TileEntityElectricChest) || (((TileEntityElectricChest)tileEntity).canAccess()))
|
||||
{
|
||||
for(int i = 0; i < tileEntity.getSizeInventory(); ++i)
|
||||
{
|
||||
|
@ -138,6 +138,7 @@ public class ItemConfigurator extends ItemEnergized
|
|||
|
||||
tileEntity.inventory = new ItemStack[tileEntity.getSizeInventory()];
|
||||
onProvide(new ElectricityPack((ENERGY_PER_ITEM_DUMP*itemAmount)/120, 120), stack);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
player.addChatMessage(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "You are not authenticated on this chest.");
|
||||
|
|
|
@ -125,6 +125,9 @@ public class Mekanism
|
|||
@SideOnly(Side.CLIENT)
|
||||
/** The main SoundHandler instance that is used by all audio sources */
|
||||
public static SoundHandler audioHandler;
|
||||
|
||||
/** A list of the usernames of players who have donated to Mekanism. */
|
||||
public static List<String> donators = new ArrayList<String>();
|
||||
|
||||
//Block IDs
|
||||
public static int basicBlockID = 3000;
|
||||
|
@ -178,6 +181,7 @@ public class Mekanism
|
|||
public static boolean disableBCSteelCrafting = true;
|
||||
public static boolean updateNotifications = true;
|
||||
public static boolean enableSounds = true;
|
||||
public static boolean fancyUniversalCableRender = true;
|
||||
public static boolean controlCircuitOreDict = true;
|
||||
public static boolean logPackets = false;
|
||||
public static boolean dynamicTankEasterEgg = false;
|
||||
|
@ -1170,6 +1174,9 @@ public class Mekanism
|
|||
PacketHandler.registerPacket(PacketDigitUpdate.class);
|
||||
PacketHandler.registerPacket(PacketPortableTeleport.class);
|
||||
|
||||
//Donators
|
||||
donators.add("mrgreaper");
|
||||
|
||||
//Load proxy
|
||||
proxy.registerRenderInformation();
|
||||
proxy.loadUtilities();
|
||||
|
|
Loading…
Reference in a new issue