-
Posts
106 -
Joined
-
Last visited
-
Days Won
1
Everything posted by kaydogz
-
You don't need to have the 'new' in front of the FloatNBT#valueOf. The method is already creating one. Also, you want a float, not an int so use FloatNBT#getFloat instead of FloatNBT#getInt.
-
Well yeah, but I figured he's not trying to override though.
-
Use DeferredWorkQueue. It's only deprecated as a 'todo': This is being deprecated in favour of a new interface on loading events, to remove confusion about how it operates. #TODO
- 1 reply
-
- 1
-
Replace the package titled 'minecraft' (right below data) with your modid. Your recipes should be under your modid namespace, not the minecraft namespace.
-
[SOLVED][1.15.2] Problems with PlayerEntity#changeDimension
kaydogz replied to Novârch's topic in Modder Support
I'm pretty sure your issue is arising from the fact that the entity is trying to change the dimension of the player while they are in the loading screen for the dimension. Btw, why do you have so many variables for your player? I'd remove the mastername and master entity variables and just keep the uuid. When you are using the player, just use World#getPlayerByUuid. -
[SOLVED] [1.15.2] Players don't regenerate their full hp
kaydogz replied to Skyriis's topic in Modder Support
Try rounding the health float to the nearest tenth. I think when it is being rendered, the float cuts off anything past the tenths place. -
What is the name of your .mcmeta file? It should end with .png.mcmeta not just .mcmeta
-
For every loaded chunk in the Overworld, I want to load the chunk which corresponds with it in my dimension (same x and z). I currently have: @SubscribeEvent public static void chunkLoad(final ChunkEvent.Load event) { if (event.getWorld() != null) if (!event.getWorld().isRemote()) { ServerWorld world = (ServerWorld) event.getWorld(); if (world.dimension.getType() == DBMDimensions.realm_of_the_ancients) { // Force Loads Corresponding Chunks in the Overworld DBMChunkManager.getLoadedChunks(world).forEach((a, b) -> world.getServer().getWorld(DimensionType.OVERWORLD).forceChunk(b.getPosition().x, b.getPosition().z, true)); } else if (world.dimension.getType() == DimensionType.OVERWORLD && DBMDimensions.realm_of_the_ancients != null) { // Force Loads Corresponding Chunks in the Realm of the Ancients DBMChunkManager.getLoadedChunks(world).forEach((a, b) -> world.getServer().getWorld(DBMDimensions.realm_of_the_ancients).forceChunk(b.getPosition().x, b.getPosition().z, true)); } } } @SubscribeEvent public static void chunkUnload(final ChunkEvent.Unload event) { if (event.getWorld() != null) if (!event.getWorld().isRemote()) { ServerWorld world = (ServerWorld) event.getWorld(); if (world.dimension.getType() == DBMDimensions.realm_of_the_ancients) { // Force Unloads Corresponding Chunks in the Overworld world.getServer().getWorld(DimensionType.OVERWORLD).forceChunk(event.getChunk().getPos().x, event.getChunk().getPos().z, false); } else if (world.dimension.getType() == DimensionType.OVERWORLD && DBMDimensions.realm_of_the_ancients != null) { // Force Unloads Corresponding Chunks in the Realm of the Ancients world.getServer().getWorld(DBMDimensions.realm_of_the_ancients).forceChunk(event.getChunk().getPos().x, event.getChunk().getPos().z, false); } } } And here is the class I made to get the loaded chunks: public class DBMChunkManager { private static final Field LOADED_CHUNKS_FIELD = ObfuscationReflectionHelper.findField(ChunkManager.class, "immutableLoadedChunks"); static { LOADED_CHUNKS_FIELD.setAccessible(true); } @SuppressWarnings("unchecked") @Nullable public static Long2ObjectLinkedOpenHashMap<ChunkHolder> getLoadedChunks(ServerWorld world) { try { return (Long2ObjectLinkedOpenHashMap<ChunkHolder>) LOADED_CHUNKS_FIELD.get(world.getChunkProvider().chunkManager); } catch (Exception e) { e.printStackTrace(); } return null; } } However, any time I try to create a new world, the game gets stuck at 0%. The last console message to show up is: [01May2020 23:18:46.645] [Server thread/INFO] [net.minecraftforge.common.DimensionManager/DIMS]: Registered dimension daboismod:the_realm_of_the_ancients of type daboismod:the_realm_of_the_ancients and id 3 The game doesn't crash or suspend, it just does not do anything from this point onward. Any help is greatly appreciated.
-
Sorry, my bad. I had a typo from before. Just remove the return
-
foodInstance is what I put as a placeholder for the instance of your food, which is for you, Foods.COTTON_STEAK. You would put the line as such: ITEMS.register("itemregistryname", () -> new Item(new Item.Properties().food(foodInstance))); As I said before, please learn java before you start modding. Edit: And please remember to swap my placeholders for your values.
-
new Item(new Item.Properties().food(foodInstance)) PLEASE learn basic java before you start modding, so you won't have to ask questions like these.
-
It's not letting you eat it because you haven't applied the food to the item's Item.Properties
-
new Food.Builder(....).build() then when instantiating your item, pass in your food instance: new Item.Properties().food(foodinstance)
-
On line 23 of RegistryHandler.java, you repeat ITEMS instead of BLOCKS. Also, I do not recommend following youtube tutorials, as they often include bad code practice, such as the use of 'ItemBase.'
-
I'd look into net.minecraft.client.renderer.FirstPersonRenderer
-
[1.15.2] Where to put keepLoaded to keep dimension loaded?
kaydogz replied to kaydogz's topic in Modder Support
After looking into it more, I moved the line to the RegisterDimensionsEvent, but the dimension still does not stay loaded when the player is not in it. -
You would create a new instance of java.util.Random then use random.nextInt() * (max - min) + min to get a random integer between min and max (inclusive, exclusive). Since you're new to modding and java, I strongly recommend taking a java course to learn about java.util.Random and more of the basics before you proceed. Modding Minecraft is not the best way of learning the language.
-
I want my dimension to stay loaded all the time, so I want to use keepLoaded. However, I don't know where to put it. Here is what I have currently: (this line is called in FMLCommonSetupEvent) DimensionManager.keepLoaded(DimensionManager.registerDimension(DaBoisMod.modLocation("the_realm_of_the_ancients"), DBMDimensions.the_realm_of_the_ancients, new PacketBuffer(Unpooled.buffer(16)), false), true); However, it doesn't work, as the dimension unloads when I leave it. Am I putting keepLoaded in the wrong place? Thanks for any help.
-
[SOLVED] [1.15.2] Nullifying fall damage does not work
kaydogz replied to kaydogz's topic in Modder Support
Thanks guys! I finally got it to work. I'm not exactly sure how I didn't know the LivingFallEvent existed... but here's the code for anyone that wants to see: @SubscribeEvent public static void playerTick(final TickEvent.PlayerTickEvent event) { if (event.side == LogicalSide.SERVER && event.player.dimension == DBMDimension.getType(DBMDimensions.the_realm_of_the_ancients_dimension) && event.player.getPosition().getY() <= 0) { DBMTeleporter.teleportPlayerTop(event.player); if (!DaBoisMod.getCapabilityOf(event.player, FallingFromSkyProvider.FALLING_FROM_SKY_CAPABILITY).isFallingFromSky()) DaBoisMod.getCapabilityOf(event.player, FallingFromSkyProvider.FALLING_FROM_SKY_CAPABILITY).setFallingFromSky(true); } } @SubscribeEvent public static void livingFall(final LivingFallEvent event) { if (event.getEntity() instanceof PlayerEntity) { PlayerEntity player = (PlayerEntity) event.getEntity(); if (DaBoisMod.getCapabilityOf(player, FallingFromSkyProvider.FALLING_FROM_SKY_CAPABILITY).isFallingFromSky()) { event.setCanceled(true); DaBoisMod.getCapabilityOf(player, FallingFromSkyProvider.FALLING_FROM_SKY_CAPABILITY).setFallingFromSky(false); } } } -
I made a dimension called the Realm of the Ancients, and when you fall into the abyss below, I want it to teleport you to the top of the Overworld, Aether-style. I made a capability called FallingFromSky which just stores a boolean that denotes if the player is falling from the dimension. Here is my code: @SubscribeEvent public static void playerTick(final TickEvent.PlayerTickEvent event) { if (event.player.dimension == DBMDimension.getType(DBMDimensions.the_realm_of_the_ancients_dimension) && event.player.getPosition().getY() <= 0) { DBMTeleporter.teleportPlayerTop(event.player); if (!DaBoisMod.getCapabilityOf(event.player, FallingFromSkyProvider.FALLING_FROM_SKY_CAPABILITY).isFallingFromSky()) DBMPacketHandler.sendToServer(new SSyncFallingFromSkyPacket(true)); } if (event.side == LogicalSide.SERVER && DaBoisMod.getCapabilityOf(event.player, FallingFromSkyProvider.FALLING_FROM_SKY_CAPABILITY).isFallingFromSky()) { if (!event.player.onGround) event.player.fallDistance = 0F; else DBMPacketHandler.sendToServer(new SSyncFallingFromSkyPacket(false)); } } The packets just set the falling from sky variable. When I fall into the void of the dimension, it successfully teleports me to the top of the Overworld and I fall to the ground and take no damage. However, when I open to LAN just to test how it would work on a server, I die when falling. I tried to debug by logging to the console the falling from sky variable every tick, and it shows that the value is true for only a second in the Overworld, after which it turns false. Any help is appreciated.
-
No... create a static KeyBinding and instantiate it in FMLClientSetupEvent. In the same event, register it to the client using ClientRegistry::registerKeyBinding
-
If you are trying to add a recipe to the recipe book, then you need to create a recipe advancement which gives the player the recipe in the recipe book. You can do this with a simple json file, look for the vanilla jsons as a template
-
[1.15.2] java.lang.IllegalStateException: Removing entity while ticking!
kaydogz replied to Novârch's topic in Modder Support
You need to provide more context like where this line is -
bump
-
How would I go about doing that