Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
- Version release 1.0
  • Loading branch information
twothe committed Jul 21, 2015
0 parents commit 46f85b9
Show file tree
Hide file tree
Showing 40 changed files with 2,297 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/.git
/.gradle
/.nb-gradle
/.settings
/build
/eclipse
/gradle
/assets/forge
/cpw
/ibxm
/net
/paulscode
/*.lzma
/*.cfg
/*.properties
/*.png
/*.xcf
/*.java
.nb-gradle-properties
gradlew
gradlew.bat
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
TwoGrave
=======

TwoGrave - Keeps your items safe after death

License
=======

Copyright (c) 2013 Stefan Feldbinder

Everyone is allowed to do whatever they want with a copy of this software,
with the following restrictions:

1. You must not claim to be the original author.
2. You must give credit to the original author in an appropriate form.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
63 changes: 63 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}

apply plugin: 'forge'

version = "1710.1.0"
group= "two.graves" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "TwoGraves"

minecraft {
version = "1.7.10-10.13.4.1481-1.7.10"
runDir = "eclipse"
}

dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"

// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html

}

processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}

// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
7 changes: 7 additions & 0 deletions src/main/java/baubles/api/BaubleType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package baubles.api;

public enum BaubleType {
RING,
AMULET,
BELT
}
41 changes: 41 additions & 0 deletions src/main/java/baubles/api/BaublesApi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package baubles.api;

import java.lang.reflect.Method;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import cpw.mods.fml.common.FMLLog;

/**
* @author Azanor
*/
public class BaublesApi
{
static Method getBaubles;

/**
* Retrieves the baubles inventory for the supplied player
*/
public static IInventory getBaubles(EntityPlayer player)
{
IInventory ot = null;

try
{
if(getBaubles == null)
{
Class<?> fake = Class.forName("baubles.common.lib.PlayerHandler");
getBaubles = fake.getMethod("getPlayerBaubles", EntityPlayer.class);
}

ot = (IInventory) getBaubles.invoke(null, player);
}
catch(Exception ex)
{
FMLLog.warning("[Baubles API] Could not invoke baubles.common.lib.PlayerHandler method getPlayerBaubles");
}

return ot;
}

}
45 changes: 45 additions & 0 deletions src/main/java/baubles/api/IBauble.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package baubles.api;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;

/**
*
* This interface should be extended by items that can be worn in bauble slots
*
* @author Azanor
*/

public interface IBauble {

/**
* This method return the type of bauble this is.
* Type is used to determine the slots it can go into.
*/
public BaubleType getBaubleType(ItemStack itemstack);

/**
* This method is called once per tick if the bauble is being worn by a player
*/
public void onWornTick(ItemStack itemstack, EntityLivingBase player);

/**
* This method is called when the bauble is equipped by a player
*/
public void onEquipped(ItemStack itemstack, EntityLivingBase player);

/**
* This method is called when the bauble is unequipped by a player
*/
public void onUnequipped(ItemStack itemstack, EntityLivingBase player);

/**
* can this bauble be placed in a bauble slot
*/
public boolean canEquip(ItemStack itemstack, EntityLivingBase player);

/**
* Can this bauble be removed from a bauble slot
*/
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player);
}
5 changes: 5 additions & 0 deletions src/main/java/baubles/api/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@API(owner = "Baubles", apiVersion = "1.0.1.10", provides = "Baubles|API")
package baubles.api;

import cpw.mods.fml.common.API;

11 changes: 11 additions & 0 deletions src/main/java/tconstruct/api/IPlayerExtendedInventoryWrapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package tconstruct.api;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;

public interface IPlayerExtendedInventoryWrapper
{
public IInventory getKnapsackInventory (EntityPlayer player);

public IInventory getAccessoryInventory (EntityPlayer player);
}
13 changes: 13 additions & 0 deletions src/main/java/tconstruct/api/TConstructAPI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package tconstruct.api;

import net.minecraft.entity.player.EntityPlayer;

public class TConstructAPI
{
public static String PROP_NAME;

public static IPlayerExtendedInventoryWrapper getInventoryWrapper (EntityPlayer player)
{
return (IPlayerExtendedInventoryWrapper) player.getExtendedProperties(PROP_NAME);
}
}
87 changes: 87 additions & 0 deletions src/main/java/two/graves/API/IInventoryHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* (c) Two aka Stefan Feldbinder
*/
package two.graves.API;

import java.util.Collection;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

/**
*
* @author Two
*/
public interface IInventoryHandler {

/**
* Removes and returns all items from the given player that are handled by this handler.
*
* After execution all items that are in the result value must have been stripped
* from the player. All further items are subject to the usual death routine,
* which means they are most likely going to be spilled out into the world (if
* not handled by something else).
*
* Note that unless you implement your own synchronization functionality, this
* should be executed on both client and server side.
*
* @param player The player to take the items from.
* @param isRemote true if this is called on the server, false if it is called on the client.
* @return A collection containing all the items that have been removed from the player and should be placed into the grave.
*/
public Collection<InventoryContent> removeAllItems(final EntityPlayer player, final boolean isRemote);

/**
* Tries to set the exact slot of an inventory related to the player to itemStack.
*
* If for that slot is occupied or cannot be set for some other reason, false
* must be returned. It is not allowed to try to add the item in any other way,
* that case is handled by addToInventory later.
*
* Note that unless you implement your own synchronization functionality, this
* should be executed on both client and server side.
*
* @param player The player to modify.
* @param slot The slot this must be placed in (if possible).
* @param itemStack The ItemStack to add.
* @param isRemote true if this is called on the server, false if it is called on the client.
* @return true if that exact slot could be set, false otherwise.
*/
public boolean set(final EntityPlayer player, final int slot, final ItemStack itemStack, final boolean isRemote);

/**
* Tries to add the given itemStack an inventory related to player.
*
* This is called if the specific slot above failed, and is allowed to
* add the item to any suitable slot. If that is not possible (or reasonable)
* this method must return false, in which case the item is added to the
* generic (vanilla) player inventory (if possible).
*
* Note that unless you implement your own synchronization functionality, this
* should be executed on both client and server side.
*
* @param player The player to modify.
* @param itemStack The ItemStack to add.
* @param isRemote true if this is called on the server, false if it is called on the client.
* @return true if the items was added to any valid inventory slot, false otherwise.
*/
public boolean add(final EntityPlayer player, final ItemStack itemStack, final boolean isRemote);

/**
* Called to notify the handler of inventory changes.
* Should call markDirty on the handled inventory to sync changes.
*
* Note that unless you implement your own synchronization functionality, this
* should be executed on both client and server side.
*
* @param player The player who's inventory has changed.
* @param isRemote true if this is called on the server, false if it is called on the client.
*/
public void markDirty(final EntityPlayer player, final boolean isRemote);

/**
* Returns the ID of this InventoryHandler.
*
* @return The ID of this InventoryHandler.
*/
public String getID();
}
Loading

0 comments on commit 46f85b9

Please sign in to comment.