diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Java/miscutil/core/block/general/LightGlass.java | 55 | ||||
-rw-r--r-- | src/Java/miscutil/core/common/CommonProxy.java | 4 | ||||
-rw-r--r-- | src/Java/miscutil/core/proxy/ClientProxy.java | 43 | ||||
-rw-r--r-- | src/Java/miscutil/core/util/Utils.java | 79 | ||||
-rw-r--r-- | src/Java/miscutil/core/util/particles/EntityParticleFXMysterious.java | 17 |
5 files changed, 156 insertions, 42 deletions
diff --git a/src/Java/miscutil/core/block/general/LightGlass.java b/src/Java/miscutil/core/block/general/LightGlass.java index 5183ec2398..4a06d61135 100644 --- a/src/Java/miscutil/core/block/general/LightGlass.java +++ b/src/Java/miscutil/core/block/general/LightGlass.java @@ -119,34 +119,35 @@ public class LightGlass extends BlockBreakable */ @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int posX, int posY, int posZ, Random random) - { - int l = world.getBlockMetadata(posX, posY, posZ); - double d0 = (double)((float)posX + 0.5F); - double d1 = (double)((float)posY + 0.7F); - double d2 = (double)((float)posZ + 0.5F); - double d3 = 0.2199999988079071D; - double d4 = 0.27000001072883606D; + public void randomDisplayTick(World world, int posX, int posY, int posZ, Random random){ + if (!world.isRemote){ + int l = world.getBlockMetadata(posX, posY, posZ); + double d0 = (double)((float)posX + 0.5F); + double d1 = (double)((float)posY + 0.7F); + double d2 = (double)((float)posZ + 0.5F); + double d3 = 0.2199999988079071D; + double d4 = 0.27000001072883606D; - if (l == 1) - { - world.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); - } - else if (l == 2) - { - world.spawnParticle("cloud", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); - } - else if (l == 3) - { - world.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D); - } - else if (l == 4) - { - world.spawnParticle("cloud", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D); - } - else - { - world.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); + if (l == 1) + { + world.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); + } + else if (l == 2) + { + world.spawnParticle("cloud", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D); + } + else if (l == 3) + { + world.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D); + } + else if (l == 4) + { + world.spawnParticle("cloud", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D); + } + else + { + world.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D); + } } } }
\ No newline at end of file diff --git a/src/Java/miscutil/core/common/CommonProxy.java b/src/Java/miscutil/core/common/CommonProxy.java index 6f8c1919c0..2a1baa705a 100644 --- a/src/Java/miscutil/core/common/CommonProxy.java +++ b/src/Java/miscutil/core/common/CommonProxy.java @@ -18,6 +18,7 @@ import miscutil.core.util.Utils; import miscutil.core.util.debug.DEBUG_INIT; import miscutil.core.util.player.PlayerCache; import miscutil.core.xmod.gregtech.common.Meta_GT_Proxy; +import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.oredict.OreDictionary; @@ -111,5 +112,8 @@ public class CommonProxy { public int addArmor(String armor) { return 0; } + + public void generateMysteriousParticles(Entity theEntity) { } + } diff --git a/src/Java/miscutil/core/proxy/ClientProxy.java b/src/Java/miscutil/core/proxy/ClientProxy.java index 2e754b9bf0..aa1ab99ced 100644 --- a/src/Java/miscutil/core/proxy/ClientProxy.java +++ b/src/Java/miscutil/core/proxy/ClientProxy.java @@ -1,6 +1,10 @@ package miscutil.core.proxy; import miscutil.core.common.CommonProxy; +import miscutil.core.util.particles.EntityParticleFXMysterious; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.entity.Entity; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; @@ -25,18 +29,51 @@ public class ClientProxy extends CommonProxy{ // TODO Auto-generated method stub super.postInit(e); } - + + @Override public void registerRenderThings(){ //RenderingRegistry.registerEntityRenderingHandler(EntityBloodSteelMob.class, new RenderBloodSteelMob(new ModelBloodSteelMob(), 0)); //RenderingRegistry.registerEntityRenderingHandler(EntityBloodSteelHostileMob.class, new RenderBloodSteelMobHostile(new ModelBloodSteelMob(), 0)); //RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(ModItems.tutGrenade)); - + //ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBloodSteelChest.class, new BloodSteelChestRenderer()); //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.tutChest), new ItemRenderBloodSteelChest()); } - + + @Override public int addArmor(String armor){ return RenderingRegistry.addNewArmourRendererPrefix(armor); } + + + @Override + public void generateMysteriousParticles(Entity theEntity) + { + double motionX = theEntity.worldObj.rand.nextGaussian() * 0.02D; + double motionY = theEntity.worldObj.rand.nextGaussian() * 0.02D; + double motionZ = theEntity.worldObj.rand.nextGaussian() * 0.02D; + EntityFX particleMysterious = new EntityParticleFXMysterious( + + theEntity.worldObj, + theEntity.posX + theEntity.worldObj.rand.nextFloat() * theEntity.width + + * 2.0F - theEntity.width, + theEntity.posY + 0.5D + theEntity.worldObj.rand.nextFloat() + + * theEntity.height, + theEntity.posZ + theEntity.worldObj.rand.nextFloat() * theEntity.width + + * 2.0F - theEntity.width, + + motionX, + + motionY, + + motionZ); + Minecraft.getMinecraft().effectRenderer.addEffect(particleMysterious); + } + + + } diff --git a/src/Java/miscutil/core/util/Utils.java b/src/Java/miscutil/core/util/Utils.java index c796abc95e..03bd0b7ded 100644 --- a/src/Java/miscutil/core/util/Utils.java +++ b/src/Java/miscutil/core/util/Utils.java @@ -10,11 +10,17 @@ import java.util.List; import java.util.Random; import java.util.Timer; import java.util.TimerTask; +import java.util.UUID; +import miscutil.MiscUtils; import miscutil.core.lib.CORE; import net.minecraft.block.Block; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -228,30 +234,79 @@ public class Utils { timer.schedule(new ShortTimerTask(), seconds * 1000); return timer; } - + public static String byteToHex(byte b) { - int i = b & 0xFF; - return Integer.toHexString(i); - } - + int i = b & 0xFF; + return Integer.toHexString(i); + } + public static Object[] convertListToArray(List<Object> sourceList) { Object[] targetArray = sourceList.toArray(new Object[sourceList.size()]); - return targetArray; + return targetArray; } - + public static List<Object> convertArrayToListFixed(Object[] sourceArray) { - List<Object> targetList = Arrays.asList(sourceArray); - return targetList; + List<Object> targetList = Arrays.asList(sourceArray); + return targetList; } - + public static List<Object> convertArrayToList(Object[] sourceArray) { - List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); - return targetList; + List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); + return targetList; + } + + public static EntityPlayer getPlayerOnServerFromUUID(UUID parUUID){ + if (parUUID == null) + { + return null; + } + List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; + for (EntityPlayerMP player : allPlayers) + { + if (player.getUniqueID().equals(parUUID)) + { + return player; + } + } + return null; } + @Deprecated + public static Block findBlockUnderEntityNonBoundingBox(Entity parEntity){ + int blockX = MathHelper.floor_double(parEntity.posX); + int blockY = MathHelper.floor_double(parEntity.posY-0.2D - (double)parEntity.yOffset); + int blockZ = MathHelper.floor_double(parEntity.posZ); + return parEntity.worldObj.getBlock(blockX, blockY, blockZ); + } + + public static Block findBlockUnderEntity(Entity parEntity){ + int blockX = MathHelper.floor_double(parEntity.posX); + int blockY = MathHelper.floor_double(parEntity.boundingBox.minY)-1; + int blockZ = MathHelper.floor_double(parEntity.posZ); + return parEntity.worldObj.getBlock(blockX, blockY, blockZ); + } + public static int getFacingDirection(Entity entity){ + int d = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360) + 0.50) & 3; + return d; + } + public static boolean isPlayerOP(EntityPlayer player){ + if (player.canCommandSenderUseCommand(2, "")){ + return true; + } + return false; + } + public static void spawnCustomParticle(Entity entity){ + MiscUtils.proxy.generateMysteriousParticles(entity); + } + + + + + + } diff --git a/src/Java/miscutil/core/util/particles/EntityParticleFXMysterious.java b/src/Java/miscutil/core/util/particles/EntityParticleFXMysterious.java new file mode 100644 index 0000000000..bcdfd25be9 --- /dev/null +++ b/src/Java/miscutil/core/util/particles/EntityParticleFXMysterious.java @@ -0,0 +1,17 @@ +package miscutil.core.util.particles; + +import net.minecraft.client.particle.EntityAuraFX; +import net.minecraft.world.World; + +public class EntityParticleFXMysterious extends EntityAuraFX +{ + public EntityParticleFXMysterious(World parWorld, + double parX, double parY, double parZ, + double parMotionX, double parMotionY, double parMotionZ) + { + super(parWorld, parX, parY, parZ, parMotionX, parMotionY, parMotionZ); + setParticleTextureIndex(82); // same as happy villager + particleScale = 2.0F; + setRBGColorF(0x88, 0x00, 0x88); + } +} |