Skip to content

Commit

Permalink
Merge pull request #406 from GrowthcraftCE/development
Browse files Browse the repository at this point in the history
2.7.0 Changes
  • Loading branch information
Alatyami authored Sep 26, 2016
2 parents 9fd2b74 + d8b18dc commit 6886329
Show file tree
Hide file tree
Showing 196 changed files with 3,959 additions and 1,903 deletions.
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Section 2: Added *, curseforge.net and the Growthcraft Community Edition GitHub

# Updated License

>Section 1: This document is Copyright © (2014-2015) "Gwafu" and is the intellectual property of the author.
>Section 1: This document is Copyright © (2014-2016) "Gwafu" and is the intellectual property of the author.
>
>Section 2: Terms regarding file hosting:
>Only minecraftforum.net, curseforge.net and the Growthcraft Community Edition GitHub repository is able to host any of these materials without the author's consent. You can just simply ask the author to allow you to host it in your website or distribute it.
Expand All @@ -24,7 +24,7 @@ Section 2: Added *, curseforge.net and the Growthcraft Community Edition GitHub
# Orginal License

>This document is Copyright © (2014-2015) "Gwafu" and is the intellectual property of the author.
>This document is Copyright © (2014-2016) "Gwafu" and is the intellectual property of the author.
>
>Terms regarding file hosting:
>Only minecraftforum.net is able to host any of these materials without the author's consent. You can just simply ask the author to allow you to host it in your website or distribute it.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ debugClient {
}

tasks.withType(JavaCompile) {
options.compilerArgs += ["-Xlint:all", "-Xlint:deprecation", "-Xlint:-rawtypes", "-Xlint:-unchecked"]
options.compilerArgs += ["-Xlint:all", "-Xlint:deprecation", "-Xlint:rawtypes", "-Xlint:unchecked"]
options.deprecation = true
options.encoding = "utf8"
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ minecraft_version=1.7.10
# Forge
minecraft_forge_version=1.7.10-10.13.4.1566-1.7.10
# GrowthCraft
growthcraft_version=2.6.3
growthcraft_version=2.7.0
# Depdendencies
applecore_version=1.3.0
bc_version=7.1.16
bc_version=7.1.17
code_chicken_core_version=1.0.7.47
code_chicken_lib_version=1.1.3.140
nei_version=1.0.5.120
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
package growthcraft.api.core.nbt;

import java.util.List;
import java.util.Collection;
import javax.annotation.Nonnull;

import net.minecraft.nbt.NBTTagList;
Expand All @@ -32,7 +32,7 @@
/**
* Utility class for wrapping a NBTTagList for Strings
*/
public class NBTStringTagList
public class NBTTagStringList
{
private NBTTagList parent;

Expand All @@ -41,28 +41,28 @@ public class NBTStringTagList
*
* @param list - the tag list to use as the parent
*/
public NBTStringTagList(@Nonnull NBTTagList list)
public NBTTagStringList(@Nonnull NBTTagList list)
{
this.parent = list;
}

/**
* Initializes the NBTStringTagList with a default taglist
* Initializes the NBTTagStringList with a default taglist
*/
public NBTStringTagList()
public NBTTagStringList()
{
this(new NBTTagList());
}

/**
* @param list - a string list
*/
public NBTStringTagList(@Nonnull List<String> list)
public NBTTagStringList(@Nonnull Collection<?> list)
{
this();
for (String str : list)
for (Object obj : list)
{
add(str);
add(obj.toString());
}
}

Expand All @@ -81,7 +81,7 @@ public int size()
*
* @param str - the string to add
*/
public NBTStringTagList add(@Nonnull String str)
public NBTTagStringList add(@Nonnull String str)
{
parent.appendTag(new NBTTagString(str));
return this;
Expand Down
21 changes: 4 additions & 17 deletions src/java/growthcraft/api/core/nbt/NBTType.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,10 @@ public enum NBTType
public static final Map<Integer, NBTType> MAPPING = new HashMap<Integer, NBTType>();
static
{
END.register();
BYTE.register();
SHORT.register();
INT.register();
LONG.register();
FLOAT.register();
DOUBLE.register();
BYTE_ARRAY.register();
STRING.register();
LIST.register();
COMPOUND.register();
INT_ARRAY.register();
for (NBTType type : values())
{
MAPPING.put(type.id, type);
}
}

public final int id;
Expand All @@ -65,11 +57,6 @@ private NBTType(int i)
this.id = i;
}

private void register()
{
MAPPING.put(this.id, this);
}

public static NBTType byId(int id)
{
return MAPPING.get(id);
Expand Down
52 changes: 52 additions & 0 deletions src/java/growthcraft/api/core/registry/GenericItemRegistry.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 IceDragon200
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* 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.
*/
package growthcraft.api.core.registry;

import java.util.LinkedList;
import java.util.List;

public class GenericItemRegistry<ItemType, T extends IItemRegistryEntry<ItemType>>
{
protected List<T> entries = new LinkedList<T>();

public void add(T entry)
{
entries.add(entry);
}

public T find(ItemType item)
{
if (item == null) return null;
for (T entry : entries)
{
if (entry.matches(item)) return entry;
}
return null;
}

public boolean contains(ItemType item)
{
return find(item) != null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package growthcraft.core.common.inventory;
package growthcraft.api.core.registry;

public interface IInventoryFlagging
public interface IItemRegistryEntry<T>
{
public void markForInventoryUpdate();
public boolean matches(T item);
}
48 changes: 48 additions & 0 deletions src/java/growthcraft/api/core/registry/ItemRegistryEntry.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016 IceDragon200
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* 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.
*/
package growthcraft.api.core.registry;

import growthcraft.api.core.definition.IMultiItemStacks;
import growthcraft.api.core.util.MultiStacksUtil;

import net.minecraft.item.ItemStack;

public class ItemRegistryEntry<T> implements IItemRegistryEntry<ItemStack>
{
public T handle;
private IMultiItemStacks stacks;

public ItemRegistryEntry(Object stack, T p_handle)
{
this.handle = p_handle;
this.stacks = MultiStacksUtil.toMultiItemStacks(stack);
}

@Override
public boolean matches(ItemStack stack)
{
if (stack == null) return false;
return stacks.containsItemStack(stack);
}
}
70 changes: 69 additions & 1 deletion src/java/growthcraft/api/core/util/BoundUtils.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 IceDragon200
* Copyright (c) 2015, 2016 IceDragon200
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -33,8 +33,76 @@
*/
public class BoundUtils
{
public static final float[] NORMALIZED_CLAMP = new float[] { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f };

private BoundUtils() {}

/**
* Clamps the target bounds using the provided `clamp` bounds
* @param target target bounds to modify
* @param clamp bounds to clamp with
* @return bounds
*/
public static float[] clampBounds(float[] target, float[] clamp)
{
assert target.length == 6;
if (target[0] < clamp[0]) target[0] = clamp[0];
if (target[1] < clamp[1]) target[1] = clamp[1];
if (target[2] < clamp[2]) target[2] = clamp[2];
if (target[3] > clamp[3]) target[3] = clamp[3];
if (target[4] > clamp[4]) target[4] = clamp[4];
if (target[5] > clamp[5]) target[5] = clamp[5];
return target;
}

/**
* Clamps the target bounds using the NORMALIZED_CLAMP
* @param target target bounds to modify
* @return bounds
*/
public static float[] clampBounds(float[] target)
{
return clampBounds(target, NORMALIZED_CLAMP);
}

/**
* Adds the expander
*
* @param target target bounds to modify
* @param expander the bounds to add
* @return bounds
*/
public static float[] addBounds(float[] target, float[] expander)
{
assert target.length == 6;
target[0] += expander[0];
target[1] += expander[1];
target[2] += expander[2];
target[3] += expander[3];
target[4] += expander[4];
target[5] += expander[5];
return target;
}

/**
* Adds the expander
*
* @param target target bounds to modify
* @param contractor the bounds to add
* @return bounds
*/
public static float[] subBounds(float[] target, float[] contractor)
{
assert target.length == 6;
target[0] -= contractor[0];
target[1] -= contractor[1];
target[2] -= contractor[2];
target[3] -= contractor[3];
target[4] -= contractor[4];
target[5] -= contractor[5];
return target;
}

/**
* Creates a new 6 element float array for use as a Bounding Box
*
Expand Down
Loading

0 comments on commit 6886329

Please sign in to comment.