Jump to content

vemerion

Members
  • Posts

    390
  • Joined

  • Last visited

  • Days Won

    14

Everything posted by vemerion

  1. Alright, so after tinkering a bit, I realized that pushing the piston itself can easily be allowed by overriding the getPushReaction() method in the BlackStickyPistonBlock class.
  2. To be honest, I have never really looked at the piston code before, so I can't say off the top of my head how to fix your problems. Would you mind uploading you project to an online repository so I could tinker around?
  3. Why did you copy code from PistonBlock when you are already extending PistonBlock?
  4. It is hard to know what is wrong without looking at the log. Could you please post it?
  5. Well, it is hard to tell you exactly what needs changing, without just writing the code for you. I think you are going to have to experiment a little on your own. You are on the right track, a good first step is to replace the generic T with Block, and see that needs changing after that.
  6. You could probably create a new goal which is similar to the AvoidEntityGoal, but instead of avoiding entities, you would avoid certain blocks.
  7. Perhaps try the getLight() method instead?
  8. Stuff like this can be easily found both in the vanilla Minecraft source code, and on the forge documentation (here is the documentation on sound for example). It will take forever for you to finish your mod if you have to ask a question here for every method you want to use. You should really take some time and learn the features of your IDE.
  9. I think you have to manually shrink the ItemStack also.
  10. Have you tried player.inventory.armorItemInSlot()?
  11. StringTextComponent is what you are looking for. If you are using eclipse, you can right click on types (such as ITextComponent) and select 'Open Type Hierarchy' to see all subtypes, which can be useful in cases such as this.
  12. You can check out the onBlockActivated method in the FlowerPotBlock class to see how to place flowers in the power pot. It involves changing the blockstate of the pot.
  13. You can use the PlayerInteractEvent.RightClickBlock to detect when a player right clicks a flower pot.
  14. You can use the static method fromPitchYaw in Vec3d to get a vector from the pitch and/or yaw of an entity.
  15. Which version of Minecraft are you using? A lot has changed from 1.11 to now, especially regarding rendering, so a lot of code that worked previously will not work anymore.
  16. Not to sound rude, but did you learn nothing from your previous thread: It will take ages for you to get your mod done if you have to ask a question for every method you want to use. I strongly suggest that you learn how to utilize you IDE to check method signatures and vanilla code to learn by context which methods you want to use.
  17. You can render items with the ItemRenderer, which you can get from Minecraft.getInstance().getItemRenderer().
  18. To get an idea of how to create a projectile with a custom model, I would recommend taking a look at the vanilla code for the ShulkerBullet. And regarding the GUI part, do you mean like a menu (then you would need to extend the Screen class), or like an hud/overlay (then you could listen to the RenderGameOverlayEvent).
  19. I don't know if this is the best way to do it, but you can increase the brightness by changing the gamma value like so: Minecraft.getInstance().gameSettings.gamma = some value here
  20. As far as I know, there is no way to fix this, except to make changed to the interface, which is obviously not possible in this case. Therefore your best bet is unfortunately to use the SuppressWarnings annotation.
  21. What do you mean you don't know what to put as mode? How would you like the explosion to behave? Destroy blocks: Choose Explosion.Mode.DESTROY Break blocks and drop the block item: Choose Explosion.Mode.BREAK Leave blocks unharmed: Choose Explosion.Mode.NONE
  22. To be honest, the most fun and exciting part of modding (and programming in general) is the problem solving part. The joy and excitement you feel when you solve a difficult problem and the whole mod falls into place. I don't want to rob you of that feeling by handing any more code to you. I would rather see that you solve this last part by inspecting vanilla code, looking at online tutorials, and of course by using your own ingenuity. (This is not to say that you should never ask for help on the forums, but I firmly believe that you are smart enough to solve this problem yourself)
  23. You are on the right track, and I agree that the vanilla respawn code is complex. Here is how I solved it: (Make sure to put this after a !world.isRemote check to avoid reaching across sides) ServerPlayerEntity player = (ServerPlayerEntity) event.player; // Get the player somehow (from a parameter or similar) ServerWorld respawnWorld = player.server.getWorld(player.func_241141_L_()); BlockPos spawn = player.func_241140_K_(); float spawnAngle = player.func_242109_L(); boolean forcedSpawn = false; boolean preserveAnchorCharges = true; Optional<Vector3d> maybeSpawn = PlayerEntity.func_242374_a(respawnWorld, spawn, spawnAngle, forcedSpawn, preserveAnchorCharges); Then the maybeSpawn will contain the respawn position of the player, and the respawnWorld will be the world in which the player will respawn. Of course, the maybeSpawn can be empty, and then you have to get the respawn position from the world.
  24. The code to get the respawn point is kind of confusing, but I think the function func_241140_K_(), in the ServerPlayerEntity class returns a BlockPos which represents the latest used bed/respawn anchor. This can however be null if the player has not used a bed/respawn anchor. Therefore this BlockPos value should be used as parameter to the method func_242374_a() in PlayerEntity, which return an optional with a potential respawn point. You can get an idea of how vanilla does it by following the call hierarchy of the event PlayerEvent.Clone, which is called when a player respawns. P.S. Just out of curiosity, does this have anything to do with the golden chorus fruit you were working on?
×
×
  • Create New...

Important Information

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