General changes and fixes

This commit is contained in:
ZombieHDGaming 2018-01-15 17:33:39 -05:00
parent e8e8794811
commit e17921136b
5 changed files with 17 additions and 6 deletions

View file

@ -1,5 +1,6 @@
package org.dimdev.dimdoors;
import net.minecraft.entity.player.EntityPlayerMP;
import org.dimdev.dimdoors.shared.commands.CommandPocket;
import org.dimdev.dimdoors.shared.commands.CommandDimTeleport;
import org.dimdev.dimdoors.shared.Config;
@ -69,7 +70,11 @@ public class DimDoors {
event.registerServerCommand(new CommandPocket());
}
public static void chat(Entity entity, String text) {
entity.sendMessage(new TextComponentString("[DimDoors] " + text));
public static void sendMessage(Entity entity, String text) {
if(true) {
EntityPlayerMP player = (EntityPlayerMP) entity;
player.sendStatusMessage(new TextComponentString(text), true);
} else
entity.sendMessage(new TextComponentString("[DimDoors] " + text));
}
}

View file

@ -75,6 +75,7 @@ public class ItemRiftBlade extends ItemSword {
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.addAll(I18nUtils.translateMultiline("info.rift_blade"));
}

View file

@ -1,6 +1,8 @@
package org.dimdev.dimdoors.shared.items;
import net.minecraft.util.*;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.dimdev.dimdoors.DimDoors;
import org.dimdev.dimdoors.shared.RayTraceHelper;
import org.dimdev.dimdoors.shared.sound.ModSounds;
@ -28,6 +30,7 @@ public class ItemRiftRemover extends Item {
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.addAll(I18nUtils.translateMultiline("info.rift_remover"));
}
@ -48,6 +51,7 @@ public class ItemRiftRemover extends Item {
// TODO: render rift removing animation
stack.damageItem(10, player);
DimDoors.sendMessage(player, "Rift Removed");
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}
return new ActionResult<>(EnumActionResult.FAIL, stack);

View file

@ -6,6 +6,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.dimdev.ddutils.I18nUtils;
@ -80,13 +81,13 @@ public class ItemRiftSignature extends Item {
stack.damageItem(1, player); // TODO: calculate damage based on position?
clearSource(stack);
DimDoors.chat(player, "Rift Created");
DimDoors.sendMessage(player, "Rift Created");
// null = send sound to the player too, we have to do this because this code is not run client-side
world.playSound(null, player.getPosition(), ModSounds.RIFT_END, SoundCategory.BLOCKS, 0.6f, 1);
} else {
// The link signature has not been used. Store its current target as the first location.
setSource(stack, new RotatedLocation(new Location(world, pos), player.rotationYaw, 0));
DimDoors.chat(player, "Location Stored in Rift Signature");
DimDoors.sendMessage(player, "Location Stored in Rift Signature");
world.playSound(null, player.getPosition(), ModSounds.RIFT_START, SoundCategory.BLOCKS, 0.6f, 1);
}

View file

@ -78,12 +78,12 @@ public class ItemStabilizedRiftSignature extends Item { // TODO: common supercla
stack.damageItem(1, player);
DimDoors.chat(player, "Rift Created");
DimDoors.sendMessage(player, "Rift Created");
world.playSound(null, player.getPosition(), ModSounds.RIFT_END, SoundCategory.BLOCKS, 0.6f, 1);
} else {
// The link signature has not been used. Store its current target as the first location.
setSource(stack, new RotatedLocation(new Location(world, pos), player.rotationYaw, 0));
DimDoors.chat(player, "Location Stored in Rift Signature");
DimDoors.sendMessage(player, "Location Stored in Rift Signature");
world.playSound(null, player.getPosition(), ModSounds.RIFT_START, SoundCategory.BLOCKS, 0.6f, 1);
}