Jump to content

Bedrock_Miner

Forge Modder
  • Posts

    613
  • Joined

  • Last visited

Everything posted by Bedrock_Miner

  1. I think this could happen because of underground mobs but i'm not sure. With Vanilla particles this doesn't happen so I think, I missed out some GL settings; but which one?
  2. I think the problem is because of the riding. Is there another way to save a special player in a way that you can load it later? How would I do this?
  3. For the ore doubler and smelter I would take a look at the furnace classes, if you edit some lines of code you can get what you want to. (TileEntityFurnace)
  4. Heyho Guys! I created a Entity which actually only spawns particles to show that its there (going to add a function soon), but it is not saved. I registered it like this: EntityRegistry.registerModEntity(EntityMagic.class, "magic_entity", EntityRegistry.findGlobalUniqueEntityId(), Main.instance, 128, 1, true); I already tried to replace EntityRegistry.findGlobalUniqueEntityId() with a constant value (0) but with no effect. The entity is configured in a way that it automatically mounts its owner in order to stay at the same place with him. Maybe I'll change this later too. What I'm wondering about is that the entity isn't shown in the list of summonable objects. Entity class: package com.bedrockminer.magicum.entity.magic; import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import com.bedrockminer.magicum.Main; import com.bedrockminer.magicum.client.particle.ParticleEffect; import com.bedrockminer.magicum.element.ElementNBTHelper; import com.bedrockminer.magicum.element.Elements; public class EntityMagic extends Entity { public List<Elements> elements; public EntityMagic(World world) { super(world); } public EntityMagic(World world, EntityLivingBase owner) { this(world); this.mountEntity(owner); } public EntityMagic setElements(List<Elements> elements) { this.elements = elements; return this; } @Override protected void entityInit() { } @Override protected void readEntityFromNBT(NBTTagCompound comp) { this.elements = ElementNBTHelper.loadElementList(comp, "elements"); } @Override protected void writeEntityToNBT(NBTTagCompound comp) { ElementNBTHelper.saveElementList(comp, "elements", this.elements); Main.log("saved"); //NEVER CALLED! } @Override public double getYOffset() { //PLAN: Make this one entity sensitive (use entities getMounted..offset) if (this.ridingEntity != null) return -1.75F; return super.getYOffset(); } @Override public void onEntityUpdate() { super.onEntityUpdate(); ParticleEffect.spawnElementParticle(Elements.Bio, this.posX, this.posY, this.posZ, 0.1F, 0.0F, 0.0F); } }
  5. Well, it would be much easier if you say what these "machines" are supposed to do. And otherwise: ...something tells me that you have not searched that much because the web is full of tutorials for TEs. If you want to create a TileEntity, you first have to make a block which extends the class "BlockContainer". This will add a abstract method which should return your TE. Create a TE class (extends TileEntity), and you have a Tile Entity. You now have to register it with GameRegistry.registerTileEntity(TILEENTITYCLASS.class, "any_name_you_want"); . To read and save data override writeToNBT and readFromNBT. To add a inventory implement the interface IInventory.
  6. Heyho Guys! I created some custom particles but sometimes (I don't exactly know why) they're just rendered in black. What can I do to avoid this annoying problem? I have to admit that I have no Idea why this problem appears. The particles are actually flying in a straight line and if I look to much downwards they appear colorless. But I can't exactly say when. Paticles code: package com.bedrockminer.mod.client.particle; import ...; public abstract class EntityModParticleFX extends EntityFX { public EntityMpdParticleFX(World world, double x, double y, double z, double vX, double vY, double vZ) { super(world, x, y, z); this.setRBGColorF(1.0F, 1.0F, 1.0F); this.motionX = vX; this.motionY = vY; this.motionZ = vZ; this.particleGravity = 0.0F; } public EntityModParticleFX(World world, double x, double y, double z) { super(world, x, y, z); this.setRBGColorF(1.0F, 1.0F, 1.0F); } @Override public void renderParticle(Tessellator t, float par2, float par3, float par4, float par5, float par6, float par7) { t.draw();//Restart so that the texture can be changed Minecraft.getMinecraft().getTextureManager().bindTexture(this.getResourceLocation()); t.startDrawingQuads(); float f6 = this.particleTextureIndexX / 4.0F; float f7 = f6 + 0.25F; float f8 = this.particleTextureIndexY / 4.0F; float f9 = f8 + 0.25F; float f10 = 0.1F * this.particleScale; GL11.glDisable(GL11.GL_LIGHTING); t.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX); float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * par2 - interpPosY); float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * par2 - interpPosZ); t.addVertexWithUV(f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10, f7, f9); t.addVertexWithUV(f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10, f7, f8); t.addVertexWithUV(f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10, f6, f8); t.addVertexWithUV(f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10, f6, f9); t.draw();//Restart so that the texture can be changed Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("textures/particle/particles.png")); t.startDrawingQuads(); } @Override public int getBrightnessForRender(float par1) //Copied from other particles in Vanilla { float agePercentage = (this.particleAge + par1) / this.particleMaxAge; if (agePercentage < 0.0F) { agePercentage = 0.0F; } if (agePercentage > 1.0F) { agePercentage = 1.0F; } int i = super.getBrightnessForRender(par1); int j = i & 255; int k = i >> 16 & 255; j += (int)(agePercentage * 15.0F * 16.0F); if (j > 240) { j = 240; } return j | k << 16; } /** * Gets how bright this entity is. */ @Override public float getBrightness(float par1) //Copied from other particles in Vanilla { float agePercentage = (this.particleAge + par1) / this.particleMaxAge; if (agePercentage < 0.0F) { agePercentage = 0.0F; } if (agePercentage > 1.0F) { agePercentage = 1.0F; } float f2 = super.getBrightness(par1); return f2 * agePercentage + (1.0F - agePercentage); } // Now only unnecessary stuff follows. @Override public void setParticleTextureIndex(int index) { index %= 16; this.particleTextureIndexX = index % 4; this.particleTextureIndexY = index / 4; } @Override public void nextTextureIndexX() { this.setParticleTextureIndex(this.particleTextureIndexX + this.particleTextureIndexY * 4 + 1); } @Override public void onUpdate() { super.onUpdate(); this.nextTextureIndexX(); } protected abstract ResourceLocation getResourceLocation(); public void addRandomToVelocity() { this.motionX = this.motionX + (float)(Math.random() * 2.0D - 1.0D) * 0.4F; this.motionY = this.motionY + (float)(Math.random() * 2.0D - 1.0D) * 0.4F; this.motionZ = this.motionZ + (float)(Math.random() * 2.0D - 1.0D) * 0.4F; float f = (float)(Math.random() + Math.random() + 1.0D) * 0.15F; float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); this.motionX = this.motionX / f1 * f * 0.4000000059604645D; this.motionY = this.motionY / f1 * f * 0.4000000059604645D + 0.10000000149011612D; this.motionZ = this.motionZ / f1 * f * 0.4000000059604645D; } public void enableGravity() { this.particleGravity = 1F; } }
  7. When exactly does the Error appear? When you just start eclipse or when you try to open the workspace? And how did you create the workspace? Did you download the Forge pack, extracted it, ran the installer and opened up the forge folder with eclipse? Or did you do this via another method? Maybe you forgot to run gradlew.bat eclipse ? If you want to you can take a look at my tutorial on how to install the forge workspace. You can find it here. Setup Minecraft Forge 1.7 (Fast method) PS: Your english is not bad. (But maybe I don't see the mistakes, because I'm also german )
  8. The "helper class" is actually my CommonProxy. May I ask when you needed th ServerProxy?
  9. Thanks a lot, that was something I didn't know about. It works fine now But.. When do you use the server proxy? I can actually see no situation where you would need it
  10. OK, I now created some data storgae and packets and everything works except one thing: If I register the EventHandler for the packet's sending method in my ServerProxy and start a Dedicated Server, everything works fine. But if I start my Combined Client and try a Singleplayer world, the event Handlers are not registered. If I place them in the commonProxy (called on client & server) everything is fine, they are registered on BOTH sides. But I only want them to be registered on SERVER side. Why does this not work??? Server Proxy: public class ServerProxy extends CommonProxy { @Override public void preInit(FMLPreInitializationEvent e) { super.preInit(e); } @Override public void init(FMLInitializationEvent e) { super.init(e); MinecraftForge.EVENT_BUS.register(new EventHandlerPotionUpdater()); FMLCommonHandler.instance().bus().register(new EventHandlerPotionUpdater()); } @Override public void postInit(FMLPostInitializationEvent e) { super.postInit(e); } } CommonProxy: (I removed unimportant stuff) public class CommonProxy { public void preInit(FMLPreInitializationEvent e) { } public void init(FMLInitializationEvent e) { //MinecraftForge.EVENT_BUS.register(new EventHandlerPotionUpdater()); //FMLCommonHandler.instance().bus().register(new EventHandlerPotionUpdater()); } public void postInit(FMLPostInitializationEvent e) { } } Client Proxy: public class ClientProxy extends CommonProxy { @Override public void preInit(FMLPreInitializationEvent e) { super.preInit(e); } @Override public void init(FMLInitializationEvent e) { super.init(e); MinecraftForge.EVENT_BUS.register(new EventHandlerPotionRenderer()); } @Override public void postInit(FMLPostInitializationEvent e) { super.postInit(e); } } Registration: @SidedProxy(clientSide="com.bedrockminer.magicum.ClientProxy", serverSide="com.bedrockminer.magicum.ServerProxy") public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent e) { proxy.preInit(e); } @EventHandler public void init(FMLInitializationEvent e) { proxy.init(e); } @EventHandler public void postInit(FMLPostInitializationEvent e) { proxy.postInit(e); }
  11. I think, you understood me wrong. Well, it might be my fault because I didn't say this clearly: The first if-statement is to remove a small bug where the fire is rendered below the player. The last two if-statements control the actual fire rendering and they are called for EVERY entity. As I said, the problem is the if statement which checks for the active effect, because if I leave it out everything is exactly as I want it to be.
  12. Heyho Guys! I created two new types of fire, namely flash fire and hell fire. I wanted to create them via potion effects. Everything works fine, except the rendering: I have created an EventHandler for the Event RenderLivingEvent.Post . There, I test if the Potions are active and if so, I render the entity on fire. But unfortunately, this only works for the active player. Neither mobs nor other players with the effect applied are rendered on fire. I think this is because the potions are controlled from the server, so the client doesn't need the active effects... But anyway, how can I solve this? Code: @SubscribeEvent public void onRenderLiving(RenderLivingEvent.Post e) { if (e.entity == Minecraft.getMinecraft().thePlayer) GL11.glTranslatef(0.0F, 1.2F, 0.0F); if (e.entity.isPotionActive(ModPotions.flash_fire.id)) this.renderEntityOnFire(e.entity, e.x, e.y, e.z, true); if (e.entity.isPotionActive(ModPotions.hell_fire.id)) this.renderEntityOnFire(e.entity, e.x, e.y, e.z, false); } If I leave out the if statements, It works fine.
  13. Ok, but with this you only affect regeneration potions and not instant health potions. I think I'll try to do this by saving the previous value (or is this already saved anywhere?) and compare it with the actual value every tick.
  14. Actually I don't want to render a specific entity on fire but every entity which has the potion effect I created, so actually I have no doRender method.
  15. Heyho Guys! I want to create a custom type of fire. I've already created a potion effect to do the damage and now I want to make the renderer. I need an event where a entity is rendered so that I can add the fire rendering. Which event do I have to subscribe to? It might help me if you can tell me where in the code the "normal" fire is rendered on the entities.
  16. Heyho Guys! I want to use some Items which reduce the damage taken if they are in the inventory. For this I want to use an event. The problem is that I can't reduce the amount of damage directly. The only thing I can imagine is to cancel the event and damage the player again but this event would go through the control again. How can I reduce the damage without this problem?
  17. Heyho Guys! I want to create a potion which reduces the effectiveness of potions by 50%. Therefore I need an event which is fired when an entity is getting healed. Which event can I use?
  18. Heyho Guys! I wanted to create a new potion effect, so I googled and found these two tutorials: http://www.minecraftforge.net/wiki/Potion_Tutorial and http://www.minecraftforum.net/topic/1682889-forge-creating-custom-potion-effects/. Both of them use reflection to get more space in the potions list to place the potion object there. I'm wondering if it wouldn't be better to use ExtendedEntityProperties because they can't interfer between different mods. If you do it with reflection and another mod also does, you'll get problems if you use the same ID (-> Item/Block ID Problems in 1.6.2 and before ). What is in your opinion the better way? Or is there a special Forge Method to add new Potions? Thanks in advance! PS: You can't add a new Icon to the potion via reflection, right?
  19. Damn hardcoded rubbish.. OK, thanks. I'll extend ItemSword and TRY to make it work anyway
  20. Heyho Guys! I want to create some wands in my mod which should be enchantable with sword enchantments like sharpness or looting or so. I don't want to make them extend the ItemSword class because this would make them stronger if you hit an entity with them; a left-click punch should do only 1 damage, not 4 or more. How can I make the items enchantable with sword (or other?) enchantments? (If I just leave them as they are they always get unbreakable)
  21. This here is the code to render a single char: GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F); GL11.glVertex3f(this.posX + f2, this.posY, 0.0F); GL11.glTexCoord2f(f / 128.0F, (f1 + 7.99F) / 128.0F); GL11.glVertex3f(this.posX - f2, this.posY + 7.99F, 0.0F); GL11.glTexCoord2f((f + f3 - 1.0F) / 128.0F, f1 / 128.0F); GL11.glVertex3f(this.posX + f3 - 1.0F + f2, this.posY, 0.0F); GL11.glTexCoord2f((f + f3 - 1.0F) / 128.0F, (f1 + 7.99F) / 128.0F); GL11.glVertex3f(this.posX + f3 - 1.0F - f2, this.posY + 7.99F, 0.0F); As you can see there is 0.0F as the z coordinate, so the zLevel variable has no effect. Instead, you have to use GL11.glTranslate(0.0F, 0.0F, zLevel); Now it works.
  22. The drawString method just draws the pictures of the text, right? So why isn't it influenced by the zLevel? Or how can you do this?
  23. In the ItemTooltipEvent I first create a Gui object. Then I set the zLevel to 300 and draw some textured rectangles (drawTexturedModalRect). Then I call the drawString method of the gui object with the zLevel still set to 300, but the text is rendered below the previous drawn picture and even below the Items in the container.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.