Skip to content

Commit

Permalink
1.0.1.0 Update - Dimensional Mirrors!
Browse files Browse the repository at this point in the history
  • Loading branch information
CodenameRevy committed Sep 24, 2019
1 parent dfc9ce7 commit 8b01c06
Show file tree
Hide file tree
Showing 32 changed files with 487 additions and 28 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '1.0.0.3'
version = '1.0.1.0'
group = 'com.codenamerevy.magicmirror' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'magicmirror'

Expand Down Expand Up @@ -115,7 +115,7 @@ dependencies {
jar {
manifest {
attributes([
"Specification-Title": "MagicMirror",
"Specification-Title": "MagicMirrors",
"Specification-Vendor": "CodenameRevy",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/codenamerevy/magicmirror/init/ItemInit.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.codenamerevy.magicmirror.init;

import com.codenamerevy.magicmirror.items.ItemDimensionalMirror;
import com.codenamerevy.magicmirror.items.ItemMagicMirror;
import com.codenamerevy.magicmirror.util.Reference;
import net.minecraft.item.Item;
Expand All @@ -14,6 +15,13 @@ public class ItemInit
public static final List<Item> ITEMS = new ArrayList<Item>();

public static final Item MAGIC_MIRROR = new ItemMagicMirror(new Item.Properties().group(ItemGroup.TOOLS).maxStackSize(1)).setRegistryName(location("magic_mirror"));
public static final Item ICE_MIRROR = new ItemMagicMirror(new Item.Properties().group(ItemGroup.TOOLS).maxStackSize(1)).setRegistryName(location("ice_mirror"));

//TODO: FIX ItemDimensionalMirror class
public static final Item DIMENSIONAL_MIRROR = new ItemDimensionalMirror(new Item.Properties().group(ItemGroup.TOOLS).maxStackSize(1)).setRegistryName(location("dimensional_mirror"));
public static final Item DIMENSIONAL_MIRROR_ICE = new ItemDimensionalMirror(new Item.Properties().group(ItemGroup.TOOLS).maxStackSize(1)).setRegistryName(location("dimensional_mirror_ice"));


private static ResourceLocation location(String name)
{
return new ResourceLocation(Reference.MODID, name);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.codenamerevy.magicmirror.items;

import com.codenamerevy.magicmirror.init.ItemInit;
import com.codenamerevy.magicmirror.init.SoundInit;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Rarity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;

/**
* EXPERIMENTAL!!!
*/
public class ItemDimensionalMirror extends ItemMagicMirror
{
private PlayerEntity player;
private BlockPos bedPos;
private BlockPos currentPos;

public ItemDimensionalMirror(Properties properties)
{
super(properties);

ItemInit.ITEMS.add(this);
}

@Override
public ItemStack onItemUseFinish(ItemStack stack, World world, LivingEntity entity)
{
if(!world.isRemote())
{
player = (ServerPlayerEntity) entity;
currentPos = player.getPosition();

if(world.getDimension().getType() == DimensionType.THE_NETHER)
{
player.sendStatusMessage(new TranslationTextComponent("chat.magicmirror.dimension"), true);
this.travelHomeFromNether(player);
}

if(world.getDimension().getType() == DimensionType.THE_END)
{
player.sendStatusMessage(new TranslationTextComponent("chat.magicmirror.dimension"), true);
this.travelHomeFromEnd(player);
}

bedPos = player.getBedLocation(player.dimension);

if (bedPos == null)
{
world.playSound(null, currentPos.getX(), currentPos.getY(), currentPos.getZ(), SoundInit.MIRROR_DISCHARGE, SoundCategory.PLAYERS, 1f, 1f);
player.sendStatusMessage(new TranslationTextComponent("chat.magicmirror.bednotfound"), true);
return stack;
}

if (entity.getRidingEntity() != null)
{
entity.stopRiding();
}
player.sendStatusMessage(new TranslationTextComponent("chat.magicmirror.teleport"), true);
entity.setPositionAndUpdate(bedPos.getX() + 0.5f, bedPos.getY() + 0.6f, bedPos.getZ() + 0.5f);
entity.fallDistance = 0;

world.playSound(null, bedPos.getX(), bedPos.getY(), bedPos.getZ(), SoundInit.TELEPORT, SoundCategory.PLAYERS, 1f, 1f);
}
return stack;
}

private void travelHomeFromNether(PlayerEntity player)
{
ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player;

DimensionType prevDimension = player.dimension;
DimensionType transDimension = prevDimension == DimensionType.THE_NETHER ? DimensionType.OVERWORLD : DimensionType.THE_NETHER;

serverPlayer.teleport(player.getServer().getWorld(transDimension), serverPlayer.posX, serverPlayer.posY, serverPlayer.posZ, serverPlayer.rotationYaw, serverPlayer.rotationPitch);
}

private void travelHomeFromEnd(PlayerEntity player)
{
ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player;

DimensionType prevDimension = player.dimension;
DimensionType transDimension = prevDimension == DimensionType.THE_END ? DimensionType.OVERWORLD : DimensionType.THE_END;

serverPlayer.teleport(player.getServer().getWorld(transDimension), serverPlayer.posX, serverPlayer.posY, serverPlayer.posZ, serverPlayer.rotationYaw, serverPlayer.rotationPitch);
}

@Override
public Rarity getRarity(ItemStack stack)
{
return Rarity.EPIC;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.codenamerevy.magicmirror.init.ItemInit;
import com.codenamerevy.magicmirror.init.SoundInit;
import com.codenamerevy.magicmirror.util.ModRarity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.*;
Expand All @@ -10,6 +11,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;

import java.util.Random;

Expand Down Expand Up @@ -57,22 +59,22 @@ public ItemStack onItemUseFinish(ItemStack stack, World world, LivingEntity enti

if(!world.dimension.isSurfaceWorld())
{
player.sendStatusMessage(new TranslationTextComponent("chat.magicmirror.power"), true);
world.playSound(null,
currentPos.getX(),
currentPos.getY(),
currentPos.getZ(),
SoundInit.MIRROR_DISCHARGE, SoundCategory.PLAYERS, 1f, 1f);
player.sendStatusMessage(new TranslationTextComponent("chat.magicmirror.power"), true);
return stack;
}
if (bedPos == null)
{
player.sendStatusMessage(new TranslationTextComponent("chat.magicmirror.bednotfound"), true);
world.playSound(null,
currentPos.getX(),
currentPos.getY(),
currentPos.getZ(),
SoundInit.MIRROR_DISCHARGE, SoundCategory.PLAYERS, 1f, 1f);
player.sendStatusMessage(new TranslationTextComponent("chat.magicmirror.bednotfound"), true);
return stack;
}

Expand Down Expand Up @@ -107,7 +109,6 @@ public int getUseDuration(ItemStack stack)
return duration;
}


@Override
public Rarity getRarity(ItemStack stack) {
return Rarity.RARE;
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/com/codenamerevy/magicmirror/util/ModRarity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.codenamerevy.magicmirror.util;

import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.common.IExtensibleEnum;

//TODO: Make usage of this :P
public enum ModRarity implements IExtensibleEnum
{
TRASH(TextFormatting.GRAY),
LEGENDARY(TextFormatting.GREEN),
ULTIMATE(TextFormatting.LIGHT_PURPLE),
DEMONIC(TextFormatting.DARK_RED),
GODLY(TextFormatting.GOLD);


public final TextFormatting color;

ModRarity(TextFormatting formatting)
{
this.color = formatting;
}

public static ModRarity create(String name, TextFormatting formatting)
{
throw new IllegalStateException("Enum not Extended!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Reference
{
public static final String MODID = "magicmirror";
public static final String NAME = "Magic Mirror";
public static final String VERSION = "1.0.0.3";
public static final String VERSION = "1.0.1.0";
public static final String MC_VERSION = "1.14.4";
public static final String CLIENT_PROXY = "com.codenamerevy.magicmirror.proxy.ClientProxy";
public static final String COMMON_PROXY = "com.codenamerevy.magicmirror.proxy.CommonProxy";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,38 @@ public static void lootLoad(LootTableLoadEvent evt)
String file = name.substring(name.indexOf(prefix) + prefix.length());
switch(file)
{
case "abandoned_mineshaft": //TODO: Add Loot Table
case "desert_pyramid": evt.getTable().addPool(getInjectPool(file)); break;
case "jungle_temple": //TODO: Add Loot Table
case "simple_dungeon": //TODO: Add Loot Table
case "spawn_bonus_chest": //TODO: Add Loot Table
case "stronghold_corridor": //TODO: Add Loot Table
case "village_blacksmith": //TODO: ADD
case "abandoned_mineshaft":
case "buried_treasure":
case "desert_pyramid":
case "end_city_treasure":
case "igloo_chest":
case "jungle_temple":
//case "jungle_temple_dispenser":
case "nether_bridge":
//case "pillager_outpost":
//case "shipwreck_map":
//case "shipwreck_supply":
case "shipwreck_treasure":
case "simple_dungeon":
//case "spawn_bonus_chest":
case "stronghold_corridor":
case "stronghold_crossing":
case "stronghold_library":
case "underwater_ruin_big":
//case "underwater_ruin_small":
//case "village_armorer":
//case "village_weaponsmith":
//case "village_butcher":
case "village_cartographer":
//case "village_mason":
//case "village_shepherd":
//case "village_tannery":
//case "village_desert_house":
//case "village_plains_house":
//case "village_savanna_house":
case "village_snowy_house":
//case "village_taiga_house":
case "woodland_mansion": evt.getTable().addPool(getInjectPool(file)); Reference.LOGGER.info(file + "Loot Table Loaded!"); break;
default: break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,4 @@ public static void onItemRegistry(final RegistryEvent.Register<Item> itemRegiste
}
Reference.LOGGER.info("Registered item(s)!");
}

/**@SubscribeEvent
public void onRegisterSounds(RegistryEvent.Register<SoundEvent> event)
{
for(SoundEvent sound : SoundInit.SOUNDS)
{
event.getRegistry().register(sound);
}
Reference.LOGGER.info("Registered sound(s)!");
}
**/
}
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ issueTrackerURL="https://github.com/CodenameRevy/-1.14.4-MagicMirror/issues"

[[mods]]
modId="magicmirror"
version="1.0.0.3"
displayName="Magic Mirror"
version="1.0.1.30
displayName="Magic Mirrors"
displayURL="https://github.com/CodenameRevy/-1.14.4-MagicMirror"
logoFile="logo.png"
#credits="" #optional
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/assets/magicmirror/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
{
"item.magicmirror.magic_mirror": "Magic Mirror",
"item.magicmirror.ice_mirror": "Mirror of the Yeti",

"item.magicmirror.dimensional_mirror": "Dimensional Mirror",
"item.magicmirror.dimensional_mirror_ice": "Mirror of the Yeti (Dimensional)",

"chat.magicmirror.bednotfound": "Bed not found! Make sure you sleep in the bed before you can use the mirror!",
"chat.magicmirror.power": "This mirror is not powerful enough for cross-dimension travel!",
"chat.magicmirror.nether": "This mirror is not powerful enough to travel trough Nether!",
"chat.magicmirror.dimension": "Jumping to Overworld...",
"chat.magicmirror.teleport": "Teleporting to your bed...",

"subtitle.magicmirror.teleport": "Teleport",
"subtitle.magicmirror.mirror_discharge": "Mirror Discharge"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "item/generated",
"textures":
{
"layer0": "magicmirror:items/dimensional_mirror"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "item/generated",
"textures":
{
"layer0": "magicmirror:items/dimensional_mirror_ice"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "item/generated",
"textures":
{
"layer0": "magicmirror:items/ice_mirror"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"pools": [
{
"name": "main",
"rolls": 1,
"entries":[
{
"type": "item",
"name": "magicmirror:magic_mirror",
"weight": 5
},
{
"type": "empty",
"weight": 95
}
]
}]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"pools": [
{
"name": "main",
"rolls": 1,
"entries":[
{
"type": "item",
"name": "magicmirror:magic_mirror",
"weight": 5
},
{
"type": "empty",
"weight": 95
}
]
}]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
{
"type": "item",
"name": "magicmirror:magic_mirror",
"weight": 20
"weight": 5
},
{
"type": "empty",
"weight": 80
"weight": 95
}
]
}]
Expand Down
Loading

0 comments on commit 8b01c06

Please sign in to comment.