aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod')
-rw-r--r--src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/bartcrops/crops/Crop_Force.java53
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java42
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java1
5 files changed, 89 insertions, 11 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java b/src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java
index 48813310d2..033aaac663 100644
--- a/src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java
+++ b/src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java
@@ -5,6 +5,7 @@ import java.util.List;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.bartcrops.crops.Crop_Force;
import gtPlusPlus.xmod.bartcrops.crops.Crop_Hemp;
import ic2.api.crops.CropCard;
import ic2.api.crops.Crops;
@@ -48,6 +49,7 @@ public class LoaderOfTheCrops {
List<LoaderOfTheCrops> p = new ArrayList<LoaderOfTheCrops>();
p.add(new LoaderOfTheCrops(new Crop_Hemp(), new ItemStack(Item.getItemById(111), 3)));
+ p.add(new LoaderOfTheCrops(new Crop_Force(), new ItemStack(Item.getItemById(111), 3)));
return p;
}
diff --git a/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java b/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java
index ca2a044564..0f590dcf2b 100644
--- a/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java
+++ b/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java
@@ -14,10 +14,10 @@ import net.minecraft.util.IIcon;
import speiger.src.crops.api.ICropCardInfo;
public abstract class BaseCrop extends CropCard implements ICropCardInfo {
+
@SideOnly(Side.CLIENT)
public void registerSprites(IIconRegister iconRegister) {
this.textures = new IIcon[this.maxSize()];
-
for (int i = 1; i <= this.textures.length; ++i) {
this.textures[i - 1] = iconRegister.registerIcon(CORE.MODID+":crop/blockCrop." + this.name() + "." + i);
}
diff --git a/src/main/java/gtPlusPlus/xmod/bartcrops/crops/Crop_Force.java b/src/main/java/gtPlusPlus/xmod/bartcrops/crops/Crop_Force.java
new file mode 100644
index 0000000000..06238a4589
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/bartcrops/crops/Crop_Force.java
@@ -0,0 +1,53 @@
+package gtPlusPlus.xmod.bartcrops.crops;
+
+import gtPlusPlus.core.material.ELEMENT.STANDALONE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.preloader.CORE_Preloader;
+import gtPlusPlus.xmod.bartcrops.abstracts.BaseAestheticCrop;
+import ic2.api.crops.ICropTile;
+import net.minecraft.item.ItemStack;
+
+public class Crop_Force extends BaseAestheticCrop {
+
+ public int tier() {
+ return 4;
+ }
+
+ public String name() {
+ return "Force";
+ }
+
+ public String discoveredBy() {
+ return "Alkalus";
+ }
+
+ public int growthDuration(ICropTile crop) {
+ int ret = 800;
+
+ /*if (crop.isBlockBelow(Blocks.dirt) || crop.isBlockBelow(Blocks.flowing_water)) {
+ ret = 225;
+ }*/
+
+ if (CORE_Preloader.DEBUG_MODE) {
+ ret = 1;
+ }
+
+ return ret;
+ }
+
+ public String[] attributes() {
+ return new String[]{"Power", "Soil", "Yellow", "Gold"};
+ }
+
+ public ItemStack getGain(ICropTile crop) {
+ ItemStack ret = this.getDisplayItem();
+ if (MathUtils.randInt(0, 10) > 8) {
+ ret = STANDALONE.FORCE.getNugget(MathUtils.randInt(4, 8));
+ }
+ return ret;
+ }
+
+ public ItemStack getDisplayItem() {
+ return STANDALONE.FORCE.getNugget(0);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
index ffaa77a0be..c5e33c088d 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
@@ -1,20 +1,13 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
+import java.util.*;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.minecraft.BlockPos;
@@ -24,12 +17,18 @@ import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
private boolean mHasBeenMapped = false;
private int mCurrentDimension = 0;
public int mMode = 0;
+ public boolean mLocked = true;
public GregtechMetaWirelessCharger(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
@@ -42,6 +41,9 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
@Override
public String[] getDescription() {
return new String[] {this.mDescription,
+ "Can be locked to the owner by sneaking with a screwdriver",
+ "Can also be locked with a lock upgrade",
+ "",
"3 Modes, Long-Range, Local and Mixed.",
"Long-Range: Can supply 2A of power to a single player up to "+(GT_Values.V[this.mTier]*4)+"m away.",
"Local: Can supply several Amps to each player within "+this.mTier*20+"m.",
@@ -150,6 +152,11 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
mWirelessChargingMap.clear();
mLocalChargingMap.clear();
+ if (aPlayer.isSneaking()) {
+ mLocked = !mLocked;
+ PlayerUtils.messagePlayer(aPlayer, mLocked ? "Locked to owner." : "Unlocked.");
+ }
+
if (!this.getBaseMetaTileEntity().getWorld().playerEntities.isEmpty()){
for (Object mTempPlayer : this.getBaseMetaTileEntity().getWorld().playerEntities){
if (mTempPlayer instanceof EntityPlayer || mTempPlayer instanceof EntityPlayerMP){
@@ -348,12 +355,14 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
@Override
public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setBoolean("mLocked", this.mLocked);
aNBT.setInteger("mMode", this.mMode);
aNBT.setInteger("mCurrentDimension", this.mCurrentDimension);
}
@Override
public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mLocked = aNBT.getBoolean("mLocked");
this.mMode = aNBT.getInteger("mMode");
this.mCurrentDimension = aNBT.getInteger("mCurrentDimension");
}
@@ -366,6 +375,19 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
private Map<EntityPlayer, UUID> mWirelessChargingMap = new HashMap<EntityPlayer, UUID>();
private Map<UUID, EntityPlayer> mLocalChargingMap = new HashMap<UUID, EntityPlayer>();
+
+ private boolean isValidPlayer(EntityPlayer aPlayer) {
+ BaseMetaTileEntity aTile = (BaseMetaTileEntity) this.getBaseMetaTileEntity();
+ if (mLocked || ( aTile != null && aTile.privateAccess())) {
+ if (aPlayer.getUniqueID().equals(getBaseMetaTileEntity().getOwnerUuid())){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ return true;
+ }
@Override
public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
@@ -389,7 +411,7 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
if (this.mMode == 1 || this.mMode == 2){
int tempRange = (this.mMode == 1 ? this.mTier*20 : this.mTier*10);
if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) < tempRange){
- if (!mLocalChargingMap.containsKey(mTemp.getPersistentID())){
+ if (isValidPlayer(mTemp) && !mLocalChargingMap.containsKey(mTemp.getPersistentID())){
mLocalChargingMap.put(mTemp.getPersistentID(), mTemp);
ChargingHelper.addValidPlayer(mTemp, this);
//PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m - Local].");
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
index ecd4882516..7514a3dea6 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
@@ -362,6 +362,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas
this.mOutputItems = outputs;
this.mOutputFluids = new FluidStack[] {tRecipe.getFluidOutput(0)};
+ this.updateSlots();
return true;
}
}