Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

desht

Members
  • Content Count

    244
  • Joined

  • Last visited

  • Days Won

    13

Everything posted by desht

  1. You should be able to use Minecraft.getMinecraft().timer.renderPartialTicks in your InputUpdateEvent handler to determine how long it's been since the last tick (that number is a float between 0.0f and 1.0f). Use this to interpolate; interpolation is calculating a value between two values, e.g. float interpolated = oldVal + (newVal - oldVal) * partialTicks; Obviously that means storing the old value as a copy of the latest value each tick.
  2. Yes, a modern Forge server mod should be able to do everything Bukkit/Spigot could do. Client-side modding is required for anything that adds blocks/items/entities/custom GUIs/custom graphical effects/etc.
  3. Worldgen has changed very considerably from 1.12 to 1.13+ : https://gist.github.com/williewillus/353c872bcf1a6ace9921189f6100d09a#world-gen-changes The link in there to Barteks2x's doc may be useful here: https://gist.github.com/Barteks2x/41122efc766afdd47aeb457a3c19b275
  4. Yes, you should override your block's onReplaced() method and drop any contained items there. Note that dropping the contents of a tile entity's inventory is a different operation from dropping the tile entity's own block (which should be done by a loot table in 1.14). Please don't make your tile entity a subclass of LockableLootTileEntity, which uses the vanilla IInventory system. Instead use Forge capabilities, and store your items in an IItemHandler implementation (most likely ItemStackHandler or a subclass of that). If you insist on using vanilla IInventory, don't be surpris
  5. SoundHandler doesn't exist on the server, because the server has, of course, no concept of how to play a sound (or even what a sound is, other than some symbol in a registry). If you want to control the playback/pause/stop of client-side sound playing from the server, you'll need to send custom packets to any interested clients. This doesn't necessarily need to be an explicit play/pause/stop packet; you could control playback from a client-side entity or tile entity, for example, and there are already ways of sync'ing information to those.
  6. Take a look through AbstractSkeletonEntity, and RangedBowAttackGoal. RangedBowAttackGoal has the strafing code (in its tick() implementation). What you'll need to do is remove that goal for the skeleton and replace it with a goal that lacks the strafe code. Fortunately, it looks like that shouldn't be too hard, since the skel's combat code is set up via AbstractSkeletonEntity#setCombatTask(), which gets called when the skel is created (whether via spawn or restoration from NBT), and when its held weapon changes. You should be able to hook entity spawning to call your own code to
  7. Container and GUI creation is very different in 1.14.x compared with 1.12.2. I wrote a post about it here while figuring it out: I hope you're developing in 1.14.x and not the dead-end that is 1.13.x. And the reason you're not finding any GuiXXXX classes in vanilla is that they've all been renamed to xxxScreen (e.g. HopperScreen).
  8. isOpaqueCube() is definitely still in Block (although the method signature has changed). Its default implementation should be fine for most cases. isFullCube() is gone and no longer needed since Minecraft can determine that from your block's voxel shape.
  9. There's also a minecraft:fences tag, which includes all wooden fences plus the nether brick fence. That sounds like a suitable place to add your metal fence. To add your block to that tag, create a file src/main/resources/data/minecraft/tags/blocks/fences.json in your project, and add something like: { "replace": false, "values": [ "yourmod:your_fence_block" ] } substituting in the correct block ID, of course. The "replace": false part there indicates that you're appending your block to the minecraft:fences tag, rather than overwriting it. If you
  10. Also, consider very carefully whether you should be using NBT here, or whether it would be better to have 3 separate Blocks (poor/medium/rich). Have a read of https://gist.github.com/williewillus/353c872bcf1a6ace9921189f6100d09a#dealing-with-item-metadata, in particular the points about abusing NBT to replace metadata. Remember that the number of blocks & items you can have is (for all intents and purposes) unlimited in 1.13+.
  11. Nope, @ObjectHolder is not new - it's been around since 1.10. Read https://mcforge.readthedocs.io/en/latest/concepts/registries/ (although it's written for 1.12.2, the concepts still apply in 1.14+). Learn it, use it - it's the Right Way to do things with Forge, especially in 1.14 where so many more things are in registries.
  12. Yes, that is correct. It's probably only important if you want to draw specifically over or under an existing element. If drawing on a separate area of the screen, either should be fine (and of course the Pre event is cancelable, while the Post event is not).
  13. RenderGameOverlayEvent.Pre (or possibly Post) is the right place, but to just draw something on the screen, I don't see the need to extend Screen (which is what GuiScreen is now called in 1.14). Just draw on the main screen, having checked the element type you want to draw before or after. drawTexturedModalRect() and the various related methods are now all called blit() (overloaded by the parameters they take, which are the same as in 1.12.2 so a direct method rename should be possible), and can be found in AbstractGui. There is a blit() overload which takes a TextureAtlasSprite,
  14. Shouldn't that be /data/[modid]/loot_tables/blocks/[block registry name].json ? Also, @NickDerMitHut I believe modded loot tables require a "name" field (in the pool itself, not just the entries). This is in contrast to vanilla loot tables which don't. The name should be something unique, so prefix it with your mod id (e.g. "cockmod:somepoolname").
  15. Rather than creating an entity at all, do what @Cadiboosaid and just render the entity's model in your TESR. I.e. do what your RenderCultist (or whatever) class does in its doRender() method.
  16. Yeah, the horse inventory handling does appear to be a bit of a special case. I'm not sure what the correct modded solution is at this point; that's something that will need some experimentation...
  17. https://gist.github.com/williewillus/353c872bcf1a6ace9921189f6100d09a#world-gen-changes
  18. No worries. One other thing, regarding my point about one-to-one container->GUI mappings... If you have one container object but you want several different GUIs (my use case: Modular Routers modules nearly all use the same container object - a 9-slot inventory for filtering - but several modules have extra GUI controls for configuring module-specific properties), then: A separate container type will need to be registered for each GUI type, but you can use the same subclass of Container each time, just with a different ContainerType parameter. Then you can associate
  19. Bit of follow up since I understand a bit more now.... To get extra data passed across to the client (like a TE blockpos, for example), Forge 26.0.16 adds an extra PacketBuffer parameter to the NetworkHooks.openGui() calls, and a corresponding parameter to the container factory constructor. Looks like NetworkHooks.openGui() remains the way to go for modded - I guess player.openContainer() is really for vanilla only? Update: player.openContainer() should be fine to use if you're just creating a GUI purely to display some container slots (and don't need direct access to the cli
  20. As anyone who's started porting to 1.14.2 is probably aware by now, container and GUI creation has changed... quite a bit. To summarise what I've gathered so far: Containers (more accurately: container types) are now registry objects and must be registered in a RegistryEvent.Register<ContainerType<?>> event handler. Container objects themselves must provide a constructor of the form MyContainer(int windowId, PlayerInventory inv, PacketBuffer extraData). This will be used to instantiate the client-side container. Your container's constructor must call the super C
  21. Further to what everyone else has said - use the EntityJoinWorldEvent#getEntity() method, checking if it's instanceof EntityPlayer. Attempting to use the Minecraft class server side will crash your game when run on a dedicated server, because Minecraft doesn't exist server-side. So drop that idea now, it's a non-starter.
  22. Item#setMaxDamage(int) can be used to define the maximum damage an item can take. Call that in the item's constructor. ItemStack#damageItem(int, EntityPlayer) or ItemStack#setItemDamage(int) can be used to damage or repair the item.
  23. A little offtopic (sorry), but is there a particular reason you're calling markDirty() in getCapability()? Bearing in mind that markDirty() calls World#updateComparatorOutputLevel() which can do a potentially non-trivial amount of work (calling Block#onNeighborChange() on all your block's neighbors, and possibly even some of their neighbors too).
  24. Fabric is an alternative modding API which is available on 1.14.2 now. But it's not Forge, so no - no Fabric questions here, please. Go to https://fabricmc.net/discuss/.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.