-
Posts
44 -
Joined
-
Last visited
Posts posted by SciPunk
-
-
How can I create my own ArmPose, I want to change the ArmPose when ElytraFlying is triggered
-
On 2/19/2020 at 4:08 PM, Cadiboo said:
Read this: https://cadiboo.github.io/tutorials/1.15.1/forge/1.4-proxies
You’re better off extending the Arrow and adding the spin in your renderer (similar time the arrow shake) as it already sticks into stuff
Got it to stick, now I'll figure out the shake thing, thanks
-
27 minutes ago, DragonITA said:
@SciPunk What is your Problem?
My projectile item, I want it to spin when in the air and stuck to surface, but I don't know how
-
I have my throwable item, which I want it to spin when it is in the air and stick to the surface when it hits a block but I can´t figure out, my item uses a sprite renderer, here´s my code
Item class
Spoilerpublic class ItemBatarang extends Item{ public ItemBatarang(Properties properties) { super(properties); setRegistryName("item_batarang"); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); Vec3d look = playerIn.getLookVec(); EntityBatarang batarang = new EntityBatarang(1.0D,1.0D,1.0D,worldIn); batarang.setPosition(playerIn.getPosX() + look.x , playerIn.getPosY() + look.y + 1, playerIn.getPosZ() + look.z); batarang.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F,1.5F,0.0F); if (!worldIn.isRemote) { worldIn.addEntity(batarang); } worldIn.playSound(null,playerIn.getPosition(), SoundEvents.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS,1.0f,1.0f); return new ActionResult<ItemStack>(ActionResultType.SUCCESS, stack); } }
Entity class
Spoilerpublic class EntityBatarang extends ProjectileItemEntity { public EntityBatarang(double x, double y, double z, World worldIn) { super(EntitiesHolder.BATARANG, x, y, z, worldIn); } public EntityBatarang( LivingEntity livingEntityIn, World worldIn) { super(EntitiesHolder.BATARANG, livingEntityIn, worldIn); } public EntityBatarang(EntityType<EntityBatarang> entityBatarangEntityType, World world) { super(EntitiesHolder.BATARANG, world); } @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } @Override protected Item getDefaultItem() { return ItemHolder.BATARANG; } @Override protected void onImpact(RayTraceResult result) { if (result.getType() == RayTraceResult.Type.ENTITY) { ((EntityRayTraceResult)result).getEntity().attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 5.0F); } if (result instanceof EntityRayTraceResult) { EntityRayTraceResult entityRayTraceResult = (EntityRayTraceResult) result; if(entityRayTraceResult.getEntity() instanceof MobEntity) { MobEntity entity = (MobEntity) entityRayTraceResult.getEntity(); double d0 = (double)entity.getPosX() ; double d1 = (double)entity.getPosY() + 1D; double d2 = (double)entity.getPosZ(); entity.addPotionEffect(new EffectInstance(Effects.SLOWNESS,120,2)); this.world.playSound(entity.getPosX(),entity.getPosY(),entity.getPosZ(), SoundEvents.BLOCK_ANVIL_HIT, SoundCategory.AMBIENT,1,1,true); //3400 this.remove(); } else if(entityRayTraceResult.getEntity() instanceof PlayerEntity) { PlayerEntity entity = (PlayerEntity) entityRayTraceResult.getEntity(); entity.addPotionEffect(new EffectInstance(Effects.SLOWNESS,120,2)); } } else if (result instanceof BlockRayTraceResult) { BlockRayTraceResult blockRayTraceResult = (BlockRayTraceResult) result; double x = this.getPosX(); double y = this.getPosY(); double z = this.getPosZ(); this.setMotion(x,y,z); } } public static EntityType register() { return EntityType.Builder.<EntityBatarang>create(EntityBatarang::new, EntityClassification.MISC).size(0.8F, 0.8F).build("batarang").setRegistryName(ComicUniverse.MODID,"batarang"); } @Override public void tick() { super.tick(); this.motionMultiplier.rotatePitch(5); } }
ClientProxy class (where it renders)
Spoilerpublic class ClientProxy implements IProxy { @Override public void init() { ScreenManager.registerFactory(BlockHolder.BLOCKGENERATOR_CONTAINER, GUIGenerator::new); ScreenManager.registerFactory(BlockHolder.SUITFABRICATOR_CONTAINER, GUISuitfabricator::new); RenderingRegistry.registerEntityRenderingHandler(EntitiesHolder.RADIOACTIVE_SPIDER, RadioactiveSpiderRenderer::new); RenderingRegistry.registerEntityRenderingHandler(EntitiesHolder.SMOKE_PELLET, renderManager -> new SpriteRenderer<EntitySmokePellet>(renderManager, Minecraft.getInstance().getItemRenderer())); RenderingRegistry.registerEntityRenderingHandler(EntitiesHolder.BATARANG, renderManager -> new SpriteRenderer<EntityBatarang>(renderManager, Minecraft.getInstance().getItemRenderer())); }
-
23 minutes ago, diesieben07 said:
The version of addParticle you are using only does something on the client. You are only ever calling it on the server, so nothing happens.
To spawn particles on the server you have to use ServerWorld#spawnParticle, however you should try to only spawn particles client-side, if possible, to avoid unnecessary network traffic.
Thanks a lot, so for this case I should render it on the server-side? as I want other players to see the smoke
-
On 2/14/2020 at 2:35 AM, DragonITA said:
@SciPunkBut from 1.12.2 (Tabula) and the 1.15.1 you have to change a lot and write again. Is there no other program that exports directly to 1.15.1?
Unfortunately haven't found one yet, I use Tabula currently and edit it to work in 1.15
- 1
-
Hi, I'm trying to make a smoke bomb, here's my code but the particles doesn't seem to render
My code:
public class EntitySmokePellet extends ProjectileItemEntity { public static final EntityType<EntitySmokePellet> BATARANG = register(); protected EntitySmokePellet(EntityType<? extends ThrowableEntity> type, World worldIn) { super(EntitiesHolder.SMOKE_PELLET,worldIn); } @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } protected EntitySmokePellet(double x, double y, double z, World worldIn) { super(EntitiesHolder.SMOKE_PELLET, x, y, z, worldIn); } protected EntitySmokePellet(EntityType<? extends ThrowableEntity> type, LivingEntity livingEntityIn, World worldIn) { super(EntitiesHolder.SMOKE_PELLET, livingEntityIn, worldIn); } protected Item getDefaultItem() { return ItemHolder.SMOKE_PELLETE; } @Override protected void onImpact(RayTraceResult result) { if (!this.world.isRemote) { if (result instanceof EntityRayTraceResult) { EntityRayTraceResult entityRayTraceResult = (EntityRayTraceResult) result; if(entityRayTraceResult.getEntity() instanceof MobEntity) { MobEntity entity = (MobEntity) entityRayTraceResult.getEntity(); double d0 = (double)entity.getPosX() + 0.5D; double d1 = (double)entity.getPosY(); double d2 = (double)entity.getPosZ() + 0.5D; entity.addPotionEffect(new EffectInstance(Effects.SLOWNESS,120,5)); entity.addPotionEffect(new EffectInstance(Effects.NAUSEA,120,5)); entity.addPotionEffect(new EffectInstance(Effects.BLINDNESS,120,5)); entity.world.addParticle(ParticleTypes.LARGE_SMOKE,d0,d1,d2,0,0,0); this.remove(); } } else if (result instanceof BlockRayTraceResult) { BlockRayTraceResult blockRayTraceResult = (BlockRayTraceResult) result; for (int i = 0; i <= 25; i++) { this.world.addParticle(ParticleTypes.LARGE_SMOKE,blockRayTraceResult.getPos().getX() , blockRayTraceResult.getPos().getY() , blockRayTraceResult.getPos().getZ(), 0, 0,0); } this.remove(); } } } public static EntityType register() { return EntityType.Builder.<EntitySmokePellet>create(EntitySmokePellet::new, EntityClassification.MISC).size(0.8F, 0.8F).build("smoke_pellet").setRegistryName(ComicUniverse.MODID,"smoke_pellet"); } }
-
14 hours ago, DragonITA said:
Headline explains everything: can you recommend me a good program to make an entity model and export it as Java file only for Minecraft 1.15.1, like Blockbench only for the 1.15.1
The one that I found that was the most useful was tabula for 1.12, some little changes in the code but not drastically like Workbench
- 1
-
Made a custom projectile, with it's own renderer but the when I right click to throw the projectile it spawns a... pig instead of my custom texture lol
Item class
Spoilerpublic class ItemBatarang extends Item { public ItemBatarang(Item.Properties properties) { super(properties); setRegistryName("item_batarang"); } public AbstractArrowEntity createBatarang(World worldIn, ItemStack stack, LivingEntity shooter) { ArrowEntity arrowentity = new ArrowEntity(worldIn, shooter); arrowentity.setPotionEffect(stack); return arrowentity; } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); Vec3d look = playerIn.getLookVec(); EntityBatarang batarang = new EntityBatarang(1.0D,1.0D,1.0D,worldIn); batarang.setPosition(playerIn.getPosX() + look.x * 1D, playerIn.getPosY() + look.y * 1D, playerIn.getPosZ() + look.z + look.z * 1D); batarang.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F,1.5F,0.5F); if (!worldIn.isRemote) { worldIn.addEntity(batarang); } worldIn.playSound(null,playerIn.getPosition(), SoundEvents.BLOCK_ANVIL_HIT, SoundCategory.PLAYERS,1.0f,1.0f); return new ActionResult<ItemStack>(ActionResultType.SUCCESS, stack); } }
Entity class
Spoilerpublic class EntityBatarang extends ThrowableEntity { public static final EntityType<EntityBatarang> BATARANG = register(); protected EntityBatarang(EntityType<? extends ThrowableEntity> type, World worldIn) { super(BATARANG,worldIn); } @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } protected EntityBatarang(double x, double y, double z, World worldIn) { super(EntityBatarang.BATARANG, x, y, z, worldIn); } protected EntityBatarang(EntityType<? extends ThrowableEntity> type, LivingEntity livingEntityIn, World worldIn) { super(EntityBatarang.BATARANG, livingEntityIn, worldIn); } protected Item getDefaultItem() { return ItemHolder.BATARANG; } @Override protected void onImpact(RayTraceResult result) { if (!this.world.isRemote) { if (result instanceof EntityRayTraceResult) { EntityRayTraceResult entityRayTraceResult = (EntityRayTraceResult) result; if(entityRayTraceResult.getEntity() instanceof MobEntity) { MobEntity entity = (MobEntity) entityRayTraceResult.getEntity(); entity.setFire(20); entity.setHealth(0); } } } } @Override protected void registerData() { } public static EntityType register() { return EntityType.Builder.<EntityBatarang>create(EntityBatarang::new, EntityClassification.MISC).size(0.8F, 0.8F).build("batarang").setRegistryName(ComicUniverse.MODID,"batarang"); } }
Entity Renderer
Spoilerpublic class BatarangRenderer extends EntityRenderer<EntityBatarang> { private static final ResourceLocation TEXTURE = new ResourceLocation(ComicUniverse.MODID,"textures/materials/batman_chest_part.png"); public BatarangRenderer(EntityRendererManager renderManager) { super(renderManager); renderManager.getFontRenderer().drawStringWithShadow("Batarang",0,0.5f,2); } @Override public void render(EntityBatarang entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) { super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn); } @Override public ResourceLocation getEntityTexture(EntityBatarang entity) { return TEXTURE; } }
-
10 hours ago, MoxLotus said:
Instead of creating a new RayTraceResult you should have an instanceof test and cast event.getRayTraceResult.
As for your question, does it do what you expect if you always cancel the event?
Got it, thanks! no, it was just for testing purposes now I got to figure out the "catch" also I noticed that with this code if I get hit by 2 arrows consecutively it crashes:
@SubscribeEvent public static void onProjectileHitEvent(ProjectileImpactEvent event) { if (event.getRayTraceResult() instanceof EntityRayTraceResult) { EntityRayTraceResult entityRayTraceResult = (EntityRayTraceResult) event.getRayTraceResult(); if (entityRayTraceResult.getEntity() instanceof PlayerEntity) { PlayerEntity playerEntity = (PlayerEntity) entityRayTraceResult.getEntity(); if (playerEntity.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() == ItemHolder.BATMAN_CHEST) { event.setCanceled(true); } } } }
-
8 hours ago, MoxLotus said:
From AbstractArrowEntity::tick
EntityRayTraceResult entityraytraceresult = this.rayTraceEntities(vec3d2, vec3d3); if (entityraytraceresult != null) { raytraceresult = entityraytraceresult; } if (raytraceresult != null && raytraceresult.getType() == RayTraceResult.Type.ENTITY) { Entity entity = ((EntityRayTraceResult)raytraceresult).getEntity(); Entity entity1 = this.getShooter(); if (entity instanceof PlayerEntity && entity1 instanceof PlayerEntity && !((PlayerEntity)entity1).canAttackPlayer((PlayerEntity)entity)) { raytraceresult = null; entityraytraceresult = null; } } if (raytraceresult != null && raytraceresult.getType() != RayTraceResult.Type.MISS && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { this.onHit(raytraceresult); this.isAirBorne = true; }
The event is fired in that fourth if statement. You should be able to get the Enity the arrow hit (if any) from the EntityRayTraceResult. Then I suppose you'll want to find out if the Entity is a player and if they were facing the appropriate direction at the time.
Hi, thanks for the tip, tried to implement it to my code but I just can't seem to get it to work, tried to do it without the condition of the player looking at it for testing purposes and I just couldn't make it work, do you have any idea why? Here's my code:
@SubscribeEvent public static void onProjectileHitEvent(ProjectileImpactEvent event) { EntityRayTraceResult entityRayTraceResult = new EntityRayTraceResult(event.getEntity(), event.getRayTraceResult().getHitVec()); Entity entity = entityRayTraceResult.getEntity(); if (entity instanceof PlayerEntity) { PlayerEntity playerEntity = (PlayerEntity) entity; if (playerEntity.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() == ItemHolder.BATMAN_CHEST) { event.setCanceled(true); } } }
-
How could I make behavior on the player that when the player sees the projectile "catches it" e.g a skeleton shoots the player but if the player is facing the arrow the player catches the projectile so far the event I think it has to do something with it is ProjectileImpactEvent, however, I'm not entirely sure how could I write that behavior. Here's my code
@SubscribeEvent public static void onProjectileCatchEvent(ProjectileImpactEvent event) { if (event.getEntity() instanceof ArrowEntity) { event.setCanceled(true); } }
-
20 hours ago, Cadiboo said:
Sorry I can’t help more, but have you tried stepping through what’s happening in the debugger and seeing why the arms are being rendered?
No worries thanks anyways, gonna check the debugger, I don't know why I didn't do that in the first place lol
-
Bump, does anybody understand how flags work? or how can I edit the "Pose" of the flag?
-
53 minutes ago, Yanny7 said:
You can check vannila crafting table, or I created custom crafting table in my mod https://github.com/yanny7/StoneAge/blob/1.15/src/main/java/com/yanny/age/stone/recipes/FlintWorkbenchRecipeSerializer.java just clone mod and try to look into code how it works
Thanks a lot! will definitely help me understand better
-
On 2/1/2020 at 12:18 PM, diesieben07 said:
The documentation is outdated.
Recipe types are now in vanilla and no longer patched-in by Forge.
You can create your own by implementing IRecipeSerializer and registering it (it's just a normal registry entry like blocks, etc.).
You can then refer to this from your recipe file like vanilla already does.
Thanks! but how could I register I'm kinda confused I implemented the interface and the methods but I'm not entirely sure how can I register the recipes, and how can I use them for my custom container(crafting table) this is my code
public class SuitsRecipes implements IRecipeSerializer { public SuitsRecipes() { } @Override public IRecipe<?> read(ResourceLocation recipeId, JsonObject json) { return null; } @Nullable @Override public IRecipe<?> read(ResourceLocation recipeId, PacketBuffer buffer) { return null; } @Override public void write(PacketBuffer buffer, IRecipe recipe) { } @Override public Object setRegistryName(ResourceLocation name) { return null; } @Nullable @Override public ResourceLocation getRegistryName() { return null; } @Override public Class getRegistryType() { return null; } }
-
-
Bump, I think it might be something to do with flags/pose but I'm not entirely sure what's making those small arms appear
-
1.7.10 is no longer supported in this forum please update to 1.14-1.15
-
1.- You have to register the event in a class like this
public class YourEventClassEventHandler { @SubscribeEvent public static void negateFallDamage(LivingFallEvent event) { if (event.getEntityLiving() instanceof PlayerEntity) { PlayerEntity playerEntity = (PlayerEntity) event.getEntityLiving(); if (playerEntity.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() == ItemHolder.BATMAN_CHEST) { event.setCanceled(true); } } } @SubscribeEvent public static void onRenderPlayerPre(RenderPlayerEvent.Pre event) { PlayerEntity player = (PlayerEntity) event.getEntity(); if (player.isElytraFlying() && player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() == ItemHolder.BATMAN_CHEST) { event.getRenderer().getEntityModel().bipedRightArm.showModel = false; event.getRenderer().getEntityModel().bipedRightArmwear.showModel = true; //70 varillas 45 de cemento event.getRenderer().getEntityModel().bipedLeftArm.showModel = false; event.getRenderer().getEntityModel().bipedLeftArmwear.showModel = true; event.getRenderer().getEntityModel().bipedBody.showModel = false; } } @SubscribeEvent public static void onRenderPlayerPost(RenderPlayerEvent.Post event) { PlayerEntity player = event.getPlayer(); } }
as you can see the onRenderPlayerPre method handles the render of the player, there you can get the model and hide the body parts you want, then you can register the events in the constructor of your mod like this:
MinecraftForge.EVENT_BUS.register(YourEventClassHandler.class);
-
Managed to change the player model for my custom elytra, however whenever I toggle the " Elytra Fly" some weird small arms appear even though I set their visibility to false, this is my code:
@SubscribeEvent public static void onRenderPlayerPre(RenderPlayerEvent.Pre event) { PlayerEntity player = (PlayerEntity) event.getEntity(); if (player.isElytraFlying() && player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() == ItemHolder.BATMAN_CHEST) { event.getRenderer().getEntityModel().bipedRightArm.showModel = false; event.getRenderer().getEntityModel().bipedRightArmwear.showModel = false; event.getRenderer().getEntityModel().bipedLeftArm.showModel = false; event.getRenderer().getEntityModel().bipedLeftArmwear.showModel = false; event.getRenderer().getEntityModel().bipedBody.showModel = false; } }
The weird arms I got:
-
3 hours ago, Cadiboo said:
That’s pretty interesting. Unfortunately I’ve got very little experience with java model rendering so I don’t think I can help.
Thanks anyway, gonna start a topic with this one to see if I can get help
-
On 1/26/2020 at 10:33 PM, Cadiboo said:
It’s definitely possible to change the player model’s pose. I would look at vanilla’s code and see where it’s done from, poke around a bit and see if there are any events you can use or if there is anything that you can replace to get what you want.
Managed to change the player model thanks, however whenever I toggle the " Elytra Fly" some weird small arms appear even though I set their visibility to false, this is my code:
@SubscribeEvent public static void onRenderPlayerPre(RenderPlayerEvent.Pre event) { PlayerEntity player = (PlayerEntity) event.getEntity(); if (player.isElytraFlying() && player.getItemStackFromSlot(EquipmentSlotType.CHEST).getItem() == ItemHolder.BATMAN_CHEST) { event.getRenderer().getEntityModel().bipedRightArm.showModel = false; event.getRenderer().getEntityModel().bipedRightArmwear.showModel = false; event.getRenderer().getEntityModel().bipedLeftArm.showModel = false; event.getRenderer().getEntityModel().bipedLeftArmwear.showModel = false; event.getRenderer().getEntityModel().bipedBody.showModel = false; } }
The weird arms I got:
The
-
Hi I'd like to know if you guys have any good course / book to know how OpenGL works for Minecraft
- 1
[1.15.2] Where can I see how Minecraft renders a cape?
in Modder Support
Posted
I'm trying to get the motion of a Minecraft cape and replicate it to my custom elytra, where can I find the code?