Skip to content

Commit

Permalink
1.0.0.3 update
Browse files Browse the repository at this point in the history
  • Loading branch information
CodenameRevy committed Sep 20, 2019
1 parent 7d758ad commit dfc9ce7
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 34 deletions.
2 changes: 1 addition & 1 deletion 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.2'
version = '1.0.0.3'
group = 'com.codenamerevy.magicmirror' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'magicmirror'

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.jvmargs=-Xmx2G
org.gradle.daemon=false
5 changes: 2 additions & 3 deletions src/main/java/com/codenamerevy/magicmirror/init/ItemInit.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.codenamerevy.magicmirror.items.ItemMagicMirror;
import com.codenamerevy.magicmirror.util.Reference;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemGroup;;
import net.minecraft.util.ResourceLocation;

import java.util.ArrayList;
Expand All @@ -13,8 +13,7 @@ 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)).setRegistryName(location("magic_mirror"));

public static final Item MAGIC_MIRROR = new ItemMagicMirror(new Item.Properties().group(ItemGroup.TOOLS).maxStackSize(1)).setRegistryName(location("magic_mirror"));
private static ResourceLocation location(String name)
{
return new ResourceLocation(Reference.MODID, name);
Expand Down
15 changes: 2 additions & 13 deletions src/main/java/com/codenamerevy/magicmirror/init/SoundInit.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
package com.codenamerevy.magicmirror.init;

import com.codenamerevy.magicmirror.util.Reference;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;

import java.util.ArrayList;
import java.util.List;

public class SoundInit
{
public static final List<SoundEvent> SOUNDS = new ArrayList<SoundEvent>();

public static final SoundEvent SOUND_TELEPORT = new SoundEvent(location("teleport")).setRegistryName("teleport");

private static ResourceLocation location(String name)
{
return new ResourceLocation(Reference.MODID, name);
}
public static SoundEvent TELEPORT;
public static SoundEvent MIRROR_DISCHARGE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.codenamerevy.magicmirror.init.ItemInit;
import com.codenamerevy.magicmirror.init.SoundInit;
import com.codenamerevy.magicmirror.util.Reference;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.*;
Expand Down Expand Up @@ -54,22 +53,44 @@ public ItemStack onItemUseFinish(ItemStack stack, World world, LivingEntity enti
PlayerEntity player = (PlayerEntity) entity;
BlockPos bedPos = player.getBedLocation(player.dimension);
BlockPos backPos = bedPos;
BlockPos currentPos = player.getPosition();

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);
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);
return stack;
}

if (entity.getRidingEntity() != null)
{
entity.stopRiding();
}
entity.setPositionAndUpdate(backPos.getX() + 0.5f, backPos.getY() + 0.6f, backPos.getZ() + 0.5f);
entity.setPositionAndUpdate(
backPos.getX() + 0.5f,
backPos.getY() + 0.6f,
backPos.getZ() + 0.5f);
entity.fallDistance = 0;

world.playSound(null, backPos.getX(), backPos.getY(), backPos.getZ(), SoundInit.SOUND_TELEPORT, SoundCategory.PLAYERS, 1f, 1f);
Reference.LOGGER.info("Playing teleport.ogg");
world.playSound(null,
backPos.getX(),
backPos.getY(),
backPos.getZ(),
SoundInit.TELEPORT, SoundCategory.PLAYERS, 1f, 1f);
}
return stack;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.codenamerevy.magicmirror.sounds;

import com.codenamerevy.magicmirror.init.SoundInit;
import com.codenamerevy.magicmirror.util.handler.SoundHandler;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;

Expand All @@ -9,7 +9,5 @@ public class SoundBase extends SoundEvent

public SoundBase(ResourceLocation name) {
super(name);

SoundInit.SOUNDS.add(this);
}
}
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.2";
public static final String VERSION = "1.0.0.3";
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
@@ -1,14 +1,11 @@
package com.codenamerevy.magicmirror.util.handler;

import com.codenamerevy.magicmirror.init.ItemInit;
import com.codenamerevy.magicmirror.init.SoundInit;
import com.codenamerevy.magicmirror.util.Reference;
import net.minecraft.item.Item;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.IForgeRegistry;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class RegistryHandler
Expand All @@ -23,14 +20,14 @@ public static void onItemRegistry(final RegistryEvent.Register<Item> itemRegiste
Reference.LOGGER.info("Registered item(s)!");
}

@SubscribeEvent
/**@SubscribeEvent
public void onRegisterSounds(RegistryEvent.Register<SoundEvent> event)
{
IForgeRegistry<SoundEvent> registry = event.getRegistry();
for(SoundEvent sound : SoundInit.SOUNDS)
{
registry.register(sound);
event.getRegistry().register(sound);
}
Reference.LOGGER.info("Registered sound(s)!");
}
**/
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.codenamerevy.magicmirror.util.handler;

import com.codenamerevy.magicmirror.util.Reference;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.ForgeRegistries;

import static com.codenamerevy.magicmirror.init.SoundInit.TELEPORT;
import static com.codenamerevy.magicmirror.init.SoundInit.MIRROR_DISCHARGE;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class SoundHandler
{
@SubscribeEvent
public static void registerSounds(RegistryEvent.Register<SoundEvent> event)
{
TELEPORT = registerSound("teleport");
MIRROR_DISCHARGE = registerSound("mirror_discharge");
Reference.LOGGER.info("Registered sound(s)!");
}

private static SoundEvent registerSound(String name)
{
ResourceLocation location = new ResourceLocation(Reference.MODID, name);
SoundEvent event = new SoundEvent(location);
event.setRegistryName(location);
ForgeRegistries.SOUND_EVENTS.register(event);
return event;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ issueTrackerURL="https://github.com/CodenameRevy/-1.14.4-MagicMirror/issues"

[[mods]]
modId="magicmirror"
version="1.0.0.2"
version="1.0.0.3"
displayName="Magic Mirror"
displayURL="https://github.com/CodenameRevy/-1.14.4-MagicMirror"
logoFile="logo.png"
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/assets/magicmirror/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"item.magicmirror.magic_mirror": "Magic Mirror",
"chat.magicmirror.bednotfound": "Bed not found! Make sure you sleep in the bed before you can use the mirror!"
"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!",
"subtitle.magicmirror.teleport": "Teleport",
"subtitle.magicmirror.mirror_discharge": "Mirror Discharge"
}
5 changes: 5 additions & 0 deletions src/main/resources/assets/magicmirror/sounds.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
"category": "player",
"subtitle": "magicmirror.subtitle.teleport",
"sounds": [ "magicmirror:teleport" ]
},
"mirror_discharge": {
"category": "player,",
"subtitle": "magicmirror.subtitle.mirror_discharge",
"sounds": [ "magicmirror:mirror_discharge" ]
}
}
Binary file not shown.

0 comments on commit dfc9ce7

Please sign in to comment.