-
Posts
106 -
Joined
-
Last visited
-
Days Won
1
Posts posted by kaydogz
-
-
Just now, Draco18s said:
(Unless you're trying to override a vanilla recipe)
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
-
-
Replace the package titled 'minecraft' (right below data) with your modid. Your recipes should be under your modid namespace, not the minecraft namespace.
-
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.
-
14 hours ago, Skyriis said:
need still help
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.
-
1 minute ago, PixxiBunny said:
Alright, here's what I got. Still some errors though, any idea what's wrong?
// Food public static final RegistryObject<Item> COTTON_STEAK_RAW = ITEMS.register("cotton_steak_raw", ItemBase::new); public static final RegistryObject<Item> COTTON_STEAK = ITEMS.register("cotton_steak", () -> return new Item(new Item.Properties().food(Foods.COTTON_STEAK))); public static class Foods { public static final Food COTTON_STEAK = (new Food.Builder()).hunger(8).saturation(12.8f).meat().build(); }
Sorry, my bad. I had a typo from before. Just remove the return
-
15 minutes ago, PixxiBunny said:
It's saying cannot resolve symbol 'foodInstance'. Also, where would I place this code?
// Food public static final RegistryObject<Item> COTTON_STEAK_RAW = ITEMS.register("cotton_steak_raw", ItemBase::new); public static final RegistryObject<Item> COTTON_STEAK = ITEMS.register("cotton_steak", ItemBase::new); public static class Foods { public static final Food COTTON_STEAK = (new Food.Builder()).hunger(8).saturation(12.8f).meat().build(); } new Item(new Item.Properties().food(foodInstance)) }
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. -
14 minutes ago, PixxiBunny said:
How would I do this? I'm sorry I'm asking so much, I'm fairly new to this.
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.
-
13 minutes ago, PixxiBunny said:
Here's what I got, still not letting me eat it:
// Food public static final RegistryObject<Item> COTTON_STEAK_RAW = ITEMS.register("cotton_steak_raw", ItemBase::new); public static final RegistryObject<Item> COTTON_STEAK = ITEMS.register("cotton_steak", ItemBase::new); public static class Foods { public static final Food COTTON_STEAK = (new Food.Builder()).hunger(8).saturation(12.8f).meat().build(); }
It's not letting you eat it because you haven't applied the food to the item's Item.Properties
-
4 minutes ago, PixxiBunny said:
I'm sorry, but how would I do this?
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
-
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.
-
16 minutes ago, PixxiBunny said:
How would I do that exactly?
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.
-
1
-
-
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.
-
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. -
51 minutes ago, Scholler said:
So KeyBinding is like keyBindings[0] = new KeyBinding("Blabla..", KeyValue, "blabla");
It was working in 1.12 but there is no org.lwjgl.input.Keyboard to use in 1.15 forgeNo... 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
-
You need to provide more context like where this line is
-
-
On 1/26/2020 at 2:43 AM, Cadiboo said:
Can't you just subscribe to the open GUI event and replace the screen with one that overrides Screen#isPauseScreen to return false?
How would I go about doing that
[1.15.2] Can't return a FloatNBT
in Modder Support
Posted
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.