Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Porteffroi

Members
  • Joined

  • Last visited

Everything posted by Porteffroi

  1. I just found another issue with this method. I have an method wich was called on right clic on the entity. I suppose the raycast issued by a clic doesn't collide anymore because now the method isn't called anymore.
  2. I tried, same result. I can walk through the entity but it's still pushed away when i stay close.
  3. I tried to overwrite the 2 methods but the entity still collides with the player. Is there other methods to implement ?
  4. thanks, i will try.
  5. Hi, i want to perform some modifications for my mod but don't really know how to apply them, if you can give me some hints please ... I want to : 1) disable mob & animals spawning. So, it's more than simply set mode to peacefull (I'm afraid of sheep's ). I don't know if it can be achieved thanks to an extension of IWorldGenerator ? 2) Register a creature such that the chunks around it will continue to be updated instead of being unloaded. This creature should never be unload. 3) Make a creature uncollidable with other creatures. Meaning for now if the player is on the entity path, it will collide while i would like to avoid this by going through the player (like a ghost mob). My current version is 1.6.2. Thanks.
  6. I still did not found how to do it ... It can also be a modification in the basic code of minecraft, it's not o be part of a mod. If it's a modification in the render code of the game it's ok.
  7. Thanks for these hints. I'll have a look to these locations and see if i can find what i need. The best of all solution would be a way to mark blocks as "to render" or "not to render". In fact i have a field of view algorithm and i want the player to see only blocks this algo considers as visible. I suppose there's no build-in solution to do it, so I'm looking to reduce the player vision range to make it looks like only the blocks from the field of view are displayed. So the objective is not really to increase the fog effect but more to block rendering of blocks which distance to the player is higher than 10. But if the fog can be set such that blocks at distance 9 are fully visible and blocks at 10 are absolutely not visible it also works. It's a bit tricky, i know. ^^ Edit : I had a look on renderDistance in the game settings but it seems it doesn't allow to set a custom distance. It looks like more a switch between the different distances already accessible from the option menu. Edit 2 : For the blind potion i found some code stubs concerning it but i cannot find the item in the creative tabs of the game.I forgot to mention that i'm still in 1.6.2. It may be the cause.
  8. Hi, does anyone know how i can alter the client such that the player is only able to see blocks in a radius of 10 meters ? I don't want to do it only for a single custom block type but for the whole world. Thanks.
  9. Hi, I currently have a GUI which opens when a key is pressed. But the key binding also intercepts the key when the player write in the chat. Which condition should i impose to check if the chat is used and avoid opening my GUI ? thanks. NB : current code is package PLCmods.robotica.commands; import java.util.EnumSet; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import org.lwjgl.input.Keyboard; import PLCmods.robotica.Robotica; import PLCmods.trashbin.LoggerKeyTickHandler; import cpw.mods.fml.client.registry.KeyBindingRegistry; import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler; import cpw.mods.fml.common.TickType; import cpw.mods.fml.common.registry.TickRegistry; import cpw.mods.fml.relauncher.Side; public class LoggerKeys extends KeyHandler { private EnumSet tickType = EnumSet.of(TickType.CLIENT); private boolean open; public static final KeyBinding[] key = {new KeyBinding("Logger GUI", Keyboard.KEY_L), new KeyBinding("Logger switch", Keyboard.KEY_O)}; public static final boolean[] repeat = {false,false}; public LoggerKeys() { super(key,repeat); KeyBindingRegistry.registerKeyBinding(this); open = false; } @Override public String getLabel() { return "Logger Key"; } @Override public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) { if(!tickEnd) { EntityClientPlayerMP e = Minecraft.getMinecraft().thePlayer; if(kb.keyCode == Keyboard.KEY_L) { if(open) e.closeScreen(); else e.openGui(Robotica.modInstance, Robotica.GUI.LogControl, e.worldObj, 0, 0, 0); open = !open; } else if(kb.keyCode == Keyboard.KEY_O) e.sendChatMessage("/log switch"); } } @Override public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) {} @Override public EnumSet<TickType> ticks() { return tickType; } }
  10. Ok, i suppose it's a better way to do it. But i could not find how to insert the player reference in the packets ... As i had already commands allowing to do the action, i found a way to force a client to send a command. Here the code line if someone have the same problem : ((EntityClientPlayerMP) entityPlayer).sendChatMessage("/[command]"); Unfortunately it's not very OOP but it works.
  11. Hi, I currently have a set of commands executed on server side. I made a GUI to allow users an easy access to the features and perform the same actions as commands but the problem is my Gui is on client. So I need a way to execute code on server side when an action is performed on the GUI and to be able to find the player who did it. Is there a way to emulate the use of commands such that i can send these to the server when a player click on the buttons ? I tried addChatMessage but this does not check if it's a command and simply display it in the chat. I also found a way to send commands like if it was typed in the server terminal using MinecraftServer getters but i think it does not allow to recover which player issued the command. Can somebody help ? Thanks a lot.
  12. I had a look, and there's the same call to destroyBlockInWorldPartially() but it's a special case where the computation seems different as it's not similar to breaking a block with a tool.
  13. Hi, I want to make my entity destroy blocks like a real player, meaning the damage state of the block should be computed the same way so the entity breaks block at the same speed a player would. How can i do it ? From ItemInWorldManager.updateBlockRemoving() i tried to sum up the computation, leading to a result like : onLivingUpdate() { [some other entity updates]; if(this.destroying_block) { ++this.curblockDamage; i = this.theWorld.getBlockId(this.partiallyDestroyedBlockX, this.partiallyDestroyedBlockY, this.partiallyDestroyedBlockZ); Block block = Block.blocksList[i]; if (block == null) { this.theWorld.destroyBlockInWorldPartially(entityId, x,y,z, -1); this.destroying_block= false; } else { ItemStack items = inventory.getCurrentItem(); float f = items.getItem().getStrVsBlock(items,block,world.getBlockMetadata(x,y,z)); float hardness = block.getBlockHardness(world,x,y,z); int l = this.curBlockDamage; float f1 = f / hardness / 30F; float f2 = f1 * (l+1); float j = (int)( f2 * 10.0F ); this.theWorld.destroyBlockInWorldPartially(entityId, x,y,z, j); } } } where curBlockDamage is initialised to 0 when destroying block is set to true. Is this correct ? I don't really understand why there are so many steps and factors when computing j so I'm absolutely not sure. Moreover, what's the limit to know when the block is destroyed ? Thanks.
  14. Can you show me the code you use to make the container work ? I tried to compare to some tutorials i found to fix mine but they don't all agree with each other and it still didn't work.
  15. This might be the problem. As my entity is managed by an AI, it destroy blocks and collects items from it's own initiative. It's a player-like entity. So in this case, the GUI of the client is not open and i suppose this leads to desynchronization. All of this happens at server side. So i suppose the client isn't aware of these changes. EDIT : Finally it's not ... If the entity collects items and then the player open the GUI, the items are correctly displayed. Only the interractions are wrong. What do you mean by the inventory only exists server-side ? Because as the inventory is part of my entity it's also existing at client-side (meaning the object exists), but is just "incorrect". But maybe a additionnal instance is created on client side when the GUI is oppened. Is that what you mean ? The GUI opening is asked by the server only. Concerning the mapping, i use my own Id's in my own structure managed by the server, not the default one assigned to entities. So i think there should be no problems concerning the ids. Moreover the id is a field stored using the NBT functions so it should never change. I don't really have other ideas as i need to be able to find back the entities in the world from a main controller. NB : to be more precise : The inventory can change while the GUI is close BUT the entity don't move and don't change it's inventory on it's own if a GUI is oppened. In this case only the player who oppened it is able to change the content.
  16. Hum ... yeah now i double check nothing really needs a TileEntity object to work properly. I adapted this from a tutorial doing it for a block so this might be why i was so focused on the tileEntity. And the trick to use x as id is already what i use for now. But anyway I still have the same issues, the problems on interaction with the GUI are still there. How can i solve this ? If it's linked to de-synchronization, are they methods to make the entity synchronize with it's corresponding entity on the client side ? I used datawatchers before for other variables like statistics about the entity, but i don't know if it's the good way to synchronize the 24 itemstacks of the inventory.
  17. Hi, I have a problem using tileEntities to represent the inventory of a creature. Objective The objective is to have a creature (like a robot) which will be controlled by an AI agent and which has an inventory. To do so, i tried to use tileEntities used generally as containers for chests. My entity thus have a reference to an instance of my custom class which extends tileEntity and implements IInventory. The funniest part is i want my entity to display it's inventory on interaction. Thus i created a GUI corresponding to the inventory. The problem The inventory works fine and is correctly used by the entity. The GUI also displays correctly when the player uses a right click on the entity. But when a player try to put something in the inventory of the entity from it's own inventory, the quantities are doubled. And if it tries to remove from the entity inventory to it's own, the items disappear ! Broken solution idea I found out that the inventory on the client side is not correctly updated and synchronized with the server, probably causing this issue. But a sub-problem is that my tileEntity, as it's linked to a moving entity, don't have a defined position. So for now my GUI find back the corresponding tileEntity using the given x as the entity id (recorded in static structure for other purpose anyway) and don't care about y and z. This actually work but is not really clean. Moreover if i use packets, this system also use tileEntities coordinates to find the correct one in the world and i think i cannot use the same trick there as nothing prevents that another tileEntity is placed at (X,0,0). My code for now : https://gist.github.com/anonymous/045bea9e67a455cb2f3e So, if someone has a clever idea, either to solve the GUI interaction, solve synchronisation or to use another mechanism than tileEntity which would be more appropriate, please let me know. I tried to be concise but if it's not clear don't hesitate to ask more info. Thanks. NB: Sorry if there is a lot of mistakes, English isn't my first language.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.