Jump to content

poopoodice

Members
  • Posts

    1160
  • Joined

  • Days Won

    7

Everything posted by poopoodice

  1. I've changed the way of registering to what Cadiboo has suggested me //Registry Class public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.ENTITIES, Reference.MODID); public static final RegistryObject<EntityType<Bullet>> BULLET = ENTITY_TYPES.register("bullet", () -> EntityType.Builder.<Bullet>create(Bullet::new, EntityClassification.CREATURE) .size(0.1F, 0.1F) .build(new ResourceLocation(Reference.MODID, "bullet").toString()) ); Since you said that the getEntityType() wouldn't work, I tried to summon the entity with command (/summon), but it only shows "Unable to summon entity" and "Tried to add entity modid:bullet but it was marked as removed already", what does it mean? Is the entity registered correctly?
  2. //Registry Class @SubscribeEvent public static void onEntitiesRegister(RegistryEvent.Register<EntityType<?>> event) { EntityType<?> bullet = EntityType.Builder.<Bullet>create(Bullet::new, EntityClassification.MISC) .size(0.1f, 0.1f) .setCustomClientFactory((packet, world) -> new Bullet(world)) .build("bullet") .setRegistryName(Reference.MODID, "bullet"); event.getRegistry().register(bullet); } //Bullet Class public Bullet(World world) { super((EntityType<? extends Bullet>) getEntityType(), world); } public static EntityType<?> getEntityType() { return ForgeRegistries.ENTITIES.getValue(new ResourceLocation(Reference.MODID + "bullet")); }
  3. My entity was not showing up at the beginning, then I noticed that I need to override IPacket<?> createSpawnPacket() After I change whatever it was returning to NetworkHooks.getEntitySpawningPacket(this) The entity appeared, but it is a pig, the debug UI (f3) also tells me that the id of the entity is minecraft:pig, but I pretty sure my entity exist on server side because I can see things I added in tick() executing. Which kind of packet do I need?
  4. It is because they dont have attribute ATTACK_DAMAGE, maybe add some checkings about whether ATTACK_DAMAGE exist for the entity then apply it
  5. Yeah, skulls have rotated models, not hitboxes. Tho you can check lectern for something similar but it is still made of multiple boxes
  6. black and pink colour means you don't have a texture for it.
  7. I think if you put this in your block class, every instance of this block will share the same values.
  8. You should probably describe what have you done and where do you not understand.
  9. What does the error say? Is it couldn't find the model file exception occurred while reading the model file? If there aren't any error you should check the place you registered your model at.
  10. Change Block to your own Block class that extends Block?
  11. Also have a look at this Forge Doc It uses (evt.getName().toString().equals("minecraft:chests/simple_dungeon")) which means the way you are doing it might be wrong (event.getName().equals(LootTableList.ENTITIES_HORSE)) or at least add a println to check if it does work
  12. Yeah you need to check if the class has been registered correctly, add some printlns to check is it actually being called
  13. Isn't name suppose to be in front of the rolls?
  14. Fixed by override shouldRefresh in te.
  15. I'm now using getActualState in my block class: @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { TileEntity te = worldIn.getTileEntity(pos); if (te instanceof TileEntityTimer) { state = state.withProperty(SECOND, ((TileEntityTimer) te).tick / 20); } return state; } and here's the onUpdate() in my tile entity class public int tick = 800; @Override public void update() { if(!world.isRemote) { this.tick--; PropertyInteger SECOND = Timer.SECOND; if (this.tick <= 0) { world.setBlockToAir(getPos()) } } } When 40 second is up, the block will be set to air, before that, the model of the timer will be changed each second depends on how many seconds has left. Although the tileentity is working (it is counting down correctly), getActualState has not changed each second.
  16. Okay, thanks for the advice. Appreciated.
  17. After all, I notice that player.velocityChanged was not necessary and I decided to move code from the eventhandler to an itemclass ( in onUpdate() ) @Override public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if(isSelected && entityIn instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityIn; player.fallDistance = 0.0F; player.motionY *= 0.90D; } } I just want to know if this fixes all the problems? Or I will still need some checkings and even more things to solve the client-server issue?
  18. I've read about getEctendedState Here is the example given from forge doc @Override public IExtendedBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { IExtendedBlockState ext = (IExtendedBlockState) state; TileEntity te = world.getTileEntity(pos); if (te instanceof MyTE) { ext = ext.withProperty(UNLISTED_PROP, ((MyTE) te).getSomeImmutableData()); } return ext; } I don't really understand what does ((MyTE) te).getSomeImmutableData()); this means? And why do I need to change IExtendedBlockState to IBlockState otherwise minecraft crashes?
  19. In my case the property integer was for modeling use, which means it can't be stored in the tileentity because it needs to be in the block so I can declare the model with blockstate. So apparently the data can't be stored in the tileentity.
  20. Well, it didn't crash or appear any error (I haven't tried it on multiplayer What I mean by the player can't move in the air is when "player.isAirBorne" and it doesn't really matter. I was trying to say when using event.player.velocityChanged = true the player won't be able to move in x and z direction. unless change event.player to Minecraft.getMinecraft().player I don't know why but it is just like this. I might record a vd later on to explain this more clearly.
  21. Thanks, I'll upload the solution later on.
  22. I created a block with property integer that contains about 41 ints and property direction. My problem is the property integer does not save, there isn't enough space for the property integer in getMetaFromState because there are only under 15 spaces can be used (correct me if I'm wrong). Is it something to do with getActualState()? If yes, how?
  23. I don't know what is the specific way to do this, but you might want to use ticking event to check what entity is instanceof EntityPlayer with the potion effect, and there are a lot of mouse events it can use as well.
  24. Can you post the log as well it makes a lot easier. Also if you mean from "no texture" means there is shape but with black and purple blocks, you need to check if there is a texture called iron_block in your textures.
  25. Solved by removing boolean variable holding One thing I want to mention is I need to use Minecraft.getMinecraft().player.velocityChanged = true; because when I use event.player.velocityChanged = true; the player will not be able to move in the air, and that's not what I want Thanks for the replies.
×
×
  • Create New...

Important Information

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