Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
225 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 19 additions & 3 deletions
22
src/main/java/com/blamejared/contenttweaker/ContentTweaker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,40 @@ | ||
package com.blamejared.contenttweaker; | ||
|
||
import com.blamejared.crafttweaker.api.*; | ||
import net.minecraft.item.*; | ||
import net.minecraftforge.event.*; | ||
import net.minecraftforge.fml.common.*; | ||
import net.minecraftforge.fml.event.lifecycle.*; | ||
import net.minecraftforge.fml.javafmlmod.*; | ||
import net.minecraftforge.registries.*; | ||
import org.apache.logging.log4j.*; | ||
|
||
@Mod("contenttweaker") | ||
public class ContentTweaker { | ||
|
||
public static final String MODID = "@MODID@"; | ||
public static final String NAME = "@NAME@"; | ||
public static final String MOD_ID = "contenttweaker"; | ||
public static final String NAME = "ContentTweaker"; | ||
|
||
public static final Logger LOG = LogManager.getLogger(NAME); | ||
|
||
public ContentTweaker() { | ||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); | ||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::registerItems); | ||
} | ||
|
||
private void setup(final FMLCommonSetupEvent event) { | ||
VanillaFactory.registerLocked = true; | ||
LOG.info("{} has loaded successfully!", NAME); | ||
} | ||
|
||
private void registerItems(final RegistryEvent.Register<Item> registryEvent){ | ||
if(registryEvent.getRegistry() != ForgeRegistries.ITEMS) { | ||
//Why though? | ||
return; | ||
} | ||
|
||
CraftTweakerAPI.logWarning("Hello from CoT!"); | ||
VanillaFactory.registry = registryEvent.getRegistry(); | ||
CraftTweakerAPI.loadScripts(new ScriptLoadingOptions().execute().setLoaderName(MOD_ID)); | ||
VanillaFactory.registerLocked = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/blamejared/contenttweaker/items/BracketHandlers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.blamejared.contenttweaker.items; | ||
|
||
import com.blamejared.contenttweaker.items.wrappers.*; | ||
import com.blamejared.crafttweaker.api.annotations.*; | ||
import net.minecraft.item.*; | ||
import org.openzen.zencode.java.*; | ||
|
||
import java.util.*; | ||
|
||
@ZenRegister | ||
@ZenCodeType.Name("mods.contenttweaker.BracketHandlers") | ||
public class BracketHandlers { | ||
|
||
@BracketResolver("itemgroup") | ||
public static MCItemGroup getItemGroup(String tokens) { | ||
return Arrays.stream(ItemGroup.GROUPS) | ||
.filter(g -> g.getPath().equals(tokens)) | ||
.map(MCItemGroup::new) | ||
.findAny() | ||
.orElseThrow(() -> new IllegalArgumentException("Could not find itemgroup for '<itemgroup:" + tokens + ">'!")); | ||
} | ||
} |
Oops, something went wrong.