parent
6802bc5f47
commit
8a8bff865f
|
@ -129,9 +129,12 @@ public class BloodAltar implements IFluidHandler
|
||||||
EnumAltarComponent component = ((IAltarComponent) worldBlock.getBlock()).getType(world, worldBlock.getState(), componentPos);
|
EnumAltarComponent component = ((IAltarComponent) worldBlock.getBlock()).getType(world, worldBlock.getState(), componentPos);
|
||||||
if (component == null || component != altarComponent.getComponent())
|
if (component == null || component != altarComponent.getComponent())
|
||||||
return false;
|
return false;
|
||||||
} else if (worldBlock.getBlock() != Utils.getBlockForComponent(altarComponent.getComponent()))
|
} else if (worldBlock.getBlock() != Utils.getBlockForComponent(altarComponent.getComponent())) // Special case Vanilla
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
} else if (BloodMagicAPI.getAltarComponents().get(worldBlock.getState()) != null) // Mod compat
|
||||||
|
{
|
||||||
|
return BloodMagicAPI.getAltarComponents().get(worldBlock.getState()) == altarComponent.getComponent();
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package WayofTime.bloodmagic.api;
|
package WayofTime.bloodmagic.api;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||||
import WayofTime.bloodmagic.api.util.helper.LogHelper;
|
import WayofTime.bloodmagic.api.util.helper.LogHelper;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -40,6 +42,8 @@ public class BloodMagicAPI
|
||||||
private static final Map<String, Integer> entitySacrificeValues = new HashMap<String, Integer>();
|
private static final Map<String, Integer> entitySacrificeValues = new HashMap<String, Integer>();
|
||||||
@Getter
|
@Getter
|
||||||
private static final ArrayList<Block> greenGroveBlacklist = new ArrayList<Block>();
|
private static final ArrayList<Block> greenGroveBlacklist = new ArrayList<Block>();
|
||||||
|
@Getter
|
||||||
|
private static final Map<IBlockState, EnumAltarComponent> altarComponents = new HashMap<IBlockState, EnumAltarComponent>();
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
@ -261,4 +265,24 @@ public class BloodMagicAPI
|
||||||
if (!greenGroveBlacklist.contains(block))
|
if (!greenGroveBlacklist.contains(block))
|
||||||
greenGroveBlacklist.add(block);
|
greenGroveBlacklist.add(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks an IBlockState as a specific {@link EnumAltarComponent} without needing to implement
|
||||||
|
* {@link WayofTime.bloodmagic.api.altar.IAltarComponent} on the block.
|
||||||
|
*
|
||||||
|
* IMC:
|
||||||
|
* {@code FMLInterModComs.sendMessage("BloodMagic", "altarComponent", "domain:name:meta:component")}
|
||||||
|
* Example:
|
||||||
|
* {@code FMLInterModComs.sendMessage("BloodMagic", "altarComponent", "minecraft:glowstone:0:GLOWSTONE")}
|
||||||
|
*
|
||||||
|
* @param state
|
||||||
|
* - The IBlockState for this component
|
||||||
|
* @param altarComponent
|
||||||
|
* - The EnumAltarComponent for this state
|
||||||
|
*/
|
||||||
|
public static void addAltarComponent(IBlockState state, EnumAltarComponent altarComponent)
|
||||||
|
{
|
||||||
|
if (!altarComponents.containsKey(state))
|
||||||
|
altarComponents.put(state, altarComponent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package WayofTime.bloodmagic.util.handler;
|
package WayofTime.bloodmagic.util.handler;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||||
|
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||||
import WayofTime.bloodmagic.util.Utils;
|
import WayofTime.bloodmagic.util.Utils;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
@ -54,6 +55,17 @@ public class IMCHandler
|
||||||
BloodMagicAPI.blacklistFromGreenGrove(block);
|
BloodMagicAPI.blacklistFromGreenGrove(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message.key.equals("altarComponent") && message.isStringMessage())
|
||||||
|
{
|
||||||
|
String[] splitInfo = message.getStringValue().split(":");
|
||||||
|
if (splitInfo.length == 4)
|
||||||
|
{
|
||||||
|
Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(splitInfo[0], splitInfo[1]));
|
||||||
|
if (block != null)
|
||||||
|
BloodMagicAPI.addAltarComponent(block.getStateFromMeta(Integer.parseInt(splitInfo[2])), EnumAltarComponent.valueOf(splitInfo[3]));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue