MyRedAlien43
-
Posts
37 -
Joined
-
Last visited
Posts posted by MyRedAlien43
-
-
Okay, I added 2 more breakpoints, and the only one that triggered was the "executes" line. I will now edit the post to mark where I put the breakpoints
-
2 minutes ago, Ugdhar said:
Did you launch the project in debug mode? I don't know how intellij does it, but I know with eclipse you have to run the project in debug mode, not normal run, to get breakpoints to work. If it still doesn't break, set a breakpoint somewhere you KNOW the code is reaching, just to make sure it's debugging properly.
Beyond that not sure about commands, not something I've messed with yet, but if you can get debug to work I'm sure that'll help!
Yes I did press debug mode... Let me just use another breakpoint somewhere..
-
-
1 hour ago, Draco18s said:
You can do either.
I am irrelevant then
-
10 minutes ago, Beep said:
I have, and so far I've got that it needs to be called in FMLClientSetupEvent in my main method, which is definitely something I needed to know but not quite what I was looking for.
Also, I understand that the inputs are ContainerType<? extends M> type and ScreenManager.IScreenFactory<M, U> factory, but I don't know how to make a new ContainerType or IScreenFactory. Most questions based around that method seem to be asking things at a level I am not at. I'm still looking but I'm not understanding it so farAn IScreenFactory basically requires a reference to the screen class constructor (e.g. ScreenClass::new), and you can look in ContainerType to see how you make one
-
1 minute ago, Beep said:
Okay, ScreenManager has openScreen, getScreenFactory, getFactory, and registerFactory. There's also createScreen. I'm not sure which one you are referring to, I can't quite understand what they do well enough to see which one links the container and the screen
Its registerFactory
-
You need to link the container and the screen (aka Gui) Using a method in ScreenManager using a method that i cant remember
-
NetworkHooks.openGui
-
I'm pretty sure you need to register the class itself, not an instance of it....
Correct me if I'm wrong -
So I want to create a command to teleport between dimensions, for testing, but when I try to run it, the game says
"Unknown Command"
"...dimension_name_here <--[HERE]"
And I also tried using breakpoints but they didn't trigger whatsoever??Command Class:
public class TeleportDimensionCommand { public static void register(CommandDispatcher<CommandSource> dispatcher) { LiteralArgumentBuilder<CommandSource> builder = Commands.literal("teleport_dimension").requires(source -> source.hasPermissionLevel(2)); builder.then(Commands.argument("dimension", DimensionArgument.getDimension())); builder.executes(TeleportDimensionCommand::teleport); //Only breakpoint which triggered LiteralCommandNode<CommandSource> teleport_dimension = dispatcher.register(builder); dispatcher.register(Commands.literal("tp_dim").requires(source -> source.hasPermissionLevel(2)).redirect(teleport_dimension)); } private static int teleport(CommandContext<CommandSource> context) { ServerPlayerEntity player; try { player = context.getSource().asPlayer(); //Put a breakpoint here.. player.sendMessage(new StringTextComponent("Attempting teleport...")); //When I didn't put any arguments, this popped up in chat } catch (CommandSyntaxException e) { Main.getLogger().error(Markers.ERROR, "Could not get player from source"); e.printStackTrace(); return 0; //Also tried a breakpoint here } if(player.changeDimension(DimensionArgument.getDimensionArgument(context, "dimension")) == null) { Main.getLogger().error(Markers.ERROR, "Could not teleport player"); //Put a breakpoint here player.sendMessage(new StringTextComponent("Could not teleport")); } else { player.sendMessage(new StringTextComponent("Teleported!")); //Put a breakpoint here } return 1; } }
In my main class:
package sdt.undergroundadditions; //Imports here... @Mod("undergroundadditions") public class Main { public Main() { //Some more code here.. IEventBus forge = MinecraftForge.EVENT_BUS; //Adding listeners here... forge.addListener(this::serverStarting); } //Some more methods in between here private void serverStarting(FMLServerStartingEvent event) { TeleportDimensionCommand.register(event.getCommandDispatcher()); logger.info(Markers.SERVER_STARTING, "Initialized server starting events"); } }
And, there's no error in the logs too. What's wrong?
-
13 minutes ago, diesieben07 said:
Looks right. But I am not 100% sure how multiple entries behave - i.e. if they always all generate.
What do you mean? Also, it works.
-
12 minutes ago, diesieben07 said:
As I understand it you'd have to use multiple entries then.
like this?
{ "type": "minecraft:block", "pools": [ { "rolls": 1, "entries": [ { "type": "minecraft:item", "functions": [ { "function": "minecraft:set_count", "count": 4 }, { "function": "minecraft:explosion_decay" } ], "name": "undergroundadditions:dirt_chunk" }, { "type": "minecraft:item", "conditions": [ { "condition": "minecraft:random_chance", "chance": 0.125 } ], "name": "undergroundadditions:grass_seeds" } ] } ] }
-
14 hours ago, Draco18s said:
Any condition you want.
What's your goal?
I want for it to always give dirt chunks when broken, but only grass seeds within a chance.
-
4 hours ago, desht said:
Your pool is of type "alternatives", which means "select one sub-entry from a list". Your second sub-entry (dirt_chunk) has no condition, so it's always successful; therefore the third entry (grass_seeds) will never be reached.
what condition can I put there?
-
I've been trying to add loot tables to my blocks + override vanilla ones but it posts this warning message despite what I do, and it's becoming annoying.
The loot tables work, but I want to get rid of this warning message so I can actually do this right.
What does this mean?
Example loot table json (most of them are like this):{ "type": "minecraft:block", "pools": [ { "name": "organic_grass", "rolls": 1, "entries": [ { "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", "conditions": [ { "condition": "minecraft:match_tool", "predicate": { "enchantments": [ { "enchantment": "minecraft:silk_touch", "levels": { "min": 1 } } ] } } ], "name": "undergroundadditions:organic_grass" }, { "type": "minecraft:item", "functions": [ { "function": "minecraft:set_count", "count": 4 }, { "function": "minecraft:explosion_decay" } ], "name": "undergroundadditions:dirt_chunk" }, { "type": "minecraft:item", "conditions": [ { "condition": "minecraft:random_chance", "chance": 0.125 } ], "name": "undergroundadditions:grass_seeds" } ] } ] } ] }
-
Correct me if I'm wrong. I also had this problem but I fixed it by passing all of the parameters in the command.
-
10 minutes ago, loordgek said:
you override hasTileEntity but not createTileEntity
Omfg im so dumb... if i knew i didnt override it... thanks it works now i really want to bang my head onto a wall
Also thanks for the help @diesieben07 i appreciate it
-
2 minutes ago, diesieben07 said:
If that is really the case, something is very wrong.
Please post a Git repository of your mod.
-
4 minutes ago, diesieben07 said:
Okay. If the first line is not triggered, obviously the other two can't trigger as well.
Now, try to use some logical reasoning. You have various if statements in onBlockActivated, so if it's not getting to openGui some condition before that is not true. Use the debugger to find out what is not true any why.
I put a break point on the line:
if(worldIn.isRemote) { return true; //This line }
And it triggered, and not the other one I put on the line:
TileEntityPress te = (TileEntityPress)worldIn.getTileEntity(pos);
that is on the else side of the if above
-
3 minutes ago, diesieben07 said:
Dude. Can you stop being so vague?
Where exactly did you put breakpoints?NetworkHooks.openGui(playermp, te, buf -> buf.writeBlockPos(pos));
return new ContainerPress(playerInventory, this);
return GuiHandler.GUI.PRESS.getGuiID();
-
1 minute ago, diesieben07 said:
Where did you put breakpoints? Did they get hit?
They didn't get hit.. I tried putting it in the block and the tile entity
-
1 minute ago, diesieben07 said:
Define "got nothing". What did you do? What happend?
Nothing popped up / got written in the debugger
-
22 minutes ago, diesieben07 said:
LOL.
Also, I know what a debugger is, I just didn't know which one
-
I got nothing in the debugger
[1.15.2] Custom Point of Interest For Villigers
in Modder Support
Posted
Also want to know this