Detect low grav dimensions by world provider

This commit is contained in:
Blood-Asp 2017-03-31 19:01:32 +02:00
parent 944f1dab7e
commit dd8510792f
4 changed files with 11 additions and 1 deletions

View file

@ -54,6 +54,8 @@ import net.minecraftforge.oredict.OreDictionary;
import org.apache.commons.lang3.StringUtils;
import java.io.*;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -255,6 +257,8 @@ public class GT_Mod implements IGT_Mod {
gregtechproxy.mAddGTRecipesToIC2Machines = tMainConfig.get("general", "AddGTRecipesToIC2Machines", true).getBoolean(true);
gregtechproxy.mUndergroundOil.getConfig(tMainConfig, "undergroundfluid");
gregtechproxy.mLowGravProcessing = Loader.isModLoaded(GT_Values.MOD_ID_GC_CORE) && tMainConfig.get("general", "LowGravProcessing", true).getBoolean(true);
LocalDate tDate = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
gregtechproxy.mAprilFool = GregTech_API.sSpecialFile.get(ConfigCategories.general, "AprilFool", tDate.getMonthValue()==4 && tDate.getDayOfMonth() == 1);
GregTech_API.mOutputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "OutputRF", true);
GregTech_API.mInputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "InputRF", false);

View file

@ -10,6 +10,7 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
@ -19,6 +20,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
@ -424,6 +426,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
endProcess();
}
if (mProgresstime > 5) mStuttering = false;
XSTR aXSTR = new XSTR();
if(GT_Mod.gregtechproxy.mAprilFool && aXSTR.nextInt(5000)==0)GT_Utility.sendSoundToPlayers(aBaseMetaTileEntity.getWorld(), GregTech_API.sSoundList.get(5), 10.0F, -1.0F, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(),aBaseMetaTileEntity.getZCoord());
} else {
if (!mStuttering) {
stutterProcess();
@ -732,7 +736,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
if (tMap == null) return DID_NOT_FIND_RECIPE;
GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), getAllInputs());
if (tRecipe == null) return DID_NOT_FIND_RECIPE;
if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && getBaseMetaTileEntity().getWorld().provider.dimensionId != -27) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && !(DimensionManager.getProvider(getBaseMetaTileEntity().getWorld().provider.dimensionId).getClass().getName().endsWith("Orbit")||DimensionManager.getProvider(getBaseMetaTileEntity().getWorld().provider.dimensionId).getClass().getName().endsWith("Space"))) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe;
if (!canOutput(tRecipe)) {
mOutputBlocked++;

View file

@ -1602,6 +1602,7 @@ public class GT_Utility {
Block tBlock = aWorld.getBlock(aX, aY, aZ);
tList.add("----- X: " + aX + " Y: " + aY + " Z: " + aZ + " -----");
tList.add("Dimension: "+DimensionManager.getProvider(aWorld.provider.dimensionId).getClass().getName());
try {
if (tTileEntity instanceof IInventory)
tList.add("Name: " + ((IInventory) tTileEntity).getInventoryName() + " MetaData: " + aWorld.getBlockMetadata(aX, aY, aZ));

View file

@ -194,6 +194,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public boolean mEnableAllComponents = false;
public boolean mAddGTRecipesToIC2Machines = true;
public boolean mLowGravProcessing = false;
public boolean mAprilFool = false;
public GT_Proxy() {
GameRegistry.registerFuelHandler(this);