Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port and update to MC 1.12 and the new Forge registry changes #214

Merged
merged 19 commits into from
Aug 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5ad68de
Fix white spaces and some warnings
maruohon May 16, 2017
61138a9
Update Forge and mappings, fix some deprecated method calls and warnings
maruohon May 16, 2017
45f31b0
Change the API from zip to jar, include the classes. Update gradle + …
maruohon Jun 24, 2017
e7d0d5a
Initial update to 1.12. Crafting related things/GUIs TODO.
maruohon Jun 24, 2017
6a539be
Update Forge and mappings
maruohon Jun 15, 2017
d092e21
Update the player inventory crafting code to 1.12
maruohon Jun 15, 2017
fd3b3d0
Update to Forge 2348+ and the new registry system. Update mappings.
maruohon Jun 24, 2017
783f8c3
Fix the expanded inventory background rendering (1.12 change)
maruohon Jun 24, 2017
3bda3e5
Replace a deprecated method call
maruohon Jun 24, 2017
d50135a
Remove unnecessary @SideOnly annotations
maruohon Jun 24, 2017
3533dc3
Create the ring item in the registry event, and use an ObjectHolder f…
maruohon Jun 25, 2017
1c34f17
Refactor some event handlers, to better separate the client-side ones
maruohon Jun 25, 2017
df5913b
Move the PacketSync message handler into a static inner class
maruohon Jun 25, 2017
5d3e419
Fix the modid case in the mcmod.info file
maruohon Jun 25, 2017
c8d4f70
Update to Forge 2373
maruohon Jun 26, 2017
677434a
Clean up the config GUI stuff
maruohon Jun 26, 2017
8da6c40
Small clean-up to the config GUI factory. Bump Forge version and mapp…
maruohon Jun 30, 2017
405cd82
Fix tooltips not rendering in the expanded/Baubles player inventory
maruohon Jun 30, 2017
1a35c8a
Update the expanded player inventory's onContainerClosed() to 1.12
maruohon Jul 15, 2017
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
18 changes: 11 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'


version = "1.11-1.4.5"
group= "com.azanor.baubles"
version = "1.12-1.4.5"
group= "com.azanor.baubles"
archivesBaseName = "Baubles"

srcCompat = JavaVersion.VERSION_1_8
targetCompat = JavaVersion.VERSION_1_8

minecraft {
version = "1.11-13.19.0.2180"
version = "1.12-14.21.1.2404"
runDir = "run"
mappings = "snapshot_20170502"
mappings = "snapshot_20170708"
makeObfSourceJar = false
}

Expand All @@ -49,11 +49,15 @@ task deobfJar(type: Jar) {
classifier = 'deobf'
}

// Create API library zip
task apiZip(type: Zip) {
// Create API library jar
task apiZip(type: Jar) {
from(sourceSets.main.java) {
include "baubles/api/**"
}
from(sourceSets.main.output) {
include "baubles/api/**"
}

classifier = 'api'
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Sep 14 12:28:28 PDT 2015
#Tue May 16 17:06:48 EEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
52 changes: 26 additions & 26 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,30 @@
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

Expand All @@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
Expand All @@ -40,31 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
Expand All @@ -90,7 +89,7 @@ location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
Expand All @@ -114,6 +113,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
Expand Down
8 changes: 4 additions & 4 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

Expand Down Expand Up @@ -46,7 +46,7 @@ echo location of your Java installation.
goto fail

:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/baubles/api/BaubleType.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ public enum BaubleType {
HEAD(4),
BODY(5),
CHARM(6);

int[] validSlots;

private BaubleType(int ... validSlots) {
this.validSlots = validSlots;
}

public boolean hasSlot(int slot) {
for (int s:validSlots) {
if (s == slot) return true;
Expand All @@ -25,6 +25,4 @@ public boolean hasSlot(int slot) {
public int[] getValidSlots() {
return validSlots;
}


}
8 changes: 3 additions & 5 deletions src/main/java/baubles/api/BaublesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
/**
* @author Azanor
*/
public class BaublesApi
{

public class BaublesApi
{
/**
* Retrieves the baubles inventory capability handler for the supplied player
*/
Expand All @@ -20,7 +19,7 @@ public static IBaublesItemHandler getBaublesHandler(EntityPlayer player)
IBaublesItemHandler handler = player.getCapability(BaublesCapabilities.CAPABILITY_BAUBLES, null);
handler.setPlayer(player);
return handler;
}
}

/**
* Retrieves the baubles capability handler wrapped as a IInventory for the supplied player
Expand All @@ -32,5 +31,4 @@ public static IInventory getBaubles(EntityPlayer player)
handler.setPlayer(player);
return new BaublesInventoryWrapper(handler, player);
}

}
13 changes: 6 additions & 7 deletions src/main/java/baubles/api/IBauble.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@
*/

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 default void onWornTick(ItemStack itemstack, EntityLivingBase player) {
}

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

/**
* This method is called when the bauble is unequipped by a player
*/
Expand All @@ -42,14 +42,14 @@ public default void onUnequipped(ItemStack itemstack, EntityLivingBase player) {
public default boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
return true;
}

/**
* Can this bauble be removed from a bauble slot
*/
public default boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
return true;
}

/**
* Will bauble automatically sync to client if a change is detected in its NBT or damage values?
* Default is off, so override and set to true if you want to auto sync.
Expand All @@ -58,5 +58,4 @@ public default boolean canUnequip(ItemStack itemstack, EntityLivingBase player)
public default boolean willAutoSync(ItemStack itemstack, EntityLivingBase player) {
return false;
}

}
35 changes: 15 additions & 20 deletions src/main/java/baubles/api/cap/BaublesCapabilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,20 @@
import net.minecraftforge.common.capabilities.CapabilityInject;

public class BaublesCapabilities {

/**
* Access to the baubles capability.
*/
@CapabilityInject(IBaublesItemHandler.class)
public static final Capability<IBaublesItemHandler> CAPABILITY_BAUBLES = null;

public static class CapabilityBaubles<T extends IBaublesItemHandler> implements IStorage<IBaublesItemHandler> {

@Override
public NBTBase writeNBT (Capability<IBaublesItemHandler> capability, IBaublesItemHandler instance, EnumFacing side) {

return null;
}

@Override
public void readNBT (Capability<IBaublesItemHandler> capability, IBaublesItemHandler instance, EnumFacing side, NBTBase nbt) {

}
}

* Access to the baubles capability.
*/
@CapabilityInject(IBaublesItemHandler.class)
public static final Capability<IBaublesItemHandler> CAPABILITY_BAUBLES = null;

public static class CapabilityBaubles<T extends IBaublesItemHandler> implements IStorage<IBaublesItemHandler> {

@Override
public NBTBase writeNBT (Capability<IBaublesItemHandler> capability, IBaublesItemHandler instance, EnumFacing side) {
return null;
}

@Override
public void readNBT (Capability<IBaublesItemHandler> capability, IBaublesItemHandler instance, EnumFacing side, NBTBase nbt){ }
}
}
29 changes: 14 additions & 15 deletions src/main/java/baubles/api/cap/BaublesContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ public class BaublesContainer extends ItemStackHandler implements IBaublesItemHa
private boolean[] changed = new boolean[BAUBLE_SLOTS];
private boolean blockEvents=false;
private EntityLivingBase player;

public BaublesContainer()
{
super(BAUBLE_SLOTS);
}
{
super(BAUBLE_SLOTS);
}

@Override
public void setSize(int size)
{
{
if (size<BAUBLE_SLOTS) size = BAUBLE_SLOTS;
super.setSize(size);
boolean[] old = changed;
Expand All @@ -28,7 +28,7 @@ public void setSize(int size)
{
changed[i] = old[i];
}
}
}

/**
* Returns true if automation is allowed to insert the given stack (ignoring
Expand All @@ -38,10 +38,10 @@ public void setSize(int size)
public boolean isItemValidForSlot(int slot, ItemStack stack, EntityLivingBase player) {
if (stack==null || stack.isEmpty() || !(stack.getItem() instanceof IBauble) ||
!((IBauble) stack.getItem()).canEquip(stack, player))
return false;
return false;
return ((IBauble) stack.getItem()).getBaubleType(stack).hasSlot(slot);
}

@Override
public void setStackInSlot(int slot, ItemStack stack) {
if (stack==null || stack.isEmpty() || this.isItemValidForSlot(slot, stack, player)) {
Expand All @@ -54,7 +54,7 @@ public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
if (!this.isItemValidForSlot(slot, stack, player)) return stack;
return super.insertItem(slot, stack, simulate);
}

@Override
public boolean isEventBlocked() {
return blockEvents;
Expand All @@ -64,13 +64,13 @@ public boolean isEventBlocked() {
public void setEventBlock(boolean blockEvents) {
this.blockEvents = blockEvents;
}

@Override
protected void onContentsChanged(int slot)
{
{
setChanged(slot,true);
}
}

@Override
public boolean isChanged(int slot) {
if (changed==null) {
Expand All @@ -91,5 +91,4 @@ public void setChanged(int slot, boolean change) {
public void setPlayer(EntityLivingBase player) {
this.player=player;
}

}
Loading