Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
BarstowBadlands authored Aug 13, 2017
1 parent 4b54ce8 commit 3610e08
Show file tree
Hide file tree
Showing 100 changed files with 9,456 additions and 0 deletions.
118 changes: 118 additions & 0 deletions src/main/java/com/TheRPGAdventurer/ROTD/RealmOfTheDragons.java
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);
}
}
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;
}
}
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
);
}

}
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;
}

}
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;
}
}
}
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 src/main/java/com/TheRPGAdventurer/ROTD/client/ClientProxy.java
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();

}
}
Loading

0 comments on commit 3610e08

Please sign in to comment.