-
[1.9] Execute command with custom ICommandSender
Pardon my ignorance, but isn't that what I'm doing with Minecraft.getMinecraft()[b].getIntegratedServer()[/b].getCommandManager().executeCommand(parent, command) ? And if there is not integrated server (i.e. I'm in multiplayer), I don't even attempt to run the command.
-
[1.9] Execute command with custom ICommandSender
I've figured out that Minecraft.getMinecraft().getIntegratedServer() works in singleplayer. Because I don't really intend for this to be a server mod, I think I'll just make it not work but not crash when attempting to execute a command on a server: MinecraftServer server = Minecraft.getMinecraft().getIntegratedServer(); if(server == null) { parent.parent.out.println("You cannot run vanilla commands on a server!"); } else { server.getCommandManager().executeCommand(parent, command); } Thanks anyways for the help, Choonster and diesieben!
-
[1.9] Execute command with custom ICommandSender
As far as I can tell, there is no way to directly do this. That has the same problem as Minecraft.getMinecraft().thePlayer.getServer() : the server is null. That is just a more low-level way of saying Minecraft.getMinecraft().thePlayer.sendChatMessage(command) , which doesn't work because that sends the results of the commands to the GuiChat, not my custom GuiScreen. I'm going to see how command blocks handle it; they might have what I'm looking for.
-
Enchanted Glow
Sorry, you are correct. I thought that SimpleItemFoiled was a generic class for items that had the enchantment effect, but it appears that other such items ( ItemExpBottle , ItemEnchantedBook , etc.) merely override hasEffect() . As mentioned by coolAlias above, don't extend ItemSimpleFoiled , just insert this into your class: @SideOnly(Side.CLIENT) @Override public boolean hasEffect(ItemStack stack) { return true; }
-
Enchanted Glow
While it doesn't make any difference right now, I think it's good practice to extend ItemSimpleFoiled . That way, if ItemSimpleFoiled gets changed in the future, the mod is more likely to continue to work as intended.
-
Enchanted Glow
If you have a custom class for your item, make it extend ItemSimpleFoiled instead of Item . If you don't have a custom class for it, use ItemSimpleFoiled instead of Item when creating the item. The key here is making public boolean hasEffect(ItemStack stack) return true with your item.
-
[1.9] Execute command with custom ICommandSender
Essentially what I'm trying to do is create a GUI that can send vanilla commands and display the results of the commands. Here's what I've tried: Minecraft.getMinecraft().thePlayer.sendChatMessage(command) doesn't work because that sends the results of the commands to the GuiChat , not my custom GuiScreen . ClientCommandHandler.instance.executeCommand(commandSender, command) doesn't work because CommandHandler 's commandMap is empty, implying normal commands aren't sent that way. In answers for 1.8 and before, people have said to use MinecraftServer.getServer().getCommandManager().executeCommand(commandSender, command) , but in 1.9 getServer() is not static. Minecraft.getMinecraft().thePlayer.getServer().getCommandManager().executeCommand(commandSender, command) also doesn't work because Minecraft.getMinecraft().thePlayer.getServer() is null. I've ran out of ideas other than creating a new EntityPlayerSP and having that send commands, but I don't think that would work very well—if at all—and it's not a very elegant solution. So, how can I either send commands with a custom ICommandSender or intercept/copy the text sent to the player if I use Minecraft.getMinecraft().thePlayer.sendChatMessage(command) ?
-
[1.9] .json block help
Here's what worked for me. Put this just after you register your block: ItemBlock myItem = new ItemBlock(myBlock); GameRegistry.register(myItem.setRegistryName(myBlock.getRegistryName())); Put this in init: Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .register(myItem, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
-
[1.9][Solved] Colored leaves
As I mentioned above, those don't work in 1.9 Okay, thanks; I'll try that out! Edit: Thanks, that worked perfectly!
-
[1.9][Solved] Colored leaves
Edit: For those who have the same problem, I used Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((state, access, pos, tintIndex) -> BiomeColorHelper.getFoliageColorAtPos(access, pos), myCustomBlockInstance); I'm trying to make a block that is visually identical to leaves. I got it working well (including fast/fancy graphics) except for colorization based on biome; my block is completely gray both in my inventory and in the world. I know that I can customize color in 1.8 with getRenderColor and/or colorMultiplier, but those methods don't appear to work at all in 1.9. I've looked around in the source a bit, but I can't find anywhere that vanilla leaves are colorized, so I have no idea how to even start colorizing my leaves. Currently my leaf block is a subclass of BlockLeaves, and its blockstate json points to the oak_leaves model. If you want to look at my code (which you shouldn't need to), it's on Github here. So, how can I colorize my leaves?
IPS spam blocked by CleanTalk.