Everything posted by Ernio
-
[1.8] Spawning entity with item creates a "still" entity
I think you are blindly using world.isRemote. A little explanation: http://www.minecraftforge.net/forum/index.php/topic,33918.msg178740.html#msg178740 So yeah - you MUST use !world.isRemote, and that "still zombie" is effect of no doing so - it spawns only on client, so server doesn't know about it, therefore it is kinda "dead". As to problem - I am on 1.8, you are on 1.8. The code I gave you WORKS (that is not theory). Since it works - you did something else wrong. Show me your whole Item class and how you initilize your items. Do you use some forge event that could cancel spawning? Maybe you use interaction events that could cancel clicking?
-
[1.8] Spawning entity with item creates a "still" entity
@Override public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { if (!worldIn.isRemote) { EntityZombie test = new EntityZombie(worldIn); worldIn.spawnEntityInWorld(test); test.setPosition(pos.getX(), pos.getY() + 1, pos.getZ()); return true; } return false; } It is impossible that this doesn't work. (You don't need item check, you are alredy in it, unless you need instance-specific checks). There is probably something wrong with your EntityTest - you might not have renderer for it. Or you messed up constructors?
-
[1.7.10] Interact with block
Can't help you directly (update to damn 1.8 please), but that is not way to go. PlayerTickEvent is not only fired by both sides, but also for each player, you can't steer other players on client. *You need to use ClientTickEvent, registered by ClientProxy. *You cannot reference ANY server methods/classes/logic. *You will need to manipulate PlayerControllerMP (in 1.8, idk about 1.7). *PlayerControllerMP handles client-sided player actions (note that is doesn NOT act on its own, but is a handler of actions) such as mining. It will send packets to server about those actions, including stuff like mining progress. It contains number of methods responsinble for handling mentioned actions. You will need to call those methods from ClientTickEvent whenever you want to create action without human-input (mouse/keyboard), and generate virtual actions - movement, mining, clicking). Example: Minecraft#rightClickMouse() has a line: this.playerController.func_178890_a(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec) Which informs client that "human" clicked mouse. PlayerController will be informed about it and send info to server. You need to replicate those actions. Simply go over PlayerControllerMP.class and check its method callbacks. Then replicate them virually.
-
Crash when launch game
There is something wrong with ShadersMod Core. Be sure you've got right version or post those logs on author's page.
-
[1.7.10] How to add new Celestial Bodies?
Without replacing dimension/world classes and ASM... Well, there are always some Rendering events. Check out Forge's client.event package. RenderWorldLast? nah.... won't do the trick. You WILL need to replace something at some point. Let's go back to dimensions idea. Basically you can grab suraface dimension and replace something in it with your own creations. In this case you will need (at least) extension to WorldProvider and override for methods that render sky (lookup WorldProvider.class). For ANYTHING more "exclusive" you will need to make quite bigger replacement - RenderGlobal is your jam. You could (theoretically) extend it and replace it in startup (yay, its public in Minecraft.class). Be cautious! Don't mess with too much code, just ADD new stuff, don't remove (compatibility). Interesting methods: RenderGlobal#renderSky(...)
-
EntityPlayer to AbstractClientPlayer
Every client-sided EntityPlayer is an instance of AbstractClientPlayer (meaning you can freerly cast it, as long as you are on client thread and do it via proxy, since it is client side class). ACP does NOT exist on server thread. To give you wider look - click on EntityPlayer and choose "Type Hierarchy". ACP is base of all client-sided players, EntityPlayerMP for all server-sided ones.
-
[1.7.10] Interact with block
Question - are you making client-side BOT, or server-side player AI? Or maybe we can sue both sides? Asking because it can be done on either of those, or on both threads.
-
What's the problem with this code?
Reminds me of time when I was like: "Wtf, why is this blade see-through?" Took me some time to actually look into .png, rather than my GL calls. And indeed- it is pretty cool, you can make glassy-stuff.
-
drawCore Probleme
Jesus christ. Dude, please learn some basics before jumping into rendering. You are noot only Java-newbie but also programming-newbie AND IDE-newbie. Do something basic, please! As to what to do: In 1.8 tesselator methods have been moved to WorldRenderer which has a getter (yes, right there). Look into vanilla - it is as simple as that. As to other ways: Clean tess rendering should be used to perform VERY custom renderings and requires quite some math and 3D-sense. Other ways are using json models or other models. Other are clean GL calls in Renderer.class-es. It all depends on what is your goal really. Differnt tools are used to make different stuff.
-
What's the problem with this code?
We need code, assets. Did you use built in model?
-
[1.7.10] Spawning player at the another dimension when creating new world
I have no idea what are you saying. Please explain. @Post below: Oh, yeah, I was totally off with my thinking, didn't think of it that way.
-
What's the problem with this code?
1.8 has new rendering and model systems. IIcon and IItemRenderer is no more. To have a peak at new rendering: https://github.com/TheGreyGhost/MinecraftByExample ISmartItemModel allows mdoel manipulation.
-
[1.7.10] Tracking ItemStacks
I actually tried doing similar thing few times in the past. I can honestly tell that there is no good way of making what you need - and I used probably all my knowledge about Forge/Vanilla. The only thing I didn't try (because it is kinda ridiculus and even harder to track) is java-based object tracking. Theoretically you could do this with ASM (would need few insertions to ItemStack.class) and some "bad" coding (I am talking about using finalize() method - which is always bad to use to modify any data). I must say - when you think about it - you could actually make sure that game has only ever one instance of ItemStack.class with given specific data. Any other creation would be simply auto-removed. This + one boolean could work (boolean would be set to true if given "specific" stack would be saved to disk (which can be detected, easily with events), so then you can use it to know it there is this itemstack in HDD when it's not in JVM). I could explain more of this mess, and i honestly belive it would work, but 1st you would need to learn ASM. Disclaimer: This is totally out-of-box thinking. And it's probably bad in long run.
-
[1.7.10] Tracking ItemStacks
Probably on-per-game legendary item or something. Anyway - not really possible without tons of specific tracking which can obviously fail at some point. Let's say that you store some world-or-server-global boolean somewhere on server thread. Call it "B". 1. I don't think EntityItem fires any events in per-existance manner (onUpdate), BUT! * You can easily extend EntityItem with your custom one and override its update methods that could set "B". Then in your Item class to spawn custom EntityItem you use: - Item#hasCustomEntity(ItemStack stack) - Item#Entity createEntity(World world, Entity location, ItemStack itemstack) So now you have Your check for EntityItem. 2. Well, Forge events only allow tracking updates (onUpdate) of living entities. Happily - I don't think that there is a non-living entity that can have inventory. So you use: - LivingUpdateEvent, check for entity, check if it has inventory and loop through items, if item was found - you set "B". So now you have entities (that can include players). 3. But wait - what about non-livng entities with inventory - sadly, I don't think there is a way. Only thing you could track are Minecarts, but if other mods have e.g backpacks - forget about it. 4. TileEntity - welp, again hard one, not every TE has onUpdate() method (since it is in interface). Other approach would be not tracking existance but only creation and destruction. Which again - is not really possible for all cases (creative-destruction or command spawn). Verdict: It is quite impossible to catch all cases, I'd forget about it.
-
[SOLVED] [1.8] Reducing Network Traffic
1. Yes, if you need to know exacly when player is holding down button/mouse the best way is to send packet containing key(int) and pressed(boolean). - ClientTickEvent is called once on client per tick, so using it would be "fine", but not entirely, because you would also have to know (on client) if previous-tick button/mouse state is different (and if so - send state-changed packet), which requires additional fields (check is needed so you don't send packet with button state every tick). - What you can utilize are input events, but I am not sure they work in all cases (might have to use ClientTick after all). - If you would have to do that - simply hold list of previous states and send apcket only if you know state is different than one from prev-tick. 2. Yes, PlayerTickEvent is called for both sides for each EntityPlayer (mening on client it will be called for every loaded-by-client player). It is also (like other TickEvents) called twice with Phase. 3. Pretty much point 1.
-
[1.7.10] Interceptor framework for incoming vanilla packets
^ This could be potentially really damn useful. Other question Goal: Change packet's data before it's being sent from server to client. Extend NetHandlerPlayerServer and override sendPacket, and then simply check instance of packet and change data. For every EntityPlayerMP - LoggedIn or JoinedWorld event? - replace handler field with extension. Happily manipulate packets with e.g world data (e.g: have 2 players in same world but one will receive totally different world data). Can something go wrong?
-
[SOLVED] [1.8] Handling Mouse Input
Don't send packets per tick. Do it once on Press (true) and unpress (false). Store bool in IEEP.
-
[1.7.10] Techne Models without using .java file
If you want to use .json models in terms of vanilla then they were added in 1.8. Logically - system doesn't exist in 1.7.10 (which is in thread's name). Aside from that - Just make wrapper/parser for your custom files.
-
[Reopened] Overriding mob drops
EntityHorse#getHorseType() EntityHorse#getHorseVariant()
-
[1.8] Changing the player name plate results in the nameplate not being centered
Well... 1. NameFormat is a forge event that is fired whenever game generates name for given EntityPlayer. Once generated name is being cached and reused and can be re-generated using simple: player.refreshDisplayName(); Event basically allows you to return any string you like. Do note that minecraft consists of server and client side and NameFormat is sided event - meaning you would have to call it (#refreshDisplayName) on both sides to update both threads. How to? Learn how to use Forge Events. (google) 2. If you need to replace some x string with something else you can utilize lang system that allows you to link strings to lang files. Whenever you use lang reference it will be replaced by lang string. 3. If you need to replace string whenever it is being rendered in game, no matter if it is generic, from-lang, or modified by NameFormat event you will indeed have to alter FontRenderer by replacing it with you extending class. FontRenderer is located in Minecraft.class as "fontRendererObj" and can be replaced and render different-than-actual-input strings. 4. If you need to replace strings on data-level (meaning not-just-rendering) - it is literally impossible in vanilla/forge.
-
[1.8]Sync server data with all clients
Please make git repo or pastebin ALL relevant files. From packets and sending methods to registering.
-
[1.7.10] Resizing the players hitbox/collisionbox: How would you do it
Move camera. Client side.
-
[1.7.10] Resizing the players hitbox/collisionbox: How would you do it
Damn... SmartMoving, along with kind of APIs it uses it one of FEW well-written-and-released APIs. From that you can expect open source, compiled deobf versions and literally ready to use code. So no - you don't need BON and other stuff. As to problem - Thronack - just lower the box or move rendering up. And no - don't use TickEvent - that was example.
-
[1.8] initGui() fired but not drawScreen()
Damn bro... Commands are ONLY fired on server. You can't fire client stuff on server thread. Not only it won't work, but also it will crash on dedicated server. Either learn IGuiHandler or: 1. Open gui from client. 2. Send command, decide on server if player can open gui, send packet to player that opens gui. Have a look at this post if you don't get how threads/sided-code works: http://www.minecraftforge.net/forum/index.php/topic,33918.msg178740.html#msg178740 Packets: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-2-customizing-packet-handling-with @Edit: My mistake, didn't see that one
-
Minecraft 1.7.10 TileEntity error
Did you register your TE? GameRegistry.registerTileEntity(TileEntityX.class, "something");
IPS spam blocked by CleanTalk.