Skip to content

Commit

Permalink
Update for 1.11 / 1.11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
freneticfeline committed Jun 27, 2017
1 parent 8a8f42c commit 5587261
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 52 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.11-1.2.2
==========
Update for 1.11 / 1.11.2

1.10-1.2.2
==========
Fix Iron Arrow damage
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ buildscript {

apply plugin: 'net.minecraftforge.gradle.forge'

version = "1.10-1.2.2"
version = "1.11-1.2.2"
group = "net.unladenswallow.minecraft.freneticfolly" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "mod_ffQuiver_forge"

minecraft {
version = "1.10.2-12.18.1.2011"
version = "1.11.2-13.20.0.2228"
runDir = "eclipse"

// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not allways work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "snapshot_20160518"
mappings = "snapshot_20161220"
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.unladenswallow.minecraft.quiver.item.ItemWaterArrow;


@Mod(modid = ModFFQuiver.MODID, useMetadata = true, acceptedMinecraftVersions="[1.10,1.11)", acceptableRemoteVersions="[1.10,1.11)")
@Mod(modid = ModFFQuiver.MODID, useMetadata = true, acceptedMinecraftVersions="[1.11,1.12)", acceptableRemoteVersions="[1.11,1.12)")
public class ModFFQuiver {

public static final String MODID = "mod_quiver";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.unladenswallow.minecraft.quiver.FFQLogger;

/**
* This class extends EntityTippedArrow, with modifications to pull
Expand Down Expand Up @@ -81,7 +82,7 @@ public void onUpdate()

if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
{
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
float f = MathHelper.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
}
Expand All @@ -92,13 +93,13 @@ public void onUpdate()
// MEMLogger.info("EntityCustomArrow onUpdate(): prevPos = " + (new BlockPos(this.prevPosX, this.prevPosY, this.prevPosZ)).toString());
// MEMLogger.info("EntityCustomArrow onUpdate(): motion = [x=" + this.motionX + ", y=" + this.motionY + ", z=" + this.motionZ + "]");

IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
IBlockState iblockstate = this.world.getBlockState(blockpos);
Block block = iblockstate.getBlock();

if (iblockstate.getMaterial() != Material.AIR)
{
// block.setBlockBoundsBasedOnState(this.worldObj, blockpos);
AxisAlignedBB axisalignedbb = iblockstate.getCollisionBoundingBox(this.worldObj, blockpos);
// block.setBlockBoundsBasedOnState(this.world, blockpos);
AxisAlignedBB axisalignedbb = iblockstate.getCollisionBoundingBox(this.world, blockpos);

if (axisalignedbb != Block.NULL_AABB && axisalignedbb.offset(blockpos).isVecInside(new Vec3d(this.posX, this.posY, this.posZ)))
{
Expand Down Expand Up @@ -139,7 +140,7 @@ public void onUpdate()
++this.ticksInAir;
Vec3d vec31 = new Vec3d(this.posX, this.posY, this.posZ);
Vec3d vec3 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
RayTraceResult rayTraceResult = this.worldObj.rayTraceBlocks(vec31, vec3, false, true, false);
RayTraceResult rayTraceResult = this.world.rayTraceBlocks(vec31, vec3, false, true, false);
vec31 = new Vec3d(this.posX, this.posY, this.posZ);
vec3 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);

Expand All @@ -150,7 +151,7 @@ public void onUpdate()

Entity entity = null;
@SuppressWarnings("rawtypes")
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
List list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
int i;
float f1;
Expand Down Expand Up @@ -180,6 +181,7 @@ public void onUpdate()

if (entity != null)
{
// FFQLogger.info("EntityCustomArrow onUpdate(): I think I hit %s", entity.getName());
rayTraceResult = new RayTraceResult(entity);
}

Expand Down Expand Up @@ -217,14 +219,14 @@ public void onUpdate()
this.xTile = blockpos1.getX();
this.yTile = blockpos1.getY();
this.zTile = blockpos1.getZ();
iblockstate = this.worldObj.getBlockState(blockpos1);
iblockstate = this.world.getBlockState(blockpos1);
this.inTile = iblockstate.getBlock();
// MEMLogger.info("EntityCustomArrow onUpdate(): Looks like I'm in block " + this.inTile.getLocalizedName());
this.inData = this.inTile.getMetaFromState(iblockstate);
this.motionX = (double)((float)(rayTraceResult.hitVec.xCoord - this.posX));
this.motionY = (double)((float)(rayTraceResult.hitVec.yCoord - this.posY));
this.motionZ = (double)((float)(rayTraceResult.hitVec.zCoord - this.posZ));
f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
f3 = MathHelper.sqrt(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
this.posX -= this.motionX / (double)f3 * 0.05000000074505806D;
this.posY -= this.motionY / (double)f3 * 0.05000000074505806D;
this.posZ -= this.motionZ / (double)f3 * 0.05000000074505806D;
Expand All @@ -235,7 +237,7 @@ public void onUpdate()

if (iblockstate.getMaterial() != Material.AIR)
{
this.inTile.onEntityCollidedWithBlock(this.worldObj, blockpos1, iblockstate, this);
this.inTile.onEntityCollidedWithBlock(this.world, blockpos1, iblockstate, this);
}
}
}
Expand All @@ -244,14 +246,14 @@ public void onUpdate()
{
for (i = 0; i < 4; ++i)
{
this.worldObj.spawnParticle(EnumParticleTypes.CRIT, this.posX + this.motionX * (double)i / 4.0D, this.posY + this.motionY * (double)i / 4.0D, this.posZ + this.motionZ * (double)i / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ, new int[0]);
this.world.spawnParticle(EnumParticleTypes.CRIT, this.posX + this.motionX * (double)i / 4.0D, this.posY + this.motionY * (double)i / 4.0D, this.posZ + this.motionZ * (double)i / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ, new int[0]);
}
}

this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
f2 = MathHelper.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);

for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
Expand Down Expand Up @@ -284,7 +286,7 @@ public void onUpdate()
for (int l = 0; l < 4; ++l)
{
f4 = 0.25F;
this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ, new int[0]);
this.world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ, new int[0]);
}

f3 = 0.6F;
Expand Down Expand Up @@ -313,8 +315,8 @@ private void handleInWater() {

protected void handleEntityHit(Entity entity) {
// FFQLogger.info("EntityCustomArrow handleEntityHit(): [%s] with base damage = %f", this.getClass().getName(), this.getDamage());
float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
int k = MathHelper.ceiling_double_int((double)f2 * this.getDamage());
float f2 = MathHelper.sqrt(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
int k = MathHelper.ceil((double)f2 * this.getDamage());

if (this.getIsCritical())
{
Expand Down Expand Up @@ -343,14 +345,14 @@ protected void handleEntityHit(Entity entity) {
{
EntityLivingBase entitylivingbase = (EntityLivingBase)entity;

if (!this.worldObj.isRemote)
if (!this.world.isRemote)
{
entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1);
}

if (this.knockbackStrength > 0)
{
float f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
float f4 = MathHelper.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);

if (f4 > 0.0F)
{
Expand Down Expand Up @@ -456,7 +458,7 @@ protected void doBlockCollisions()
BlockPos blockpos = new BlockPos(this.getEntityBoundingBox().minX + 0.001D, this.getEntityBoundingBox().minY + 0.001D, this.getEntityBoundingBox().minZ + 0.001D);
BlockPos blockpos1 = new BlockPos(this.getEntityBoundingBox().maxX - 0.001D, this.getEntityBoundingBox().maxY - 0.001D, this.getEntityBoundingBox().maxZ - 0.001D);

if (this.worldObj.isAreaLoaded(blockpos, blockpos1))
if (this.world.isAreaLoaded(blockpos, blockpos1))
{
for (int i = blockpos.getX(); i <= blockpos1.getX(); ++i)
{
Expand All @@ -465,13 +467,13 @@ protected void doBlockCollisions()
for (int k = blockpos.getZ(); k <= blockpos1.getZ(); ++k)
{
BlockPos blockpos2 = new BlockPos(i, j, k);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos2);
IBlockState iblockstate = this.world.getBlockState(blockpos2);

// FFLogger.info("EntityCustomArrow doBlockCollisions(): collided with " + iblockstate.getBlock().getUnlocalizedName());

try
{
iblockstate.getBlock().onEntityCollidedWithBlock(this.worldObj, blockpos2, iblockstate, this);
iblockstate.getBlock().onEntityCollidedWithBlock(this.world, blockpos2, iblockstate, this);
}
catch (Throwable throwable)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public EntityExplodingArrow(World worldIn, EntityLivingBase shooter, float explo

@Override
protected void handleInTileState(Block block, EnumFacing facing) {
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius, true);
this.world.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius, true);
this.setDead();
}

@Override
protected void handleEntityHit(Entity entity) {
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius, true);
this.world.createExplosion(this, this.posX, this.posY, this.posZ, this.explosionRadius, true);
this.setDead();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected void handleInTileState(Block block, EnumFacing facing) {
BlockPos facingBlockPos = facingBlock(blockpos, facing);
// worldObj.setBlockState(facingBlockPos, Blocks.water.getDefaultState());
ItemBucket waterBucket = (ItemBucket)(Items.LAVA_BUCKET);
waterBucket.tryPlaceContainedLiquid((EntityPlayer)this.shootingEntity, this.worldObj, facingBlockPos);
waterBucket.tryPlaceContainedLiquid((EntityPlayer)this.shootingEntity, this.world, facingBlockPos);
this.setDead();
}

Expand All @@ -35,7 +35,7 @@ protected void handleEntityHit(Entity entity) {
// Block.spawnAsEntity(worldObj, blockpos, new ItemStack(ModFreneticFolly.waterArrow));
ItemBucket waterBucket = (ItemBucket)(Items.LAVA_BUCKET);
// FFLogger.info("EntityLavaArrow handleEntityHit: trying to place a block of lava at " + blockpos);
waterBucket.tryPlaceContainedLiquid((EntityPlayer)this.shootingEntity, this.worldObj, blockpos);
waterBucket.tryPlaceContainedLiquid((EntityPlayer)this.shootingEntity, this.world, blockpos);
this.setDead();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.MoverType;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
Expand All @@ -19,16 +20,16 @@ public EntityTeleportArrow(World worldIn, EntityLivingBase shooter) {
protected void handleInTileState(Block block, EnumFacing facing) {
for (int i = 0; i < 32; ++i)
{
this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian(), new int[0]);
this.world.spawnParticle(EnumParticleTypes.PORTAL, this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian(), new int[0]);
}

if (!this.worldObj.isRemote)
if (!this.world.isRemote)
{
if (null != this.shootingEntity && this.shootingEntity instanceof EntityPlayerMP)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)this.shootingEntity;

if (entityplayermp.connection.getNetworkManager().isChannelOpen() && entityplayermp.worldObj == this.worldObj && !entityplayermp.isPlayerSleeping())
if (entityplayermp.connection.getNetworkManager().isChannelOpen() && entityplayermp.world == this.world && !entityplayermp.isPlayerSleeping())
{
net.minecraftforge.event.entity.living.EnderTeleportEvent event = new net.minecraftforge.event.entity.living.EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F);
if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event))
Expand All @@ -52,7 +53,7 @@ protected void handleInTileState(Block block, EnumFacing facing) {

@Override
protected void handleEntityHit(Entity entity) {
entity.moveEntity(0, 20, 0);
entity.move(MoverType.SELF, 0, 20, 0);
this.setDead();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ public EntityTorchArrow(World worldIn, EntityLivingBase shooter) {
protected void handleInTileState(Block block, EnumFacing facing) {
BlockPos blockpos = new BlockPos(this.xTile, this.yTile, this.zTile);
BlockPos facingBlockPos = facingBlock(blockpos, facing);
if (facing != EnumFacing.DOWN && Blocks.TORCH.canPlaceBlockAt(worldObj, facingBlockPos)) {
worldObj.setBlockState(facingBlockPos, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, swapZFacing(facing)));
if (facing != EnumFacing.DOWN && Blocks.TORCH.canPlaceBlockAt(world, facingBlockPos)) {
world.setBlockState(facingBlockPos, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, swapZFacing(facing)));
} else {
Block.spawnAsEntity(worldObj, facingBlockPos, new ItemStack(ModFFQuiver.torchArrow));
Block.spawnAsEntity(world, facingBlockPos, new ItemStack(ModFFQuiver.torchArrow));
}
this.setDead();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected void handleInTileState(Block block, EnumFacing facing) {
BlockPos facingBlockPos = facingBlock(blockpos, facing);
// worldObj.setBlockState(facingBlockPos, Blocks.water.getDefaultState());
ItemBucket waterBucket = (ItemBucket)(Items.WATER_BUCKET);
waterBucket.tryPlaceContainedLiquid((EntityPlayer)this.shootingEntity, this.worldObj, facingBlockPos);
waterBucket.tryPlaceContainedLiquid((EntityPlayer)this.shootingEntity, this.world, facingBlockPos);
this.setDead();
}

Expand All @@ -35,7 +35,7 @@ protected void handleEntityHit(Entity entity) {
// Block.spawnAsEntity(worldObj, blockpos, new ItemStack(ModFreneticFolly.waterArrow));
ItemBucket waterBucket = (ItemBucket)(Items.WATER_BUCKET);
// FFLogger.info("EntityWaterArrow handleEntityHit: trying to place a block of water at " + blockpos);
waterBucket.tryPlaceContainedLiquid((EntityPlayer)this.shootingEntity, this.worldObj, blockpos);
waterBucket.tryPlaceContainedLiquid((EntityPlayer)this.shootingEntity, this.world, blockpos);
this.setDead();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.init.Enchantments;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;
Expand Down Expand Up @@ -156,7 +157,7 @@ protected void takeDamage(int i, ItemStack stack, EntityPlayer playerIn) {
}
if (stack.getItemDamage() == stack.getMaxDamage()) {
// FFLogger.info("ItemBowAndQuiver takeDamage(): Quiver empty. Reverting to default state.");
playerIn.getHeldItemMainhand().setItem(ModFFQuiver.emptyBowAndQuiver);
playerIn.setHeldItem(EnumHand.MAIN_HAND, new ItemStack(ModFFQuiver.emptyBowAndQuiver));
playerIn.getHeldItemMainhand().setItemDamage(0);
}
// logCurrentStackState(stack);
Expand Down
Loading

0 comments on commit 5587261

Please sign in to comment.