Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions src/main/java/com/lothrazar/samscontrolblocks/ModControlBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.StatCollector;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.Mod.EventHandler;
Expand Down Expand Up @@ -123,7 +126,7 @@ else if(ClientProxy.keyTransform.isPressed())

public static void playSoundAt(World world,BlockPos pos, String sound)
{
world.playSound(pos.getX(), pos.getY(), pos.getZ(), sound, 1.0F, 1.0F, false);
world.playSound((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), new SoundEvent(new ResourceLocation(sound)), SoundCategory.MASTER,1.0F, 1.0F,false);
}

public static ArrayList<Block> getBlockListFromCSV(String csv)
Expand Down Expand Up @@ -151,25 +154,25 @@ public static ArrayList<Block> getBlockListFromCSV(String csv)

public static void playSoundAt(Entity player, String sound)
{
player.worldObj.playSoundAtEntity(player, sound, 1.0F, 1.0F);
player.world.playSound((double)player.getPosition().getX(), (double)player.getPosition().getY(), (double)player.getPosition().getZ(), new SoundEvent(new ResourceLocation(sound)), SoundCategory.MASTER,1.0F, 1.0F,false);
}

public static String lang(String name)
{
return StatCollector.translateToLocal(name);
return name;
}

public static void addChatMessage(String string)
{
addChatMessage(new ChatComponentTranslation(string));
addChatMessage(string);
}
public static void addChatMessage(IChatComponent string)
public static void addChatMessage(ITextComponent string)
{
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(string);
}
public static void addChatMessage(EntityPlayer player,String string)
{
player.addChatMessage(new ChatComponentTranslation(string));
player.sendMessage(new TextComponentString(string));
}

public static EnumFacing getPlayerFacing(EntityPlayer player)
Expand Down Expand Up @@ -203,7 +206,7 @@ public static void spawnParticle(World world, EnumParticleTypes type, double x,

public static void execute(EntityPlayer player, String cmd)
{
MinecraftServer.getServer().getCommandManager().executeCommand(player, cmd);
FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager().executeCommand(player, cmd);
}

}
30 changes: 15 additions & 15 deletions src/main/java/com/lothrazar/samscontrolblocks/UtilMoveBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;

Expand All @@ -23,18 +24,18 @@ private static void translateCSV()
ignoreList = ModControlBlocks.getBlockListFromCSV(ignoreListFromConfig);

//ignoreList.add(Blocks.bedrock);
ignoreList.add(Blocks.end_portal_frame);
ignoreList.add(Blocks.end_portal);
ignoreList.add(Blocks.portal);
ignoreList.add(Blocks.bed);
ignoreList.add(Blocks.dark_oak_door);
ignoreList.add(Blocks.acacia_door);
ignoreList.add(Blocks.birch_door);
ignoreList.add(Blocks.oak_door);
ignoreList.add(Blocks.spruce_door);
ignoreList.add(Blocks.jungle_door);
ignoreList.add(Blocks.iron_door);
ignoreList.add(Blocks.skull);
ignoreList.add(Blocks.END_PORTAL_FRAME);
ignoreList.add(Blocks.END_PORTAL);
ignoreList.add(Blocks.PORTAL);
ignoreList.add(Blocks.BED);
ignoreList.add(Blocks.DARK_OAK_DOOR);
ignoreList.add(Blocks.ACACIA_DOOR);
ignoreList.add(Blocks.BIRCH_DOOR);
ignoreList.add(Blocks.OAK_DOOR);
ignoreList.add(Blocks.SPRUCE_DOOR);
ignoreList.add(Blocks.JUNGLE_DOOR);
ignoreList.add(Blocks.IRON_DOOR);
ignoreList.add(Blocks.SKULL);
}
}

Expand Down Expand Up @@ -67,8 +68,7 @@ public static void moveBlockTo(World world, EntityPlayer player,BlockPos pos, Bl
//world.destroyBlock(posMoveToHere, false);
world.destroyBlock(pos, false);
world.setBlockState(posMoveToHere, hit);//pulls the block towards the player

player.swingItem();
player.swingArm(EnumHand.MAIN_HAND);
}
}
}
Expand Down
Loading