Jump to content

Bedrock_Miner

Forge Modder
  • Posts

    613
  • Joined

  • Last visited

Everything posted by Bedrock_Miner

  1. The corresponding variables are all the default ones, they are not overridden in any way, neither the used methods are.
  2. Well, at this stage of Entity development I don't use a special renderer, so the Entity is actually a white box which is perfectly aligned with the bounding box. I checked posX, posY and posZ and on client side they DO have wrong values. I really can't understand this, because I searched for every access to methods or variables which change the position but there is nothing which can cause the error.
  3. I have created some other mods which just use registerModEntity and this worked but this were Entities which were not controlled by the player. I think, the Entity itself works... (I think...) EDIT: Actually the same issue occurs if I change the registration... I have no idea what can cause this because its such a weird behaviour. I checked the posX...posZ vars of the Entity: They have the right values on server but wrong on client. Maybe a sync error? How could I fix this with Entities?
  4. In this modding series I will teach you all about Minecraft Forge Modding, starting with the basic setup and advancing to rather complicate things. The only things you have to know are the basics of Java. If you have no idea what classes, switch statements or for loops are, please learn some of the java basics. Just take a look in the internet for a beginner tutorial and you'll get something soon. Please don't miss this step because modding without java knowledge is completely nonsense! Once you have learned the Java basics, you can start your first mod. In my tutorials I'll create a basic mod together with you and explain everything. You can either retype the code, copy it or download it from a GitHub repository to which I added a link under each tutorial. Of course you can also take a look at the tutorials if you are a little bit familiar with modding but want to broaden your horizon.. Please note that the tutorials are still WORK IN PROGRESS. I'll try to add at least one new tutorial per week, so the list of tutorials will increase over time. Ready to start modding? Go to create your first mod!
  5. Heyho guys! I created an Entity which adjusts its position to its owner's position (normally the player). Now I encountered a small problem: The Entity's y position is not updated correctly. I have one line of code which is called in onUpdate on server side to update the entities position: this.setPositionAndRotation(this.owner.posX, this.owner.posY + 10.0F, this.owner.posZ, this.owner.rotationYaw, this.owner.rotationPitch); On the server, the Entity is at the right position ten blocks above the player but on the client, the entity is just at the player's origin point. The problem is that basically everything works, if the player moves, the entity moves too. I tried to set the height of the entity to a constant value like this: this.setPositionAndRotation(this.owner.posX, 70.0F, this.owner.posZ, this.owner.rotationYaw, this.owner.rotationPitch); On the server side, the entity is at this position but on the client side its rendered at the height I spawned it, no matter if this was 70 or maybe 90. I'll post some code here, but I'm really not sure which code you'll need so please write if you need more. I hope anybody understands what the problem is or give me at least a hint what may cause problems with this. Thanks in advance!
  6. Heyho Guys! I've been working on a series of tutorials for some time now (But its still at work) and I want the tutorials to be linked at this site. Link to my tutorials I now wanted to add a post to the tutorials subforum of the modderSupport forum, but I can't do this (I see no New Topic button). How can I add a link to my tutorials on the forum?
  7. Forget this post. I somehow managed to damage the entity in a way that I have to recreate it Heyho Guys! I want to create a Entity which produces custom particles which are controlled by the entity in Order to rotate around it. The problem is the following: I placed the controll methods in the onUpdate method inside of an if-clause to ensure its client side. (!worldObj.isRemote) because on the server side I can't handle my particles as they extend client-only EntityFX. But onUpdate seems to be called only a few times, I think when a Entity is created. Why? And which method should I use in order to get an update each tick?
  8. I thought about any existing entity :-)
  9. Well actually I don't want to do this only for player but for any Entity, but I don't think this changes much. What I don't understand is how to get the player(or entity) you marked before via NBT. Im thinking about a kind of a waiting loop (via the onEntityJoinWorldEvent) where the task for the player waits until the player comes online and then starts executing again. Is this something like you thought about?
  10. OK, I now created (a little bit different from what you said) a scheduler which calls every tick every object in the active task list. With a task object you can do anything you want, so I can use it also for other things. But now I have the same problem I mentioned above: I want to save the running tasks. I can save a presistant UUID for an Entity, but I don't know how load a Entity from its UUID. Anyone who knows this?
  11. Thanks! I think I can work with this!
  12. Sound quite logical, although I have no Idea how to create the Player tracker. Is this just a kind of extendedProperties?
  13. I want to make a kind of a flamethrower where the player is constantly firing entities in his viewing direction which cause damage and ignite the hit entities.
  14. OK, new problem: I can get a persistant UUID from a entity but I don't know how to get the entity from its UUID. @Override protected void readEntityFromNBT(NBTTagCompound comp) { if (comp.hasKey("ownerMost") && comp.hasKey("ownerLeast")) { UUID id = new UUID(comp.getLong("ownerMost"), comp.getLong("ownerLeast")); //Got the UUID; but now..? } } @Override protected void writeEntityToNBT(NBTTagCompound comp) { Main.log("uuid:" + this.owner.getPersistentID().toString()); comp.setLong("ownerMost", this.owner.getPersistentID().getMostSignificantBits()); comp.setLong("ownerLeast", this.owner.getPersistentID().getLeastSignificantBits()); }
  15. But actually I don't think it's useful if you do it with the riding because it would destroy any other riding entities which are maybe added by other mods. Can't I just disable the normal saving and only use the one in the ExtProps? Or can I save a reference to the corresponding player in the entity itself and save it the normal way? I think this would be better.
  16. Ok, my mistake. I thought about completely replacing the riding with the extended properties.
  17. Heyho Guys! I want to create a potions which stuns the entity to which it has been applied. Generally it works fine; Zombies, Pigs or Players can't move any more, but I want some extra features: [*]A player who is flying should not be able to move (this is not affected by SharedMonsterAttributes.movementSpeed) and thus he has to fall down [*]The same for a flying bat [*]The same for a swimming squid [*]Enderman should not be able to teleport All in all: No mob should be able to move, they all have to fall down until they hit a block. (Maybe not the enderdragon/wither but generally every mob) Actual code: Potion: package com.bedrockminer.magicum.potion; import net.minecraft.client.Minecraft; import net.minecraft.entity.ai.attributes.IAttribute; import net.minecraft.potion.Potion; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import com.bedrockminer.magicum.Main; import com.bedrockminer.magicum.event.potion.EventHandlerFreezePotion; public class PotionFreeze extends Potion { private ResourceLocation icons = new ResourceLocation(Main.MODID, "textures/gui/icons.png"); protected PotionFreeze(int id, boolean isBad, int color) { super(id, isBad, color); this.setIconIndex(0, 0); MinecraftForge.EVENT_BUS.register(new EventHandlerFreezePotion()); } @Override public int getStatusIconIndex() { Minecraft.getMinecraft().getTextureManager().bindTexture(this.icons); return super.getStatusIconIndex(); } @Override public boolean isReady(int duration, int amplifier) { return false; } public Potion addAttribute(IAttribute attribute, String name, double amount, int operation) { this.func_111184_a(attribute, name, amount, operation); return this; } } Init of the Potion: freeze = new PotionFreeze(getNextID(), true, rgbToInt(100, 100, 255)).setPotionName("potion.magicum.freeze"); //0|0 ((PotionFreeze) freeze).addAttribute(SharedMonsterAttributes.movementSpeed, "91AEAA56-376B-4498-935B-2F7F68070635", -1.0D, 2); ((PotionFreeze) freeze).addAttribute(SharedMonsterAttributes.attackDamage, "91AEAA56-376B-4498-935B-2F7F68070635", -1.0D, 2); ((PotionFreeze) freeze).addAttribute(SharedMonsterAttributes.followRange, "91AEAA56-376B-4498-935B-2F7F68070635", -1.0D, 2); EventHandler for Potion: package com.bedrockminer.magicum.event.potion; import net.minecraft.client.Minecraft; import net.minecraftforge.client.event.MouseEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; import org.lwjgl.input.Mouse; import com.bedrockminer.magicum.potion.ModPotions; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class EventHandlerFreezePotion { @SubscribeEvent(priority=EventPriority.HIGHEST) public void mouseEvent(MouseEvent e) { if (Minecraft.getMinecraft().thePlayer.isPotionActive(ModPotions.freeze)) { Mouse.getDX(); Mouse.getDY(); } } @SubscribeEvent(priority=EventPriority.HIGHEST) public void jumpEvent(LivingJumpEvent e) { if (e.entityLiving.isPotionActive(ModPotions.freeze)) { e.entityLiving.setVelocity(0.0F, -10.0F, 0.0F); } } }
  18. OK, basically the saving process worked. @Override public void saveNBTData(NBTTagCompound compound) { if (this.activeMagic != null) { NBTTagCompound nbt = new NBTTagCompound(); this.activeMagic.writeToNBT(nbt); nbt.setString("id", EntityList.getEntityString(this.activeMagic)); compound.setTag("activeMagic", nbt); } } @Override public void loadNBTData(NBTTagCompound compound) { if (compound.hasKey("activeMagic")) { NBTTagCompound nbt = compound.getCompoundTag("activeMagic"); Entity e = EntityList.createEntityFromNBT(nbt, this.thePlayer.worldObj); this.thePlayer.worldObj.spawnEntityInWorld(e); } } But now I'm wondering how I can disable the saving of the entity in the world if its saved by the ExtendedProperties.
  19. You mean I shouldn't save the entity in the world but instead in the extended properties?
  20. Sounds logical to me. But how do I save the Entity in the ExtendedProperties? With the UUID? With the EntityID? Or another way?
  21. The problem is: If I make the entity riding the player, it is not saved. If I just place it in the world it is saved. I thought about another method, namely saving the player's uuid (or EntityID?) to get the player object if its loaded again; then the entity doesn't have to ride the player, but I don't know how to do this exactly.
  22. No, actually I don't want to extend the player (I did this before ) but I want to create an entity which can be controlled by the player: It should point anywhere a player (its owner) looks.
×
×
  • Create New...

Important Information

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