warjort
Members-
Posts
5420 -
Joined
-
Last visited
-
Days Won
175
Everything posted by warjort
-
(1.18.2) Block entity renderer disappears after leaving the world
warjort replied to ElTotisPro50's topic in Modder Support
The inventory is only sent when you right click a block as part of showing the screen. If you want data to always be available you need to tell minecraft how to do this. BlockEntity already has some infrastructure for this, but its default logic does nothing - as will overriding the methods and just calling super() like you have. For reference look at something like BeaconBlockEntity which sends data to the client so it can for example draw the beam correctly. 1) getUpdatePacket() says how to create your network packet, by default this returns null so nothing happens. You need to change this to actually do something, e.g. the beacon does @Override public ClientboundBlockEntityDataPacket getUpdatePacket() { return ClientboundBlockEntityDataPacket.create(this); } 2) The above logic calls back to your getUpdateTag() to actually get the data. By default this just returns an empty CompundTag. The beacon changes it to use the same logic as the data saved to disk. @Override public CompoundTag getUpdateTag() { return this.saveWithoutMetadata(); } 3) When the data arrives on the client it will call onDataPacket() - the default behaviour for this is to call load() NOTE: After your block entity is initially loaded and sent to the client, additional packets will only be sent when the block is marked as "dirty". This is the same call that needs to be made to make sure your changed data is saved to disk. You can do this by either by calling setChanged on your BlockEntity or by calling Level.blockEntityChanged(). You can see BeaconMenu uses the second method in updateEffects(). -
There are other considerations, it depends what you are actually trying to achieve? e.g. if the player has haste or mining fatigue.
-
You can pretty much always mine a block. You just don't get any items/drops. Try punching obsidian for long enough. There are exceptions like * Command Blocks which is hardcoded, * Bedrock which has a destroy speed of -1 * or if somebody uses one of the forge events to cancel() the block break. But I don't think there is any generic way to test for this? They are "ad hoc" logic.
-
Player.hasCorrectToolForDrops()
-
How to make hitboxes "invisible" to player's interactions?
warjort replied to Jetug's topic in Modder Support
I am not sure I understand what you are doing, but entity hitboxes are controlled by Entity.getDimensions(Pose). See Entity.refreshDimensions() for the full logic. For how the game determines what to interact with, see GameRenderer.pick() -
Mojang didn't provide a way to do that. Presumably because it is a lot of work to do it. This reddit thread discusses how to do it manually by editing the json, but it requires a lot of technical knowledge on the old custom world format and the new world format: https://www.reddit.com/r/minecraft_configs/comments/hz4ti7/is_it_technically_possible_to_convert_an_old/ But this has a number of problems, e.g. * Since that thread is 2 years old, the information on that thread will be out-of-date. 1.18 had major changes to world gen storage, hence your problem. * It assumes a vanilla world, while you said you had Biomes o Plenty which will have additional world gen config that would needs to be converted BTW: I think even in 1.16 the old custom world format wasn't really properly supported. Instead it just kept any world chunks that you had already created and generated normal (non-custom) chunks for new ones?
-
I'm fairly sure no version of forge (or java) has supported uninitialsed data. ๐ Since you like videos: https://www.youtube.com/results?search_query=nullpointerexception+in+java
-
[18Aug2022 01:12:41.158] [Render thread/ERROR] [net.minecraft.world.level.storage.LevelStorageSource/]: Exception reading C:\Users\Princess\AppData\Roaming\.minecraft\saves\16_5 Creative (Azimuth) NonBOP-copy\level.dat java.lang.IllegalStateException: Unable load old custom worlds. at net.minecraft.util.datafix.fixes.WorldGenSettingsDisallowOldCustomWorldsFix.m_185165_(WorldGenSettingsDisallowOldCustomWorldsFix.java:25) ~[client-1.18.2-20220404.173914-srg.jar%2374!/:?] Your world uses the old custom world format that minecraft no longer supports in 1.18
-
[1.19.2] How to give an effect to a player during an event
warjort replied to Pherment's topic in Modder Support
See MobEffects here: https://forge.gemwire.uk/wiki/Main_Page -
[1.19.2] How to give an effect to a player during an event
warjort replied to Pherment's topic in Modder Support
EntityMountEvent -
I don't know much about VSCode and the error message doesn't give much to go on. From the error message, it could be something is missing in your gradle cache and you are running gradle in offline mode so it won't try to download it and instead just say it is missing. It could also be you mistyped a version number (e.g. wrong forge version for the minecraft version), although it looks correct to me at first glance. Another thing it might be is a previous run of a gradle task only partially downloaded something. And so you have a broken file in your gradle cache. You can try running gradle with --debug to see if it gives some useful information. But usually a simpler fix is to exit your ide (to make sure gradle is not running in the background). If you have previously run gradle from the command line use gradlew --stop as well Then delete /C:/Users/judea/.gradle/caches/forge_gradle/ This will force ForgeGradle to redownload everything from scratch. That way you don't have to try to figure out which file is broken.
-
MobEffects.CONFUSION
-
AbstractArrow.tick() has the "physics" The calculation is an iteration and uses floating point so it won't match exactly simple equations using calculus. The initial velocity calculation can be found in for example BowItem.releaseUsing() or CrossBowItem.shootProjectile() For at least the crossbow this has a random component, see Projectile.shoot() There is a kind of cheat answer to your question. The server stops ticking entities at the "simulation distance". So if the arrow reaches that distance, it will be the maximum, assuming the player stands still and never moves towards the arrow to make it tick again. ๐
-
Which side already has the data and where is it missing? Your capability data. You need to spend time thinking about this, you don't seem to have a clear understanding of what the problem is or what you need to do solve it.
-
@Override public InteractionResult mobInteract(Player player, InteractionHand hand) { Item item = player.getItemInHand(hand).getItem(); Item addTrackerItem = ModItems.TRACKER.get(); if (item == addTrackerItem && !this.hasTracker()) { // HERE: You are trying to add the tracker on the client when it should be on the server if (this.level.isClientSide) { return this.addTracker(player); } } // HERE: This will return PASS which means the server never sees this interaction return super.mobInteract(player, hand); } Compare your code with for example how the creeper interacts with flint and steel.
-
If you look at what could cause this problem, it would be because the server thinks the block is "instamine", but the client does not. So the client is sending block break progress events to the server. But the server thinks the block is already broken.
-
Haven't we already been through this discussion? https://forums.minecraftforge.net/topic/115010-1182-capability/ It doesn't look like you followed my advice there.
-
Did you send your capabilities to the client? i.e. do both the client and server agree on the break speed.
-
Your problem is with grimoireofgaia. You have 2.0.0-alpha.1 which doesn't even exist on curseforge. The latest is alpha.18 https://www.curseforge.com/minecraft/mc-mods/grimoire-of-gaia/files/all?filter-game-version=1738749986%3a73250 If you still get this error after updating to the latest version, contact the mod author.
-
Use the run.sh
-
See the bottom of here for how to broadcast packets: https://forge.gemwire.uk/wiki/SimpleChannel You probably want to use something like PacketDistributor.TRACKING_ENTITY.with(() -> player); which sends the packet to all other players in range of that "player". You will need to include the player.getId() in the packet you send. So on the client side you can then use it to do Minecraft.getInstance().level.getEntity() - check this is not null