Everything posted by idev
-
1.16.5 Rotate text behind the player's camera.
I don't know how, but setting: mappings channel: 'snapshot', version: '20210309-1.16.5' build.gradlew helped me. In short, I deployed the project on a new one and it all worked. I thought it was a bug or a flaw, maybe it is
-
1.16.5 Rotate text behind the player's camera.
Is this even possible with forge? Maybe I'm waiting in vain for an answer and I need to come up with a workaround
-
1.16.5 Rotate text behind the player's camera.
Hello, I have been suffering for 6 hours and cannot find a good, working solution. I need the text above the creature to always face the camera. I went through a lot of code examples and even tried to find the source code of the tag item in the game and render it. But I didn't find anything I needed. As far as I understand, the new version does not have MatrixStack.rotate, I need it judging by the examples. I tried GlStateManager and don't know how to pass the required matrixStack to fontRenderer.draw (matrixStack, ...) What should I do? Now I stopped at the option that is shown in the code below, but it does not do what I need. @Mod.EventBusSubscriber(modid = XCraft.MODID, value = Dist.CLIENT) public class ClientEventHandler { @SubscribeEvent public static void potion(RenderLivingEvent.Post<? extends LivingEntity, ? extends EntityModel<?>> event) { HealthBar.renderInWorld(event.getMatrixStack(), event.getEntity()); } } public class HealthBar { public static void renderInWorld(MatrixStack matrixStack, LivingEntity entity) { ClientPlayerEntity playerEntity = Minecraft.getInstance().player; assert playerEntity != null; FontRenderer fontRenderer = Minecraft.getInstance().font; assert fontRenderer != null; ITextComponent name = entity.getName(); fontRenderer.draw(matrixStack, name, 0, 0, 0xffffff); } }
-
[ 1.16.5 ] How to cancel or replace particles of potion effects.
It may seem silly, but I just can't find how to cancel particles of potion effects or replace them, please tell me. I didn't even find a hint of calling them or drawing them
-
[1.16.5] Trying to add a screen before uploading to the world.
@Mod.EventBusSubscriber(modid = XCraft.MODID, value = Dist.CLIENT) public class ListenGuiOpenEvent{ @SubscribeEvent(priority = EventPriority.HIGHEST) public static void guiOpen(GuiOpenEvent event) { if (event.getGui() instanceof DemoScreen) { System.out.println("Gui Demo open scene"); } } } Oh, I'm sorry, but I'm not talking about that a bit. I calmly added the events themselves. You wrote above about canceling the closure, I thought it was something like a method, most likely I was looking in the wrong place
-
[1.16.5] Trying to add a screen before uploading to the world.
Unfortunately, I have not found a more or less detailed description. Climbing in the GuiOpenEvent itself, I found only a description. That, in general, was clear before. I quote: This event is called before any Gui will open. If you don't want this to happen, cancel the event. If you want to override this Gui, simply set the gui variable to your own Gui. That is, I need to redefine the open screen anyway? I found nothing about the other. You said about canceling the closure, and I tried to reproduce it, but I did not find anything I needed. Maybe I misunderstood
-
[1.16.5] Trying to add a screen before uploading to the world.
I do not understand. I started listening to GuiOpenEvent But what will make it not close?
-
[1.16.5] Trying to add a screen before uploading to the world.
Trying to add a screen before uploading to the world. I did not find examples anywhere, I had to write something of my own. I'm not sure if this approach is correct, I'm not very sure. However, this works more or less. The screen appears but disappears immediately. And I need to wait for the buttons to be pressed before it disappears. How can I implement this? @Mod.EventBusSubscriber(modid = XCraft.MODID, value = Dist.CLIENT) public class ListenEntityJoinWorldEvent { @SubscribeEvent public static void joinEntity(EntityJoinWorldEvent event) { if (event.getEntity() instanceof ClientPlayerEntity) { Minecraft.getInstance().forceSetScreen(new DemoScreen()); System.out.println("PlayerEntity join in WORLD"); } } } I would be glad if you point out mistakes.
-
[1.16.5] Extending the base class of the player and drawing the screen when entering the world or server
Alas, the EntityJoinWorldEvent event does not send me EntityPlayer. I think another event is needed here, but I do not know which one.
-
[1.16.5] Extending the base class of the player and drawing the screen when entering the world or server
Many thanks. I haven't been in mod for long and didn't know about it. I will definitely study
-
[1.16.5] Extending the base class of the player and drawing the screen when entering the world or server
Did not quite understand. You can read a little more about: "then attach it to the player with a default value"
-
[1.16.5] Extending the base class of the player and drawing the screen when entering the world or server
Hello. Faced such a problem. I don't even know where to start. I rendered a new screen, when using the item I open it (temporarily). There are two buttons on this screen. Type one and type two. (this is the essence of the player so to speak), I need to somehow extend the base class of the player to add a new player type with a new change (the choice takes place on the buttons), but since a lot of functionality will be tied to this change, I do not know what to do. For example, in the future I will need to ignore the damage of other players with the same player type. Maximum simple screen with two buttons. What is the best way for me to expand the base character class in minecraft. It didn’t work with coremod and I think it’s better to somehow do without it if necessary, in extreme cases it’s not essential, but I don’t know how to work with it and I don’t even know how, I think it’s worth reading a lot. So how do you call this screen with the buttons for choosing the type of player when you enter the world / server? This is a must for everyone who logs into the world or the server. Thanks a lot in advance for any help and advice I apologize for my english. If something is not clear, please ask. I am not a native speaker of this language
-
[Solved] Rendering ProjectileItemEntity 1.16.5
I don't even know, I thought it changed in version 16.5, so I went to the forum. The IDE can be said to be clean, like a clean installation of MC Forge, I even created an almost clean mod, removing all unnecessary, and I used PacketSpawn for tests
-
[Solved] Rendering ProjectileItemEntity 1.16.5
There are a few things I tried to do for rendering. In the Networking and PacketSpawn class, but I'm not sure if this was needed at all. Took from an example https://github.com/idev-hub/DangerMod
-
[Solved] Rendering ProjectileItemEntity 1.16.5
I duplicated GranateEntity above with the place where I entered createSpawnPacket, but got an error.
-
[Solved] Rendering ProjectileItemEntity 1.16.5
public class GranateEntity extends ProjectileItemEntity { public GranateEntity(EntityType<GranateEntity> type, World world) { super(type, world); } public GranateEntity(LivingEntity entity, World world) { super(Registration.granateEntity.get(), entity, world); } public GranateEntity(double x, double y, double z, World world) { super(Registration.granateEntity.get(), x, y, z, world); } @Nonnull @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } @Override public void tick() { super.tick(); } @OnlyIn(Dist.CLIENT) public void handleEntityEvent(byte p_70103_1_) { if (p_70103_1_ == 3) { double d0 = 0.08D; for(int i = 0; i < 8; ++i) { this.level.addParticle(new ItemParticleData(ParticleTypes.ITEM, this.getItem()), this.getX(), this.getY(), this.getZ(), ((double)this.random.nextFloat() - 0.5D) * 0.08D, ((double)this.random.nextFloat() - 0.5D) * 0.08D, ((double)this.random.nextFloat() - 0.5D) * 0.08D); } } } protected void onHitEntity(EntityRayTraceResult p_213868_1_) { super.onHitEntity(p_213868_1_); p_213868_1_.getEntity().hurt(DamageSource.thrown(this, this.getOwner()), 0.0F); } protected void onHit(RayTraceResult p_70227_1_) { super.onHit(p_70227_1_); if (!this.level.isClientSide) { ChickenEntity chickenentity = EntityType.CHICKEN.create(this.level); chickenentity.setAge(-24000); chickenentity.moveTo(this.getX(), this.getY(), this.getZ(), this.yRot, 0.0F); this.level.addFreshEntity(chickenentity); this.level.broadcastEntityEvent(this, (byte)3); this.remove(); } } protected Item getDefaultItem() { return Registration.FragGranade.get(); } }
-
[Solved] Rendering ProjectileItemEntity 1.16.5
Thank you very much for the links, I may need them more than once. But, the problem is that I cannot override the method createSpawnPacket My editor shows an error: Method does not override method from its superclass
-
[Solved] Rendering ProjectileItemEntity 1.16.5
Привет. Сразу прошу прощения за мой английский, я не носитель этого языка. Пытаюсь создать гранату. Но возникли проблемы с отрисовкой моего ProjectileItemEntity. Доходит до моба, но в игре не отображается. Прочитал некоторые темы, но так и не понял, что нужно делать на версии 1.16.5 GranateEntity.java public GranateEntity(double x, double y, double z, World world) { super(Registration.granateEntity.get(), x, y, z, world); } @OnlyIn(Dist.CLIENT) public void handleEntityEvent(byte p_70103_1_) { if (p_70103_1_ == 3) { double d0 = 0.08D; for(int i = 0; i < 8; ++i) { this.level.addParticle(new ItemParticleData(ParticleTypes.ITEM, this.getItem()), this.getX(), this.getY(), this.getZ(), ((double)this.random.nextFloat() - 0.5D) * 0.08D, ((double)this.random.nextFloat() - 0.5D) * 0.08D, ((double)this.random.nextFloat() - 0.5D) * 0.08D); } } } protected void onHitEntity(EntityRayTraceResult p_213868_1_) { super.onHitEntity(p_213868_1_); p_213868_1_.getEntity().hurt(DamageSource.thrown(this, this.getOwner()), 0.0F); } protected void onHit(RayTraceResult p_70227_1_) { super.onHit(p_70227_1_); if (!this.level.isClientSide) { ChickenEntity chickenentity = EntityType.CHICKEN.create(this.level); chickenentity.setAge(-24000); chickenentity.moveTo(this.getX(), this.getY(), this.getZ(), this.yRot, 0.0F); this.level.addFreshEntity(chickenentity); this.level.broadcastEntityEvent(this, (byte)3); this.remove(); } } protected Item getDefaultItem() { return Registration.FragGranade.get(); } } Registation.java public class Registration { private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, DangerMod.MODID); private static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, DangerMod.MODID); public static void init() { ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); ENTITIES.register(FMLJavaModLoadingContext.get().getModEventBus()); } public static final RegistryObject<Item> FragGranade = ITEMS.register("frag_granate", FragGrenade::new); public static final RegistryObject<EntityType<GranateEntity>> granateEntity = ENTITIES.register("granate_projectile", () -> EntityType.Builder.<GranateEntity>of(GranateEntity::new, EntityClassification.MISC) .sized(0.25F, 0.25F) .setShouldReceiveVelocityUpdates(false) .build("granate_projectile")); } FragGrenade.java public class FragGrenade extends Item { public FragGrenade() { super(new Properties().tab(ModSetup.ITEM_GROUP)); } @Override public ActionResult<ItemStack> use(World world, PlayerEntity entity, Hand hand) { ItemStack itemstack = entity.getItemInHand(hand); world.playSound((PlayerEntity) null, entity.getX(), entity.getY(), entity.getZ(), SoundEvents.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (random.nextFloat() * 0.4F + 0.8F)); if (!world.isClientSide) { GranateEntity granateEntity = new GranateEntity(entity, world); granateEntity.setItem(itemstack); granateEntity.shootFromRotation(entity, entity.xRot, entity.yRot, 0.0F, 1F, 1F); world.addFreshEntity(granateEntity); }
IPS spam blocked by CleanTalk.