Skip to content

Commit

Permalink
Adding a clockwork powered block and reworked time to use integers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lumaceon committed Dec 1, 2015
1 parent a2bb6d3 commit 99f0948
Show file tree
Hide file tree
Showing 63 changed files with 1,143 additions and 437 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public class TemporalAchievementList
{
public static Map<Achievement, Long> achievementValues = new HashMap<Achievement, Long>(AchievementList.achievementList.size());
public static Map<Achievement, Integer> achievementValues = new HashMap<Achievement, Integer>(AchievementList.achievementList.size());

public static boolean isAchievementListed(Achievement achievement) {
return achievementValues.containsKey(achievement) && achievementValues.get(achievement) > 0;
Expand All @@ -27,9 +27,9 @@ public static int getPageBonusMultiplier(AchievementPage page)

public static class INTERNAL
{
public static long totalWeight = 0;
public static long specialAchievementCount = 0;
public static long maxPageMultiplier = 1;
public static int totalWeight = 0;
public static int specialAchievementCount = 0;
public static int maxPageMultiplier = 1;
public static double specialAchievementMultiplierExponent = 1;

/**
Expand All @@ -39,11 +39,11 @@ public static class INTERNAL
* @param achievement The achievement to calculate.
* @return The weight of this achievement.
*/
public static long registerAchievement(Achievement achievement)
public static int registerAchievement(Achievement achievement)
{
if(achievement.isIndependent || !achievement.isAchievement())
return 0;
long calculatedWeight = 60;
int calculatedWeight = 60;
Achievement temp = achievement.parentAchievement;

while(temp != null)
Expand Down Expand Up @@ -76,7 +76,7 @@ public static int registerPage(AchievementPage page)
}

public static void setupSpecialMultiplier() {
long maxValueWithoutSpecialMultipliers = totalWeight * maxPageMultiplier;
int maxValueWithoutSpecialMultipliers = totalWeight * maxPageMultiplier;
specialAchievementMultiplierExponent = Math.log(TimeConverter.INFINITE / maxValueWithoutSpecialMultipliers) / Math.log(specialAchievementCount + 1);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package lumaceon.mods.clockworkphase2.api.steammachine;
package lumaceon.mods.clockworkphase2.api.block;

import net.minecraftforge.common.util.ForgeDirection;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package lumaceon.mods.clockworkphase2.api.time;
package lumaceon.mods.clockworkphase2.api.block;

import net.minecraft.item.ItemStack;

public interface ITimezone
public interface ITimezoneProvider
{
public float getRange();
public int getX();
Expand All @@ -17,21 +17,21 @@ public interface ITimezone

public void setTimestream(int index, ItemStack item);

public long getMaxTimeSand();
public long getTimeSand();
public void setTimeSand(long timeSand);
public int getMaxTimeSand();
public int getTimeSand();
public void setTimeSand(int timeSand);

/**
* Adds time sand to this timezone.
* @param timeSand Amount of time sand to add to this timezone.
* @return The amount of time sand successfully added.
*/
public long addTimeSand(long timeSand);
public int addTimeSand(int timeSand);

/**
* Consumes time sand from this timezone.
* @param timeSand Amount of time sand to remove from this timezone.
* @return The amount of time sand successfully consumed.
*/
public long consumeTimeSand(long timeSand);
public int consumeTimeSand(int timeSand);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package lumaceon.mods.clockworkphase2.api.block.clockwork;

import net.minecraftforge.common.util.ForgeDirection;

public interface IClockworkDestination extends IClockworkTile
{
public boolean canReceiveFrom(ForgeDirection direction);

/**
* Called to transfer clockwork energy into this destination.
*
* @param maxReception The amount of energy this destination is being exposed to.
* @return The amount of energy taken by this destination.
*/
public int receiveClockworkEnergy(ForgeDirection from, int maxReception);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package lumaceon.mods.clockworkphase2.api.block.clockwork;

import net.minecraftforge.common.util.ForgeDirection;

public interface IClockworkSource extends IClockworkTile
{
public boolean canDistributeTo(ForgeDirection direction);

/**
* Called to transfer clockwork energy from this source outward.
*
* @param maxExtraction The amount of energy trying to be extracted.
* @return The amount of energy taken from this source.
*/
public int distributeClockworkEnergy(ForgeDirection direction, int maxExtraction);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package lumaceon.mods.clockworkphase2.api.block.clockwork;

public interface IClockworkTile
{
public int getMaxCapacity();
public int getEnergyStored();

/**
* All clockwork tiles can be wound up, regardless of whether they are a destination or not.
* @param tension Tension to wind.
* @return The tension that was wound.
*/
public int wind(int tension);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@

public interface ITimeSand
{
public long getTimeSand(ItemStack item);
public int getTimeSand(ItemStack item);

/**
* Returns only this item's max time sand, does not take into account internal temporal cores.
* @param item Item to check.
* @return The max time sand for this item.
*/
public long getMaxTimeSand(ItemStack item);
public void setTimeSand(ItemStack item, EntityPlayer player, long timeSand);
public void setTimeSand(ItemStack item, long timeSand); //Overloaded version for when there is no player involved.
public int getMaxTimeSand(ItemStack item);
public void setTimeSand(ItemStack item, EntityPlayer player, int timeSand);
public void setTimeSand(ItemStack item, int timeSand); //Overloaded version for when there is no player involved.
/**
* Called to add time sand to the given itemstack.
* @param item The itemstack to add timesand to.
* @param player The player using the itemstack if any. Check that this is not null before using for safety.
* @param amount The amount of time sand to add.
* @return The amount of time sand that was successfully added.
*/
public long addTimeSand(ItemStack item, EntityPlayer player, long amount);
public long addTimeSand(ItemStack item, long amount); //Overloaded version for when there is no player involved.
public int addTimeSand(ItemStack item, EntityPlayer player, int amount);
public int addTimeSand(ItemStack item, int amount); //Overloaded version for when there is no player involved.

/**
* Called to remove time sand from the given itemstack.
Expand All @@ -32,6 +32,6 @@ public interface ITimeSand
* @param amount The amount of time sand to consume.
* @return The amount of time sand that was successfully consumed.
*/
public long consumeTimeSand(ItemStack item, EntityPlayer player, long amount);
public long consumeTimeSand(ItemStack item, long amount); //Overloaded version for when there is no player involved.
public int consumeTimeSand(ItemStack item, EntityPlayer player, int amount);
public int consumeTimeSand(ItemStack item, int amount); //Overloaded version for when there is no player involved.
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@

import net.minecraft.item.ItemStack;

public interface IClockworkComponent
public interface IClockworkComponent extends IClockwork
{
public int getQuality(ItemStack is);
public int getSpeed(ItemStack is);

/**
* Default clockwork tools will take on the greatest harvest level found in their components.
*
* Default clockwork tools will take on the greatest 'tier' found in their components as their harvest level.
* Machines may ignore this depending on the machine in question. There is no standard convention for component tier
* use in machines, so base your tier off of the (sometimes theoretical) pickaxe mining level.
* -1 - Hand.
* 0 - Wood.
* 1 - Stone.
* 2 - Iron (and most metals).
* 3 - Diamond.
* 4 - Modded materials (Alumite and similar materials from tinker's construct).
* 5 - Modded materials (Manyullyn from tinker's construct).
* 6+ - Modded materials.
* @return This component's harvest level.
* 0 - Wood pickaxe.
* 1 - Stone pickaxe.
* 2 - Iron pickaxe.
* 3 - Diamond pickaxe.
* 4 - Mod tools (Not used in vanilla, a good example is the Alumite pickaxe from Tinker's Construct).
* 5 - Mod tools (Not used in vanilla, a good example is the Manyullyn pickaxe from Tinker's Construct).
* @return This component's tier.
*/
public int getHarvestLevel(ItemStack is);
public int getTier(ItemStack is);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@

import java.util.List;

public interface IClockworkConstruct
public interface IClockworkConstruct extends IClockwork
{
public int getTier(ItemStack item);
public int getTension(ItemStack item);
public int getMaxTension(ItemStack item);
public int getQuality(ItemStack item);
public int getSpeed(ItemStack item);
public void setTension(ItemStack item, int tension);
public void setHarvestLevels(ItemStack item, int harvestLevel);

/**
* Sets the 'tier' of this construct's clockwork. This is context sensitive; in clockwork tools this sets the
* appropriate harvest level, but in machines it's usually ignored or saved and referred to directly.
* @param tier The tier to set up, which is set by the highest tiered component in the clockwork.
*/
public void setTier(ItemStack item, int tier);

/**
* Used by a winding box and similar contraptions to add tension to this item.
Expand All @@ -33,5 +38,5 @@ public interface IClockworkConstruct
* @param item The itemstack to add information for.
* @param list The list of informative lines.
*/
public void addClockworkInformation(ItemStack item, EntityPlayer player, List list);
public void addConstructInformation(ItemStack item, EntityPlayer player, List list);
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface ITimeContainerItem
* @param simulate If true, a simulation will occur, but no time will actually be added.
* @return The amount of time that was added successfully (or would have been added if simulated).
*/
public long receiveTime(ItemStack timeItem, long maxReceive, boolean simulate);
public int receiveTime(ItemStack timeItem, int maxReceive, boolean simulate);

/**
* Extracts time from the timeItem passed in.
Expand All @@ -27,15 +27,15 @@ public interface ITimeContainerItem
* @param simulate If true, a simulation will occur, but no time will actually be removed.
* @return The amount of time that was removed successfully (or would have been removed if simulated).
*/
public long extractTime(ItemStack timeItem, long maxExtract, boolean simulate);
public int extractTime(ItemStack timeItem, int maxExtract, boolean simulate);

/**
* Returns the maximum amount of time that can be stored in this ItemStack.
*/
public long getMaxCapacity(ItemStack timeItem);
public int getMaxCapacity(ItemStack timeItem);

/**
* Returns the amount of time that's stored in this ItemStack.
*/
public long getTimeStored(ItemStack timeItem);
public int getTimeStored(ItemStack timeItem);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public interface ITimeProvider extends ITimeConnection
* @param simulate If true, a simulation will occur, but no time will actually be removed.
* @return The amount of time that was removed successfully (or would have been removed if simulated).
*/
public long extractTime(long maxExtract, boolean simulate);
public int extractTime(int maxExtract, boolean simulate);

/**
* Returns the maximum amount of time that can be stored.
*/
public long getMaxCapacity();
public int getMaxCapacity();

/**
* Returns the amount of time that's stored.
*/
public long getTimeStored();
public int getTimeStored();
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public interface ITimeReceiver extends ITimeConnection
* @param simulate If true, a simulation will occur, but no time will actually be added.
* @return The amount of time that was added successfully (or would have been added if simulated).
*/
public long receiveTime(long maxReceive, boolean simulate);
public int receiveTime(int maxReceive, boolean simulate);

/**
* Returns the maximum amount of time that can be stored.
*/
public long getMaxCapacity();
public int getMaxCapacity();

/**
* Returns the amount of time that's stored.
*/
public long getTimeStored();
public int getTimeStored();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ public interface ITimeStorage
* @param simulate If true, a simulation will occur, but no time will actually be added.
* @return The amount of time that was added successfully (or would have been added if simulated).
*/
public long receiveTime(long maxReceive, boolean simulate);
public int receiveTime(int maxReceive, boolean simulate);

/**
* Extract time from this storage.
* @param maxExtract The amount of time trying to be removed from storage.
* @param simulate If true, a simulation will occur, but no time will actually be removed.
* @return The amount of time that was removed successfully (or would have been removed if simulated).
*/
public long extractTime(long maxExtract, boolean simulate);
public int extractTime(int maxExtract, boolean simulate);

/**
* Returns the maximum amount of time that can be stored.
*/
public long getMaxCapacity();
public int getMaxCapacity();

/**
* Returns the amount of time that's in this storage.
*/
public long getTimeStored();
public int getTimeStored();
}
Loading

0 comments on commit 99f0948

Please sign in to comment.