Jump to content

SHiLLySiT

Members
  • Posts

    26
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

SHiLLySiT's Achievements

Tree Puncher

Tree Puncher (2/8)

-1

Reputation

  1. Is it possible to translate a chat message and then replace a specified pattern with a replacement string upon translation? Say for example I have this in my language file: my.test.string=Hello {PLAYERNAME}! How are you today? Ideally the string would arrive at the client, be translated, and then replace "{PLAYERNAME}" with the player's display name.
  2. Ah sorry if that wasn't clear in my first post - yes the chunk that the AI is in before attempting to move it is definitely unloaded.
  3. Is there a way to force the AI on?
  4. I'm trying to move an entity when a player right-clicks with an item. It works as intended if the Entity is in a nearby loaded chunk, but if its far enough away, the player has to move a bit before the entity appears after right clicking. Here's the code: public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float offsetX, float offsetY, float offsetZ) { if (!player.getEntityWorld().isRemote) { if (side == 1) { // only spawn on top of blocks EntityExtendedPlayer extPlayer = EntityExtendedPlayer.get(player); if (extPlayer.state.pet.hasPet) { EntityCorgi corgi = (EntityCorgi) Util.getEntityByUUID(world, extPlayer.state.pet.uuid); if (corgi == null) { Empathy.questManager.spawnCorgi(player, x, y + 1, z); } else { corgi.setLocationAndAngles(x, y + 1, z, 0.0F, 0.0F); } } } } return true; } Is there a method that I need to call to force an update of sorts?
  5. I just realized its because forge creates a new player each time I compile and run the mod, which is generating a new UUID. If I simply leave the world without closing the client it works as intended.
  6. I've extended the EntityTameable class, so the methods I'm using are the ones found in there. I had assumed they were setup to sync since other classes do nothing extra. Here they are anyway: public void func_152115_b(String p_152115_1_) { this.dataWatcher.updateObject(17, p_152115_1_); } public EntityLivingBase getOwner() { try { UUID uuid = UUID.fromString(this.func_152113_b()); return uuid == null ? null : this.worldObj.func_152378_a(uuid); } catch (IllegalArgumentException illegalargumentexception) { return null; } }
  7. My custom mob is losing its owner after I logout and back into a world. public EntityCustom(World world) { super(world); this.setSize(0.6F, 0.8F); _type = 0; preventEntitySpawning = true; this.func_110163_bv(); // forces entity to not despawn this.getNavigator().setAvoidsWater(true); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, this.aiSit); this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F)); this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 5.0F, 1.0F)); this.tasks.addTask(6, new EntityAIMate(this, 1.0D)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(9, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this)); this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this)); this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false)); System.out.println("OWNER: " + this.getOwner() + " " + FMLCommonHandler.instance().getEffectiveSide()); } public EntityCustom(World world, EntityPlayer player) { this(world); this.setTamed(true); this.func_152115_b(player.getUniqueID().toString()); // sets owner this.worldObj.setEntityState(this, (byte)7); System.out.println("SET OWNER: " + this.getOwner() + " " + FMLCommonHandler.instance().getEffectiveSide()); } The output of those logs: SET OWNER: EntityPlayerMP['Player54'/45, l='Copy of New World', x=261.50, y=69.00, z=317.50] SERVER OWNER: null CLIENT From what I could tell func_152115_b() sets the UUID on the datawatcher which (from what I understand) is automatically synced between the server and clients. Am I missing a step?
  8. I'm trying to add custom structures (similar to villages) to map generation. I've so far worked out that I need to create a generator that implements the IWorldGenerator class and I can generate blocks within a single chunk. Beyond that I'm not sure where to go; most tutorials I've found have been for ore generation. If anyone can point out any tutorials or open-source mods that accomplish something similar I'd greatly appreciate it!
  9. I'm having an issue with chat colors not carrying over to new lines. You can see the behavior here: https://s32.postimg.org/4lbyeg5xh/2016_07_13_1027.png[/img] Here's the code I used to produce the message: sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Lorem ipsum dolor sit amet, eius maiorum accusam at cum, eu congue facilisi quaerendum mea, est id discere honestatis intellegebat. Et vel iuvaret aliquando sadipscing. Nam et dolore nominati. Est ancillae adolescens no, his falli dolor ut. An vel feugait nusquam indoctum, ad ius munere putant aperiri.")); Am I applying the formatting wrong or is this a bug? I only found one post with a solution, but its not very pretty: http://www.minecraftforge.net/forum/index.php?topic=15445.0
  10. I'd love to upgrade but we must be able to support MinecraftEDU and the current stable version is forked from 1.7.10. In what class is getRegistryName() located? It doesn't seem to be on Item or ItemStack.
  11. I want to search through the players inventory to check and see if any of the items match a specified string which is defined in an XML. I've found getUnlocalizedName(), however the string is often quite long. Is there anything more concise? I've seen websites that list ids similar to this website: http://minecraft-ids.grahamedgecombe.com/
  12. Oh I just assumed that since the command was being run on the server that it should check the entity on the server rather than the client, but if this isn't a problem then I will leave it!
  13. I just discovered IEntityAdditionalSpawnData which seems to have fixed the issue, but as you pointed out, I'm using the client to get the entity the player is looking at. What would be the alternative for the server?
  14. I created a new Entity that has two properties - bundleId and npcId: public EntityQuestNpc(World world, String bundleId, String npcId) { super(world); this.bundleId = bundleId; this.npcId = npcId; preventEntitySpawning = true; } Currently the entity is only spawned via a console command: private void commandSpawnNpc(ICommandSender sender, String bundleId, String npcId) { EntityQuestNpc npc = new EntityQuestNpc(sender.getEntityWorld(), bundleId, npcId); npc.setLocationAndAngles(sender.getPlayerCoordinates().posX, sender.getPlayerCoordinates().posY, sender.getPlayerCoordinates().posZ, 0.0F, 0.0F); sender.getEntityWorld().spawnEntityInWorld(npc); } And I have the properties being saved with the NBT data: @Override public void readEntityFromNBT(NBTTagCompound tag) { super.readEntityFromNBT(tag); NBTTagCompound data = tag.getCompoundTag(PROP_NAME); bundleId = data.getString("bundleId"); npcId = data.getString("npcId"); System.out.println("[readEntityFromNBT] BUNDLE:" + bundleId + " NPC:" + npcId); } @Override public void writeEntityToNBT(NBTTagCompound tag) { super.writeEntityToNBT(tag); NBTTagCompound data = new NBTTagCompound(); data.setString("bundleId", bundleId); data.setString("npcId", npcId); tag.setTag(PROP_NAME, data); System.out.println("[writeEntityToNBT] BUNDLE:" + bundleId + " NPC:" + npcId); } The logs show that the correct data is being written and read. However when I use the following command to attempt to print the properties to the chat window, they are null: private void commandNpcInfo(ICommandSender sender) { if (Minecraft.getMinecraft().objectMouseOver.entityHit != null) { if (Minecraft.getMinecraft().objectMouseOver.entityHit instanceof EntityQuestNpc) { EntityQuestNpc npc = (EntityQuestNpc) Minecraft.getMinecraft().objectMouseOver.entityHit; sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "ID:" + npc.npcId + " BUNDLE:" + npc.bundleId)); } else { sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "You must be looking at a quest NPC")); } } else { sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "You must be looking at a quest NPC")); } } From my understanding all commands are run on the server, so even if I'm not syncing the properties with clients it should still be printing out a value?
×
×
  • Create New...

Important Information

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