-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 parent
4b54ce8
commit 3610e08
Showing
100 changed files
with
9,456 additions
and
0 deletions.
There are no files selected for viewing
118 changes: 118 additions & 0 deletions
118
src/main/java/com/TheRPGAdventurer/ROTD/RealmOfTheDragons.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,118 @@ | ||
/* | ||
** 2012 August 13 | ||
** | ||
** The author disclaims copyright to this source code. In place of | ||
** a legal notice, here is a blessing: | ||
** May you do good and not evil. | ||
** May you find forgiveness for yourself and forgive others. | ||
** May you share freely, never taking more than you give. | ||
*/ | ||
package com.TheRPGAdventurer.ROTD; | ||
|
||
import com.TheRPGAdventurer.ROTD.client.init.ModArmour; | ||
import com.TheRPGAdventurer.ROTD.client.init.ModBlocks; | ||
import com.TheRPGAdventurer.ROTD.client.init.ModItems; | ||
import com.TheRPGAdventurer.ROTD.client.init.ModTools; | ||
import com.TheRPGAdventurer.ROTD.server.CommonProxy; | ||
import com.TheRPGAdventurer.ROTD.server.handler.RecipeHandler; | ||
import com.TheRPGAdventurer.ROTD.server.world.RealmOfTheDragonsWorldGenerator; | ||
import net.minecraftforge.common.config.Configuration; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.common.Mod.EventHandler; | ||
import net.minecraftforge.fml.common.Mod.Instance; | ||
import net.minecraftforge.fml.common.ModMetadata; | ||
import net.minecraftforge.fml.common.SidedProxy; | ||
import net.minecraftforge.fml.common.event.FMLInitializationEvent; | ||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; | ||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; | ||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent; | ||
import net.minecraftforge.fml.common.event.FMLServerStoppedEvent; | ||
import net.minecraftforge.fml.common.registry.GameRegistry; | ||
|
||
/** | ||
* Main control class for Forge. | ||
* | ||
*/ | ||
@Mod( | ||
modid = RealmOfTheDragons.MODID, | ||
name = RealmOfTheDragons.NAME, | ||
version = RealmOfTheDragons.VERSION, | ||
useMetadata = true, | ||
guiFactory = "com.TheRPGAdventurer.ROTD.RealmOfTheDragonsConfigGuiFactory" | ||
) | ||
public class RealmOfTheDragons { | ||
|
||
public static final String NAME = "Realm Of The Dragons"; | ||
public static final String MODID = "rotd"; | ||
public static final String VERSION = "1.0.2 Alpha"; | ||
|
||
@SidedProxy( | ||
serverSide = "com.TheRPGAdventurer.ROTD.server.CommonProxy", | ||
clientSide = "com.TheRPGAdventurer.ROTD.client.ClientProxy" | ||
) | ||
public static CommonProxy proxy; | ||
|
||
@Instance(MODID) | ||
public static RealmOfTheDragons instance; | ||
|
||
private ModMetadata metadata; | ||
private RealmOfTheDragonsConfig config; | ||
|
||
public RealmOfTheDragonsConfig getConfig() { | ||
return config; | ||
} | ||
|
||
public ModMetadata getMetadata() { | ||
return metadata; | ||
} | ||
|
||
@EventHandler | ||
public void preInit(FMLPreInitializationEvent evt) { | ||
ModItems.init(); | ||
ModBlocks.init(); | ||
ModItems.register(); | ||
ModBlocks.register(); | ||
ModTools.init(); | ||
ModTools.register(); | ||
ModArmour.init(); | ||
ModArmour.register(); | ||
RealmOfTheDragonsLootTables.registerLootTables(); | ||
|
||
proxy.registerRenders(); | ||
} | ||
|
||
@EventHandler | ||
public void onPreInit(FMLPreInitializationEvent evt) { | ||
config = new RealmOfTheDragonsConfig(new Configuration(evt.getSuggestedConfigurationFile())); | ||
metadata = evt.getModMetadata(); | ||
proxy.onPreInit(evt); | ||
|
||
} | ||
|
||
@EventHandler | ||
public void init(FMLInitializationEvent evt) { | ||
RecipeHandler.registerCraftingRecipes(null, null, null, null, null); | ||
GameRegistry.registerWorldGenerator(new RealmOfTheDragonsWorldGenerator(), 0); | ||
} | ||
|
||
@EventHandler | ||
public void onInit(FMLInitializationEvent evt) { | ||
proxy.onInit(evt); | ||
|
||
} | ||
|
||
@EventHandler | ||
public void onPostInit(FMLPostInitializationEvent event) { | ||
proxy.onPostInit(event); | ||
} | ||
|
||
@EventHandler | ||
public void onServerStarting(FMLServerStartingEvent evt) { | ||
proxy.onServerStarting(evt); | ||
} | ||
|
||
@EventHandler | ||
public void onServerStopped(FMLServerStoppedEvent evt) { | ||
proxy.onServerStopped(evt); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/com/TheRPGAdventurer/ROTD/RealmOfTheDragonsConfig.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,44 @@ | ||
/* | ||
** 2013 May 30 | ||
** | ||
** The author disclaims copyright to this source code. In place of | ||
** a legal notice, here is a blessing: | ||
** May you do good and not evil. | ||
** May you find forgiveness for yourself and forgive others. | ||
** May you share freely, never taking more than you give. | ||
*/ | ||
package com.TheRPGAdventurer.ROTD; | ||
|
||
import net.minecraftforge.common.config.Configuration; | ||
|
||
public class RealmOfTheDragonsConfig { | ||
|
||
private final Configuration config; | ||
|
||
// config properties | ||
private boolean disableBlockOverride = false; | ||
private boolean debug = false; | ||
|
||
public RealmOfTheDragonsConfig(Configuration config) { | ||
debug = config.getBoolean("debug", "client", debug, "Debug mode. Unless you're a developer or are told to activate it, you don't want to set this to true."); | ||
disableBlockOverride = config.getBoolean("disableBlockOverride", "client", debug, "Disables right-click override on the vanilla dragon egg block. May help to fix issues with other mods."); | ||
|
||
if (config.hasChanged()) { | ||
config.save(); | ||
} | ||
|
||
this.config = config; | ||
} | ||
|
||
public Configuration getParent() { | ||
return config; | ||
} | ||
|
||
public boolean isDebug() { | ||
return debug; | ||
} | ||
|
||
public boolean isDisableBlockOverride() { | ||
return disableBlockOverride; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/TheRPGAdventurer/ROTD/RealmOfTheDragonsConfigGui.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,36 @@ | ||
/* | ||
** 2016 March 18 | ||
** | ||
** The author disclaims copyright to this source code. In place of | ||
** a legal notice, here is a blessing: | ||
** May you do good and not evil. | ||
** May you find forgiveness for yourself and forgive others. | ||
** May you share freely, never taking more than you give. | ||
*/ | ||
package com.TheRPGAdventurer.ROTD; | ||
|
||
import java.util.Arrays; | ||
import net.minecraft.client.gui.GuiScreen; | ||
import net.minecraftforge.common.config.ConfigElement; | ||
import net.minecraftforge.common.config.Configuration; | ||
import net.minecraftforge.fml.client.config.GuiConfig; | ||
|
||
public class RealmOfTheDragonsConfigGui extends GuiConfig { | ||
|
||
private static final Configuration CONFIG = RealmOfTheDragons.instance.getConfig().getParent(); | ||
|
||
public RealmOfTheDragonsConfigGui(GuiScreen parentScreen) { | ||
super( | ||
parentScreen, | ||
Arrays.asList( | ||
new ConfigElement(CONFIG.getCategory("server")), | ||
new ConfigElement(CONFIG.getCategory("client")) | ||
), | ||
RealmOfTheDragons.MODID, | ||
false, | ||
false, | ||
RealmOfTheDragons.NAME | ||
); | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/com/TheRPGAdventurer/ROTD/RealmOfTheDragonsConfigGuiFactory.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,38 @@ | ||
/* | ||
** 2016 March 18 | ||
** | ||
** The author disclaims copyright to this source code. In place of | ||
** a legal notice, here is a blessing: | ||
** May you do good and not evil. | ||
** May you find forgiveness for yourself and forgive others. | ||
** May you share freely, never taking more than you give. | ||
*/ | ||
package com.TheRPGAdventurer.ROTD; | ||
|
||
import java.util.Set; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.GuiScreen; | ||
import net.minecraftforge.fml.client.IModGuiFactory; | ||
|
||
public class RealmOfTheDragonsConfigGuiFactory implements IModGuiFactory { | ||
|
||
@Override | ||
public void initialize(Minecraft minecraftInstance) { | ||
} | ||
|
||
@Override | ||
public Class<? extends GuiScreen> mainConfigGuiClass() { | ||
return RealmOfTheDragonsConfigGui.class; | ||
} | ||
|
||
@Override | ||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { | ||
return null; | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/com/TheRPGAdventurer/ROTD/RealmOfTheDragonsLootTables.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,46 @@ | ||
package com.TheRPGAdventurer.ROTD; | ||
|
||
import static com.TheRPGAdventurer.ROTD.RealmOfTheDragonsLootTables.RegistrationHandler.create; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraft.world.storage.loot.LootTable; | ||
import net.minecraft.world.storage.loot.LootTableList; | ||
|
||
public class RealmOfTheDragonsLootTables { | ||
|
||
public static final ResourceLocation ENTITIES_DEAD_SCALES = create("dragon"); | ||
public static final ResourceLocation ENTITIES_DRAGON_AMETHYST = create("amethyst"); | ||
public static final ResourceLocation ENTITIES_DRAGON_GARNET = create("garnet"); | ||
public static final ResourceLocation ENTITIES_DRAGON_JADE = create("jade"); | ||
public static final ResourceLocation ENTITIES_DRAGON_RUBY = create("ruby"); | ||
public static final ResourceLocation ENTITIES_DRAGON_SAPPHIRE = create("sapphire"); | ||
public static final ResourceLocation ENTITIIES_DRAGON = create("dragon"); | ||
|
||
/** | ||
* Register this mod's {@link LootTable}s. | ||
*/ | ||
public static void registerLootTables() { | ||
RegistrationHandler.LOOT_TABLES.forEach(LootTableList::register); | ||
} | ||
|
||
public static class RegistrationHandler { | ||
|
||
/** | ||
* Stores the IDs of this mod's {@link LootTable}s. | ||
*/ | ||
private static final Set<ResourceLocation> LOOT_TABLES = new HashSet<>(); | ||
|
||
/** | ||
* Create a {@link LootTable} ID. | ||
* | ||
* @param id The ID of the LootTable without the testmod3: prefix | ||
* @return The ID of the LootTable | ||
*/ | ||
protected static ResourceLocation create(String id) { | ||
final ResourceLocation lootTable = new ResourceLocation(RealmOfTheDragons.MODID, id); | ||
RegistrationHandler.LOOT_TABLES.add(lootTable); | ||
return lootTable; | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/TheRPGAdventurer/ROTD/RealmOfTheDragonsSoundEvents.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,21 @@ | ||
package com.TheRPGAdventurer.ROTD; | ||
|
||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraft.util.SoundEvent; | ||
import net.minecraftforge.fml.common.registry.GameRegistry; | ||
|
||
public class RealmOfTheDragonsSoundEvents { | ||
|
||
public static final SoundEvent ENTITY_DRAGON_STEP = registerSound("mob.dragon.step"); | ||
public static final SoundEvent ENTITY_DRAGON_BREATHE = registerSound("mob.dragon.breathe"); | ||
public static final SoundEvent ENTITY_DRAGON_DEATH = registerSound("mob.dragon.death"); | ||
public static final SoundEvent ENTITY_DRAGON_GROWL = registerSound("mob.dragon.growl"); | ||
|
||
private static SoundEvent registerSound(String soundName) { | ||
ResourceLocation soundID = new ResourceLocation(RealmOfTheDragons.MODID, soundName); | ||
return GameRegistry.register(new SoundEvent(soundID).setRegistryName(soundID)); | ||
} | ||
|
||
private RealmOfTheDragonsSoundEvents() { | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
src/main/java/com/TheRPGAdventurer/ROTD/client/ClientProxy.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,79 @@ | ||
/* | ||
** 2012 August 27 | ||
** | ||
** The author disclaims copyright to this source code. In place of | ||
** a legal notice, here is a blessing: | ||
** May you do good and not evil. | ||
** May you find forgiveness for yourself and forgive others. | ||
** May you share freely, never taking more than you give. | ||
*/ | ||
package com.TheRPGAdventurer.ROTD.client; | ||
|
||
import com.TheRPGAdventurer.ROTD.RealmOfTheDragons; | ||
import com.TheRPGAdventurer.ROTD.client.gui.GuiDragonDebug; | ||
import com.TheRPGAdventurer.ROTD.client.init.ModArmour; | ||
import com.TheRPGAdventurer.ROTD.client.init.ModBlocks; | ||
import com.TheRPGAdventurer.ROTD.client.init.ModItems; | ||
import com.TheRPGAdventurer.ROTD.client.init.ModTools; | ||
import com.TheRPGAdventurer.ROTD.client.render.DragonRenderer; | ||
import com.TheRPGAdventurer.ROTD.server.CommonProxy; | ||
import com.TheRPGAdventurer.ROTD.server.entity.EntityTameableDragon; | ||
import com.TheRPGAdventurer.ROTD.server.entity.breeds.EnumDragonBreed; | ||
|
||
import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.client.model.ModelLoader; | ||
import net.minecraftforge.common.MinecraftForge; | ||
import net.minecraftforge.fml.client.registry.RenderingRegistry; | ||
import net.minecraftforge.fml.common.event.FMLInitializationEvent; | ||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; | ||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; | ||
|
||
/** | ||
* | ||
* @author Nico Bergemann <barracuda415 at yahoo.de> | ||
*/ | ||
public class ClientProxy extends CommonProxy { | ||
|
||
|
||
@Override | ||
public void onPreInit(FMLPreInitializationEvent event) { | ||
super.onPreInit(event); | ||
|
||
// register dragon entity renderer | ||
RenderingRegistry.registerEntityRenderingHandler( | ||
EntityTameableDragon.class, DragonRenderer::new); | ||
|
||
// register item renderer for dragon egg block variants | ||
ResourceLocation eggModelItemLoc = new ResourceLocation(RealmOfTheDragons.MODID, "dragon_egg"); | ||
Item itemBlockDragonEgg = Item.REGISTRY.getObject(eggModelItemLoc); | ||
EnumDragonBreed.META_MAPPING.forEach((breed, meta) -> { | ||
ModelResourceLocation eggModelLoc = new ModelResourceLocation(RealmOfTheDragons.MODID + ":dragon_egg", "breed=" + breed.getName()); | ||
ModelLoader.setCustomModelResourceLocation(itemBlockDragonEgg, meta, eggModelLoc); | ||
}); | ||
} | ||
|
||
@Override | ||
public void onInit(FMLInitializationEvent evt) { | ||
super.onInit(evt); | ||
} | ||
|
||
@Override | ||
public void onPostInit(FMLPostInitializationEvent event) { | ||
super.onPostInit(event); | ||
|
||
if (RealmOfTheDragons.instance.getConfig().isDebug()) { | ||
MinecraftForge.EVENT_BUS.register(new GuiDragonDebug()); | ||
} | ||
} | ||
|
||
@Override | ||
public void registerRenders() { | ||
ModItems.registerRenders(); | ||
ModTools.registerRenders(); | ||
ModArmour.registerRenders(); | ||
ModBlocks.registerRenders(); | ||
|
||
} | ||
} |
Oops, something went wrong.