Jump to content

sFXprt

Members
  • Posts

    68
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sFXprt

  1. make ur own methods
  2. does it print at all? Try printing old and new and see if the values are different, sometimes it might be block pos or actual view origin so it wouldnt be the same. If push comes to shove make your own old pos, compare to current pos then if not the same change old pos to new pos and do whatever
  3. I couldnt find a move event, maybe use PlayerTickEvent and check the old position and compare to new positon, if not equal then do whatever
  4. Hi, I'm currently trying to remake a spigot plugin called Custom Enchantments. Basically the only thing I'm trying to achieve is when I pickup an item in my inventory and hover over another item and swap with it I want it to cancel the swap and allow me to access both item stacks so I can transfer data from one another. Any ideas?
  5. MinecraftServer#getLocalIP()?
  6. Create a new abstractcontainermenu, attach a screen to it, override isValid to return true with given logic, then call the menu wherever you seem it is fit.
  7. I agree, and being able to set a fixed cost would be good as well.
  8. Create a method in ur custom item class with an entity as the parameter and call it at any event that handles ticks, check if that entity has the item in their inventory if so check if item is an instance of your custom item if so cast and call that method and in ur custom item class do ur logic there
  9. I made a mistake, Im currently not at an IDE right but can you just pass in ur Entity.get() thru ur init?
  10. https://github.com/Rinventor/SavedDataSync/blob/main/PTMSavedData.java#:~:text=(level)) {-,PTMSavedData data %3D PTMSavedData.getInstance(level)%3B,-return data. Whenever you are calling Client side code and want the server to do something with it you must send a packet over to the server and have the server do the logic there and if needed return any data changes back to the client. Not to be rude, but I really think you are over complicating everything and making it harder on yourself. Like mentioned above its really as simple as sending the data to server and if needed have the server send the data back to the client. Usually if the data you need to mess with is server side you don't need to send any data back.
  11. do you still need help, I can guide you on how to accomplish everything. Only thing I ask is next time you help others
  12. I went out of my way to debug it for you, I got the error to go away. Here is your final Code PrimedLumeniteTnt public class PrimedLumeniteTnt extends PrimedTnt { @Nullable private LivingEntity owner; public PrimedLumeniteTnt(Level level, double x, double y, double z, @Nullable LivingEntity igniter) { this(EntityInit.LUMENITE_TNT.get(), level); this.setPos(x, y, z); double d0 = level.random.nextDouble() * (double)((float)Math.PI * 2F); this.setDeltaMovement(-Math.sin(d0) * 0.02D, (double)0.2F, -Math.cos(d0) * 0.02D); this.setFuse(80); this.xo = x; this.yo = y; this.zo = z; this.owner = igniter; } public PrimedLumeniteTnt(EntityType<Entity> entityEntityType, Level level) { super((EntityType<? extends PrimedTnt>) entityEntityType, level); } @Nullable public LivingEntity getOwner() { return this.owner; } @Override protected void explode() { float f = 4.0F; this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), f, Explosion.BlockInteraction.BREAK); } } And here is where you register it public static final RegistryObject<EntityType<Entity>> LUMENITE_TNT = ENTITY_TYPES.register("lumenite_tnt", () -> EntityType.Builder.of(PrimedLumeniteTnt::new, MobCategory.MISC) .fireImmune() .sized(0.98F, 0.98F) .build(new ResourceLocation(Main.MOD_ID, "lumenite_tnt").toString())); I think what happened here is when you tried to extend your tnt class when in fact you should've just put <Entity> since PrimedTnt is extending Entity
  13. Its not happy with the constructor you currently have, delete it and when it suggests to create a constructor in the registry just create it there and see if it works. I wouldn't know what the correct constructor would be since I've never worked with PrimedTnt before.
  14. It should run twice, it does logic on both sides.
  15. This is a bit messy and could be implemented so much easier and cleaner. Just create your own AbstractContainerMenu at this point and have your own AbstractContainerScreen, make sure you override the stillValid() method in your Menu class and do whatever logic you deem necessary to keep that container open for that player.
  16. Just use KeyInputEvent and if you have server side logic just send a packet to server.
  17. Send a picture of what you see and the code No, the way models work is they have different parts so that they do different animations. The ones I can think of the top of my head is Body, Legs, Right Arm, Left Arm, Head, Hat. I know some other models in the game have more custom model parts but since you are editing the player you just need to work with those parts If you use your own custom renderer maybe, but I am very unsure... You are gonna have to wait for a much more advanced forum member like @ChampionAsh5357 or @warjort to assist you further.
  18. are you using parchment mappings yet? And every model in the game has different parts so that they do different animations. The ones I can think of the top of my head is Body, Legs, Right Arm, Left Arm, Head, Hat. I know some other models in the game have more custom model parts but since you are editing the player you just need to work with those parts
  19. Add me im forporsmok#0816
  20. Bro bro, please dont pay anyone for such a simple thing I can literally make one for you for free
  21. There are a few things I recommend you to do. First correct your ResourceLocation call, you put two "//" instead of one. Next make the texture location a public static field so that you may derive a RenderType from it as well so that it can be called in the render method(if you don't put anything in render() the model wont show up) Example public static final ResourceLocation TEXTURE = new ResourceLocation(TestMod.MOD_ID, "textures/entity/projectiles/cool_arrow_model.png"); private static final RenderType RENDER_TYPE = RenderType.entityCutoutNoCull(TEXTURE); Here is the code you will need to render the Arrow //From ArrowRenderer.class public void render(T pEntity, float pEntityYaw, float pPartialTicks, PoseStack pMatrixStack, MultiBufferSource pBuffer, int pPackedLight) { pMatrixStack.pushPose(); pMatrixStack.mulPose(Vector3f.YP.rotationDegrees(Mth.lerp(pPartialTicks, pEntity.yRotO, pEntity.getYRot()) - 90.0F)); pMatrixStack.mulPose(Vector3f.ZP.rotationDegrees(Mth.lerp(pPartialTicks, pEntity.xRotO, pEntity.getXRot()))); int i = 0; float f = 0.0F; float f1 = 0.5F; float f2 = 0.0F; float f3 = 0.15625F; float f4 = 0.0F; float f5 = 0.15625F; float f6 = 0.15625F; float f7 = 0.3125F; float f8 = 0.05625F; float f9 = (float)pEntity.shakeTime - pPartialTicks; if (f9 > 0.0F) { float f10 = -Mth.sin(f9 * 3.0F) * f9; pMatrixStack.mulPose(Vector3f.ZP.rotationDegrees(f10)); } pMatrixStack.mulPose(Vector3f.XP.rotationDegrees(45.0F)); pMatrixStack.scale(0.05625F, 0.05625F, 0.05625F); pMatrixStack.translate(-4.0D, 0.0D, 0.0D); VertexConsumer vertexconsumer = pBuffer.getBuffer(RENDER_TYPE); //Buffer wants a RenderType, hence the private static field above! PoseStack.Pose posestack$pose = pMatrixStack.last(); Matrix4f matrix4f = posestack$pose.pose(); Matrix3f matrix3f = posestack$pose.normal(); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, -2, 0.0F, 0.15625F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, 2, 0.15625F, 0.15625F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, 2, 0.15625F, 0.3125F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, -2, 0.0F, 0.3125F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, -2, 0.0F, 0.15625F, 1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, 2, 0.15625F, 0.15625F, 1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, 2, 0.15625F, 0.3125F, 1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, -2, 0.0F, 0.3125F, 1, 0, 0, pPackedLight); for(int j = 0; j < 4; ++j) { pMatrixStack.mulPose(Vector3f.XP.rotationDegrees(90.0F)); this.vertex(matrix4f, matrix3f, vertexconsumer, -8, -2, 0, 0.0F, 0.0F, 0, 1, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, 8, -2, 0, 0.5F, 0.0F, 0, 1, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, 8, 2, 0, 0.5F, 0.15625F, 0, 1, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -8, 2, 0, 0.0F, 0.15625F, 0, 1, 0, pPackedLight); } pMatrixStack.popPose(); super.render(pEntity, pEntityYaw, pPartialTicks, pMatrixStack, pBuffer, pPackedLight); } public void vertex(Matrix4f pMatrix, Matrix3f pNormals, VertexConsumer pVertexBuilder, int pOffsetX, int pOffsetY, int pOffsetZ, float pTextureX, float pTextureY, int pNormalX, int p_113835_, int p_113836_, int pPackedLight) { pVertexBuilder.vertex(pMatrix, (float)pOffsetX, (float)pOffsetY, (float)pOffsetZ).color(255, 255, 255, 255).uv(pTextureX, pTextureY).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(pPackedLight).normal(pNormals, (float)pNormalX, (float)p_113836_, (float)p_113835_).endVertex(); } After all this is done you will be all set!
  22. Nice glad to see you got it working man!
  23. You also mentioned you made a similar projectile like the Ghast does what class did you derive it from AbstractHurtingProjectile or AbstractArrow?
  24. issues aside(I apologize) this mod looks really cool, if you could add a fire combustion effect spark from the tip of the barrel would be extremely cool. I would totally download this mod and set it on a ship or a castle of mines
  25. //From AbstractSkeleton.class //shoot() method parameters (x,y,z,velocity,inaccuracy) abstractarrow.shoot(d0, d1 + d3 * (double)0.2F, d2, 1.6F, (float)(14 - this.level.getDifficulty().getId() * 4)); as you see in the last parameter its adjusting the inaccuracy of the shoot from a hardcoded number subtracted by the current world difficulty * 4. Now if you set it to 0 and it'll be accurate and increasing the velocity makes it deal more damage and is a factor in the trajectory of the arrow. I think what you are trying to compare are two different things, the arrow first of all has drop off which compared to a fireball does not drop off and keeps its velocity constant. I have pulled the code from the Vanilla Ghast and Fireball to show you what it does compared to the Arrow This is the code the Ghast uses to shoot a fireball if (this.chargeTime == 20) { double d1 = 4.0D; Vec3 vec3 = this.ghast.getViewVector(1.0F); double d2 = livingentity.getX() - (this.ghast.getX() + vec3.x * 4.0D); double d3 = livingentity.getY(0.5D) - (0.5D + this.ghast.getY(0.5D)); double d4 = livingentity.getZ() - (this.ghast.getZ() + vec3.z * 4.0D); if (!this.ghast.isSilent()) { level.levelEvent((Player)null, 1016, this.ghast.blockPosition(), 0); } LargeFireball largefireball = new LargeFireball(level, this.ghast, d2, d3, d4, this.ghast.getExplosionPower()); largefireball.setPos(this.ghast.getX() + vec3.x * 4.0D, this.ghast.getY(0.5D) + 0.5D, largefireball.getZ() + vec3.z * 4.0D); level.addFreshEntity(largefireball); this.chargeTime = -40; } This is the AbstractHurtingProjectile.class code that calls when its spawned in the world public void tick() { Entity entity = this.getOwner(); if (this.level.isClientSide || (entity == null || !entity.isRemoved()) && this.level.hasChunkAt(this.blockPosition())) { super.tick(); if (this.shouldBurn()) { this.setSecondsOnFire(1); } HitResult hitresult = ProjectileUtil.getHitResult(this, this::canHitEntity); if (hitresult.getType() != HitResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitresult)) { this.onHit(hitresult); } this.checkInsideBlocks(); Vec3 vec3 = this.getDeltaMovement(); double d0 = this.getX() + vec3.x; double d1 = this.getY() + vec3.y; double d2 = this.getZ() + vec3.z; ProjectileUtil.rotateTowardsMovement(this, 0.2F); float f = this.getInertia(); if (this.isInWater()) { for(int i = 0; i < 4; ++i) { float f1 = 0.25F; this.level.addParticle(ParticleTypes.BUBBLE, d0 - vec3.x * 0.25D, d1 - vec3.y * 0.25D, d2 - vec3.z * 0.25D, vec3.x, vec3.y, vec3.z); } f = 0.8F; } this.setDeltaMovement(vec3.add(this.xPower, this.yPower, this.zPower).scale((double)f)); this.level.addParticle(this.getTrailParticle(), d0, d1 + 0.5D, d2, 0.0D, 0.0D, 0.0D); this.setPos(d0, d1, d2); } else { this.discard(); } } AbstractArrow.class tick() method, the area in where it checks if a block was hit or not if (this.inGround && !flag) { if (this.lastState != blockstate && this.shouldFall()) { this.startFalling(); } else if (!this.level.isClientSide) { this.tickDespawn(); } ++this.inGroundTime; } ShouldFall check and StartFalling method private boolean shouldFall() { return this.inGround && this.level.noCollision((new AABB(this.position(), this.position())).inflate(0.06D)); } private void startFalling() { this.inGround = false; Vec3 vec3 = this.getDeltaMovement(); this.setDeltaMovement(vec3.multiply((double)(this.random.nextFloat() * 0.2F), (double)(this.random.nextFloat() * 0.2F), (double)(this.random.nextFloat() * 0.2F))); this.life = 0; } as you see the arrow is more complex in physics compared to the fireball, if you want it to be just as accurate as the fireball I think you would have to override a custom extended AbstractArrow or just outright make your own version of the AbstractArrow class
×
×
  • Create New...

Important Information

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