Jump to content

Kristopher_RAS

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by Kristopher_RAS

  1. So where can I find my advancement ? well found it: return serverPlayer.getAdvancements().getProgress(serv.getAdvancementManager().getAdvancement(Registry.GetRL(AdvName))).isDone();
  2. Last small things, I still to use: Minecraft.getInstance().player.connection.getAdvancementManager().getAdvancementList().getAdvancement(Registry.GetRL(AdvName)) to get the advancement, if I'm Serveur side how do I get a ClientPlayerEnity (where is the connection and the advancementManager) ??
  3. I've followed this tutorial: And now it work properly this "Research" Function is called on server side (I've tested it with isRemote), Thank you a lot guys. If you want me to post my codes for you to check tell me.
  4. https://mcforge.readthedocs.io/en/1.15.x/networking/simpleimpl/ Did not really helped me, do you have a proper tutorial on Minecraft networking ??
  5. OK, so I found this https://mcforge.readthedocs.io/en/1.15.x/networking/simpleimpl/, to learn how to send packet but I'm not sure if EntityPlayerMP is ClientPlayerEnity or ServeurPlayerEntity (I guess this is he first but i want to be sure). My bad found it: ServeurPlayerEntity
  6. Well basically the event is called when the player press a button in the interface. But the screen, handle the button events only on client side (I think), so I don't know how to do it on server side.
  7. So I tried using player.world.getServer() but it crashed. I've made some test and player.world.getServer() return null. Note: the player came from the container for the interface.
  8. Hello everyone, I'm sorry if I asking a lot of question recently. But I've noticed that when I place a block I created his assigned tile entity is created twice (more exactly two of them are created). Same when I open the block interface two container are created. BUT only one screen is created. So my question is: "Is that normal ?? And how do I synchronize them" Note: I've tried to figured it out and I've noticed the override function createTileEntity of the block is called twice (on client side), so this is why I have a doubt about if it's a bug or not. Thanks.
  9. I have a research table and when you do a specific researches it unlock some advancements but I have to check first if the previous achievement has been granted or not.
  10. This is the only way I've found. But if you have a better way don't hesitate to tell.
  11. After hours of research in the forge and minecraft codes i found it: Minecraft.getInstance().getIntegratedServer().getPlayerList().getPlayerAdvancements(Minecraft.getInstance().getIntegratedServer().getPlayerList().getPlayers().get(0)).grantCriterion(Minecraft.getInstance().player.connection.getAdvancementManager().getAdvancementList().getAdvancement(Registry.GetRL("copper_cable")), "unlock"); Minecraft.getInstance().getIntegratedServer().getPlayerList().getPlayerAdvancements(Minecraft.getInstance().getIntegratedServer().getPlayerList().getPlayers().get(0)).getProgress(Minecraft.getInstance().player.connection.getAdvancementManager().getAdvancementList().getAdvancement(Registry.GetRL("copper_cable"))).getPercent();
  12. Hello everyone, I try access to the player advancements to - first: check if specifics advancements has been granted - second: Grant advancements. I found several leads like: Minecraft.getInstance().player.connection.getAdvancementManager().setSelectedTab(Minecraft.getInstance().player.connection.getAdvancementManager().getAdvancementList().getAdvancement(Registry.GetRL("copper_cable")), true); also I found a class called: PlayerAdvancements (With a grant and revoke function) but I don't know where to find it in the player class or how to instance a new one (the second arguments is a file and I don't know what file it has to be). (https://forge.galaxy.nctu.me/forge/javadoc/14.23.5.2838-stable_39/net/minecraft/advancements/playeradvancements#getProgress-net.minecraft.advancements.Advancement-) Thanks. Note: it's possible to grant achievement through commands but I prefer do it by code.
  13. Hi, I try to create a team, here is the actual code: World.getScoreboard().createTeam("blue"); World.getScoreboard().getTeam("blue").setDisplayName(new StringTextComponent("Blue")); World.getScoreboard().getTeam("blue").setColor(TextFormatting.BLUE); World.getScoreboard().getTeam("blue").setNameTagVisibility(Visible.HIDE_FOR_OTHER_TEAMS); When I'm testing it the team is well created but when I try the command : /team join (minecraft offer the "blue" option to me) Dev : it says "Unknown team 'blue' " Same when ask: /team list: it says: "there are no teams" Note: - the team is created by right click on a block in the mod. - Each time I reload the map the team disappear. RESOLVED BY IT SELF.
  14. Hey, Thank you for your answer: it was func_225533_a_ I was stupid to do not think about it I usually check them when I can't find a function. Anyways I gonna check for mapping. Thanks a lot.
  15. Thanks for your help
  16. Hi everyone, I try to make an event when a player is right-clicking on my block. I Found this function from Block Class: onBlockActivated that we usually override and add the event but I can't find it in 1.15. Do you which function is replacing this?
  17. Ok found it, I have to define multiple AABB that define the edges of the block and then combine all of them in one voxel shape: public static final AxisAlignedBB FEET1_AABB = new AxisAlignedBB(0D, 0D, 0D, 2D/16D, 15D/16D, 2D/16D); public static final AxisAlignedBB FEET2_AABB1 = new AxisAlignedBB(14D/16D, 0D, 0D, 16D/16D, 15D/16D, 2D/16D); public static final AxisAlignedBB FEET3_AABB1 = new AxisAlignedBB(0D, 0D, 14D/16D, 2D/16D, 15D/16D, 16D/16D); public static final AxisAlignedBB FEET4_AABB1 = new AxisAlignedBB(14D/16D, 0D, 14D/16D, 16D/16D, 15D/16D, 16D/16D); public static final AxisAlignedBB TOP_AABB1 = new AxisAlignedBB(0D, 15D/16D, 0D, 16D/16D, 16D/16D, 16D/16D); public static VoxelShape shapeMain; //Initializing blocks property public Research_basic() { super("research_basic", Block.Properties.create(Material.WOOD).hardnessAndResistance(1.f, 5.f).variableOpacity(), ModTypes.STATIONS); VoxelShape shape1 = VoxelShapes.create(FEET1_AABB); VoxelShape shape2 = VoxelShapes.create(FEET2_AABB1); VoxelShape shape3 = VoxelShapes.create(FEET3_AABB1); VoxelShape shape4 = VoxelShapes.create(FEET4_AABB1); VoxelShape shape5 = VoxelShapes.create(TOP_AABB1); shapeMain = VoxelShapes.combine(shape1, shape2, IBooleanFunction.OR); shapeMain = VoxelShapes.combine(shapeMain, shape3, IBooleanFunction.OR); shapeMain = VoxelShapes.combine(shapeMain, shape4, IBooleanFunction.OR); shapeMain = VoxelShapes.combine(shapeMain, shape5, IBooleanFunction.OR); } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { // TODO Auto-generated method stub return shapeMain; } @Override public VoxelShape getRenderShape(BlockState state, IBlockReader worldIn, BlockPos pos) { return shapeMain; } @Override public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return shapeMain; } So now it works perfectly, thanks for your help guys.
  18. Well, my cube is a full cube so, I would say that the bounding box (the total volume) is basically a cube size. But as you can see it not take in consideration the gap between the feet of the table and it even consider it as a full block since the block underneath is not rendered. I basically want to do like a hopper or a cauldron: So: 1 I don't know because I couldn't find any tutorial about this. 2: the total volume is a full block.
  19. Okay I think I made some progress: I think I need to override those functions public static final AxisAlignedBB BASIC_AABB = new AxisAlignedBB(0D, 0D, 0D, 1D, 1D, 1D); @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { // TODO Auto-generated method stub return VoxelShapes.create(BASIC_AABB); } @Override public VoxelShape getRenderShape(BlockState p_196247_1_, IBlockReader p_196247_2_, BlockPos p_196247_3_) { return VoxelShapes.create(BASIC_AABB); } @Override public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return VoxelShapes.create(BASIC_AABB); } @Override public VoxelShape getRaytraceShape(BlockState state, IBlockReader worldIn, BlockPos pos) { return VoxelShapes.create(BASIC_AABB); But I don't really know how to use them.
  20. Thanks for your answer but there is no such function the block class. And actually BlockRenderLayer Doesn't even exist.
  21. Hi, I try to register a block with a custom model in Minecraft, but it appears as a full block (and the block under is invisible). I know that for the entities you have to create a class for the rendering and another the model. I don't know if it's the same for the blocks and if yes I don't know how to convert a JSON file for the model that I made with Blockbench into java class. Thanks for your help. Note: I found that in past version there were the functions isOpaqueCube() and isFullCube() that you were overriding but today in 1.15 with voxel it changed but I couldn't find a tutorial on it.
  22. I Understand. And I fixed it, it was indeed really simple. Thanks for your help
  23. Okay, so I looked to the source as you asked: public static <T extends Entity> void registerEntityRenderingHandler(EntityType<T> entityClass, IRenderFactory<? super T> renderFactory) { INSTANCE.entityRenderers.put(entityClass, renderFactory); } It asks for an EntityType<T> entityClass, so I tried to go give him that: public static EntityType<?> tutorial_entity = EntityType.Builder.create(TutorialEntity::new, EntityClassification.CREATURE).build(FirstMod.modid + ":tutorial_entity").setRegistryName(new ResourceLocation(FirstMod.modid, "tutorial_entity")); This is the EnityType defined in another class defined with my EntityClass but it still not working I don't know why. It's possible that I'm missing something really stupid it happened a lot to me. I also check the source of the function in 1.14 and it's different: public static <T extends Entity> void registerEntityRenderingHandler(Class<T> entityClass, IRenderFactory<? super T> renderFactory) { INSTANCE.entityRenderers.put(entityClass, renderFactory); } It asks for a Class<T> entityClass things that I was provided in the previous version (that the guy was doing in his tutorial).
  24. I know about Generics (I'm a C++ programmer for 6 Years now and we have the same things it's called templates, whit few different changes). The problem is that in 1.14 the registerEntityRenderingHandler wasn't required a generics it was asking for an Entity class. Today in 1.15 it asking an EntityType with a generics probably the Entity class but when I'm implementing my EntityType class it still shows me an error. So all I'm asking what they changed between the versions because in 1.14 this worked public class TutorialRenderRegistry { public static void registryEntityRender() { RenderingRegistry.registerEntityRenderingHandler(TutorialEntity.class, new TutorialEntityRender.RenderFactory()); } } Maybe the registerEntityRenderingHandler function is outdated something appeared in 1.15.
  25. Hi, I try to register my entity (I follow a tutorial so just ignore the names I gave to the classes), So I made this class: public class TutorialRenderRegistry { public static void registryEntityRender() { RenderingRegistry.registerEntityRenderingHandler(TutorialEntity.class, new TutorialEntityRender.RenderFactory()); } } but on the registerEntityRenderingHandler function it shows me an error: I did exactly what he did in the tutorial and it worked for him, why not for me? The Tutorial is with Forge 1.14 me I'm with Forge 1.15 maybe it has been changed in the update but I don't know to resolve it. EDIT: I tried with forge for 1.14 and it works perfectly if someone knows what changed in the 1.15 version, how to fix this, maybe it's a bit too soon to 1.15 since it has just been released.
×
×
  • Create New...

Important Information

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