Jump to content

Pixtar

Members
  • Posts

    57
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Germany

Pixtar's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. Hi @diesieben07 and there comes the hammer. ? Many many thanks for these snippets diesieben07. ? This will reduce my current source dramatically. ? Best regards, Mike
  2. Hi @Animefan8888 yes you're right: I missed like always "equals" .. a typical C++ disease ^^ (I've edited it.) Yes, I agree with you, that from your point of view it's better to use "instanceof" or "getClass()", but if for example a user can configure the needed entity on its own via a config file - like in my case - your method won't work if he writes down: s:entity=minecraft:armor_stand Therefore I used at first the way I've written down in my previous post. Any other solution or idea to "cast" that type of string from a config file back to "EntityArmorStand" or "EntityArmorStand.class" is appreciated. Best regards, Mike
  3. Hi @Animefan8888 examples in the form of source code are always a great help for people like me and others who are not much familiar with the depth of MC / Forge methods. Finally I think I figured out how to get the Name of the Entity; may it be a help for others ^^: @SubscribeEvent public static void onPlayerInteractSpecific( EntityInteractSpecific event ) { Entity enti = event.getTarget(); String[] entiSource = EntityList.getKey( enti ).toString().split( ":" ); if( entiSource[0].equals("minecraft") && entiSource[1].equals("armor_stand") ) { event.setCanceled( true ); } } With this code you are able to react - more dynamically - to the incoming target enity. Best regards, Mike
  4. Hey @jabelar do you know another - more dynamic - method to check if the Entity is an armor stand? I want to get at the end the Item ID or Name of the Entity - as far as there is an item available for it. In this case it would be for example: Item ID: 416 Name: minecraft:armor_stand Best regards, Mike
  5. Hi @jabelar thanks for your hint. I wasn't aware of the PlayerInteractSpecific event. The following code works like I needed it: @SubscribeEvent public static void onPlayerInteractSpecific( EntityInteractSpecific event ) { if( event.getTarget() instanceof EntityArmorStand ) { event.setCanceled( true ); } } Best regards, Mike
  6. Hi all, I'm a bit confused: Isn't there any event that is triggered, if you interact with an armor stand? I want to detect, if somebody placed anything onto the stand. Best regards, Mike
  7. Hi @loordgek, thanks for the hint. So there is no setting / option at all to handle such a thing. I did found the Morpheus mod myself while searching around. Therefore I started to handle the feature on my own. Kind regards, Pixtar
  8. Hi all, is there an option to adjust how many percentage of players need to lay in the bed to skip the night? Kind regards, Pixtar
  9. Hi @weeeee currently I'm using 1.12.1 and it seems that the event will not be called. How did you manage it? @SubscribeEvent public void onPlayerWakeUpEvent( PlayerWakeUpEvent event ) { MyMod.getLogger().warn( "onPlayerWakeUpEvent" ); //do warn message 'onPlayerWakeUpEvent' in the console } Currently I'm thinking that this event gets only fired on the client side, or am I wrong? Kind regards, Pixtar UPDATE / EDIT: weeeee did the same mistake like me. I looked at the Type Hierarchy and saw the little 'S'. The methods needs to be declared as static. Now it's working - on both sides. ^^ (Navigate with Eclipse to the base Event class and right click the class -> Open Type Hierarchy) public static void onPlayerWakeUpEvent( PlayerWakeUpEvent event )
  10. Hi all, I wanted to give players the possibility to sleep in the nether and/or the end. Currently I was able to turn off the damn explosion after right clicking a bed in such world types. Now I'm stuck making the player sleep. I tried: @SubscribeEvent public static void onPlayerRightClickBlock( RightClickBlock event ) { //some code to determine the world type ... SleepResult sR = event.getEntityPlayer().trySleep( event.getPos() ); //sR returns EntityPlayer.SleepResult.NOT_POSSIBLE_HERE (in the nether) } Does anyone have an idea how to ship around this? I had a look at https://github.com/CallMeFoxie/BetterSleeping2 to see how CallMeFoxie patched that issue, but I've my troubles understanding what causes to sleep in the nether. The main intension is (if I'm right) to ""overwrite"" the net.minecraft.world.WorldProviderHell via IClassTransformer?! In the end it's the following line which I need to work-a-round: https://github.com/Creeperface01/MinecraftSource/blob/master/src/net/minecraft/entity/player/EntityPlayer.java#L1534 Another attempt would be to extend EntityPlayer, to overwrite the trySleep method and to create a new instance of that extended class based on EntityPlayer ... could that work? Kind regards, Pixtar
  11. Ah okay, found it in another thread: if( DimensionManager.getWorld( dimension ) == null ) { DimensionManager.initDimension( dimension ); } Does the magic.
  12. Hi all, I found out how to teleport a player, but currently I'm stuck. Before teleporting the player I need to check a block from the dimension the player wants to teleport to. To check the block I'm using the following code: int dimension = -1; World wWorld = DimensionManager.getWorld( dimension ); Block bBlock = Block.getIdFromBlock( wWorld.getBlockState( pos.getPosition() ).getBlock() ); From time to time the variable wWorld is NULL. I think it's mainly, because the world was unloaded. How do I preload the needed world? Kind regards, Pixtar
  13. Sorry for replying instead of editing, but maybe I haven't explained it very well. I want to modify the SuccessCount of the scoreboard on my own. Mainly it should work like the following: The following command can by typed: /examplemod active At night it says: Active At day it says Inactive If it's active I want to set the SuccessCount to 1; on inactive I want to set it to 0. Currently I think this isn't possible to do within the execute of CommandTreeBase / CommandBase, because later in the event chain MC/Forge detects, that the command was successfully executed and overwrites my previously set number. Any ideas how to ship around this?
  14. Mhh .. maybe I did something wrong. I did the following ingame: /scoreboard objectives add CommandStats dummy /scoreboard objectives setdisplay sidebar CommandStats /scoreboard players set Success CommandStats 0 /stats entity Pixtar set SuccessCount Success CommandStats After this I executed the command which should affect SuccessCount via: sender.setCommandStat( CommandResultStats.Type.SUCCESS_COUNT, 1 ); //sender = ICommandSender .. but nothing changed in the scoreboard. Do I need to cast sender to EntityPlayerMP? Any ideas? I tried this one too, without any effect: CommandResultStats crs = new CommandResultStats(); crs.setCommandStatForSender( server, sender, CommandResultStats.Type.SUCCESS_COUNT, 1 );
  15. Hi all, I was asked, if I'm able to add a tracking to my commands if they were successful or not. The user asked about pumping it into the stats command of mc. Currently I haven't any clue for what he needs such a thing, but I'm always willing to learn. ^^ Anyway - which method is able to modify these stats? Currently I've found: ICommandSender.setCommandStat(CommandResultStats.Type type, int amount) but I'm not sure if this is the right one?! Kind regards, Pixtar
×
×
  • Create New...

Important Information

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