Skip to content

Commit

Permalink
1.0.4.3 Update:
Browse files Browse the repository at this point in the history
-Fixed crafting recipe;
-Cleaned up and removed unnecessary code
  • Loading branch information
Codename Revy committed Jan 25, 2020
1 parent b55f97f commit 16c6e18
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 137 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'idea'
apply plugin: 'maven-publish'

version = '1.0.4.1'
version = '1.0.4.3'
group = 'com.codenamerevy.magicmirror'
archivesBaseName = 'magicmirror'

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.

minecraft {
//Mappings Version
mappings channel: 'snapshot', version: '20191227-1.14.3'
mappings channel: 'snapshot', version: '20200122-1.15.1'
runs {
client {
workingDirectory project.file('run')
Expand Down Expand Up @@ -76,7 +76,7 @@ minecraft {

dependencies {
// Forge version
minecraft 'net.minecraftforge:forge:1.15.1-30.0.39'
minecraft 'net.minecraftforge:forge:1.15.1-30.0.42'
}

// Manifest for reading by the runtime..
Expand Down
22 changes: 5 additions & 17 deletions src/main/java/com/codenamerevy/magicmirror/MagicMirror.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.codenamerevy.magicmirror;

import com.codenamerevy.magicmirror.config.MagicMirrorsConfig;
import com.codenamerevy.magicmirror.init.ParticleInit;
import com.codenamerevy.magicmirror.config.Config;
import com.codenamerevy.magicmirror.tabs.MirrorsItemGroup;
import com.codenamerevy.magicmirror.util.Ref;
import com.codenamerevy.magicmirror.util.handler.*;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
Expand All @@ -27,34 +24,25 @@ public MagicMirror()
{
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();

ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.COMMON_CONFIG);

FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup);
MinecraftForge.EVENT_BUS.register(this);

ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, MagicMirrorsConfig.SERVER_CONFIG);
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, MagicMirrorsConfig.COMMON_CONFIG);
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, MagicMirrorsConfig.CLIENT_CONFIG);

MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void commonSetup (final FMLCommonSetupEvent event)
{
if(MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Doing Common Setup!");
}
MinecraftForge.EVENT_BUS.register(RegistryHandler.class);
MinecraftForge.EVENT_BUS.register(SoundHandler.class);
MinecraftForge.EVENT_BUS.register(EventHandler.class);
MinecraftForge.EVENT_BUS.register(LootHandler.class);
}

@SubscribeEvent
public void clientSetup(final FMLClientSetupEvent event)
{
if(MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Doing Client Setup!");
Ref.LOGGER.info("STARTING MAGICMIRRORS MOD LOADING. IF YOU ARE NOT A DEVELOPER, PLEASE DISABLE INTERNAL LOGGING IN CONFIG");
}
MinecraftForge.EVENT_BUS.register(SoundHandler.class);
MinecraftForge.EVENT_BUS.register(ParticleHandler.class);
MinecraftForge.EVENT_BUS.register(ParticleFactoryHandler.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
import static net.minecraftforge.fml.loading.LogMarkers.FORGEMOD;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class MagicMirrorsConfig {
public class Config {

private static final Builder COMMON_BUILDER = new Builder();
private static final Builder SERVER_BUILDER = new Builder();
private static final Builder CLIENT_BUILDER = new Builder();

public static final CategoryGeneral GENERAL = new CategoryGeneral();
Expand All @@ -26,36 +25,22 @@ public static final class CategoryGeneral {

public static ForgeConfigSpec.BooleanValue enableIngredients;
public static ForgeConfigSpec.BooleanValue enableDimensionalMirrors;
public static ForgeConfigSpec.BooleanValue enableDimensionCrystal;
public static ForgeConfigSpec.BooleanValue enableMagicMirrors;

private CategoryGeneral() {
COMMON_BUILDER.comment("General Settings").push("GENERAL");
COMMON_BUILDER.comment("General Settings (COMMON)").push("GENERAL");

COMMON_BUILDER.comment("Ingredients");
COMMON_BUILDER.comment("Magic Mirror recipe");
enableIngredients = COMMON_BUILDER
.comment("Enable / Disable Magic Mirror Ingredients")
.translation("magicmirror.config.ingredients")
.comment("Enable magic mirror recipe")
.translation("magicmirror.config.recipe_mirror")
.define("ingredientsEnabled", false);

COMMON_BUILDER.comment("Dimensional Mirrors");
enableDimensionalMirrors = COMMON_BUILDER
.comment("Enable / Disable Dimensional Mirrors")
.translation("magicmirror.config.dimensionals")
.comment("Enable recipes for dimensional mirrors")
.translation("magicmirror.config.recipe_dim")
.define("dimensionalMirrorsEnabled", true);

COMMON_BUILDER.comment("Dimension Crystal");
enableDimensionCrystal = COMMON_BUILDER
.comment("Enable / Disable Dimension Crystal (Disabling this means disabling upgrades to dimensionals!!!)")
.translation("magicmirror.config.crystal")
.define("dimensionCrystalEnabled", true);

COMMON_BUILDER.comment("Disable All Items");
enableMagicMirrors = COMMON_BUILDER
.comment("Enable / Disable Magic Mirrors")
.translation("magicmirror.config.disable_all_items")
.define("magicmirrors", true);

COMMON_BUILDER.pop();
}
}
Expand All @@ -76,7 +61,6 @@ private CategoryDeveloper(){
}

public static final ForgeConfigSpec COMMON_CONFIG = COMMON_BUILDER.build();
public static final ForgeConfigSpec SERVER_CONFIG = SERVER_BUILDER.build();
public static final ForgeConfigSpec CLIENT_CONFIG = CLIENT_BUILDER.build();

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.codenamerevy.magicmirror.content.items;

import com.codenamerevy.magicmirror.config.MagicMirrorsConfig;
import com.codenamerevy.magicmirror.config.Config;
import com.codenamerevy.magicmirror.util.Ref;
import com.google.gson.JsonObject;
import net.minecraft.util.ResourceLocation;
Expand All @@ -26,13 +26,8 @@ public ResourceLocation getID()
@Override
public boolean test()
{
if (MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Begin Item Condition registering");
}
if(object.equals("magic_mirrors")) return MagicMirrorsConfig.CategoryGeneral.enableMagicMirrors.get();
if(object.equals("dimension_crystals")) return MagicMirrorsConfig.CategoryGeneral.enableDimensionCrystal.get();
if(object.equals("ingredients")) return MagicMirrorsConfig.CategoryGeneral.enableIngredients.get();
if(object.equals("dimensionals")) return MagicMirrorsConfig.CategoryGeneral.enableDimensionalMirrors.get();
if(object.equals("ingredients")) return Config.GENERAL.enableIngredients.get();
if(object.equals("dimensionals")) return Config.GENERAL.enableDimensionalMirrors.get();
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

public class ItemInit
{
//public static final List<Item> ITEMS = new ArrayList<Item>(); Obsolete now

//Regular Mirrors
public static final Item MAGIC_MIRROR = new ItemMagicMirror(new Item.Properties().group(MagicMirror.MAGIC_MIRRORS).maxStackSize(1)).setRegistryName(location("magic_mirror"));
public static final Item ICE_MIRROR = new ItemMagicMirror(new Item.Properties().group(MagicMirror.MAGIC_MIRRORS).maxStackSize(1)).setRegistryName(location("ice_mirror"));
Expand All @@ -34,12 +32,7 @@ public class ItemInit

//Materials
public static final Item DIMENSION_CRYSTAL = new ItemBase(new Item.Properties().group(MagicMirror.MAGIC_MIRRORS)).setRegistryName(location("dimension_crystal"));
/**
* TODO: Add Config files
* - Add Textures
* - Add to creative tab
* - With this method, only the main magic mirror can be crafted
* **/

public static final Item MIRROR_FRAME = new ItemBase(new Item.Properties().group(MagicMirror.MAGIC_MIRRORS)).setRegistryName(location("mirror_frame"));
public static final Item ENCHANTED_MIRROR = new ItemMirrorBase(new Item.Properties().group(MagicMirror.MAGIC_MIRRORS)).setRegistryName(location("enchanted_mirror"));
public static final Item BROKEN_MIRROR = new ItemBase(new Item.Properties()).setRegistryName(location("broken_mirror"));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/codenamerevy/magicmirror/util/Ref.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.codenamerevy.magicmirror.util;

import com.codenamerevy.magicmirror.config.MagicMirrorsConfig;
import com.codenamerevy.magicmirror.config.Config;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand All @@ -11,7 +11,7 @@ public class Ref

private Ref()
{
if(MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
if(Config.CategoryDeveloper.enableLogger.get()) {
LOGGER.info("Reference called!");
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.codenamerevy.magicmirror.util.handler;

import com.codenamerevy.magicmirror.config.MagicMirrorsConfig;
import com.codenamerevy.magicmirror.config.Config;
import com.codenamerevy.magicmirror.content.items.ItemConditions;
import com.codenamerevy.magicmirror.util.Ref;
import net.minecraft.item.crafting.IRecipeSerializer;
Expand All @@ -14,7 +14,7 @@ public class EventHandler
{
@SubscribeEvent
public static void registerRecipeSerializers(RegistryEvent.Register<IRecipeSerializer<?>> event) {
if (MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
if (Config.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Begin Recipe Serializer conditions");
}
CraftingHelper.register(ItemConditions.Serializer.INSTANCE);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.codenamerevy.magicmirror.util.handler;

import com.codenamerevy.magicmirror.config.MagicMirrorsConfig;
import com.codenamerevy.magicmirror.config.Config;
import com.codenamerevy.magicmirror.util.Ref;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.*;
Expand All @@ -18,7 +18,7 @@ public static void lootLoad(LootTableLoadEvent event)
String name = event.getName().toString();
if(name.startsWith(prefix))
{
if (MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
if (Config.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Begin LootPool load");
}
String file = name.substring(name.indexOf(prefix) + prefix.length());
Expand Down Expand Up @@ -47,15 +47,15 @@ public static void lootLoad(LootTableLoadEvent event)

private static LootPool getInjectPool(String entry)
{
if (MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
if (Config.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Begin Injecting loot pool");
}
return LootPool.builder().addEntry(getInjectEntry(entry, 1)).bonusRolls(0, 1).name("mirrors_inject").build();
}
private static LootEntry.Builder getInjectEntry(String name, int weight)
{

if (MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
if (Config.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Begin getting loot pool entries");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.codenamerevy.magicmirror.util.handler;

import com.codenamerevy.magicmirror.config.MagicMirrorsConfig;
import com.codenamerevy.magicmirror.config.Config;
import com.codenamerevy.magicmirror.init.ItemInit;
import com.codenamerevy.magicmirror.util.Ref;
import net.minecraft.item.Item;
Expand All @@ -15,63 +15,42 @@ public class RegistryHandler
@SubscribeEvent
public static void onItemRegistry(final RegistryEvent.Register<Item> event)
{
registerItems(event.getRegistry());
if(MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Registered item(s)!");
}
registerMirrors(event.getRegistry());
registerDimensionals(event.getRegistry());
registerCrystals(event.getRegistry());
registerIngredients(event.getRegistry());
}

public static void registerItems (IForgeRegistry<Item> registry) {
//Mirrors
if (MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Registering Items under configuration enableMagicMirrors (" + MagicMirrorsConfig.CategoryGeneral.enableMagicMirrors.get().toString() + ")");
}
if (MagicMirrorsConfig.CategoryGeneral.enableMagicMirrors.get()) {

registry.register(ItemInit.MAGIC_MIRROR);
registry.register(ItemInit.ICE_MIRROR);
registry.register(ItemInit.MAGIC_MIRROR_CARTOGRAPHER);
registry.register(ItemInit.MAGIC_MIRROR_DESERT);
registry.register(ItemInit.MAGIC_MIRROR_JUNGLE);
registry.register(ItemInit.MAGIC_MIRROR_LIBRARY);
registry.register(ItemInit.MAGIC_MIRROR_OCEAN);
}

//Dimensionals
if (MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Registering Items under configuration enableDimensionalMirrors (" + MagicMirrorsConfig.CategoryGeneral.enableDimensionalMirrors.get().toString() + ")");
}
if (MagicMirrorsConfig.CategoryGeneral.enableDimensionalMirrors.get()) {
registry.register(ItemInit.DIMENSIONAL_MIRROR);
registry.register(ItemInit.DIMENSIONAL_MIRROR_ICE);
registry.register(ItemInit.DIMENSIONAL_MIRROR_CARTOGRAPHER);
registry.register(ItemInit.DIMENSIONAL_MIRROR_DESERT);
registry.register(ItemInit.DIMENSIONAL_MIRROR_JUNGLE);
registry.register(ItemInit.DIMENSIONAL_MIRROR_LIBRARY);
registry.register(ItemInit.DIMENSIONAL_MIRROR_OCEAN);
registry.register(ItemInit.DIMENSIONAL_MIRROR_END);
}

//Dimension Crystal
if (MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Registering Items under configuration enableDimensionCrystal (" + MagicMirrorsConfig.CategoryGeneral.enableDimensionCrystal.get().toString() + ")");
public static void registerMirrors(IForgeRegistry<Item> registry)
{
registry.register(ItemInit.MAGIC_MIRROR);
registry.register(ItemInit.ICE_MIRROR);
registry.register(ItemInit.MAGIC_MIRROR_CARTOGRAPHER);
registry.register(ItemInit.MAGIC_MIRROR_DESERT);
registry.register(ItemInit.MAGIC_MIRROR_JUNGLE);
registry.register(ItemInit.MAGIC_MIRROR_LIBRARY);
registry.register(ItemInit.MAGIC_MIRROR_OCEAN);
}
public static void registerDimensionals(IForgeRegistry<Item> registry)
{
registry.register(ItemInit.DIMENSIONAL_MIRROR);
registry.register(ItemInit.DIMENSIONAL_MIRROR_ICE);
registry.register(ItemInit.DIMENSIONAL_MIRROR_CARTOGRAPHER);
registry.register(ItemInit.DIMENSIONAL_MIRROR_DESERT);
registry.register(ItemInit.DIMENSIONAL_MIRROR_JUNGLE);
registry.register(ItemInit.DIMENSIONAL_MIRROR_LIBRARY);
registry.register(ItemInit.DIMENSIONAL_MIRROR_OCEAN);
registry.register(ItemInit.DIMENSIONAL_MIRROR_END);
}

}
if(MagicMirrorsConfig.CategoryGeneral.enableDimensionCrystal.get())
{
registry.register(ItemInit.DIMENSION_CRYSTAL);
}
public static void registerCrystals(IForgeRegistry<Item> registry)
{
registry.register(ItemInit.DIMENSION_CRYSTAL);
}

//Ingredients
if(MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Registering Items under configuration enableIngredients (" + MagicMirrorsConfig.CategoryGeneral.enableIngredients.get().toString() + ")");
}
if(MagicMirrorsConfig.CategoryGeneral.enableIngredients.get())
{
registry.register(ItemInit.BROKEN_MIRROR);
registry.register(ItemInit.BROKEN_MIRROR_DIMENSIONAL);
registry.register(ItemInit.ENCHANTED_MIRROR);
registry.register(ItemInit.MIRROR_FRAME);
}
public static void registerIngredients(IForgeRegistry<Item> registry)
{
registry.register(ItemInit.ENCHANTED_MIRROR);
registry.register(ItemInit.MIRROR_FRAME);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.codenamerevy.magicmirror.util.handler;

import com.codenamerevy.magicmirror.config.MagicMirrorsConfig;
import com.codenamerevy.magicmirror.config.Config;
import com.codenamerevy.magicmirror.util.Ref;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
Expand All @@ -20,7 +20,7 @@ public static void registerSounds(RegistryEvent.Register<SoundEvent> event)
{
TELEPORT = registerSound("teleport");
MIRROR_DISCHARGE = registerSound("mirror_discharge");
if (MagicMirrorsConfig.CategoryDeveloper.enableLogger.get()) {
if (Config.CategoryDeveloper.enableLogger.get()) {
Ref.LOGGER.info("Registered sound(s)!");
}
}
Expand Down
8 changes: 0 additions & 8 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ credits="MichaelLimaRodrigues"
authors="CodenameRevy"
description='''
Magic Mirror mod adds several new items that are used to teleport you to your bed location almost instantly!
Update 1.0.3.6 (1.15.1) changelog:
- Updated to Forge 30.0.15
- Updated Mappings to 20191222-1.14.3
[Internal Changes]
- Fixed some weird function names :P
'''

[[dependencies.magicmirror]]
Expand Down
Loading

0 comments on commit 16c6e18

Please sign in to comment.