It compiles. Somehow.

This commit is contained in:
Nicholas Ignoffo 2017-08-15 20:21:54 -07:00
parent 554c9852e6
commit 348fee1e2a
150 changed files with 1029 additions and 2186 deletions

View file

@ -410,7 +410,7 @@ public class Utils
case BLOODRUNE:
return RegistrarBloodMagicBlocks.BLOOD_RUNE;
case CRYSTAL:
return RegistrarBloodMagicBlocks.CRYSTAL;
return RegistrarBloodMagicBlocks.BLOOD_RUNE;
case NOTAIR:
return Blocks.STONEBRICK;
default:

View file

@ -16,56 +16,57 @@ public class IMCHandler
public static void handleIMC(FMLInterModComms.IMCEvent event)
{
for (FMLInterModComms.IMCMessage message : event.getMessages())
{
if (message.key.equals("teleposerBlacklist") && message.isItemStackMessage())
{
ItemStack stack = message.getItemStackValue();
if (stack.getItem() instanceof ItemBlock)
{
Block block = Block.getBlockFromItem(stack.getItem());
BloodMagicAPI.addToTeleposerBlacklist(block, stack.getItemDamage());
}
}
if (message.key.equals("transpositionBlacklist") && message.isItemStackMessage())
{
ItemStack stack = message.getItemStackValue();
if (stack.getItem() instanceof ItemBlock)
{
Block block = Block.getBlockFromItem(stack.getItem());
BloodMagicAPI.addToTranspositionBlacklist(block, stack.getItemDamage());
}
}
if (message.key.equals("sacrificeValue") && message.isStringMessage())
{
String[] splitInfo = message.getStringValue().split(";");
if (splitInfo.length == 2 && Utils.isInteger(splitInfo[1]))
BloodMagicAPI.setEntitySacrificeValue(splitInfo[0], Integer.parseInt(splitInfo[1]));
}
if (message.key.equals("greenGroveBlacklist") && message.isStringMessage())
{
String[] splitInfo = message.getStringValue().split(":");
if (splitInfo.length == 2)
{
Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(splitInfo[0], splitInfo[1]));
if (block != null)
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]));
}
}
}
// TODO
// for (FMLInterModComms.IMCMessage message : event.getMessages())
// {
// if (message.key.equals("teleposerBlacklist") && message.isItemStackMessage())
// {
// ItemStack stack = message.getItemStackValue();
// if (stack.getItem() instanceof ItemBlock)
// {
// Block block = Block.getBlockFromItem(stack.getItem());
// BloodMagicAPI.addToTeleposerBlacklist(block, stack.getItemDamage());
// }
// }
//
// if (message.key.equals("transpositionBlacklist") && message.isItemStackMessage())
// {
// ItemStack stack = message.getItemStackValue();
// if (stack.getItem() instanceof ItemBlock)
// {
// Block block = Block.getBlockFromItem(stack.getItem());
// BloodMagicAPI.addToTranspositionBlacklist(block, stack.getItemDamage());
// }
// }
//
// if (message.key.equals("sacrificeValue") && message.isStringMessage())
// {
// String[] splitInfo = message.getStringValue().split(";");
// if (splitInfo.length == 2 && Utils.isInteger(splitInfo[1]))
// BloodMagicAPI.setEntitySacrificeValue(splitInfo[0], Integer.parseInt(splitInfo[1]));
// }
//
// if (message.key.equals("greenGroveBlacklist") && message.isStringMessage())
// {
// String[] splitInfo = message.getStringValue().split(":");
// if (splitInfo.length == 2)
// {
// Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(splitInfo[0], splitInfo[1]));
// if (block != null)
// 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]));
// }
// }
// }
}
}

View file

@ -7,6 +7,7 @@ import java.util.Map;
import java.util.Set;
import WayofTime.bloodmagic.client.key.KeyBindings;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.GlStateManager;
@ -53,7 +54,6 @@ import WayofTime.bloodmagic.item.ItemRitualDiviner;
import WayofTime.bloodmagic.item.sigil.ItemSigilHolding;
import WayofTime.bloodmagic.network.BloodMagicPacketHandler;
import WayofTime.bloodmagic.network.SigilHoldingPacketProcessor;
import WayofTime.bloodmagic.registry.ModPotions;
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
import WayofTime.bloodmagic.util.GhostItemHelper;
import WayofTime.bloodmagic.util.helper.TextHelper;
@ -117,7 +117,7 @@ public class ClientHandler
public void onSoundEvent(PlaySoundEvent event)
{
EntityPlayer player = Minecraft.getMinecraft().player;
if (player != null && player.isPotionActive(ModPotions.deafness))
if (player != null && player.isPotionActive(RegistrarBloodMagic.DEAFNESS))
{
event.setResultSound(null);
}

View file

@ -1,6 +1,7 @@
package WayofTime.bloodmagic.util.handler.event;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@ -41,7 +42,6 @@ import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeGrimReaperSp
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeJump;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSpeed;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeStepAssist;
import WayofTime.bloodmagic.registry.ModPotions;
@Handler
public class LivingArmourHandler
@ -246,7 +246,7 @@ public class LivingArmourHandler
{
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
boolean hasAssist = false;
if (event.getEntityLiving().isPotionActive(ModPotions.boost))
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
{
hasAssist = true;
player.stepHeight = Constants.Misc.ALTERED_STEP_HEIGHT;
@ -289,9 +289,9 @@ public class LivingArmourHandler
}
}
if (event.getEntityLiving().isPotionActive(ModPotions.boost))
if (event.getEntityLiving().isPotionActive(RegistrarBloodMagic.BOOST))
{
int i = event.getEntityLiving().getActivePotionEffect(ModPotions.boost).getAmplifier();
int i = event.getEntityLiving().getActivePotionEffect(RegistrarBloodMagic.BOOST).getAmplifier();
{
percentIncrease += (i + 1) * 0.05f;
}

View file

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
@ -35,7 +36,6 @@ import WayofTime.bloodmagic.demonAura.WillChunk;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.registry.ModPotions;
@Handler
public class WillHandler
@ -84,9 +84,9 @@ public class WillHandler
DamageSource source = event.getSource();
Entity entity = source.getTrueSource();
if (attackedEntity.isPotionActive(ModPotions.soulSnare) && (attackedEntity instanceof EntityMob || attackedEntity.getEntityWorld().getDifficulty() == EnumDifficulty.PEACEFUL))
if (attackedEntity.isPotionActive(RegistrarBloodMagic.SOUL_SNARE) && (attackedEntity instanceof EntityMob || attackedEntity.getEntityWorld().getDifficulty() == EnumDifficulty.PEACEFUL))
{
PotionEffect eff = attackedEntity.getActivePotionEffect(ModPotions.soulSnare);
PotionEffect eff = attackedEntity.getActivePotionEffect(RegistrarBloodMagic.SOUL_SNARE);
int lvl = eff.getAmplifier();
double amountOfSouls = attackedEntity.getEntityWorld().rand.nextDouble() * (lvl + 1) * (lvl + 1) * 5;

View file

@ -1,181 +0,0 @@
package WayofTime.bloodmagic.util.helper;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
/**
* @author <a href="https://github.com/TehNut">TehNut</a>
*
* The goal of this class is to make registering the inventory renders
* for your Items/Blocks a much simpler and easier process.
*
* You must call this at the post initialization stage on the clientside
* only.
*
* If you pass a Block through here that uses the default ItemBlock, you
* should specify a custom name.
*
* @deprecated in favor of {@link InventoryRenderHelperV2}
*/
@Deprecated
public class InventoryRenderHelper
{
/**
* This is the base string for your resources. It will usually be your modid
* in all lowercase with a colon at the end.
*/
private final String domain;
public InventoryRenderHelper(String domain)
{
this.domain = domain;
}
/**
* Registers a Model for the given Item and meta.
*
* @param item
* - Item to register Model for
* @param meta
* - Meta of Item
* @param name
* - Name of the model JSON
*/
public void itemRender(Item item, int meta, String name)
{
ResourceLocation resName = new ResourceLocation(domain + name);
ModelBakery.registerItemVariants(item, resName);
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(resName, "inventory"));
}
/**
* Registers a Model for the given Item and meta. This does not call
* setCustomModelResourceLocation, to allow the implementation of
* ItemMeshDefinition.
*
* @param item
* - Item to register Model for
* @param meta
* - Meta of Item
* @param name
* - Name of the model JSON
*/
public void customItemRender(Item item, int meta, String name)
{
ResourceLocation resName = new ResourceLocation(domain + name);
ModelBakery.registerItemVariants(item, resName);
}
/**
* Shorthand of {@code itemRender(Item, int, String)}
*
* @param item
* - Item to register Model for
* @param meta
* - Meta of Item
*/
public void itemRender(Item item, int meta)
{
itemRender(item, meta, getClassName(item) + meta);
}
public void customItemRender(Item item, int meta)
{
customItemRender(item, meta, getClassName(item) + meta);
}
public void itemRender(Item item, String name)
{
itemRender(item, 0, name);
}
/**
* Shorthand of {@code itemRender(Item, int)}
*
* @param item
* - Item to register Model for
*/
public void itemRender(Item item)
{
itemRender(item, 0, getClassName(item));
}
/**
* Registers a model for the item across all Meta's that get used for the
* item
*
* @param item
* - Item to register Model for
*/
public void itemRenderAll(Item item)
{
final Item toRender = item;
ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition()
{
@Override
public ModelResourceLocation getModelLocation(ItemStack stack)
{
return new ModelResourceLocation(domain + getClassName(toRender), "inventory");
}
});
}
public void fluidRender(Block block)
{
final Block toRender = block;
ModelBakery.registerItemVariants(InventoryRenderHelper.getItemFromBlock(block));
ModelLoader.setCustomMeshDefinition(InventoryRenderHelper.getItemFromBlock(block), new ItemMeshDefinition()
{
@Override
public ModelResourceLocation getModelLocation(ItemStack stack)
{
return new ModelResourceLocation(Constants.Mod.DOMAIN + toRender.getClass().getSimpleName(), "fluid");
}
});
ModelLoader.setCustomStateMapper(block, new StateMapperBase()
{
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
{
return new ModelResourceLocation(domain + toRender.getClass().getSimpleName(), "fluid");
}
});
}
/**
* @param block
* - Block to get Item of
*
* @return - The ItemBlock that corresponds to the Block.
*/
public static Item getItemFromBlock(Block block)
{
return Item.getItemFromBlock(block);
}
/**
* Finds the class name of the given Item. If handed an ItemBlock, it will
* use the class name of the contained Block.
*
* @return The class name of the given Item
*/
public static String getClassName(Item item)
{
return item instanceof ItemBlock ? Block.getBlockFromItem(item).getClass().getSimpleName() : item.getClass().getSimpleName();
}
}

View file

@ -1,64 +0,0 @@
package WayofTime.bloodmagic.util.helper;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
public class InventoryRenderHelperV2
{
private final String domain;
public InventoryRenderHelperV2(String domain)
{
this.domain = domain.endsWith(":") ? domain.replace(":", "") : domain;
}
public void registerMesher(Item item, ItemMeshDefinition meshDefinition)
{
ModelLoader.setCustomMeshDefinition(item, meshDefinition);
}
public void registerRender(Item item, int meta, String name, String variant)
{
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(new ResourceLocation(domain, "item/" + name), "type=" + variant));
}
public void registerRender(Item item, int meta, String variant)
{
registerRender(item, meta, item.getRegistryName().getResourcePath(), variant);
}
public void registerRender(Item item, String name, String variant)
{
registerRender(item, 0, name, variant);
}
public void registerRender(Item item, String variant)
{
registerRender(item, item.getRegistryName().getResourcePath(), variant);
}
public void registerRender(Block block, int meta, String name, String variant)
{
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(new ResourceLocation(domain, name), variant));
}
public void registerRender(Block block, int meta, String variant)
{
registerRender(block, meta, block.getRegistryName().getResourcePath(), variant);
}
public void registerRender(Block block, String name, String variant)
{
registerRender(block, 0, name, variant);
}
public void registerRender(Block block, String variant)
{
registerRender(block, block.getRegistryName().getResourcePath(), variant);
}
}