Commit d996edfa authored by mrAppleXZ's avatar mrAppleXZ 💾

IF fix

parent 505509f2
......@@ -56,6 +56,7 @@ public class TESRCodeStorage extends PXLFastTESR<TileCodeStorage>
}
else
{
float percentage = ((float)delta / (float)ANIMATION_DURATION);
degrees = te.isOpened() ? 90 * percentage : 90 - 90*percentage;
}
......
......@@ -12,7 +12,6 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import ru.pearx.libmc.client.gui.DrawingTools;
import ru.pearx.purmag.PurMag;
import ru.pearx.purmag.common.CapabilityRegistry;
import ru.pearx.purmag.common.Utils;
import ru.pearx.purmag.common.magibench.MagibenchRegistry;
import ru.pearx.purmag.common.recipes.magibench.AbstractMagibenchRecipe;
......@@ -68,7 +67,7 @@ public abstract class AbstractMagibenchRecipeWrapper implements ICraftingRecipeW
int stY = MagibenchRecipeCategory.HEIGHT - 16;
if(mouseX >= stX && mouseY >= stY && mouseX <= stX + 14 && mouseY <= stY + 14)
{
boolean unloc = Minecraft.getMinecraft().player.getCapability(CapabilityRegistry.ENTRY_STORE_CAP, null).isFullyUnlocked(recipe.getEntry());
boolean unloc = PurMag.INSTANCE.getIfRegistry().getEntry(recipe.getEntry()).isUnlocked(Minecraft.getMinecraft().player);
return Arrays.asList(
I18n.format("misc.jei.magibench.tooltip.entry"),
(unloc ? TextFormatting.GREEN : TextFormatting.RED) + PurMag.INSTANCE.getIfRegistry().getEntry(recipe.getEntry()).getDisplayName() + TextFormatting.RESET,
......
......@@ -6,6 +6,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import ru.pearx.libmc.client.gui.drawables.IGuiDrawable;
import ru.pearx.purmag.PurMag;
import ru.pearx.purmag.client.infofield.pages.IIfPage;
import ru.pearx.purmag.common.CapabilityRegistry;
import ru.pearx.purmag.common.infofield.playerdata.IIfEntryStore;
......@@ -133,12 +134,11 @@ public class IfEntry
//Just available to see, not read/continue researching/etc.
public boolean isAvailableToSee(EntityPlayer p, int tier)
{
IIfEntryStore store = p.getCapability(CapabilityRegistry.ENTRY_STORE_CAP, null);
//if tier is < needed.
if (tier < getTier())
return false;
if (!isAllParentsUnlocked(p))
if (!isAvailable(p))
return false;
return true;
......@@ -146,16 +146,35 @@ public class IfEntry
public boolean isAvailableToResearch(EntityPlayer p)
{
if (!isAllParentsUnlocked(p))
return false;
return true;
return isAvailable(p);
}
public boolean isAllParentsUnlocked(EntityPlayer p)
public boolean isAvailable(EntityPlayer p)
{
for (String id : getParents())
if (!p.getCapability(CapabilityRegistry.ENTRY_STORE_CAP, null).isFullyUnlocked(id))
{
if(!PurMag.INSTANCE.getIfRegistry().getEntry(id).isUnlocked(p))
return false;
}
return true;
}
public boolean isUnlocked(EntityPlayer p)
{
IIfEntryStore store = p.getCapability(CapabilityRegistry.ENTRY_STORE_CAP, null);
if(store.getSteps(getId()) < getSteps().size())
{
return false;
}
if(getSteps().size() == 0)
{
for(String parent : getParents())
{
IfEntry entr = PurMag.INSTANCE.getIfRegistry().getEntry(parent);
if(!entr.isUnlocked(p))
return false;
}
}
return true;
}
}
......@@ -17,8 +17,6 @@ public interface IIfEntryStore extends INBTSerializable<NBTTagCompound>
void setSteps(String id, int st);
boolean isFullyUnlocked(String id);
void sync(EntityPlayerMP p);
void sync(EntityPlayerMP p, String res);
......
......@@ -2,7 +2,6 @@ package ru.pearx.purmag.common.infofield.playerdata;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import ru.pearx.purmag.PurMag;
import ru.pearx.purmag.common.DisplayMessage;
import ru.pearx.purmag.common.networking.NetworkManager;
import ru.pearx.purmag.common.networking.packets.CPacketDisplayMessage;
......@@ -38,12 +37,6 @@ public class IfEntryStore implements IIfEntryStore
entries.put(id, steps);
}
@Override
public boolean isFullyUnlocked(String id)
{
return getSteps(id) >= PurMag.INSTANCE.getIfRegistry().getEntry(id).getSteps().size();
}
@Override
public void sync(EntityPlayerMP p)
{
......
......@@ -4,7 +4,7 @@ import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import net.minecraftforge.registries.IForgeRegistryEntry;
import ru.pearx.purmag.common.CapabilityRegistry;
import ru.pearx.purmag.PurMag;
import ru.pearx.purmag.common.inventory.ContainerMagibench;
/*
......@@ -42,7 +42,7 @@ public abstract class AbstractMagibenchRecipe extends IForgeRegistryEntry.Impl<I
{
ContainerMagibench.Crafting craft = (ContainerMagibench.Crafting) inv;
return craft.getMagibench().tier.getTier() >= getTier() &&
craft.getMagibench().inv.player.getCapability(CapabilityRegistry.ENTRY_STORE_CAP, null).isFullyUnlocked(getEntry());
PurMag.INSTANCE.getIfRegistry().getEntry(getEntry()).isUnlocked(craft.getMagibench().inv.player);
}
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment