Jump to content

andreybadrey

Members
  • Posts

    34
  • Joined

  • Last visited

  • Days Won

    1

andreybadrey last won the day on June 20 2023

andreybadrey had the most liked content!

1 Follower

Recent Profile Visitors

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

andreybadrey's Achievements

Tree Puncher

Tree Puncher (2/8)

3

Reputation

  1. the method displayClientMessage itself outputs only one line you can write your own method for displaying such messages, for example using an overlay. or try overriding the display ClientMessage method so that it accepts and processes List<Component> in my opinion, your own implementation through an overlay will be the simplest way
  2. depending on the context and location of the call, the method of obtaining it may differ significantly, but it is always Level example: the Player parameter is passed to a certain method public boolen anyMethod(ServerPlayer player, par1, par2) {...} you will receive the client side as follows player.getLevel.isClientSide server code is written in a block if (! player.getLevel.isClientSide){///} client code is written in a block if (player.getLevel.isClientSide){///} in some cases, the world can be passed directly to the method, but I don’t remember this in my practice in almost all cases I get the client side from LivingEntity.getLevel.isClientSide example 2: the client side is taken from the event public static void onPlayerJoin(EntityJoinLevelEvent event){ if(!event.getLevel().isClientSide()){ if(event.getEntity() instanceof ServerPlayer player){ val = event; RegisterPlayer registerPlayer = new RegisterPlayer(); registerPlayer.start(); SetupQuestCoreForPlayer setupQuestCoreForPlayer = new SetupQuestCoreForPlayer(); setupQuestCoreForPlayer.start(); } } here you can also get the client side via event.getEntity().getLevel().isClientSide() OR event.getLevel().isClientSide() sorry my ENGLISH is very bad loock this https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/event/CapsEvents.java https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/event/JoinLevel.java https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/event/LivingEntityDeath.java https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/event/LivingEntityHurt.java https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/util/SyncScaner.java its help you!
  3. Wrap it all in a block if(!livingentity instanseof ServerPlayer){ }
  4. a method that allows you to use what you want is called UseOn(), maybe a little differently NOT onItemRightClick
  5. 1 use in yor weapons classes^ @Override public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) { return new ProviderItemStak(); } 2 create provider class for capabilit itemstacks: package com.bodryak.gmod.variables.server; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.CapabilityToken; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.common.util.LazyOptional; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class ProviderItemStak implements ICapabilityProvider, INBTSerializable<CompoundTag> { public static Capability<IDS> ITEM_DATA = CapabilityManager.get(new CapabilityToken<IDS>() { }); private IDS data = null; private final LazyOptional<IDS> optional = LazyOptional.of(this::createItemData); private IDS createItemData() { if (this.data == null) { this.data = new IDS(); } return this.data; } @Override public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side) { if(cap == ITEM_DATA) { return optional.cast(); } return LazyOptional.empty(); } @Override public CompoundTag serializeNBT() { CompoundTag nbt = new CompoundTag(); createItemData().saveNBTData(nbt); return nbt; } @Override public void deserializeNBT(CompoundTag nbt) { createItemData().loadNBTData(nbt); } } package com.bodryak.gmod.variables.server; import net.minecraft.nbt.CompoundTag; public class IDS { private int damage = 1; public int getDamage() { return damage; } public void setDamage(int damage) { this.damage = damage; } public void saveNBTData(CompoundTag nbt) { nbt.putInt("damage", damage); } public void loadNBTData(CompoundTag nbt) { damage = nbt.getInt("damage"); } }
  6. import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber public class TestProcedure { @SubscribeEvent public static void onRightClickBlock(PlayerInteractEvent.RightClickBlock event) { if(event.getLevel().getBlockState(event.getPos()).getBlock() == Blocks.GRASS){ if(!event.getLevel().isClientSide()){ event.getLevel().setBlock(new BlockPos(event.getPos().getX(), event.getPos().getY() +1, event.getPos().getZ()), Blocks.MOSS_CARPET.defaultBlockState(), 3); } } } }
  7. Yes, you can, but not quite in this way, for this you can use CAPABILITIES https://docs.minecraftforge.net/en/1.19.x/datastorage/capabilities/ and on this basis rewrite the damage system here is an example https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/variables/server/MDS.java https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/event/LivingEntityHurt.java
  8. As I understand it, the event occurs 1 time for the right hand, 2 times for the left hand you need to write a code that excludes the action for the left hand if ((cow.getAge() != -1) && event.getEntity().getItemInHand(InteractionHand.MAIN_HAND).getItem().equals(Items.BOWL)) checks for the right hand, but does not preclude execution of the code for the left hand when the right hand condition is true add && hand == InteractionHand.MAIN_HAND in if(!event.getLevel().isClientSide()) should work
  9. method must start with super.init(); to reset buttons this.init(); anywhere in the code loock https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/gui/gui/screen/GuiAlchemistScreen.java#L118C9-L118C22
  10. Hi I want to implement the following mechanic I have an item with a flat square model for all inventory slots and interfaces. I want to program the display of this item as a 3D model, but only for certain states: 1 when the object is on the ground, the 3d model should be displayed 2 when the item is in hand, the 3d model should be displayed in all other cases, the generated flat model should be displayed how can i achieve something like this? gpt chat gave some thoughts, but the methods and classes proposed by the neural network do not exist in the mapping 1.20.1 patchment, they probably exist in the official mapping, but I did not check it, sorry. one word after talking with gpt i just got more confused help me figure this out please
  11. loock https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/gui/overlay/HudOverlay.java
  12. Загрузите на github, что есть на данный момент, я посмотрю. I suspect you want to do something similar to JEI. Find items for each mod in a separate tab?
  13. try to display the BAR through the picture GitHub Here is a working example
  14. So it is, having received information about the player, you can send a packet with the necessary data to the client https://github.com/andreybadrey/keymodoverlay something similar is here, this mod was written to test just the possibility of data exchange: Client1 -> server -> client2 -> server -> client1 look it up for 1.16 you need modify this
×
×
  • Create New...

Important Information

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