aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2017-01-14 13:53:30 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2017-01-14 13:53:30 +1000
commitd83aa2f50568b001ca462d467fe9b5ad61a008dc (patch)
tree1864881661a709b3faa5943b85a2bf24cd592713 /src
parent9649317bee1a0621cd4a7ea0e9295571832d629d (diff)
downloadGT5-Unofficial-d83aa2f50568b001ca462d467fe9b5ad61a008dc.tar.gz
GT5-Unofficial-d83aa2f50568b001ca462d467fe9b5ad61a008dc.tar.bz2
GT5-Unofficial-d83aa2f50568b001ca462d467fe9b5ad61a008dc.zip
+ Added the basis for a config option, which enables GT textures (For all machine components, ingots/plates/rods/etc.).
- Removed recipe addition logging. % Tried again to boost multi-tool durabilities by 3x. % Added sapling plant code to the Tree Farmer, improved output bus storage of chopped logs.
Diffstat (limited to 'src')
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java25
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java27
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java26
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java2
-rw-r--r--src/Java/gtPlusPlus/core/lib/CORE.java2
-rw-r--r--src/Java/gtPlusPlus/core/util/item/ItemUtils.java2
-rw-r--r--src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java60
8 files changed, 122 insertions, 26 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
index 90da27914a..bab4bfeded 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
@@ -35,7 +35,7 @@ public class BaseItemComponent extends Item{
this.setCreativeTab(AddToCreativeTab.tabMisc);
this.setUnlocalizedName(unlocalName);
this.setMaxStackSize(64);
- this.setTextureName(CORE.MODID + ":" + "item"+componentType.COMPONENT_NAME);
+ this.setTextureName(getCorrectTextures());
this.componentColour = material.getRgbAsHex();
GameRegistry.registerItem(this, unlocalName);
GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this));
@@ -57,6 +57,25 @@ public class BaseItemComponent extends Item{
GT_OreDictUnificator.registerOre(ComponentTypes.CELL.getOreDictName()+unlocalName, ItemUtils.getSimpleStack(this));
}
+ public String getCorrectTextures(){
+ if (!CORE.configSwitches.useGregtechTextures){
+ return CORE.MODID + ":" + "item"+componentType.COMPONENT_NAME;
+ }
+ if (componentType == ComponentTypes.GEAR){
+ return "gregtech" + ":" + "materialicons/METALLIC/" + "gearGt";
+ }
+ else if (componentType == ComponentTypes.ROD){
+ return "gregtech" + ":" + "materialicons/METALLIC/" + "stick";
+ }
+ else if (componentType == ComponentTypes.RODLONG){
+ return "gregtech" + ":" + "materialicons/METALLIC/" + "stickLong";
+ }
+ else if (componentType == ComponentTypes.PLATEDOUBLE){
+ return "gregtech" + ":" + "materialicons/METALLIC/" + "plateDouble";
+ }
+ return "gregtech" + ":" + "materialicons/METALLIC/" + componentType.COMPONENT_NAME.toLowerCase();
+ }
+
@Override
public String getItemStackDisplayName(ItemStack p_77653_1_) {
@@ -114,8 +133,8 @@ public class BaseItemComponent extends Item{
}
if (componentMaterial != null){
if (!componentMaterial.vChemicalFormula.equals("??"))
- list.add(componentMaterial.vChemicalFormula);
-
+ list.add(componentMaterial.vChemicalFormula);
+
if (componentMaterial.isRadioactive){
list.add(CORE.GT_Tooltip_Radioactive);
}
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
index 2998fbbc74..4e4192262a 100644
--- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
@@ -33,11 +33,9 @@ public class BaseItemDust extends Item{
public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, int sRadioactivity) {
setUnlocalizedName(unlocalizedName);
this.setUnlocalizedName(unlocalizedName);
- this.setMaxStackSize(64);
- if (pileSize == "dust" || pileSize == "Dust"){
- this.setTextureName(CORE.MODID + ":" + "dust");}
- else{
- this.setTextureName(CORE.MODID + ":" + "dust"+pileSize);}
+ this.setMaxStackSize(64);
+ this.setTextureName(getCorrectTexture(pileSize));
+
this.setCreativeTab(tabMisc);
this.colour = colour;
this.mTier = tier;
@@ -75,6 +73,23 @@ public class BaseItemDust extends Item{
addMacerationRecipe();
}
+ private String getCorrectTexture(String pileSize){
+ if (!CORE.configSwitches.useGregtechTextures){
+ if (pileSize == "dust" || pileSize == "Dust"){
+ this.setTextureName(CORE.MODID + ":" + "dust");}
+ else{
+ this.setTextureName(CORE.MODID + ":" + "dust"+pileSize);
+ }
+ }
+ if (pileSize.toLowerCase().contains("small")){
+ return "gregtech" + ":" + "materialicons/METALLIC/dustSmall";
+ }
+ else if (pileSize.toLowerCase().contains("tiny")){
+ return "gregtech" + ":" + "materialicons/METALLIC/dustTiny";
+ }
+ return "gregtech" + ":" + "materialicons/METALLIC/dust";
+ }
+
@Override
public String getItemStackDisplayName(ItemStack iStack) {
@@ -117,7 +132,7 @@ public class BaseItemDust extends Item{
if (dustInfo != null){
list.add(dustInfo.vChemicalFormula);
}
-
+
//}
super.addInformation(stack, aPlayer, list, bool);
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
index fee8861d64..c90499c1ca 100644
--- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
@@ -29,11 +29,8 @@ public class BaseItemDustUnique extends Item{
public BaseItemDustUnique(String unlocalizedName, String materialName, int colour, String pileSize) {
setUnlocalizedName(unlocalizedName);
this.setUnlocalizedName(unlocalizedName);
- this.setMaxStackSize(64);
- if (pileSize == "dust" || pileSize == "Dust"){
- this.setTextureName(CORE.MODID + ":" + "dust");}
- else{
- this.setTextureName(CORE.MODID + ":" + "dust"+pileSize);}
+ this.setMaxStackSize(64);
+ this.setTextureName(getCorrectTexture(pileSize));
this.setCreativeTab(tabMisc);
this.colour = colour;
this.materialName = materialName;
@@ -82,6 +79,23 @@ public class BaseItemDustUnique extends Item{
return name;
}
+ private String getCorrectTexture(String pileSize){
+ if (!CORE.configSwitches.useGregtechTextures){
+ if (pileSize == "dust" || pileSize == "Dust"){
+ this.setTextureName(CORE.MODID + ":" + "dust");}
+ else{
+ this.setTextureName(CORE.MODID + ":" + "dust"+pileSize);
+ }
+ }
+ if (pileSize.toLowerCase().contains("small")){
+ return "gregtech" + ":" + "materialicons/SHINY/dustSmall";
+ }
+ else if (pileSize.toLowerCase().contains("tiny")){
+ return "gregtech" + ":" + "materialicons/SHINY/dustTiny";
+ }
+ return "gregtech" + ":" + "materialicons/SHINY/dust";
+ }
+
protected final int sRadiation;
@Override
public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
@@ -98,7 +112,7 @@ public class BaseItemDustUnique extends Item{
}
super.addInformation(stack, aPlayer, list, bool);
}
-
+
static boolean containsSubScript(String s){
if (s.contains(MaterialUtils.superscript("1"))) return true;
if (s.contains(MaterialUtils.superscript("2"))) return true;
diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java
index dad3cf320b..6cdb426fa9 100644
--- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java
+++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java
@@ -43,7 +43,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{
this.setTextureName(CORE.MODID + ":" + "itemPickaxe");
this.FACING_HORIZONTAL=true;
this.setMaxStackSize(1);
- this.setMaxDamage(materialDurability);
+ this.setMaxDamage(materialDurability*3);
this.colour = colour;
this.materialName = material.name();
this.setCreativeTab(AddToCreativeTab.tabTools);
diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java
index f4d70b79c8..dddae0c89c 100644
--- a/src/Java/gtPlusPlus/core/lib/CORE.java
+++ b/src/Java/gtPlusPlus/core/lib/CORE.java
@@ -124,7 +124,9 @@ public class CORE {
public static boolean enableMultiblock_NuclearFuelRefinery = true;
public static boolean enableMultiblock_TreeFarmer = true;
+ //Visuals
public static boolean enableTreeFarmerParticles = true;
+ public static boolean useGregtechTextures = true;
}
diff --git a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java
index 03d512d359..2ce6d5bb66 100644
--- a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java
+++ b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java
@@ -307,7 +307,7 @@ public class ItemUtils {
Utils.LOG_WARNING("Generating a Multi-Pick out of "+material.name());
short[] rgb;
rgb = material.getRGBA();
- int dur = customMaterial.getMaxUses();
+ int dur = customMaterial.getMaxUses()*3;
Utils.LOG_WARNING("Determined durability for "+material.name()+" is "+dur);
if (GT_Durability){
dur = material.mDurability*100;
diff --git a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java
index 036e542a29..fe4399a579 100644
--- a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java
+++ b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java
@@ -36,7 +36,7 @@ public class RecipeUtils {
return false;
}
- Utils.LOG_INFO("Trying to add a recipe for "+resultItem.toString());
+ //Utils.LOG_INFO("Trying to add a recipe for "+resultItem.toString());
String a,b,c,d,e,f,g,h,i;
if (slot_1 == null){ a = " ";} else { a = "1";validSlots.add('1');validSlots.add(slot_1);}
Utils.LOG_WARNING(a);
@@ -110,7 +110,7 @@ public class RecipeUtils {
try {
GameRegistry.addRecipe(new ShapedOreRecipe(resultItem.copy(), (Object[]) validSlots.toArray()));
- Utils.LOG_INFO("Success! Added a recipe for "+resultItem.getDisplayName());
+ //Utils.LOG_INFO("Success! Added a recipe for "+resultItem.getDisplayName());
if (!COMPAT_HANDLER.areInitItemsLoaded){
RegistrationHandler.recipesSuccess++;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java
index 8b9ad13212..a03e4c3952 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityTreeFarm.java
@@ -2,6 +2,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
import static gtPlusPlus.core.lib.CORE.configSwitches.enableTreeFarmerParticles;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -299,11 +300,12 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock
//If Machine can work and it's only one of two times a second this will tick, tick.
if (mMachine){
Utils.LOG_INFO("Looking For Trees - Serverside | "+treeCheckTicks);
- final boolean b = findLogs(aBaseMetaTileEntity);
- Utils.LOG_INFO("Did I manage to find/cut logs? "+b);
+ findLogs(aBaseMetaTileEntity);
cleanUp(aBaseMetaTileEntity);
+ plantSaplings(aBaseMetaTileEntity);
+
findSaplings(aBaseMetaTileEntity);
}
}
@@ -388,7 +390,7 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock
final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7;
for (int i = -10; i <= 10; i++) {
for (int j = -10; j <= 10; j++) {
- for (int h=2;h<175;h++){
+ for (int h=1;h<175;h++){
if (TreefarmManager.isLeaves(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)) || TreefarmManager.isWoodLog(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))){
int posiX, posiY, posiZ;
posiX = aBaseMetaTileEntity.getXCoord()+xDir+i;
@@ -431,16 +433,60 @@ public class GregtechMetaTileEntityTreeFarm extends GT_MetaTileEntity_MultiBlock
return true;
}
+ private boolean plantSaplings(final IGregTechTileEntity aBaseMetaTileEntity){
+ Utils.LOG_INFO("called plantSaplings()");
+ World world = aBaseMetaTileEntity.getWorld();
+ ArrayList<ItemStack> r = getStoredInputs();
+ int saplings = 0;
+ final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7;
+ final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7;
+ for (int i = -7; i <= 7; i++) {
+ for (int j = -7; j <= 7; j++) {
+ int h = 1;
+
+ if (TreefarmManager.isAirBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))){
+ for (ItemStack n : r){
+ if (n != null){
+ if (OrePrefixes.sapling.contains(n) || n.getDisplayName().toLowerCase().contains("sapling")){
+ Utils.LOG_INFO(""+n.getDisplayName());
+
+ int posX, posY, posZ;
+ posX = aBaseMetaTileEntity.getXCoord()+xDir+i;
+ posY = aBaseMetaTileEntity.getYCoord()+h;
+ posZ = aBaseMetaTileEntity.getZCoord()+zDir+j;
+
+ //Works for everything but forestry saplings - TODO
+ Block saplingToPlace = Block.getBlockFromItem(n.getItem());
+
+ //If sapling block is not null
+ if (saplingToPlace != null){
+ //Plant Sapling
+ world.setBlock(posX, posY, posZ, saplingToPlace);
+ world.setBlockMetadataWithNotify(posX, posY, posZ, n.getItemDamage(), 4);
+ //Deplete Input stack
+ depleteInput(n);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ Utils.LOG_INFO("Tried to grow saplings: | "+saplings );
+ return true;
+ }
+
+ private Block findAirForSaplingToGrow(){
+ return null;
+ }
private boolean cutLog(final World world, final int x, final int y, final int z){
Utils.LOG_INFO("Cutting Log");
try {
//Get Log.
- final Block block = world.getBlock(x, y, z);
- //Make a valid itemstack to add to the output bus.
- ItemStack logStack[] = {ItemUtils.getSimpleStack(block)};
+ final Block block = world.getBlock(x, y, z);
//Add the stack to the bus.
- this.mOutputItems = logStack;
+ addOutput(ItemUtils.getSimpleStack(block));
//Update bus contents.
updateSlots();
//Remove drop that was added to the bus.