Jump to content

MaxAnimator

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by MaxAnimator

  1. Hello again, after a long time I got back onto this issue. I tried many things, and currently I found this function "this.setMotion(this.getMotion().add(0.0D, 0.08D, 0.0D));". But it still doesnt work, the entity just doesnt move and stays in air. Yes I tried changing the value to see if it was counter balanced by another use of this function in the code, but still nothing. package com.maxandcarl.inan.entities; import net.minecraft.entity.EntityType; import net.minecraft.entity.item.FallingBlockEntity; import net.minecraft.world.World; public class EndGravelBlockEntity extends FallingBlockEntity{ @Override public void tick() { this.setMotion(this.getMotion().add(0.0D, 0.08D, 0.0D)); } public EndGravelBlockEntity(EntityType<? extends FallingBlockEntity> type, World worldIn) { super(type, worldIn); } }
  2. Hello there, so I tried making a falling block that falls up. So I made a new entity that extends FallingBlockEntity and I overwrited a method in the constructor to change the motion of the entity. I tried changing values to their negative equivalent and multipliying them by -1 but none worked. package com.maxandcarl.inan.entities; import net.minecraft.block.BlockState; import net.minecraft.entity.EntityType; import net.minecraft.entity.item.FallingBlockEntity; import net.minecraft.world.World; public class EndGravelBlockEntity extends FallingBlockEntity{ public EndGravelBlockEntity(World worldIn, double x, double y, double z, BlockState fallingBlockState) { super(worldIn, x, y, z, fallingBlockState); this.setPosition(x, y + (double)((1.0F - this.getHeight()) /2.0F) * -1, z); } public EndGravelBlockEntity(EntityType<? extends FallingBlockEntity> type, World worldIn) { super(type, worldIn); } } Help please. Is gravity linked directly to this function for falling blocks or is it something else that applies to every entity that I have to change?
  3. This is what I tried doing: public class EndGravelBlock extends FallingBlock{ public EndGravelBlock(Properties properties) { super(properties); } public void WorldTickEvent() { ServerWorld.getEntities(EntityFallingBlock); } } It gives me an error when using instanceof and it doesn't let me import EntityFallingBlock
  4. How do I "use world tick and get every entity and check if its your falling block and set its motion"? I'm still beggining at modding and java...
  5. I don't have a git repository, but here's the class' code: package com.maxandcarl.inan.objects.blocks; import java.util.Random; import net.minecraft.block.BlockState; import net.minecraft.block.FallingBlock; import net.minecraft.entity.item.FallingBlockEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.server.ServerWorld; public class EndGravelBlock extends FallingBlock{ public EndGravelBlock(Properties properties) { super(properties); } @Override public void tick(BlockState state, ServerWorld worldIn, BlockPos pos, Random rand) { if (worldIn.isAirBlock(pos.up()) || canFallThrough(worldIn.getBlockState(pos.up())) && pos.getY() <= 0) { FallingBlockEntity fallingblockentity = new FallingBlockEntity(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() * -1, (double)pos.getZ() + 0.5D, worldIn.getBlockState(pos)); this.onStartFalling(fallingblockentity); worldIn.addEntity(fallingblockentity); } } }
  6. Hello there! I'm fairly new to modding, and I'm trying to make a 1.15 mod for Minecraft. So my problem is: I made an end gravel block. It's nice and all, but I want it to fall upside down, e.g. up. But: at first, I made a new block using the class GravelBlock, and it worked! But it wasn't falling upside down yet of course. So: I made a new class called EndGravelBlock which extends FallingBlock(I tried expending GravelBlock first but it didn't work either), and I "overrided" a method which I assume to be what MOVES the falling block. The problem though is that after inverting values which I didn't know the use because there wasn't any variables, just floats and ints, I ended up in ALL cases with a block that DID NOT even SPAWN a falling block. So my question is: am I supposed to change the way it moves in the blocks class? If yes how? Or am I supposed to create a new Entity that expends EntityFallingBlock and change it's gravity? Cuz I haven't made a single entity ever in any of my tests with modding. Sorry for bad english
×
×
  • Create New...

Important Information

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