-
Posts
2638 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Ernio
-
Override Item#onItemRightClick, perform code on !world.isRemote (server side), code can look similar to EntityLivingBase#knockBack method.
-
No offense, but read OP's post, where is the use of IEEP? @OP What you seek to do is far behind hardest thing you've ever done and probably possible only with HEAVY operations on classLoaders and bytecode. Anyway - as proposed - playerController is the thing you might want to have look at for sake of smootheness on client side rendering stuff (keep it nice). As to your reasoning - how I see it - it is FAR from reasonable - both movemeent and jump can be directly manipulated with events - on both server and client. Think about available design options before throwin random ideas around ASM fields of Java. And for ASM - start with google, and not with Minecraft interaction, but reading bytecode itself.
-
There are no such things as limits - you can do whatever you please. It is matter of design. Using provided tools (NBT) you could save time of creation, then also time of transition to container. Only thing to do then is to update all Items whenever container is opened - update ofc based on stored data. But doing complicated things require you to complicate your code - what if you put in and out your item few times (say freeze it for some time, then unfreeze and again freeze for some time) - at thins point you have to redesign. What I would store: int decayFactor - say it starts from 0 and goes to x number. Say max will be 48000 tick = two days. When player has food in inventory you can easily increment this factor. When item is in world - you can also operate on EntityItem and change NBT. When item is put into container you save timestamp and leave decayFactor. int storeTimestamp - moment of transition to container. When you pull out food from container you calculate based on time passed (currentTime - storeTimestamp) and container type how much should be added to decayFactor. Viola - cut and dried fridge system. Note: Keep in mind: 1st - it is a game, moreover Minecraft, it is not supposed to be real; 2nd - don't overcomplicate systems - makes harder to track things down, uses more resources and memory. Better to make "imitation" such as one above.
-
Can't you just open/close Gui on down/up button press? And on unpress get position of mouse related to center which will tell you to what side you hovered (e.g hovered to the left to pick left slot)?
-
It REALLY depends on what should happen during free-cursor time. Present whole idea.
-
There is no "smaller" thing than tick (as said partial ones are for rendering) when talking about minecraft-proper coding. Probably only way to achieve this would require you to have synchronized (and self-correcting) mod-timer that would work along with minecraft's timer (where 50ms = 1 tick). It IS obviously possible (been there, done that) but you would have to handle synchronizations on your own, and more importantly - system would be no more useful than TickEvent (because it wouldn't be really possible to "guess" when is the right time to call method with it). Verdict: Don't do that (in probably any case). P.S - you might be interested in mod that allows users to "record" world in means of "action-recording". Action-recording - you can watch record from any perspective in given tick. Why? I am not sure, but I belive they managed to extend ticks to more-than-20 per second (or something similar), at least, that's what they were working on few months ago. Probably ASM stuff tho
-
The name ms:chaos_gem has been registered twice, for net.minecraft.item.Item@6b5c4b75 and net.minecraft.item.Item@2e53f980. You've got it on plate... You registered same id-name twice. Search "chaos_gem" in IDE.
-
In PreInit: EntityRegistry.registerModEntity(EntityClazz.class, "Name", ID, ModID, trackingRangeInBlocks, positionUpdateFrequency, velocityUpdates); positionUpdateFrequency should be "3", no point in making it faster. velocityUpdates should be used with throwables and other thing that need velocity to know how to move. As to model - in Init, inside client proxy: RenderingRegistry.registerEntityRenderingHandler(EntityClass.class, new RenderEntityClass(Minecraft.getMinecraft().getRenderManager())); P.S: You could seriously find it in 1st google search tutorial. Look next time, there are plenty
-
1. As long as they are not in per-tick calls - yes. Whenever you go into ticking stuff - always: The less, the better and if you can't - you don't do it per-tick, but per few sec at least - in critical cases ofc. 2. if(multiblock == true) - I hope this si pseudocode, you don't need "==" in boolean statements - meaning: if(multiblock) - is correct. No, do not extend hitbox (which I think is impossible in "good" terms). What I'd do is make clicking other blocks (around) search for parent furnace and open it remotely by passing arguments from onBlockRightClick or whatever (just idea). 3. I don't get the pictured example. I probably know what you want, but still not sure, explain. You will probably want to make custom renederer, not an expert.
-
WorldEvent.Load is responsible for replacing, on client side (since it is client thread that "controls" player), player controller with hijacked one. PlayerControllerMPHijack extends PlayerControllerMP Is the hijacked version of normal controller that allows you to manipulate reach. It is possible by overriding methods: getBlockReachDistance() attackEntity(...) Inside those - you can see that everything is client sided, so you can use you own player from Minecraft.class to e.g get held item. As to reflection magic inside - google "java reflection" - LEARN IT - then, when you do - have look at class ObfuscationReflectionHelper. Logic behind - dev names are deobfuscated, when you release mod, you need SRGs - that is what those "func_78750_j" are. General questions get general answers - be more precise, or if you don't understand anything - learn more about Java (please).
-
Do you want to extend reach in matter of attacking, block-harvesting or totally in terms of reach in everything? There are ways of doing some stuff smooth and nice, but in case of "total-override" - yes, this (not counting ASM) is the only good way.
-
If you mean "entity" as it is - then you can even extend Entity.class and Override needed methods (for example look at EntityItem.class which is literally "awkwardly standing" entity). If you mean entity as living thing - you simply can extend EntityLivingBase for most basic living thing. For it to not have tasks - you can simply not add them Rest of classes, such as Mob, Monster, Animal, etc. are abstract stuff implemented as base of some entitie's groups (cows, chickens, pigs are Animals for example). In your case I'd go with EntityLivingBase since you want total-pure thing (or Entity.class as mentioned before if you don't want it to live).
-
Can't you just look into code? What you need is atomicstryker's DynamicLights mod which has configuration that allows you to make moving lights. DL is the ONLY (popular) properly written mod that does it. Pure ASM magic - still - very resource-eating. Note: It's client side only.
-
1. GL > Swing in terms of games. 2. You did right thing. 3. As to buttons - extend GuiButton and Override drawing method. Use: this.mc.getTextureManager().bindTexture(resourceOfTexture); this.drawTexturedModalRect(params...); To draw texture onto button.
-
Important thing - rendering phase (added) - always pick one. Same thing appears in TickEvents. Also - never too many Push/Pops public class EventsHandler extends Gui { private static final float PI = 3.14152f; private static final int RADIUS = 90; private static final int SECTORS = 200; @SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.NORMAL) public void onRenderExperienceBar(RenderGameOverlayEvent.Post event) { Item holding; if (Minecraft.getMinecraft().thePlayer.getHeldItem() != null) { if (event.type == ElementType.ALL) { holding = Minecraft.getMinecraft().thePlayer.getHeldItem().getItem(); if (holding instanceof ItemBag && HotbarBag.bagHUD.getIsKeyPressed()) { BagInventory inventory = new BagInventory(Minecraft.getMinecraft().thePlayer.getHeldItem()); int items = 0; for(int i = 0; i < inventory.getSizeInventory(); i++) { if (inventory.getStackInSlot(i) != null) items++; } int x = event.resolution.getScaledWidth() / 2; int y = event.resolution.getScaledHeight() / 2 - 15; if (items != 0) { float multiplier = this.SECTORS / items; GL11.glPushMatrix(); GL11.glColor4f(0.6F, 0.6F, 0.6F, 0.3F); GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glVertex2f(x, y); for(int i = 0; i < items; i++) { for(float n = 0 + (i * multiplier); n <= (this.SECTORS / items) + (i * multiplier); n += 1) { float t = 2 * PI * (float) n / (float) this.SECTORS; GL11.glVertex2d(x + Math.sin(t) * this.RADIUS, y + Math.cos(t) * this.RADIUS); } } GL11.glEnd(); ItemStack itemStack = inventory.getStackInSlot(1); EntityItem entity = new EntityItem(Minecraft.getMinecraft().theWorld, 0, 0, 0, itemStack); GL11.glPopMatrix(); } } } } } }
-
Best way to store a player into IEEP?[1.8]
Ernio replied to ItsAMysteriousYT's topic in Modder Support
Player's UUID is same forever. You need to store UUID and retrieve EntityPlayer from world.getPlayerByUUID(). -
MinecraftForge.EVENT_BUS.register(new ForgeEvents()); Also - it should be in client proxy. (since it is rendering, you should separate common and client events) There are Forge and FML events - 2 different buses.
-
There are 2 pickup events! Many people don't know that EntityItemPickupEvent can be cancelled and is called before you pickup EntityItem, so that is what you are looking for.
-
how to you get the world without a method. 1.7.10
Ernio replied to BoonieQuafter-CrAfTeR's topic in Modder Support
This thread is getting ridiculus: 1. OP doesn't know basic programming logic (not just Java). 2. OP fails to see that World is an Object - and you can't just pull that out your ass, can you? 3. Noone even tries to explain this "basic logic". I know it's not Java school, but this guy clearly doesn't see the fact that you can't just grab a totally random world and operate on it. Now: 1. You should NEVER, EVER use Minecraft.class outside client-side classes (that said - use proxy if you need). Minecraft.getMinecraft().theWorld This is only for your world, where you are currently at (your player), on client side - used only for local stuff. 2. One server has many worlds - you can't "grab" a world. END OF DISCUSSION 3. If you really need a world: * You pass it to the method. * You ship it within other object. In Minecraft - the "other objects" are Entities (players, mobs) from which you can pull out world with entity.worldObj. 4. So if you REALLY want to make your cooldown method have world param: private int getCooldown(ItemStack stack, World world) { boolean offCooldown = isOffCooldown(stack, world); //something } private boolean isOffCooldown(ItemStack stack, World world) { return !stack.hasTagCompound() || (world.getTotalWorldTime() - stack.getTagCompound().getLong( "LastUseTime")) >= getCooldown(stack); } And you call #getCooldown with world as passed param - e.g getting it from entity/player holding it. This should end the discussion. Other answer is - you want to get main dimension of server - in this case you can get it from: MinecraftServer.getServer().worldServers[i] - where "i" is some world in list (read point 2.). EDIT Also - indeed - to save cooldown use itemStack's NBT - BUT don't save the ticks and decrement like proposed above - use timestamps and save server tick time - meaning the total ticks this server ran (time in different worlds can be different so timestamps become useless). -
Please, just rename your methods - you will see it right away. (If I am right - because I don't see full code). You are making (at least what it seems like, because I don't see neither whole class, nor its super class which you call with super.method()) infinite loop in your method callings.
-
There is actually difference between entityId and UUID. entityID is an integer assigned to entity spawned in world - this ID is shared between client and server logical sides and is used mostly in synchronization processes. entityId is generated once per one-time-world-join and is NOT persistent. entityUniqueId is the UUID of entity - generated once per entity existance, saved to world and loaded on entity load. It is persistent. Edit: Note that UUID is NOT valid on client side - only server has "real" uuid that is persistent. Client generates fakes. You need to use second one if you want persistence.
-
Infinite loop? Please - rename variables, methods and make it readable. EDIT I feel the need to point out that is not question - this IS the answer.
-
[1.8][GUI][FONT] Justified text in Minecraft
Ernio replied to Major Squirrel's topic in Modder Support
Because "Lorem Ipsum" is too mainstream. -
How to increase the update frequenzy of an entity
Ernio replied to Kloonder's topic in Modder Support
Damn 1. Use !world.isRemote to run code on server logical side - that is regarding to operation on world (chaning blocks) aswell as spawning entities. 2. What was said - you cannot hold ANY fields that are not shared between all Items in YourItem.class. There is ever only one instance of Item, what player is holding (or world, or whatever) is an ItemStack and only it holds stack-specific data. Globall Entity field will cause issues when used with more than one item (multiplayer). That said - you need to save everything you need to ItemStack used by player - if you need it CAN BE a reference to block spawned in world (entityId) - note that it does not presist through sessions so it is useless after unload. 3. You problem lies in bad minecraft code understanding, not "how to make it synchro faster" - fix issues mentioned above. -
List<IResourcePack> defaultResourcePacks = ObfuscationReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks", "field_110449_ao"); defaultResourcePacks.add(new FileResourcePack(new File("C:/Users/My/Stuff/iAmRetarded/lol/hiddenMessage/pack.jar"))); Minecraft.getMinecraft().refreshResources(); In this example the pack.jar will be treated as LITERALLY normal resource pack (zip/jar) - so resource pack structure applies (assets/modid/textures/...etc). Idk if there is direct implementation for normal "folders" (above is for .jar/.zips only, I belive), but if there is not - you can make one, easy stuff.