mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-18 11:19:17 +00:00
-Dropped support for golem type api
-Added crafting/uncrafting for disguised armor
This commit is contained in:
1 parent
4bd8d0ce5a
commit
aeecdbe33b
12 files changed
+306
-32
No files matched your search
@@ -24,6 +24,7 @@ public abstract class GadomancyApi {
|
||||
GadomancyApi.handler = handler;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean registerAdditionalGolemType(String name, String modId, AdditionalGolemType newType){
|
||||
return handler.registerAdditionalGolemType(name, modId, newType);
|
||||
}
|
||||
|
||||
@@ -7,31 +7,27 @@ import makeo.gadomancy.client.util.ExtendedTypeDisplayManager;
|
||||
import makeo.gadomancy.client.util.FamiliarHandlerClient;
|
||||
import makeo.gadomancy.client.util.MultiTickEffectDispatcher;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.aura.ResearchPageAuraAspects;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar;
|
||||
import makeo.gadomancy.common.data.DataAchromatic;
|
||||
import makeo.gadomancy.common.data.SyncDataHolder;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.utils.Injector;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.*;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.BlockCoordinates;
|
||||
import thaumcraft.api.IArchitect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.research.ResearchItem;
|
||||
import thaumcraft.api.research.ResearchPage;
|
||||
import thaumcraft.api.wands.ItemFocusBasic;
|
||||
import thaumcraft.client.gui.GuiResearchRecipe;
|
||||
import thaumcraft.client.lib.REHWandHandler;
|
||||
@@ -39,7 +35,6 @@ import thaumcraft.common.items.relics.ItemThaumometer;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
@@ -118,17 +113,55 @@ public class RenderEventHandler {
|
||||
}
|
||||
|
||||
private EntityPlayer current = null;
|
||||
private ItemStack[] armor = null;
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void renderEntityPre(RenderLivingEvent.Pre event) {
|
||||
if(event.entity instanceof EntityPlayer
|
||||
&& ((DataAchromatic)SyncDataHolder.getDataClient("AchromaticData")).isAchromatic((EntityPlayer) event.entity)) {
|
||||
current = (EntityPlayer) event.entity;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
|
||||
if(event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer) event.entity;
|
||||
if(((DataAchromatic)SyncDataHolder.getDataClient("AchromaticData")).isAchromatic((EntityPlayer) event.entity)) {
|
||||
current = p;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
|
||||
}
|
||||
|
||||
armor = p.inventory.armorInventory;
|
||||
p.inventory.armorInventory = new ItemStack[armor.length];
|
||||
System.arraycopy(armor, 0, p.inventory.armorInventory, 0, armor.length);
|
||||
|
||||
boolean changed = false;
|
||||
for(int i = 0; i < armor.length; i++) {
|
||||
if(armor[i] != null && NBTHelper.hasPersistentData(armor[i])) {
|
||||
NBTTagCompound compound = NBTHelper.getPersistentData(armor[i]);
|
||||
if(compound.hasKey("disguise")) {
|
||||
NBTBase base = compound.getTag("disguise");
|
||||
if(base instanceof NBTTagCompound) {
|
||||
p.inventory.armorInventory[i] = ItemStack.loadItemStackFromNBT((NBTTagCompound) base);
|
||||
} else {
|
||||
p.inventory.armorInventory[i] = null;
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!changed) {
|
||||
p.inventory.armorInventory = armor;
|
||||
armor = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true)
|
||||
public void renderPost(RenderLivingEvent.Post event) {
|
||||
if(event.entity instanceof EntityPlayer) {
|
||||
EntityPlayer p = (EntityPlayer) event.entity;
|
||||
if(armor != null) {
|
||||
p.inventory.armorInventory = armor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,9 +174,6 @@ public class RenderEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true)
|
||||
public void renderEntityPost(RenderLivingEvent.Specials.Pre event) {}
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerRenderEvent(RenderPlayerEvent.Post renderEvent) {
|
||||
FamiliarHandlerClient.playerRenderEvent(renderEvent.entityPlayer, renderEvent.partialRenderTick);
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
package makeo.gadomancy.common.crafting;
|
||||
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.research.SimpleResearchItem;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.lib.crafting.InfusionRunicAugmentRecipe;
|
||||
import thaumcraft.common.lib.research.ResearchManager;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* This class is part of the Gadomancy Mod
|
||||
* Gadomancy is Open Source and distributed under the
|
||||
* GNU LESSER GENERAL PUBLIC LICENSE
|
||||
* for more read the LICENSE file
|
||||
* <p/>
|
||||
* Created by makeo @ 25.12.2015 15:35
|
||||
*/
|
||||
public class InfusionDisguiseArmor extends InfusionRunicAugmentRecipe {
|
||||
private static final ItemStack[] COMPONENTS = new ItemStack[] {new ItemStack(Items.slime_ball), new ItemStack(Items.slime_ball)};
|
||||
private static final AspectList ASPECTS = new AspectList().add(Aspect.WATER, 1);
|
||||
|
||||
private Map<ItemStack, List<ItemStack>> cachedItems = new HashMap<ItemStack, List<ItemStack>>();
|
||||
|
||||
@Override
|
||||
public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player) {
|
||||
if(input.size() != COMPONENTS.length + 1 || !ResearchManager.isResearchComplete(player.getCommandSenderName(), SimpleResearchItem.getFullName("STICKYJAR"))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<ItemStack> copy = (List<ItemStack>) input.clone();
|
||||
List<ItemStack> result = new ArrayList<ItemStack>(copy.size());
|
||||
for(ItemStack required : COMPONENTS) {
|
||||
boolean contains = false;
|
||||
for(int i = 0; i < copy.size(); i++) {
|
||||
if(areItemStacksEqual(required, copy.get(i), true)) {
|
||||
contains = true;
|
||||
result.add(copy.get(i));
|
||||
copy.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!contains) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack disguise = copy.get(0);
|
||||
if(!isValidDisguise(central, disguise)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
result.add(0, disguise);
|
||||
cachedItems.put(central, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getComponents(ItemStack input) {
|
||||
List<ItemStack> components = cachedItems.get(input);
|
||||
if(components != null) {
|
||||
return components.toArray(new ItemStack[components.size()]);
|
||||
}
|
||||
return new ItemStack[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects(ItemStack input) {
|
||||
cachedItems.remove(input);
|
||||
return ASPECTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstability(ItemStack input) {
|
||||
return -20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getRecipeOutput(ItemStack input) {
|
||||
List<ItemStack> components = cachedItems.get(input);
|
||||
if(components != null) {
|
||||
ItemStack disguise = components.get(0);
|
||||
ItemStack out = input.copy();
|
||||
NBTTagCompound compound = NBTHelper.getPersistentData(out);
|
||||
if(disguise.getItem() == Items.potionitem) {
|
||||
compound.setBoolean("disguise", true);
|
||||
} else {
|
||||
compound.setTag("disguise", disguise.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
private boolean isValidDisguise(ItemStack armor, ItemStack disguise) {
|
||||
if(isDisguised(armor) || isDisguised(disguise)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int armorPos = EntityLiving.getArmorPosition(armor);
|
||||
return armorPos != 0 && (isInvisItem(disguise) || EntityLiving.getArmorPosition(disguise) == armorPos);
|
||||
}
|
||||
|
||||
private boolean isDisguised(ItemStack stack) {
|
||||
return NBTHelper.hasPersistentData(stack) && NBTHelper.getPersistentData(stack).hasKey("disguise");
|
||||
}
|
||||
|
||||
private boolean isInvisItem(ItemStack disguise) {
|
||||
if(disguise.getItem() == Items.potionitem) {
|
||||
List effects = Items.potionitem.getEffects(disguise);
|
||||
for(Object obj : effects) {
|
||||
if(obj instanceof PotionEffect) {
|
||||
if(((PotionEffect)obj).getPotionID() == Potion.invisibility.getId()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -51,10 +51,11 @@ public class InfusionUpgradeRecipe extends InfusionRecipe {
|
||||
|
||||
for(int i = 0; i < EnumGolemType.values().length ; i++) {
|
||||
EnumGolemType type = EnumGolemType.values()[i];
|
||||
|
||||
AdditionalGolemType addType = GadomancyApi.getAdditionalGolemType(type);
|
||||
Item input = addType == null ? ConfigItems.itemGolemPlacer : addType.getPlacerItem();
|
||||
recipes[i] = new InfusionUpgradeRecipe(research, upgrade, inst, aspects, new ItemStack(input, 1, type.ordinal()), recipe);
|
||||
if(type.health > 0) {
|
||||
AdditionalGolemType addType = GadomancyApi.getAdditionalGolemType(type);
|
||||
Item input = addType == null ? ConfigItems.itemGolemPlacer : addType.getPlacerItem();
|
||||
recipes[i] = new InfusionUpgradeRecipe(research, upgrade, inst, aspects, new ItemStack(input, 1, type.ordinal()), recipe);
|
||||
}
|
||||
}
|
||||
return recipes;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package makeo.gadomancy.common.events;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import makeo.gadomancy.common.aura.AuraEffects;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileAuraPylon;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileBlockProtector;
|
||||
@@ -9,19 +10,24 @@ import makeo.gadomancy.common.data.config.ModConfig;
|
||||
import makeo.gadomancy.common.entities.EntityPermNoClipItem;
|
||||
import makeo.gadomancy.common.familiar.FamiliarAIController;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.ItemUtils;
|
||||
import makeo.gadomancy.common.utils.MiscUtils;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import makeo.gadomancy.common.utils.Vector3;
|
||||
import makeo.gadomancy.common.utils.world.TCMazeHandler;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.entity.boss.IBossDisplayData;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
@@ -29,6 +35,8 @@ import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.items.armor.Hover;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -15,6 +15,7 @@ import makeo.gadomancy.common.entities.golems.ItemAdditionalGolemPlacer;
|
||||
import makeo.gadomancy.common.entities.golems.nbt.ExtendedGolemProperties;
|
||||
import makeo.gadomancy.common.registration.RegisteredGolemStuff;
|
||||
import makeo.gadomancy.common.registration.RegisteredPotions;
|
||||
import makeo.gadomancy.common.utils.MiscUtils;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -22,6 +23,8 @@ import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
@@ -200,10 +203,18 @@ public class EventHandlerGolem {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.NORMAL)
|
||||
public void on(LivingHurtEvent event) {
|
||||
if (!event.entity.worldObj.isRemote && event.entity instanceof EntityGolemBase) {
|
||||
EntityGolemBase golem = (EntityGolemBase) event.entity;
|
||||
if(event.ammount > 0 && RegisteredGolemStuff.upgradeRunicShield.hasUpgrade(golem)) {
|
||||
event.ammount = RegisteredGolemStuff.upgradeRunicShield.absorb(golem, event.ammount, event.source);
|
||||
if (!event.entity.worldObj.isRemote) {
|
||||
if(event.entity instanceof EntityGolemBase) {
|
||||
EntityGolemBase golem = (EntityGolemBase) event.entity;
|
||||
if(event.ammount > 0 && RegisteredGolemStuff.upgradeRunicShield.hasUpgrade(golem)) {
|
||||
event.ammount = RegisteredGolemStuff.upgradeRunicShield.absorb(golem, event.ammount, event.source);
|
||||
}
|
||||
}
|
||||
|
||||
if(event.source.getEntity() != null && event.source.getEntity() instanceof EntityGolemBase
|
||||
&& ((EntityGolemBase) event.source.getEntity()).getGolemType()
|
||||
== RegisteredGolemStuff.typeObsidian.getEnumEntry()) {
|
||||
event.entityLiving.addPotionEffect(new PotionEffect(Potion.wither.getId(), 3*20, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,12 +12,17 @@ import makeo.gadomancy.common.data.config.ModConfig;
|
||||
import makeo.gadomancy.common.registration.RegisteredBlocks;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.GolemEnumHelper;
|
||||
import makeo.gadomancy.common.utils.ItemUtils;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import makeo.gadomancy.common.utils.WandHandler;
|
||||
import makeo.gadomancy.common.utils.world.TCMazeHandler;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@@ -25,6 +30,7 @@ import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.GameRules;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
@@ -36,7 +42,9 @@ import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.tiles.TileJarFillable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -48,6 +56,58 @@ import java.util.Map;
|
||||
* Created by makeo @ 05.07.2015 13:20
|
||||
*/
|
||||
public class EventHandlerWorld {
|
||||
public List<EntityItem> trackedItems = new ArrayList<EntityItem>();
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void on(EntityJoinWorldEvent event) {
|
||||
if(!event.world.isRemote && event.entity instanceof EntityItem
|
||||
&& isDisguised(((EntityItem) event.entity).getEntityItem())) {
|
||||
trackedItems.add((EntityItem) event.entity);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void on(TickEvent.WorldTickEvent event) {
|
||||
if(event.phase == TickEvent.Phase.START && !event.world.isRemote && event.world.getTotalWorldTime() % 20 == 0) {
|
||||
for(int i = 0; i < trackedItems.size(); i++) {
|
||||
EntityItem entity = trackedItems.get(i);
|
||||
if(event.world == entity.worldObj) {
|
||||
if(entity.isDead || !isDisguised(entity.getEntityItem())) {
|
||||
trackedItems.remove(i);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
int x = (int) entity.posX - 1;
|
||||
int y = (int) entity.posY;
|
||||
int z = (int) entity.posZ - 1;
|
||||
if(ConfigBlocks.blockFluidPure == event.world.getBlock(x, y, z)
|
||||
&& event.world.getBlockMetadata(x, y, z) == 0) {
|
||||
NBTTagCompound compound = NBTHelper.getPersistentData(entity.getEntityItem());
|
||||
NBTBase base = compound.getTag("disguise");
|
||||
if(base instanceof NBTTagCompound) {
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT((NBTTagCompound) base);
|
||||
EntityItem newEntity = new EntityItem(event.world, entity.posX, entity.posY, entity.posZ, stack);
|
||||
ItemUtils.applyRandomDropOffset(newEntity, event.world.rand);
|
||||
event.world.spawnEntityInWorld(newEntity);
|
||||
}
|
||||
compound.removeTag("disguise");
|
||||
if(compound.hasNoTags()) {
|
||||
NBTHelper.removePersistentData(entity.getEntityItem());
|
||||
if(entity.getEntityItem().getTagCompound().hasNoTags()) {
|
||||
entity.getEntityItem().setTagCompound(null);
|
||||
}
|
||||
}
|
||||
event.world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDisguised(ItemStack stack) {
|
||||
return NBTHelper.hasPersistentData(stack) && NBTHelper.getPersistentData(stack).hasKey("disguise");
|
||||
}
|
||||
|
||||
private int serverTick = 0;
|
||||
private Entity lastUpdated;
|
||||
@@ -183,6 +243,21 @@ public class EventHandlerWorld {
|
||||
e.toolTip.add(1, "\u00a7a" + StatCollector.translateToLocal("gadomancy.lore.stickyjar"));
|
||||
}
|
||||
}
|
||||
|
||||
if(e.toolTip.size() > 0 && NBTHelper.hasPersistentData(e.itemStack)) {
|
||||
NBTTagCompound compound = NBTHelper.getPersistentData(e.itemStack);
|
||||
if(compound.hasKey("disguise")) {
|
||||
NBTBase base = compound.getTag("disguise");
|
||||
String lore;
|
||||
if(base instanceof NBTTagCompound) {
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT((NBTTagCompound) base);
|
||||
lore = String.format(StatCollector.translateToLocal("gadomancy.lore.disguise.item"), EnumChatFormatting.getTextWithoutFormattingCodes(stack.getDisplayName()));
|
||||
} else {
|
||||
lore = StatCollector.translateToLocal("gadomancy.lore.disguise.none");
|
||||
}
|
||||
e.toolTip.add("\u00a7a" + lore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class ValueOverride extends GameRules.Value {
|
||||
|
||||
@@ -43,7 +43,9 @@ public class ItemFakeGolemPlacer extends Item {
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for(EnumGolemType type : EnumGolemType.values()) {
|
||||
list.add(new ItemStack(this, 1, type.ordinal()));
|
||||
if(type.health > 0) {
|
||||
list.add(new ItemStack(this, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,10 +58,6 @@ public class ItemFakeGolemShield extends Item {
|
||||
if(pass == getRenderPasses(stack.getItemDamage()) - 1) {
|
||||
return shieldIcon;
|
||||
} else {
|
||||
//EnumGolemType type = EnumGolemType.getType(stack.getItemDamage());
|
||||
|
||||
|
||||
//TODO: change dat
|
||||
return golemItem.getIcon(stack, pass);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package makeo.gadomancy.common.registration;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import makeo.gadomancy.api.golems.AdditionalGolemType;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.crafting.InfusionDisguiseArmor;
|
||||
import makeo.gadomancy.common.crafting.InfusionUpgradeRecipe;
|
||||
import makeo.gadomancy.common.crafting.RecipeStickyJar;
|
||||
import makeo.gadomancy.common.data.config.ModConfig;
|
||||
@@ -229,6 +230,8 @@ public class RegisteredRecipes {
|
||||
'C', aerCore, 'J', new ItemStack(ConfigBlocks.blockJar), 'T', new ItemStack(ConfigBlocks.blockTable, 1, 15));
|
||||
|
||||
auraCoreRecipes = createAuraCoreRecipes();
|
||||
|
||||
ThaumcraftApi.getCraftingRecipes().add(new InfusionDisguiseArmor());
|
||||
}
|
||||
|
||||
private static List[] createAuraCoreRecipes() {
|
||||
|
||||
@@ -52,6 +52,18 @@ public class NBTHelper {
|
||||
}
|
||||
|
||||
|
||||
public static void removePersistentData(Entity entity) {
|
||||
removePersistentData(entity.getEntityData());
|
||||
}
|
||||
public static void removePersistentData(ItemStack item) {
|
||||
if(item.hasTagCompound()) removePersistentData(item.getTagCompound());
|
||||
}
|
||||
|
||||
public static void removePersistentData(NBTTagCompound base) {
|
||||
base.removeTag(Gadomancy.MODID);
|
||||
}
|
||||
|
||||
|
||||
public static NBTTagCompound getData(ItemStack stack) {
|
||||
NBTTagCompound compound = stack.getTagCompound();
|
||||
if(compound == null) {
|
||||
|
||||
@@ -141,6 +141,9 @@ gadomancy.lore.hasAdditionalLore=<Press SHIFT for more information>
|
||||
gadomancy.lore.stickyjar=Sticky
|
||||
gadomancy.lore.remotejar=§7Network: %s
|
||||
|
||||
gadomancy.lore.disguise.item=Disguised as %s
|
||||
gadomancy.lore.disguise.none=Transparent
|
||||
|
||||
gadomancy.eldritch.portalPlacerCreative=Creative portal placer
|
||||
gadomancy.eldritch.noflyCreative=(even in creative)
|
||||
gadomancy.eldritch.nobreakPortalNothing=This portal cannot be broken
|
||||
|
||||
Reference in new issue
Block a user