Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Everything posted by Pixtar

  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
  16. Hi all, a user asked me, if I could port my mod back to 1.11.2 and 1.10.2. That's not the problem at all, I've more a problem to use conditionals to have an easy to use code afterwards without losing any functionality. As far as I know maven solves the topic conditionals by using different profiles which are used to include different files. So if I'm right let us take the following function: FMLCommonHandler.instance().getMinecraftServerInstance().getWorld( id ); //in 1.12.2 FMLCommonHandler.instance().getMinecraftServerInstance().worlds[ id ]; //in 1.11.2 FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[ id ]; //in 1.10.2 Now I need to put them into a method like public static WorldServer getServer( int id ) and this one into separated files like: example.utils.getWorldServer.1-12-2.java; example.utils.getWorldServer.1-11-2.java; example.utils.getWorldServer.1-10-2.java; To use them I need to include the entire namespace with import example.utils.getWorldServer.*; The last step would be to create a xml file handling the profiles which java file should be included, where I got stucked. I mean shouldn't it be possible through gradle too? Like: if ( project.minecraft.version.equals("1.12.2") ) // include file 1-12-2.java else if ( project.minecraft.version.equals("1.11.2") ) // include file 1-11-2.java else if ( project.minecraft.version.equals("1.10.2") ) // include file 1-10-2.java If you have any other more sophisticated ideas to solve this topic I will appreciate it. Kind regards, Pixtar
  17. Hi Draco18s, thanks for your detailed answer. For a bed I got the properties I needed, thanks so far: ImmutableMap < IProperty<?>, Comparable<? >> iMap = event.getState().getProperties(); EnumFacing ef = null; EnumPartType ept = null; for( Map.Entry<IProperty<?>, Comparable<? >> entry : iMap.entrySet() ) { if( entry.getValue() instanceof EnumFacing ) { ef = (EnumFacing) entry.getValue(); } if( entry.getValue() instanceof EnumPartType ) { ept = (EnumPartType) entry.getValue(); } } if( ef != null && ept != null ) ... I will look at the other properties of chest and sunflowers to see how it's working there. Kind regards, Pixtar
  18. Hi all, what I want to achieve is to find the next entity of a multiblock. That means for example if I click a multiblock like a bed/door/chest/piston/sunflower/etc. to detect the position of the other none clicked element/entity of that block. Is there an easy way to achieve this? Kind regards, Pixtar
  19. Hi all, is there a function to get all registered blocks / items of a certain mod? If so, what's the name of it? Pixtar
  20. Guilty as charged. Yeah sometimes I'm slow on the uptake. I will try the tutorial next ^^
  21. Hi all, now I know why I can throw away the exact amount , because my inventory is stored server-side - so it still knows that there are e.g. two of the not placed blocks. *facepalm* Dropping, collecting, clicking or changing the held item will sync the client with the server. Isn't there any public event/signal to generate that network package manually like: event.setCanceled( true ); if( FMLCommonHandler.instance().getSide().isServer() ) { //Emit standard held item event } Have a nice day, Pixtar
  22. Hi all, in my opinion it would be like taking a sledgehammer to crack a nut (after I saw the tutorial). I'm still confused about the fact, that I can throw away, the ""gone"" blocks in the right amount. That fact is telling me that there is still a sync of the canceled event. --.-- Pixtar
  23. Hi Draco18s, thanks for the link. The tutorial from coolAlias in the MinecraftForum is nice and I think that it's working - but I feels like putting the cart before the horse. Like I mentioned IMHO the client knows about the not placed block it ""only"" needs to update the active slot at the right time. Isn't there any event or callback when a placed block isn't placed where I can hook into to refresh the hotbar? Like this? @SubscribeEvent void canceledEvent( CancelEvent event ) { if( event.type == Events.PlaceEvent ) { if( event.getEntity() instanceof EntityPlayerMP ) { ((EntityPlayerMP)event.getEntity()).updateHeldItem(); } } } Kind regards, Pixtar
  24. Hi Draco18s, your answer tunes me in a good mood, because your answer sounds like it's possible to synchronize the config files. Do you have any hint for me which class/method could be used for such a crazy venture? Kind regards, Pixtar
  25. Hi all again, it's driving me insane. It's only working flawless if both ; client and server are having the same config file. Now I changed the config file at the server from dirt to stone and I'm running into the same problem - again. Block isn't placed, Block is temporary gone from the hotbar slot. I can throw/drop [Q] the "empty" slot and it drops the gone stone block. SOO the client knows about the not placed block, but it doesn't refresh the hotbar slot. How can I refresh/update the hotbar slot? Kind regards, Pixtar
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.