Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/18/20 in all areas

  1. Extend `WorldSavedData` and override `read()` and `write()`. You can also create a empty constructor calling the super constructor with the name of your WorldSavedData. If you have a `ServerWorld`, `ServerWorld#getSavedData` returns a `DimensionSavedDataManager`. Call `DimensionSavedDataManager#getOrCreate` (or `#get`), passing in a Supplier that gives new instances of your WorldSavedData, and a string data identifier. I'm not very sure if this is cross-dimensional.
    1 point
  2. Check out net.minecraft.util.math.AxisAlignedBB class. You may take Player AABB and then use AxisAlignedBB#intersect method on blocks positioned at player's coordinates +1(-1). AABB has constructor AxisAlignedBB(BlockPos pos). Don't forget to check if block at selected BlockPos exists and is not air (optional)
    1 point
  3. 1) Class names were decided to start from a capital letter. Please, change your mod class name to "Testmod". 2) If you found nothing in debug.txt it means, that forge does not recognize your mod at all, because at least 1 message you log in you mod class constructor. 3) You did not subscribe your mod class with Mod.EventBusSubscriber annotation. Put "@Mod.EventBusSubscriber(bus = Bus.MOD, modid = Testmod.MODID)" before your main class.
    1 point
  4. You would need to call a event that is handled in Minecraft's constructor. Do note that forge's event bus doesn't start until mod loading is completed meaning that it has to be called from somewhere on the mod event bus. The Lifecycle Events for creating and loading registries would work, but then we have to deal with it being fired specifically for the client. The easiest event to use is actually ParticleFactoryRegisterEvent. Do remember this is on your mod's event bus and only on the client side.
    1 point
  5. https://mcforge.readthedocs.io/en/latest/blocks/interaction/#onblockactivated
    1 point
  6. When you say touching, do you mean which side they're bumping against, or which side they're clicking on? For clicking on, there's an event that gets fired (PlayerInteractEvent) that includes the face of the block they interacted with. Or, if you want a block to do something depending on which face the player interacts with, the Block class has onBlockActivated which takes a BlockRayTraceResult, which contains the side of the block that was clicked. For which side a player has run in to, that's a bit tricker. I don't think there's any event which gets fired off for that, so the easiest way would be to check PlayerTickEvent or some other similar event and just see if a player is colliding with any blocks, and then from there it'd be pretty simple (i.e. if the player is colliding with a block in the +x direction, then they must be touching the western face (since the block is to their east, the player is to the block's west)).
    1 point
  7. I remember seeing similar question in previous posts, and iirc it's mac's problem that it reads some files that isn't supposed to be read
    1 point
  8. you can use player.getHorizontalFacing() to get the player's facing, and player.getPosition() to get the blockpos of the player, and BlockPos.offset(dir) to get the translated position
    1 point
  9. MacOS creates files you don't want. Search the forum for .DS_Store:sounds.json and you'll find plenty of threads about it.
    1 point
  10. Actually, I have no certain idea how FoV works in Minecraft. But I if we assume, that it works like an optical camera, I may help you. Here you can see how world is projected to the screen (or matrix in camera). So, to negate FoV deformations you should (using spherical trigonometry) calculate angle distance to center of the screen and take a tangent of it - now you have pure coordinate - distance to target in radius of some sphere. To find a pure coordinate of screen border, you may take tan(FoV/2). Then using screen resolution calculate distance in pixels on screen between center and target. Then again using spherical trigonometry calculate angle between Center-Target and, for example, horizon line, understand that it is unchanged after projection, and get your result vector by this angle and that distance. But please, don't do that! I'm sure, more forge-like way exists to do what you want. For example, this: or net.minecraftforge.client.event.RenderWorldLastEvent.
    1 point
  11. Why would you even need that? You need to draw something near a cow? You may use RenderLivingEvent (Post subclass, if you need to draw over the cow). About your own math - check if you're rotating your vector in correct directions. Actually, you need to turn -yaw and -pitch (I see, you did it ok), because initially your vector points target, but you need it to point your looking direction. Also your yaw and pitch should be actually a difference between camera yaw and entity relative yaw, I can't see you calculating it. At last, you may use Quaternions to make you code more readable - they are at package net.minecraft.util.math.vector.Quaternion, and Vector3f has useful methods, such as rotation(float) gives you a Quternion to rotate around axis collinear to vector and transform(Quternion) to transform current vector with specified Quaternion. Happy math-ing!
    1 point
  12. It's a pretty complicated system to set up a custom village, but definitely do-able. The current Minecraft villages are created using a "Jigsaw" system. In order to do anything with custom villages, you need to understand how these function. This video is a really good explanation of the system, make sure to watch the whole thing. It's from 1.14, but for the most part the Jigsaw system hasn't changed much since then. The 1.15.2 mod "The Farlanders", which creates custom villages, has all of their code available on Github, so if you were to use that code as well as vanilla village files as reference, then you'd be in a pretty good spot. Not much more documentation exists out there regarding doing something like this, so past everything I've given you, there isn't much else available that can guide you in the process.
    1 point
  13. Sets are like arrays and lists, except they don't have an order, don't allow duplicates, and have no "positional" notation. http://net-informations.com/java/cjava/list.htm I'm not sure how you missed that when learning programming, as the comparison between a shopping list and a grab bag should have been made at some point.
    1 point
  14. private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.OAK_PLANKS, Blocks.SPRUCE_PLANKS, Blocks.BIRCH_PLANKS) Pretty much the same as in AxeItem, edited some stuff to avoid breaching Mojang's copyright. Remember that you need a class that extends ToolItem (at least in 1.15, but I don't think that changed in 1.16).
    1 point
  15. AttributeModifierMap$MutableAttribute has three main methods: func_233803_a_ which creates an empty instanceof AttributeModifierMap#MutableInstance, func_233814_a_ which adds an attribute to the map that is initialized to the default value, and func_233815_a_ which adds an attribute to the map that is initialized to the value set. Most of the entity types hold a static method of a map that is stored within GlobalEntityTypeAttributes#field_233833_b_. The default map used seems to be based on the closest parent to the child object in question (ChickenEntity would use the one in MobEntity, EndermanEntity would use the one in MonsterEntity). All changes to the base map or additional attributes are applied using MutableAttribute#func_233815_a_.MutableAttribute#func_233814_a_ only seems to be used if the value is the default or where placeholder value is used (such as in LivingEntity until called by each child). As for registering, forge added the method GlobalEntityTypeAttributes#put which satisfies the requirement of where to initialize the MutableAttribute for each custom EntityType. Since the factory used to spawn the EntityType isn't called until the entity needs to be spawned, it can probably be called within your FMLCommonSetupEvent. I'm pretty sure the method is not thread-safe however, so it is best to set it up within a DeferredWorkQueue.
    1 point
  16. Forge for 1.16.1 The first Forge build for 1.16.1 is now live thanks to the hard work of: covers, illy, jd, garrett, giga, and the rest of the forge crew. With their help we were also able to release the updates to MCPConfig for 1.16 and 1.16.1 the same day that vanilla did. The Nether Update has brought a lot of changes to many systems, and as with any update there are likely to be bugs. We are still evaluating and working on some of the systems like dimensions and trees to come up with the best system to allow for modders to integrate with vanilla’s new dimension system. We are also expecting Mojang to release a 1.16.2 fairly shortly and are prepared to work on updating to it as soon as they do. As with every update, there are bugs and other minor things to be expected. Please report them responsibly and have fun with the new version! Changes to the LTS There are a couple changes happening to the Long Term Support system originally introduced here. We are moving the LTS from 1.14.4 to 1.15.2 to reflect the community being more active and also changing how we chose what version the LTS will be to be more maintainable. We are now going to be supporting the latest (n) and second latest (n - 1) versions, with the reservation of potentially having the LTS being n - 2 if something is Mojang ends up really making a mess of a particular version. That being said we still will be providing critical fixes for all possible versions. Do not worry about 1.14 being instantly dropped while we are still working on updating 1.16, as we have a customary grace period for while everything is still in flux before we start strictly enforcing the LTS rules. New Team Members We are happy to announce we've added a few new members to the Forge team officially. These people have been a part of the community for a while and have been helping out a lot. The first two are new members of the 'Toolchain' team. Which is responsible for some of the backend tools, like the decompiler, update scripts, gradle and other internals. The others are joining our ever growing list of Triage team members. Who are responsible for managing the issues and pull requests on our github. They are the front line of bug reports and feature requests, treat them with respect and listen to what they tell you! Toolchain covers1624 JDLogic Triage AshersLab Curle OrionOnline pupnewfster
    1 point
  17. Thanks for the amazing work, it was such a fast release!
    1 point
×
×
  • Create New...

Important Information

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