Jump to content

Orionss

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Orionss

  1. Hello and thank you for your answer. I'm afraid that the Block class doesn't have an overridable createTileEntity function neither a hasTileEntity function as shown in your examples : EDIT : ok, I was mispelling it. But it doesn't solve my problem with datafixers for now. I'm looking depper in your examples right now. /** * User: The Grey Ghost * Date: 11/01/2015 * * BlockTileEntityData is a ordinary solid cube with an associated TileEntity * For background information on block see here http://greyminecraftcoder.blogspot.com.au/2014/12/blocks-18.html */ public class BlockTileEntityData extends Block { public BlockTileEntityData() { super(Block.Properties.create(Material.ROCK) ); } private final int TIMER_COUNTDOWN_TICKS = 20 * 10; // duration of the countdown, in ticks = 10 seconds @Override public boolean hasTileEntity(BlockState state) { return true; } // Called when the block is placed or loaded client side to get the tile entity for the block // Should return a new instance of the tile entity for the block @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) {return new TileEntityData();} // Called just after the player places a block. Start the tileEntity's timer @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityData) { // prevent a crash if not the right type, or is null TileEntityData tileEntityData = (TileEntityData)tileentity; tileEntityData.setTicksLeftTillDisappear(TIMER_COUNTDOWN_TICKS); } } // render using a BakedModel // not required because the default (super method) is MODEL @Override public BlockRenderType getRenderType(BlockState iBlockState) { return BlockRenderType.MODEL; } } Without ITileEntityProvider implementation, there is not these functions. I'm using forge 1.15.2 31.1.0 It's not the only problem I encounter : there is a lot of "func_id_x_" functions in the API, and I don't have the setters for Block properties. Even in the last implemented TileEntityBlocks, as the lectern, I see a use of the ITileEntityProvider, and in the net.minecraft.block code, it's not marked as deprecated. EDIT 2 : I can see that the TileEntityType.Builder.create().build() function is marked as @NotNull EDIT 3 : I solved the problem by adding the library Gradle: com.mojang:datafixerupper:2.0.24 to my classpath, IntelliJ didn't ask me until I decomposed the assignation in : TileEntityType.Builder<NIHayTileEntity> builder = TileEntityType.Builder.create(NIHayTileEntity::new, blockNIHay); tileEntityNIHayBlock = builder.build(null);
  2. Yeah, I think it can be done in a second time. (it doesn't change anything if I do it anyway) I would like to know if this is normal that ITileEntityProvider is seen as deprecated ? What should I use then ?
  3. Hello, I have troubles while trying to register a new TileEntityType. I get the error : Cannot access com.mojang.datafixers.types.Type for this sample : @SubscribeEvent public static void onTileEntitiesTypeRegistry(final RegistryEvent.Register<TileEntityType<?>> entitiesRegistryEvent) { TileEntityType<?> type = TileEntityType.Builder.create(NIHayTileEntity::new, blockNIHay).build(null); entitiesRegistryEvent.getRegistry().register(e); } I get the error on the first line of the function, where type is initialized. My TileEntity : public class NIHayTileEntity extends TileEntity { public NIHayTileEntity() { super(NatureImprovedMod.tileEntityNIHay); } } I've taken the example of the FurnaceTileEntity, but it seems that ITileEntityProvider was marked as deprecated. I can't figure why. public class NIHayBlock extends Block implements ITileEntityProvider { public NIHayBlock() { super(Properties.create(Material.LEAVES).sound(SoundType.PLANT).hardnessAndResistance(0.25f)); } @Override public TileEntity createNewTileEntity(IBlockReader worldIn) { return new NIHayTileEntity(); } } Can you help me please ? Addendum :
  4. I'm fucking blind & stupid, thank you very much
  5. Hello there, I would like to spawn my new working mob (working when summoned) instead of a Cow entity. I've seen on other posts that the best way to do that is to create a new entity at the spawning event of a cow, and to remove the old cow. I've tried this way (and some others) : @SubscribeEvent public static void onWorldJoin(final EntityJoinWorldEvent entityJoinWorldEvent) { Entity entity = entityJoinWorldEvent.getEntity(); if (entity instanceof CowEntity) { NewCowEntity newCow = e.create(entity.world); newCow.setPosition(entity.getPosition().getX(), entity.getPosition().getY(), entity.getPosition().getZ()); entity.remove(); } } It's not working at all, the original cow just disappears and the newCow never comes. I've tried to teleport to any entity of type new_co but no entity is found (the EntityType is found however). How could I repair this behaviour please .
  6. Hello, I would like to retry to develop some mods for Minecraft 1.14.4 but I feel like there's a lack of documentation here. Maybe I'm blind (feel free to redirect me) but I've not seen a lot of user-friendly sources of information (The doc seems to be updated for 1.13 only) on the website nor elsewhere. Can you help me to find documentation please ?
×
×
  • Create New...

Important Information

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