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

coalbricks

Members
  • Posts

    9
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

coalbricks's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. This is an old discussion, but after reading through it seems you've been unfair to @mlgmxyysd and wrong to assume that there are only two reasons why someone might want an offline mode server. I can give you a couple more valid and legitimate reasons: 1. The local network point is valid, and yes nobody can join from outside, but he could be running his server on a university network in which case custom authentication would be useful. It could be that nobody could join from outside, but 30 thousand people could join from inside. 2. He could be running his server on a network where Minecraft's authentication endpoint is blocked.
  2. You've already done it, here: new SPlayerListItemPacket(SPlayerListItemPacket.Action.UPDATE_DISPLAY_NAME, (ServerPlayerEntity) player) A packet is just a bit of data that is sent between two or more computers over a network. Usually you don't have to manually send packets because Minecraft takes care of this for you for standard vanilla gameplay, but in this case I think it's the best solution. You can dig around the 'net.minecraft.network' or 'net.minecraft.network.play' packages to look at some example packet implementations; AFAIK there isn't any documentation on them. What IDE are you using?
  3. It looks like you will need to use reflection twice. After you create the packet object, you will need to access SPlayerListItemPacket#players. SPlayerListItem#getEntries() only exists on the client, so you won't be able to use this. The elements of the list (of type SPlayerListItemPacket.AddPlayerData) contain a private 'displayName' member, which you will also need access to. (I would advise creating the Field objects in a static context instead of every EntityJoinWorldEvent, to save performance). Iterate through all the objects in the list and set their display names accordingly - although from your code it looks like there should only be one object in the list.
  4. You can use one of the subclasses of net.minecraftforge.event.entity.player.PlayerInteractEvent, some of which are fired both client and server side. The javadoc comments for each of these classes tell you on which sides the event will be fired.
  5. Replying for future modders. net.minecraftforge.event.entity.player.PlayerInteractEvent does what you need. As of 1.16.1 there are several subclasses that the server fires when a player right or left clicks; the one you're looking for is probably PlayerInteractEvent.RightClickItem.
  6. 1. It's a basic example. And that exception handling is fine for the purposes of being a basic example. It's also fine in production code in certain cases which I don't want to debate here, although I will admit the doStuff() function should have a null guard. 2. Yes while it would be better to store it in a static final field, the JVM optimizations obtained by making the member final are minimal at best, unless the field is being used to perform reflective gets/sets frequently. This pattern works perfectly fine in MOST cases but if you really care you can separate the static initializer logic into a separate function and make the field final; in most cases it's just not worth the trouble.
  7. I took a look at RedstoneWireBlock and placed some dust in Minecraft to see what's up (you can press F3 and look at the dust to see properties). There's a RedstoneSide enum that can be either NONE, SIDE, or UP. Each side of the block (north, south, east, west) has an associated RedstoneSide value. These side properties are mapped to these enum values in a BlockState (field_235543_o_). Consider a block of redstone dust, Block A. If Block A was not surrounded by any blocks and the dust was pointing in all directions, the NORTH, SOUTH, EAST, and WEST properties would all be SIDE. If there was another redstone dust to the north of Block A, then Block A's NORTH and SOUTH properties would be SIDE, and its EAST and WEST properties would be NONE. If there was a solid block to the north of Block A with a dust on top, then Block A's NORTH property would be UP, its SOUTH property would be SIDE, and its EAST and WEST properties would be NONE. From a quick look it seems like func_235554_l_ builds a shape for each valid block state. You can probably look at the blocks adjacent to yours and set these properties accordingly, then use the properties to change the block state.
  8. Can you provide some details? What problems are you facing, what have you tried to fix them, etc...
  9. Replying for future modders. ObfuscationReflectionHelper is perfectly fine if you use it efficiently. You can use it to get a Field object, which you can store in a static member. Example: public class Example { private static Field someField = null; static { try { someField = ObfuscationReflectionHelper.findField(SomeMinecraftClass.class, "field_12345_a"); // You need to pass the SRG name someField.setAccessible(true); } catch (Exception e) { e.printStackTrace(); } } public void doStuff(SomeMinecraftClass minecraftThing) { try { Object o = someField.get(minecraftThing); } catch (Exception e) { e.printStackTrace(); } } } I would also advise against passing the fully qualified class name as a String if you can help it. It's better to use the Class object directly if you can, and in most cases you can. You can find SRG names at http://mcpbot.bspk.rs/
×
×
  • Create New...

Important Information

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