Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
CreatureChat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Public
CreatureChat
Commits
3829e213
Unverified
Commit
3829e213
authored
Sep 22, 2021
by
Levy Ehrstein
Committed by
GitHub
Sep 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Logger instead of println (#126)
parent
9df9227e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
ExampleMod.java
src/main/java/net/fabricmc/example/ExampleMod.java
+8
-1
ExampleMixin.java
src/main/java/net/fabricmc/example/mixin/ExampleMixin.java
+2
-1
No files found.
src/main/java/net/fabricmc/example/ExampleMod.java
View file @
3829e213
package
net
.
fabricmc
.
example
;
import
net.fabricmc.api.ModInitializer
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
public
class
ExampleMod
implements
ModInitializer
{
// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public
static
final
Logger
LOGGER
=
LogManager
.
getLogger
(
"modid"
);
@Override
public
void
onInitialize
()
{
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.
System
.
out
.
println
(
"Hello Fabric world!"
);
LOGGER
.
info
(
"Hello Fabric world!"
);
}
}
src/main/java/net/fabricmc/example/mixin/ExampleMixin.java
View file @
3829e213
package
net
.
fabricmc
.
example
.
mixin
;
import
net.fabricmc.example.ExampleMod
;
import
net.minecraft.client.gui.screen.TitleScreen
;
import
org.spongepowered.asm.mixin.Mixin
;
import
org.spongepowered.asm.mixin.injection.At
;
...
...
@@ -10,6 +11,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public
class
ExampleMixin
{
@Inject
(
at
=
@At
(
"HEAD"
),
method
=
"init()V"
)
private
void
init
(
CallbackInfo
info
)
{
System
.
out
.
println
(
"This line is printed by an example mod mixin!"
);
ExampleMod
.
LOGGER
.
info
(
"This line is printed by an example mod mixin!"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment