
The_SlayerMC
Members-
Posts
209 -
Joined
-
Last visited
Everything posted by The_SlayerMC
-
This is what i did for 1.8. You can easily get it to work with 1.7 if you can understand the way it works... tool class
-
Try putting an @Override over your display tick method. See if you're overriding it
-
You could have a look at the redstone ore class, thats what i used for my ores:
-
[1.8] Trying to make a particle with a custom texture
The_SlayerMC replied to The_SlayerMC's topic in Modder Support
I should also state, the particle only renders as a solid orange rectangles -
So I'm trying to make my custom particle have a custom texture, and that doesn't seem to be working... Here is my particle class: package net.industrial_magic.client.particle; import net.industrial_magic.event.TextureMagicParticle; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.IParticleFactory; import net.minecraft.client.renderer.texture.TextureClock; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.slayer.api.SlayerAPI; @SideOnly(Side.CLIENT) public class EntityMagicFX extends EntityFX { private float scale; private double x; private double y; private double z; public EntityMagicFX(World worldIn, double p_i1204_2_, double p_i1204_4_, double p_i1204_6_, double p_i1204_8_, double p_i1204_10_, double p_i1204_12_) { super(worldIn, p_i1204_2_, p_i1204_4_, p_i1204_6_, p_i1204_8_, p_i1204_10_, p_i1204_12_); this.motionX = p_i1204_8_; this.motionY = p_i1204_10_; this.motionZ = p_i1204_12_; this.x = p_i1204_2_; this.y = p_i1204_4_; this.z = p_i1204_6_; this.posX = this.prevPosX = p_i1204_2_ + p_i1204_8_; this.posY = this.prevPosY = p_i1204_4_ + p_i1204_10_; this.posZ = this.prevPosZ = p_i1204_6_ + p_i1204_12_; float f = this.rand.nextFloat() * 0.6F + 0.4F; this.scale = this.particleScale = this.rand.nextFloat() * 0.5F + 0.2F; this.particleRed = this.particleGreen = this.particleBlue = 1.0F * f; this.particleGreen *= 0.9F; this.particleRed *= 0.9F; this.particleMaxAge = (int)(Math.random() * 10.0D) + 30; this.noClip = true; func_180435_a(new TextureMagicParticle("builtin/particles")); //this.setParticleTextureIndex(rand.nextInt(3)); } @Override public int getFXLayer() { return 1; } @Override public int getBrightnessForRender(float f) { return 100; } @Override public float getBrightness(float p_70013_1_) { return 100F; } @Override public void onUpdate() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; float f = (float)this.particleAge / (float)this.particleMaxAge; f = 1.0F - f; float f1 = 1.0F - f; f1 *= f1; f1 *= f1; this.posX = this.x + this.motionX * (double)f; this.posY = this.y + this.motionY * (double)f - (double)(f1 * 1.2F); this.posZ = this.z + this.motionZ * (double)f; if(this.particleAge++ >= this.particleMaxAge) this.setDead(); } } And here is my TextureMagicParticle: package net.industrial_magic.event; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.ResourceLocation; import net.slayer.api.SlayerAPI; public class TextureMagicParticle extends TextureAtlasSprite { public TextureMagicParticle(String spriteName) { super(spriteName); makeAtlasSprite(new ResourceLocation(SlayerAPI.PREFIX + "textures/misc/particles.png")); } @Override public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) { return true; } } Now with the 1.8 update, it seems difficult making custom a texture
-
Well when you figure out your crash, remove public void onContainerClosed(EntityPlayer playerIn) { super.onContainerClosed(playerIn); if (!this.worldObj.isRemote) { for (int i = 0; i < 9; ++i) { ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i); if (itemstack != null) { playerIn.dropPlayerItemWithRandomChoice(itemstack, false); } } } } Because thats the code that dispenses the items after you exit the workbench
-
I seem to not be able to set my dimensions spawn, Im adding an End like dimension (one floating island) and i spawn way out of where i should be. I've added these into my world provider but i still seem to spawn in at the same position that i would be in the overworld (coords carrying over from the overworld dimension) @Override public boolean canCoordinateBeSpawn(int x, int z) { return this.worldObj.getGroundAboveSeaLevel(new BlockPos(x, 0, z)) == EssenceBlocks.corbaStone; } @Override public BlockPos getRandomizedSpawnPoint() { return new BlockPos(0, 63, 0); } @Override public BlockPos getSpawnPoint() { return new BlockPos(0, 63, 0); } @Override public void setSpawnPoint(BlockPos pos) { super.setSpawnPoint(new BlockPos(0, 63, 0)); } @Override public BlockPos getSpawnCoordinate() { return new BlockPos(0, 63, 0); } @Override public int getAverageGroundLevel() { return 63; } I even got so desperate that i called an event: @SubscribeEvent public void transferDims(PlayerChangedDimensionEvent e) { if(e.toDim == Config.corba) { SlayerAPI.addChatMessage(e.player, "In corba"); e.player.setLocationAndAngles(0, 63, 0, 0.0F, 0.0F); } } And it prints the message in chat, so why doesnt it set my location..? As always, any help would be muchly appreciated
-
You also shouldn't have more then one generation inside a for loop. It will just replace the first generation because you're using the same coords.
-
So back in 1.7 i made ores look like they're glowing (Just the ore part) sorta like Thaumcrafts shard ore. But now that the ISimpleBlockRenderingHandler is gone, i can't render two blocks at the same time (the way i did it is have a dummy block render as the background and have the texture of the ore only have the bits that show it is an ore otherwise it was a transparent texture in the texture file and set the actual ore block getMixedBrightnessForBlock to a high number to make it glow without emitting any light from the block.) So i know i can render an overlay over my block without having to render two blocks at once, but how do i set the brightness of only one overlay? Ill use grass as an example. The snow overlay would be bright and the rest of the block would have a normal brightness without emitting a light source.
-
https://github.com/MinecraftForge/MinecraftForge/issues/1562
-
So while loading up forge for mc 1.8 I start playing in a world (testing my mod) and this happens to me a lot: So I'm basically just wondering if this crash is because of me or because of forge not being stable yet. I would look more into the crash but it refers to something i cant control (not my code, it's mc's code) So I think the likely reason is.. Because Mojang. But if it's not, can someone tell me what it?
-
Yeah... ill see what i can do... If worst comes to worst, i wont have particles
-
This is still not spawning anything... @Override public void spawnParticle(EnumParticlesClasses particle, World worldObj, double x, double y, double z) { if(worldObj.isRemote) { worldObj.spawnParticle(particle.getParticle(), x, y, z, 0D, 0D, 0D); } }
-
Uhg the isRemote should be isClient then to solve confusions and to be honest, i actually don't know why i still am
-
So i basically changed these: @Override public void spawnParticle(EnumParticlesClasses particle, World worldObj, double x, double y, double z) { if(!worldObj.isRemote) { try { worldObj.spawnParticle(particle.getParticle(), x, y, z, 0D, 0D, 0D); } catch (Exception e) { e.printStackTrace(); } } } public enum EnumParticlesClasses { LAVA("lava"), SMOKE("smoke"), FLAME("flame"), SNOWBALL_POOF("snowballpoof"); private String particle; private EnumParticlesClasses(String name) { particle = name; } public String getParticle() { return particle; } } @Override public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase hit, EntityLivingBase player) { Random r = new Random(); hit.setFire(10); if(Config.spawnSwordParticles) { for(int i = 0; i < 70; i++) { Essence.proxy.spawnParticle(EnumParticlesClasses.FLAME, player.worldObj, hit.posX + r.nextFloat() - 0.5F, hit.posY + 0.5D + r.nextFloat(), hit.posZ + r.nextFloat() - 0.5F); Essence.proxy.spawnParticle(EnumParticlesClasses.SMOKE, player.worldObj, hit.posX + r.nextFloat() - 0.5F, hit.posY + 0.5D + r.nextFloat(), hit.posZ + r.nextFloat() - 0.5F); Essence.proxy.spawnParticle(EnumParticlesClasses.LAVA, player.worldObj, hit.posX + r.nextFloat() - 0.5F, hit.posY + 0.5D + r.nextFloat(), hit.posZ + r.nextFloat() - 0.5F); } } return super.hitEntity(par1ItemStack, hit, player); } And it doesn't spawn any particles at all
-
So i basically cannot use the particle classes, i have to stay with the Strings?
-
I forgot to mention, this is the new method: @Override public void spawnParticle(EnumParticlesClasses particle, World worldObj, double posX, double posY, double posZ, boolean b) { if(!worldObj.isRemote) { try { EntityFX fx = null; if(b) { fx = (EntityFX)particle.getParticle().getConstructor(World.class, double.class, double.class, double.class).newInstance(worldObj, posX, posY, posZ); } else { fx = (EntityFX)particle.getParticle().getConstructor(World.class, double.class, double.class, double.class, double.class, double.class, double.class).newInstance(worldObj, posX, posY, posZ, 0D, 0D, 0D); } Minecraft.getMinecraft().effectRenderer.addEffect(fx); } catch (Exception e) { e.printStackTrace(); } } }
-
So i changed this to make it be called on the client only: @Override public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase hit, EntityLivingBase player) { Random r = new Random(); hit.setFire(10); if(Config.spawnSwordParticles) { for(int i = 0; i < 70; i++) { Essence.proxy.spawnParticle(EnumParticlesClasses.FLAME, player.worldObj, hit.posX + r.nextFloat() - 0.5F, hit.posY + 0.5D + r.nextFloat(), hit.posZ + r.nextFloat() - 0.5F, false); Essence.proxy.spawnParticle(EnumParticlesClasses.SMOKE, player.worldObj, hit.posX + r.nextFloat() - 0.5F, hit.posY + 0.5D + r.nextFloat(), hit.posZ + r.nextFloat() - 0.5F, false); Essence.proxy.spawnParticle(EnumParticlesClasses.LAVA, player.worldObj, hit.posX + r.nextFloat() - 0.5F, hit.posY + 0.5D + r.nextFloat(), hit.posZ + r.nextFloat() - 0.5F, true); } } return super.hitEntity(par1ItemStack, hit, player); } common proxy public void spawnParticle(EnumParticlesClasses particle, World worldObj, double posX, double posY, double posZ, boolean b) { } and it now overrides the method in the client proxy
-
Wait... you don't think that i think that just because the method is in the ClientProxy that it automatically get called on the client do you?! I just put it there because I don't want to make a new class for client methods.
-
Okay, so I added this to my main class: public static ClientProxy clientProxy; this is now the particle method: public void spawnParticle(EnumParticlesClasses particle, World worldObj, double posX, double posY, double posZ, boolean b) { try { EntityFX fx = null; if(b) { fx = (EntityFX)particle.getParticle().getConstructor(World.class, double.class, double.class, double.class).newInstance(worldObj, posX, posY, posZ); } else { fx = (EntityFX)particle.getParticle().getConstructor(World.class, double.class, double.class, double.class, double.class, double.class, double.class).newInstance(worldObj, posX, posY, posZ, 0D, 0D, 0D); } Minecraft.getMinecraft().effectRenderer.addEffect(fx); } catch (Exception e) { e.printStackTrace(); } } and am now using this in the item class: @Override public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase hit, EntityLivingBase player) { Random r = new Random(); for(int i = 0; i < 40; i++) { if(!player.worldObj.isRemote) { Essence.clientProxy.spawnParticle(EnumParticlesClasses.FLAME, player.worldObj, hit.posX + r.nextFloat() - 0.5F, hit.posY + 0.5D + r.nextFloat(), hit.posZ + r.nextFloat() - 0.5F, false); Essence.clientProxy.spawnParticle(EnumParticlesClasses.SMOKE, player.worldObj, hit.posX + r.nextFloat() - 0.5F, hit.posY + 0.5D + r.nextFloat(), hit.posZ + r.nextFloat() - 0.5F, false); Essence.clientProxy.spawnParticle(EnumParticlesClasses.LAVA, player.worldObj, hit.posX + r.nextFloat() - 0.5F, hit.posY + 0.5D + r.nextFloat(), hit.posZ + r.nextFloat() - 0.5F, true); } return super.hitEntity(par1ItemStack, hit, player); }
-
So I have a strange crash with making my items spawn particles when they get hit using this: @Override public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase hit, EntityLivingBase player) { Random r = new Random(); for(int i = 0; i < 10; i++) ClientProxy.spawnParticle(EnumParticlesClasses.SNOWBALL_POOF, player.worldObj, hit.posX + r.nextFloat() - 0.5F, hit.posY + 0.5D + r.nextFloat(), hit.posZ + r.nextFloat() - 0.5F, false); return super.hitEntity(par1ItemStack, hit, player); } public static void spawnParticle(EnumParticlesClasses particle, World worldObj, double posX, double posY, double posZ, boolean b) { try { EntityFX fx = null; if(b) { fx = (EntityFX)particle.getParticle().getConstructor(World.class, double.class, double.class, double.class).newInstance(worldObj, posX, posY, posZ); } else { fx = (EntityFX)particle.getParticle().getConstructor(World.class, double.class, double.class, double.class, double.class, double.class, double.class).newInstance(worldObj, posX, posY, posZ, 0D, 0D, 0D); } Minecraft.getMinecraft().effectRenderer.addEffect(fx); } catch (Exception e) { e.printStackTrace(); } } public enum EnumParticlesClasses { LAVA(EntityLavaFX.class), SMOKE(EntitySmokeFX.class), FLAME(EntityFlameFX.class), SNOWBALL_POOF(EntitySnowShovelFX.class); private Class particle; private EnumParticlesClasses(Class<? extends EntityFX> clazz) { particle = clazz; } public Class getParticle() { return particle; } Crash report: The crash seems to be caused at "moveEntity(Entity)". The particles spawn but when they hit the ground they crash. So if anyone can help, that would be great...
-
https://github.com/TheSlayerMC/Essence/blob/master/main/java/net/essence/items/ItemMultiTool.java
-
Replied
-
With it there, it generates nothing. Without it, it generates a square..