To be able to select a 3d bock area in the world using something in my hand without adding a new item.
My intent is to be able to save an area to a file on disk including all IDs, registered names, NBT data, and possibly all non-player entities.
Then be able to paste that back into the world.
A extended intent is to be able to bring these saved areas into a newer version of minecraft such as 1.7.2 or 1.7.10 and proceed to interactivly help the user resolve the proper block/item/entity substitutions when pasting. In english: save our buildings etc from old active servers and bring them back into new servers. Well, thats the goal and I am taking this on now.
So for now I am starting with how to setup a selection tool that is easy to use and doesnt add IDs.
I am now looking into using Forge Hooks to do this part.
my published mods
I am really hoping to do this without adding a new item or block to the game.
I have considered just using the players coordinates and command line entry but its nowhere near as friendly as clicking with a tool.
my published mods
ASM injection. (I don't really know what it's actually called, but all I know is that it's not called assembly.)
What you even need this for?
My intent is to be able to save an area to a file on disk including all IDs, registered names, NBT data, and possibly all non-player entities.
Then be able to paste that back into the world.
A extended intent is to be able to bring these saved areas into a newer version of minecraft such as 1.7.2 or 1.7.10 and proceed to interactivly help the user resolve the proper block/item/entity substitutions when pasting. In english: save our buildings etc from old active servers and bring them back into new servers. Well, thats the goal and I am taking this on now.
So for now I am starting with how to setup a selection tool that is easy to use and doesnt add IDs.
I am now looking into using Forge Hooks to do this part.
my published mods
references:
AtomicStryker's guide on How To Use Forge Events
Event reference - Minecraft Forge
Code:
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkMod;
@Mod(modid=ModInfo.ID,name=ModInfo.NAME,version=ModInfo.VERS)
@NetworkMod(clientSideRequired=false,serverSideRequired=true)
public class Cleanup {
@SidedProxy(clientSide=ModInfo.CLIENTPROXY,serverSide=ModInfo.COMMONPROXY)
public static CommonProxy proxy;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(new ForgeHooks());
}
}
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
public class ForgeHooks {
public ForgeHooks() {}
@ForgeSubscribe
public void PlayerInteractEvent( PlayerInteractEvent event) {
EntityPlayer player = event.entityPlayer;
if ( ( event.action != Action.RIGHT_CLICK_BLOCK )
|| ( player.worldObj.isRemote )
|| ( player.getCurrentEquippedItem() == null )
|| ( player.getCurrentEquippedItem().itemID != Item.shovelWood.itemID )
)
{ return; }
String[] facing = {"NoFace","Down","Up","North","South","West","East"};
Do.Say(player," ");
Do.Say(player,"PlayerInteractEvent Detected.");
Do.Say(player,"Action:" + event.action.name() +", x"+event.x+", y"+event.y+", z"+event.z+", face="+ facing[event.face + 1]);
if ( player.getCurrentEquippedItem() != null)
{ Do.Say(player,"Item in use "+ player.getCurrentEquippedItem().getDisplayName()); }
else
{ Do.Say(player,"No item equipped."); }
}
}
This is working in place of using onItemRightClick on an existing vanilla item.
If anyone knows how to do this with the onItemRightClick please post a message here. Or if there is a better way.
my published mods
Well... that works too.