Initial work on the Attractor alchemy array. Very WIP and is not quite where I like it.
This commit is contained in:
parent
a35e4385ed
commit
ad546380a3
|
@ -0,0 +1,491 @@
|
|||
package WayofTime.bloodmagic.alchemyArray;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.EntityAITasks;
|
||||
import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry;
|
||||
import net.minecraft.entity.monster.EntityBlaze;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.monster.EntityPigZombie;
|
||||
import net.minecraft.entity.monster.EntitySilverfish;
|
||||
import net.minecraft.entity.monster.EntitySlime;
|
||||
import net.minecraft.entity.monster.EntitySpider;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.pathfinding.Path;
|
||||
import net.minecraft.pathfinding.PathFinder;
|
||||
import net.minecraft.pathfinding.WalkNodeProcessor;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyArrayEffect;
|
||||
import WayofTime.bloodmagic.fakePlayer.FakePlayerBM;
|
||||
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
/**
|
||||
* Credits for the initial code go to Crazy Pants of EIO.
|
||||
*/
|
||||
public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
|
||||
{
|
||||
private FakePlayer target;
|
||||
private Set<EntityLiving> tracking = new HashSet<EntityLiving>();
|
||||
|
||||
private int counter = 0;
|
||||
private int maxMobsAttracted = 10000;
|
||||
|
||||
private int cooldown = 50;
|
||||
|
||||
public AlchemyArrayEffectAttractor(String key)
|
||||
{
|
||||
super(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(TileEntity tile, int ticksActive)
|
||||
{
|
||||
BlockPos pos = tile.getPos();
|
||||
counter++;
|
||||
if (counter < 10)
|
||||
{
|
||||
Iterator<EntityLiving> itr = tracking.iterator();
|
||||
while (itr.hasNext())
|
||||
{
|
||||
EntityLiving ent = itr.next();
|
||||
onEntityTick(pos, ent);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
counter = 0;
|
||||
|
||||
World world = tile.getWorld();
|
||||
|
||||
Set<EntityLiving> trackingThisTick = new HashSet<EntityLiving>();
|
||||
List<EntityLiving> entsInBounds = world.getEntitiesWithinAABB(EntityLiving.class, getBounds(pos));
|
||||
|
||||
for (EntityLiving ent : entsInBounds)
|
||||
{
|
||||
if (!ent.isDead)// && isMobInFilter(ent))
|
||||
{
|
||||
double x = (pos.getX() + 0.5D - ent.posX);
|
||||
double y = (pos.getY() + 1D - ent.posY);
|
||||
double z = (pos.getZ() + 0.5D - ent.posZ);
|
||||
double distance = Math.sqrt(x * x + y * y + z * z);
|
||||
|
||||
if (distance < 2 && tracking.contains(ent))
|
||||
{
|
||||
setEntityCooldown(pos, ent, cooldown);
|
||||
removeAssignedAITask(pos, ent);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!canEntityBeTracked(pos, ent))
|
||||
{
|
||||
// System.out.println("Cooldown: " + getEntityCooldown(pos, ent));
|
||||
decrementEntityCooldown(pos, ent);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tracking.contains(ent))
|
||||
{
|
||||
trackingThisTick.add(ent);
|
||||
onEntityTick(pos, ent);
|
||||
} else if (tracking.size() < maxMobsAttracted && trackMob(pos, ent))
|
||||
{
|
||||
trackingThisTick.add(ent);
|
||||
onTracked(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (EntityLiving e : tracking)
|
||||
{
|
||||
if (!trackingThisTick.contains(e))
|
||||
{
|
||||
onUntracked(e);
|
||||
}
|
||||
}
|
||||
tracking.clear();
|
||||
tracking = trackingThisTick;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEntityBeTracked(BlockPos pos, EntityLiving entity)
|
||||
{
|
||||
return getEntityCooldown(pos, entity) <= 0;
|
||||
}
|
||||
|
||||
private String getPosKey(BlockPos pos)
|
||||
{
|
||||
return "BMAttractor:" + pos;
|
||||
}
|
||||
|
||||
public int getEntityCooldown(BlockPos pos, EntityLiving entity)
|
||||
{
|
||||
return entity.getEntityData().getInteger(getPosKey(pos));
|
||||
}
|
||||
|
||||
public void setEntityCooldown(BlockPos pos, EntityLiving entity, int cooldown)
|
||||
{
|
||||
entity.getEntityData().setInteger(getPosKey(pos), cooldown);
|
||||
}
|
||||
|
||||
public void decrementEntityCooldown(BlockPos pos, EntityLiving entity)
|
||||
{
|
||||
int cooldown = getEntityCooldown(pos, entity);
|
||||
if (cooldown > 0)
|
||||
{
|
||||
setEntityCooldown(pos, entity, cooldown - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public AxisAlignedBB getBounds(BlockPos pos)
|
||||
{
|
||||
return new AxisAlignedBB(pos).expand(getRange(), getRange(), getRange());
|
||||
}
|
||||
|
||||
public float getRange()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
private void onUntracked(EntityLiving e)
|
||||
{
|
||||
if (e instanceof EntityEnderman)
|
||||
{
|
||||
e.getEntityData().setBoolean("BM:tracked", false);
|
||||
}
|
||||
}
|
||||
|
||||
private void onTracked(EntityLiving e)
|
||||
{
|
||||
if (e instanceof EntityEnderman)
|
||||
{
|
||||
e.getEntityData().setBoolean("BM:tracked", true);
|
||||
}
|
||||
}
|
||||
|
||||
private void onEntityTick(BlockPos pos, EntityLiving ent)
|
||||
{
|
||||
if (ent instanceof EntitySlime)
|
||||
{
|
||||
ent.faceEntity(getTarget(ent.worldObj, pos), 10.0F, 20.0F);
|
||||
} else if (ent instanceof EntitySilverfish)
|
||||
{
|
||||
if (counter < 10)
|
||||
{
|
||||
return;
|
||||
}
|
||||
EntitySilverfish sf = (EntitySilverfish) ent;
|
||||
Path pathentity = getPathEntityToEntity(ent, getTarget(ent.worldObj, pos), getRange());
|
||||
sf.getNavigator().setPath(pathentity, sf.getAIMoveSpeed());
|
||||
} else if (ent instanceof EntityBlaze)
|
||||
{
|
||||
double x = (pos.getX() + 0.5D - ent.posX);
|
||||
double y = (pos.getY() + 1D - ent.posY);
|
||||
double z = (pos.getZ() + 0.5D - ent.posZ);
|
||||
double distance = Math.sqrt(x * x + y * y + z * z);
|
||||
if (distance > 1.25)
|
||||
{
|
||||
double speed = 0.01;
|
||||
ent.motionX += x / distance * speed;
|
||||
if (y > 0)
|
||||
{
|
||||
ent.motionY += (0.3 - ent.motionY) * 0.3;
|
||||
}
|
||||
ent.motionZ += z / distance * speed;
|
||||
}
|
||||
} else if (ent instanceof EntityPigZombie || ent instanceof EntitySpider)
|
||||
{
|
||||
forceMove(pos, ent);
|
||||
// ent.setAttackTarget(target);
|
||||
} else if (ent instanceof EntityEnderman)
|
||||
{
|
||||
((EntityEnderman) ent).setAttackTarget(getTarget(ent.worldObj, pos));
|
||||
}
|
||||
}
|
||||
|
||||
private void forceMove(BlockPos pos, EntityLiving ent)
|
||||
{
|
||||
double x = (pos.getX() + 0.5D - ent.posX);
|
||||
double y = (pos.getY() + 1D - ent.posY);
|
||||
double z = (pos.getZ() + 0.5D - ent.posZ);
|
||||
double distance = Math.sqrt(x * x + y * y + z * z);
|
||||
if (distance > 2)
|
||||
{
|
||||
EntityMob mod = (EntityMob) ent;
|
||||
mod.faceEntity(getTarget(ent.worldObj, pos), 180, 0);
|
||||
mod.moveEntityWithHeading(0, 0.3f);
|
||||
if (mod.posY < pos.getY())
|
||||
{
|
||||
mod.setJumping(true);
|
||||
} else
|
||||
{
|
||||
mod.setJumping(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Path getPathEntityToEntity(Entity entity, Entity targetEntity, float range)
|
||||
{
|
||||
int targX = MathHelper.floor_double(targetEntity.posX);
|
||||
int targY = MathHelper.floor_double(targetEntity.posY + 1.0D);
|
||||
int targZ = MathHelper.floor_double(targetEntity.posZ);
|
||||
|
||||
PathFinder pf = new PathFinder(new WalkNodeProcessor());
|
||||
return pf.findPath(targetEntity.worldObj, (EntityLiving) entity, new BlockPos(targX, targY, targZ), range);
|
||||
}
|
||||
|
||||
private boolean trackMob(BlockPos pos, EntityLiving ent)
|
||||
{
|
||||
//TODO: Figure out if this crud is needed
|
||||
if (useSetTarget(ent))
|
||||
{
|
||||
((EntityMob) ent).setAttackTarget(getTarget(ent.worldObj, pos));
|
||||
return true;
|
||||
} else if (useSpecialCase(ent))
|
||||
{
|
||||
return applySpecialCase(pos, ent);
|
||||
} else
|
||||
{
|
||||
return attractUsingAITask(pos, ent);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean useSetTarget(EntityLiving ent)
|
||||
{
|
||||
return ent instanceof EntityPigZombie || ent instanceof EntitySpider || ent instanceof EntitySilverfish;
|
||||
}
|
||||
|
||||
public void removeAssignedAITask(BlockPos pos, EntityLiving ent)
|
||||
{
|
||||
Set<EntityAITaskEntry> entries = ent.tasks.taskEntries;
|
||||
EntityAIBase remove = null;
|
||||
for (EntityAITaskEntry entry : entries)
|
||||
{
|
||||
if (entry.action instanceof AttractTask)
|
||||
{
|
||||
AttractTask at = (AttractTask) entry.action;
|
||||
if (at.coord.equals(pos))
|
||||
{
|
||||
remove = entry.action;
|
||||
} else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (remove != null)
|
||||
{
|
||||
ent.tasks.removeTask(remove);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean attractUsingAITask(BlockPos pos, EntityLiving ent)
|
||||
{
|
||||
tracking.add(ent);
|
||||
Set<EntityAITaskEntry> entries = ent.tasks.taskEntries;
|
||||
// boolean hasTask = false;
|
||||
EntityAIBase remove = null;
|
||||
// boolean isTracked;
|
||||
for (EntityAITaskEntry entry : entries)
|
||||
{
|
||||
if (entry.action instanceof AttractTask)
|
||||
{
|
||||
AttractTask at = (AttractTask) entry.action;
|
||||
if (at.coord.equals(pos) || !at.continueExecuting())
|
||||
{
|
||||
remove = entry.action;
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (remove != null)
|
||||
{
|
||||
ent.tasks.removeTask(remove);
|
||||
}
|
||||
|
||||
cancelCurrentTasks(ent);
|
||||
ent.tasks.addTask(0, new AttractTask(ent, getTarget(ent.worldObj, pos), pos));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void cancelCurrentTasks(EntityLiving ent)
|
||||
{
|
||||
Iterator<EntityAITaskEntry> iterator = ent.tasks.taskEntries.iterator();
|
||||
|
||||
List<EntityAITasks.EntityAITaskEntry> currentTasks = new ArrayList<EntityAITasks.EntityAITaskEntry>();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
EntityAITaskEntry entityaitaskentry = iterator.next();
|
||||
if (entityaitaskentry != null)
|
||||
{
|
||||
if (entityaitaskentry.action instanceof AttractTask)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
currentTasks.add(entityaitaskentry);
|
||||
}
|
||||
}
|
||||
// Only available way to stop current execution is to remove all current
|
||||
// tasks, then re-add them
|
||||
for (EntityAITaskEntry task : currentTasks)
|
||||
{
|
||||
ent.tasks.removeTask(task.action);
|
||||
ent.tasks.addTask(task.priority, task.action);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean applySpecialCase(BlockPos pos, EntityLiving ent)
|
||||
{
|
||||
if (ent instanceof EntitySlime)
|
||||
{
|
||||
ent.faceEntity(getTarget(ent.worldObj, pos), 10.0F, 20.0F);
|
||||
// ent.setAttackTarget(getTarget(ent.worldObj, pos));
|
||||
return true;
|
||||
} else if (ent instanceof EntitySilverfish)
|
||||
{
|
||||
EntitySilverfish es = (EntitySilverfish) ent;
|
||||
Path pathentity = getPathEntityToEntity(ent, getTarget(ent.worldObj, pos), getRange());
|
||||
es.getNavigator().setPath(pathentity, es.getAIMoveSpeed());
|
||||
return true;
|
||||
} else if (ent instanceof EntityBlaze)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean useSpecialCase(EntityLiving ent)
|
||||
{
|
||||
return ent instanceof EntitySlime || ent instanceof EntitySilverfish || ent instanceof EntityBlaze;
|
||||
}
|
||||
|
||||
public FakePlayer getTarget(World world, BlockPos pos)
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
// System.out.println("...Hi? " + pos);
|
||||
target = new Target(world, pos);
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
private class Target extends FakePlayerBM
|
||||
{
|
||||
public Target(World world, BlockPos pos)
|
||||
{
|
||||
super(world, pos, new GameProfile(null, Constants.Mod.MODID + "ArrayAttractor" + ":" + pos));
|
||||
posY += 1;
|
||||
}
|
||||
}
|
||||
|
||||
private static class AttractTask extends EntityAIBase
|
||||
{
|
||||
private EntityLiving mob;
|
||||
private BlockPos coord;
|
||||
private FakePlayer target;
|
||||
private int updatesSincePathing;
|
||||
|
||||
private boolean started = false;
|
||||
|
||||
private AttractTask(EntityLiving mob, FakePlayer target, BlockPos coord)
|
||||
{
|
||||
this.mob = mob;
|
||||
this.coord = coord;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
return continueExecuting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTask()
|
||||
{
|
||||
started = false;
|
||||
updatesSincePathing = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean continueExecuting()
|
||||
{
|
||||
boolean res = false;
|
||||
//TODO:
|
||||
TileEntity te = mob.worldObj.getTileEntity(coord);
|
||||
if (te instanceof TileAlchemyArray)
|
||||
{
|
||||
res = true;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInterruptible()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTask()
|
||||
{
|
||||
if (!started || updatesSincePathing > 20)
|
||||
{
|
||||
started = true;
|
||||
int speed = 1;
|
||||
// mob.getNavigator().setAvoidsWater(false);
|
||||
boolean res = mob.getNavigator().tryMoveToEntityLiving(target, speed);
|
||||
if (!res)
|
||||
{
|
||||
mob.getNavigator().tryMoveToXYZ(target.posX, target.posY + 1, target.posZ, speed);
|
||||
}
|
||||
updatesSincePathing = 0;
|
||||
} else
|
||||
{
|
||||
updatesSincePathing++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlchemyArrayEffect getNewCopy()
|
||||
{
|
||||
return new AlchemyArrayEffectAttractor(key);
|
||||
}
|
||||
}
|
|
@ -133,7 +133,7 @@ public class AlchemyCircleRenderer
|
|||
double var35 = 0;
|
||||
double var37 = 1;
|
||||
|
||||
GlStateManager.color(0.5f, 1f, 1f, 1f);
|
||||
GlStateManager.color(1f, 1f, 1f, 1f);
|
||||
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
// wr.setBrightness(200);
|
||||
wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
|
||||
|
|
|
@ -174,11 +174,29 @@ public class AlchemyArrayRecipeRegistry
|
|||
if (input.size() == 1 && arrayRecipe.getInput().size() == 1)
|
||||
{
|
||||
if (ItemStackWrapper.getHolder(arrayRecipe.getInput().get(0)).equals(ItemStackWrapper.getHolder(input.get(0))))
|
||||
return arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack); // TODO: Decide if a copy should be returned.
|
||||
{
|
||||
AlchemyArrayEffect effect = arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack);
|
||||
if (effect != null)
|
||||
{
|
||||
return effect.getNewCopy();
|
||||
} else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (input.equals(arrayRecipe.getInput()))
|
||||
return arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack);
|
||||
{
|
||||
AlchemyArrayEffect effect = arrayRecipe.getAlchemyArrayEffectForCatalyst(catalystStack);
|
||||
if (effect != null)
|
||||
{
|
||||
return effect.getNewCopy();
|
||||
} else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
package WayofTime.bloodmagic.client.render.alchemyArray;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyCircleRenderer;
|
||||
|
||||
public class AttractorAlchemyCircleRenderer extends AlchemyCircleRenderer
|
||||
{
|
||||
public AttractorAlchemyCircleRenderer()
|
||||
{
|
||||
super(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/ZombieBeacon.png"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSizeModifier(float craftTime)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRotation(float craftTime)
|
||||
{
|
||||
float offset = 2;
|
||||
if (craftTime >= offset)
|
||||
{
|
||||
float modifier = (craftTime - offset) * 5f;
|
||||
return modifier * 1f;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSecondaryRotation(float craftTime)
|
||||
{
|
||||
float offset = 50;
|
||||
float secondaryOffset = 150;
|
||||
if (craftTime >= offset)
|
||||
{
|
||||
if (craftTime < secondaryOffset)
|
||||
{
|
||||
float modifier = 90 * (craftTime - offset) / (float) (secondaryOffset - offset);
|
||||
return modifier;
|
||||
} else
|
||||
{
|
||||
return 90;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderAt(TileEntity tile, double x, double y, double z, float craftTime)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer wr = tessellator.getBuffer();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
float rot = getRotation(craftTime);
|
||||
float secondaryRot = getSecondaryRotation(craftTime);
|
||||
|
||||
float size = 1.0F * getSizeModifier(craftTime);
|
||||
|
||||
// Bind the texture to the circle
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
|
||||
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(770, 1);
|
||||
|
||||
GlStateManager.translate(x, y, z);
|
||||
|
||||
// Specify which face this "circle" is located on
|
||||
EnumFacing sideHit = EnumFacing.UP;
|
||||
|
||||
GlStateManager.translate(sideHit.getFrontOffsetX() * offsetFromFace, sideHit.getFrontOffsetY() * offsetFromFace, sideHit.getFrontOffsetZ() * offsetFromFace);
|
||||
|
||||
switch (sideHit)
|
||||
{
|
||||
case DOWN:
|
||||
GlStateManager.translate(0, 0, 1);
|
||||
GlStateManager.rotate(-90.0f, 1, 0, 0);
|
||||
break;
|
||||
case EAST:
|
||||
GlStateManager.rotate(-90.0f, 0, 1, 0);
|
||||
GlStateManager.translate(0, 0, -1);
|
||||
break;
|
||||
case NORTH:
|
||||
break;
|
||||
case SOUTH:
|
||||
GlStateManager.rotate(180.0f, 0, 1, 0);
|
||||
GlStateManager.translate(-1, 0, -1);
|
||||
break;
|
||||
case UP:
|
||||
GlStateManager.translate(0, 1, 0);
|
||||
GlStateManager.rotate(90.0f, 1, 0, 0);
|
||||
break;
|
||||
case WEST:
|
||||
GlStateManager.translate(0, 0, 1);
|
||||
GlStateManager.rotate(90.0f, 0, 1, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0.5f, 0.5f, getVerticalOffset(craftTime));
|
||||
GlStateManager.rotate(rot, 0, 0, 1);
|
||||
GlStateManager.rotate(secondaryRot, 1, 0, 0);
|
||||
double var31 = 0.0D;
|
||||
double var33 = 1.0D;
|
||||
double var35 = 0;
|
||||
double var37 = 1;
|
||||
|
||||
GlStateManager.color(1f, 1f, 1f, 1f);
|
||||
wr.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
// wr.setBrightness(200);
|
||||
wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
|
||||
wr.pos(size / 2f, -size / 2f, 0.0D).tex(var33, var35).endVertex();
|
||||
wr.pos(-size / 2f, -size / 2f, 0.0D).tex(var31, var35).endVertex();
|
||||
wr.pos(-size / 2f, size / 2f, 0.0D).tex(var31, var37).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
// GlStateManager.depthMask(true);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableCull();
|
||||
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package WayofTime.bloodmagic.client.render.alchemyArray;
|
||||
|
||||
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyCircleRenderer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
@ -9,6 +8,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyCircleRenderer;
|
||||
|
||||
public class BindingAlchemyCircleRenderer extends AlchemyCircleRenderer
|
||||
{
|
||||
|
|
|
@ -0,0 +1,179 @@
|
|||
package WayofTime.bloodmagic.fakePlayer;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.EnumPacketDirection;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.client.CPacketAnimation;
|
||||
import net.minecraft.network.play.client.CPacketChatMessage;
|
||||
import net.minecraft.network.play.client.CPacketClickWindow;
|
||||
import net.minecraft.network.play.client.CPacketClientSettings;
|
||||
import net.minecraft.network.play.client.CPacketClientStatus;
|
||||
import net.minecraft.network.play.client.CPacketCloseWindow;
|
||||
import net.minecraft.network.play.client.CPacketConfirmTransaction;
|
||||
import net.minecraft.network.play.client.CPacketCreativeInventoryAction;
|
||||
import net.minecraft.network.play.client.CPacketEnchantItem;
|
||||
import net.minecraft.network.play.client.CPacketEntityAction;
|
||||
import net.minecraft.network.play.client.CPacketHeldItemChange;
|
||||
import net.minecraft.network.play.client.CPacketInput;
|
||||
import net.minecraft.network.play.client.CPacketKeepAlive;
|
||||
import net.minecraft.network.play.client.CPacketPlayer;
|
||||
import net.minecraft.network.play.client.CPacketPlayerAbilities;
|
||||
import net.minecraft.network.play.client.CPacketPlayerDigging;
|
||||
import net.minecraft.network.play.client.CPacketPlayerTryUseItem;
|
||||
import net.minecraft.network.play.client.CPacketResourcePackStatus;
|
||||
import net.minecraft.network.play.client.CPacketSpectate;
|
||||
import net.minecraft.network.play.client.CPacketTabComplete;
|
||||
import net.minecraft.network.play.client.CPacketUpdateSign;
|
||||
import net.minecraft.network.play.client.CPacketUseEntity;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
|
||||
/**
|
||||
* All credits for this go to CrazyPants, from EIO
|
||||
*/
|
||||
public class FakeNetHandlerPlayServer extends NetHandlerPlayServer
|
||||
{
|
||||
public FakeNetHandlerPlayServer(EntityPlayerMP p_i1530_3_)
|
||||
{
|
||||
super(FMLCommonHandler.instance().getMinecraftServerInstance(), new net.minecraft.network.NetworkManager(EnumPacketDirection.CLIENTBOUND), p_i1530_3_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkManager getNetworkManager()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kickPlayerFromServer(String p_147360_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processInput(CPacketInput p_147358_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processPlayer(CPacketPlayer p_147347_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerLocation(double p_147364_1_, double p_147364_3_, double p_147364_5_, float p_147364_7_, float p_147364_8_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processPlayerDigging(CPacketPlayerDigging p_147345_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processPlayerBlockPlacement(CPacketPlayerTryUseItem packetIn)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnect(ITextComponent p_147231_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPacket(Packet<?> p_147359_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processHeldItemChange(CPacketHeldItemChange p_147355_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processChatMessage(CPacketChatMessage p_147354_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleAnimation(CPacketAnimation packetIn)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processEntityAction(CPacketEntityAction p_147357_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processUseEntity(CPacketUseEntity p_147340_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processClientStatus(CPacketClientStatus p_147342_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCloseWindow(CPacketCloseWindow p_147356_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processClickWindow(CPacketClickWindow p_147351_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processEnchantItem(CPacketEnchantItem p_147338_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCreativeInventoryAction(CPacketCreativeInventoryAction p_147344_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processConfirmTransaction(CPacketConfirmTransaction p_147339_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processUpdateSign(CPacketUpdateSign p_147343_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processKeepAlive(CPacketKeepAlive p_147353_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processPlayerAbilities(CPacketPlayerAbilities p_147348_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processTabComplete(CPacketTabComplete p_147341_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processClientSettings(CPacketClientSettings p_147352_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleSpectate(CPacketSpectate packetIn)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleResourcePackStatus(CPacketResourcePackStatus packetIn)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package WayofTime.bloodmagic.fakePlayer;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
/**
|
||||
* All credits for this go to CrazyPants, from EIO
|
||||
*/
|
||||
public class FakePlayerBM extends FakePlayer
|
||||
{
|
||||
ItemStack prevWeapon;
|
||||
|
||||
public FakePlayerBM(World world, BlockPos pos, GameProfile profile)
|
||||
{
|
||||
super(FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(world.provider.getDimension()), profile);
|
||||
posX = pos.getX() + 0.5;
|
||||
posY = pos.getY() + 0.5;
|
||||
posZ = pos.getZ() + 0.5;
|
||||
connection = new FakeNetHandlerPlayServer(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewPotionEffect(PotionEffect p_70670_1_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onChangedPotionEffect(PotionEffect effect, boolean p_70695_2_)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishedPotionEffect(PotionEffect effect)
|
||||
{
|
||||
}
|
||||
|
||||
protected void playEquipSound(@Nullable ItemStack stack)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@ package WayofTime.bloodmagic.registry;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -16,6 +15,7 @@ import net.minecraftforge.oredict.RecipeSorter;
|
|||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectAttractor;
|
||||
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBinding;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
|
||||
|
@ -30,6 +30,7 @@ import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
|||
import WayofTime.bloodmagic.api.registry.TartaricForgeRecipeRegistry;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.block.BlockBloodRune;
|
||||
import WayofTime.bloodmagic.client.render.alchemyArray.AttractorAlchemyCircleRenderer;
|
||||
import WayofTime.bloodmagic.client.render.alchemyArray.BindingAlchemyCircleRenderer;
|
||||
import WayofTime.bloodmagic.compress.AdvancedCompressionHandler;
|
||||
import WayofTime.bloodmagic.compress.BaseCompressionHandler;
|
||||
|
@ -40,6 +41,7 @@ import WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid;
|
|||
import WayofTime.bloodmagic.item.alchemy.ItemLivingArmourPointsUpgrade;
|
||||
import WayofTime.bloodmagic.item.soul.ItemSoulGem;
|
||||
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableDyeableRecipe;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
import com.google.common.base.Stopwatch;
|
||||
|
||||
|
@ -224,6 +226,7 @@ public class ModRecipes
|
|||
AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_TELEPOSITION), new ItemStack(ModItems.slate, 1, 3), new ItemStack(ModItems.sigilTeleposition), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png"));
|
||||
AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_TRANSPOSITION), new ItemStack(ModItems.slate, 1, 3), new ItemStack(ModItems.sigilTransposition), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png"));
|
||||
|
||||
AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.ROTTEN_FLESH), new ItemStack(Items.ROTTEN_FLESH), new AlchemyArrayEffectAttractor("attractor"), new AttractorAlchemyCircleRenderer());
|
||||
}
|
||||
|
||||
public static void addCompressionHandlers()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package WayofTime.bloodmagic.tile;
|
||||
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
|
@ -75,6 +76,19 @@ public class TileAlchemyArray extends TileInventory implements ITickable
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This occurs when the block is destroyed.
|
||||
*/
|
||||
@Override
|
||||
public void dropItems()
|
||||
{
|
||||
super.dropItems();
|
||||
if (arrayEffect != null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public boolean attemptCraft()
|
||||
{
|
||||
AlchemyArrayEffect effect = AlchemyArrayRecipeRegistry.getAlchemyArrayEffect(this.getStackInSlot(0), this.getStackInSlot(1));
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
Loading…
Reference in a new issue