Jump to content

Darkorg69

Members
  • Posts

    21
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Darkorg69's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. You need to create a class which extends from Screen and overrides init() and render(). Make sure you load the screen only on Dist.CLIENT! Common mistake with Screens is trying to reach across logical sides, like trying to access data which is only present on the logical server from the logical client. Any manipulation of data should be handled with packets. Eg. you edit the sign, and the input is then encoded and send to the server as NBT, then decoded on the server and saved into the BlockEntity, and lastly synchronized to each individual player, best case to prevent unneeded syncronization is to make your logical client only send a update request when rendering the BlockEntity. Because in a server scenario a player 1000 chunks away should probably not know about your sign and what it says, as they don't even see it. It really depends and what you want to achieve. Note that you might need to attach a Capability to store data on your BlockEntity. I hope this helps
  2. first your mixin should extend/implement everything the target class is extending or implementing second, always declare your mixins abstract so you don't accidentally instantiate them. then just cast ((object) (target class) this).->... it should work as both mixin class and target class are objects
  3. When I do runData, it doesn't show any errors and it says that all providers took 0ms to finish. It just broke after updating to 1.19.3 PS: fixed, problem was method was not static.
  4. So I am getting this error while trying to register a seed blockitem for a crop block. Blocks class: Items class: SeedBlockItem class: ModCropBlock class: Main class: I have registered the block but the supplier.get() doesn't resolve the block for some reason. Any ideas what is wrong?
  5. It's my bad I forgot about the online docs, I meant there was not enough documentation in the IDE when looking through the classes. I got it to work now. public class ModBlockStateProvider extends BlockStateProvider { public ModBlockStateProvider(DataGenerator gen, String modid, ExistingFileHelper exFileHelper) { super(gen, modid, exFileHelper); } @Override protected void registerStatesAndModels() { addCropBlock(ModBlocks.TOMATOES.get()); } public void addCropBlock(Block pBlock) { this.getVariantBuilder(pBlock) .forAllStates(state -> ConfiguredModel.builder() .modelFile( models().getExistingFile( modLoc(pBlock.getRegistryName().getPath() + "_stage" + state.getValue(((CropBlock) pBlock).getAgeProperty())) ) ) .build() ); } }
  6. So I am trying to generate crop blockstate.json files by using BlockStateProvider. I'm not finding a method in the class handling crops. I guess it has to be done with the VariantBuilder from getVariantBuilder(BLOCK).forAllStates(state -> ...), from what I understand the function takes returns ConfiguredModel[] but how I am supposed to add definitions for each variant? Documentation is not very clear, can someone briefly explain how does this work. I'm using Forge 40.1.86 for 1.18.2. Generated JSON's should look like this: { "variants": { "age=0": { "model": "examplemod:block/example_crop_stage0" }, "age=1": { "model": "examplemod:block/example_crop_stage0" }, "age=2": { "model": "examplemod:block/example_crop_stage1" }, "age=3": { "model": "examplemod:block/example_crop_stage1" }, "age=4": { "model": "examplemod:block/example_crop_stage2" }, "age=5": { "model": "examplemod:block/example_crop_stage2" }, "age=6": { "model": "examplemod:block/example_crop_stage2" }, "age=7": { "model": "examplemod:block/example_crop_stage3" } } }
  7. I mean the respawn button doesn't work at all. Nothing happens when I press it.
  8. So, I have a capability storing some data, so I want to keep the data when the player dies (if resetOnDeath is false) or when he comes back from the end dimension. Here's my code: @SubscribeEvent public void onPlayerClone(PlayerEvent.@NotNull Clone event) { if (!event.isWasDeath() || !ServerConfig.resetOnDeath.get()) { Player original = event.getOriginal(); original.reviveCaps(); original.getCapability(PlayerCapabilityProvider.PLAYER_CAP).ifPresent(oldCap -> { event.getEntity().getCapability(PlayerCapabilityProvider.PLAYER_CAP).ifPresent(newCap -> { newCap.setNBTData(oldCap.getNBTData()); }); }); original.invalidateCaps(); } } Event is registered though the Forge EventBus, registration is located at FMLCommonSetupEvent. When testing in a singleplayer world, everything seems to be perfectly working. When I join a server however and die, the respawn button does nothing. Any ideas? PS: I'm using latest Forge version 43.1.43 for 1.19.2.
  9. Already tried that, unfortunately it doesn't work. Also tried setting field arrow.hurtMarked = true; , but that also doesn't work.
  10. Long story short, I'm writing some mod which allows you to increase your arrow speed and bow draw speed. Currently I'm handling this though events. @SubscribeEvent public void onArrowSpeed(@NotNull EntityJoinLevelEvent event) { if (event.getEntity() instanceof Arrow arrow) { if (arrow.getOwner() instanceof ServerPlayer serverPlayer) { serverPlayer.getCapability(PlayerCapabilityProvider.PLAYER_CAP).ifPresent(capability -> { if (capability.isUnlocked(serverPlayer, ARROW_SPEED)) { int level = capability.getLevel(serverPlayer, ARROW_SPEED); //Level is value between 0 and 20; if (level > 0) { float modifier = 1.0F + level * 0.05F; arrow.setDeltaMovement(arrow.getDeltaMovement().scale(modifier)); } } }); } } } @SubscribeEvent public void onBowDraw(@NotNull ArrowNockEvent event) { if (event.getEntity() instanceof ServerPlayer serverPlayer) { if (event.getBow().getItem() instanceof BowItem) { serverPlayer.getCapability(PlayerCapabilityProvider.PLAYER_CAP).ifPresent(capability -> { if (capability.isUnlocked(serverPlayer, BOW_DRAW)) { int level = capability.getLevel(serverPlayer, BOW_DRAW); //Level is value between 0 and 10; if (level > 0) { //I have used AT to make this field public from protected; serverPlayer.useItemRemaining -= level; } } }); } } } } Problem I have is this delta movement data is not syncronized with the client, because when I shoot the arrow, at first the arrow goes in another direction and later actually syncs to it's real position. In other words client-side animation is bugged/not properly synced. To better visualize the problem I'm including a video: https://streamable.com/x741gp Any ideas how can I fix this?
  11. Yup, thanks For some reason my EventHandler was looking like this. Probably I have hit Ctrl+D....
  12. I have some problems making a Capability work. Upon joining a world this happens: Console says: This is my Capability class: This is my CapabilityProvider: AttachCapabilities event:
  13. Can someone explain to me shortly the process of registering and rendering a gui with forge on latest 1.18.2 version. It's has completely changed from 1.12.2 and I feel lost. I need to make simple gui's, first has to render a scaled box in the middle of the screen as background, inside the box, just a few buttons with text and texture from an ItemStack inside and a simple Done button, rendered below the background box which sends the data chosen from the other buttons to the Server for sync.
  14. Which minecraft version are you using? Refined Storage, Mekanism and their Addons mods cannot load. Try removing these.
  15. The issue was related to a typo in my BlockItem declaration.
×
×
  • Create New...

Important Information

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