World
This commit is contained in:
parent
776eb00ed3
commit
4b4146bbed
|
@ -196,7 +196,7 @@
|
|||
public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_)
|
||||
{
|
||||
return new ItemStack(Item.getItemFromBlock(this), 1, this.damageDropped(p_185473_3_));
|
||||
@@ -844,6 +865,1167 @@
|
||||
@@ -844,6 +865,1166 @@
|
||||
return "Block{" + blockRegistry.getNameForObject(this) + "}";
|
||||
}
|
||||
|
||||
|
@ -1248,7 +1248,6 @@
|
|||
+ * Called when the entity is inside this block, may be used to determined if the entity can breathing,
|
||||
+ * display material overlays, or if the entity can swim inside a block.
|
||||
+ *
|
||||
+ * @param state The current block state
|
||||
+ * @param world that is being tested.
|
||||
+ * @param blockpos position thats being tested.
|
||||
+ * @param iblockstate state at world/blockpos
|
||||
|
@ -1258,7 +1257,7 @@
|
|||
+ * @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
|
||||
+ * @return null for default behavior, true if the entity is within the material, false if it was not.
|
||||
+ */
|
||||
+ public Boolean isEntityInsideMaterial(IBlockState state, IBlockAccess world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead)
|
||||
+ public Boolean isEntityInsideMaterial(IBlockAccess world, BlockPos blockpos, IBlockState iblockstate, Entity entity, double yToTest, Material materialIn, boolean testingHead)
|
||||
+ {
|
||||
+ return null;
|
||||
+ }
|
||||
|
|
|
@ -56,16 +56,18 @@
|
|||
{
|
||||
d2 = 1.0D - d1;
|
||||
i = 5;
|
||||
@@ -515,6 +528,12 @@
|
||||
@@ -515,7 +528,13 @@
|
||||
|
||||
public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_)
|
||||
{
|
||||
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, p_184185_2_, p_184185_3_);
|
||||
- this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false);
|
||||
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_);
|
||||
+ if (event.isCanceled() || event.getSound() == null) return;
|
||||
+ p_184185_1_ = event.getSound();
|
||||
+ p_184185_2_ = event.getVolume();
|
||||
+ p_184185_3_ = event.getPitch();
|
||||
+
|
||||
this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false);
|
||||
+ this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, event.getCategory(), p_184185_2_, p_184185_3_, false);
|
||||
}
|
||||
|
||||
public boolean isServerWorld()
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ);
|
||||
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
|
||||
|
||||
+ Boolean result = iblockstate.getBlock().isEntityInsideMaterial(iblockstate, this.worldObj, blockpos, iblockstate, this, d0, materialIn, true);
|
||||
+ Boolean result = iblockstate.getBlock().isEntityInsideMaterial(this.worldObj, blockpos, iblockstate, this, d0, materialIn, true);
|
||||
+ if (result != null) return result;
|
||||
+
|
||||
if (iblockstate.func_185904_a() == materialIn)
|
||||
|
|
|
@ -45,7 +45,90 @@
|
|||
if (this.isBlockLoaded(pos))
|
||||
{
|
||||
Chunk chunk = this.getChunkFromBlockCoords(pos);
|
||||
@@ -409,6 +426,9 @@
|
||||
@@ -194,7 +211,7 @@
|
||||
|
||||
public boolean isAirBlock(BlockPos pos)
|
||||
{
|
||||
- return this.getBlockState(pos).func_185904_a() == Material.air;
|
||||
+ return this.getBlockState(pos).getBlock().isAir(this.getBlockState(pos), this, pos);
|
||||
}
|
||||
|
||||
public boolean isBlockLoaded(BlockPos pos)
|
||||
@@ -291,23 +308,49 @@
|
||||
{
|
||||
Chunk chunk = this.getChunkFromBlockCoords(pos);
|
||||
Block block = newState.getBlock();
|
||||
+
|
||||
+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null;
|
||||
+ if (this.captureBlockSnapshots && !this.isRemote)
|
||||
+ {
|
||||
+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags);
|
||||
+ this.capturedBlockSnapshots.add(blockSnapshot);
|
||||
+ }
|
||||
+ IBlockState oldState = getBlockState(pos);
|
||||
+ int oldLight = oldState.getLightValue(this, pos);
|
||||
+ int oldOpacity = oldState.getLightOpacity(this, pos);
|
||||
+
|
||||
IBlockState iblockstate = chunk.setBlockState(pos, newState);
|
||||
|
||||
if (iblockstate == null)
|
||||
{
|
||||
+ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (newState.func_185891_c() != iblockstate.func_185891_c() || newState.func_185906_d() != iblockstate.func_185906_d())
|
||||
+ if (newState.getLightOpacity(this, pos) != oldOpacity || newState.getLightValue(this, pos) != oldLight)
|
||||
{
|
||||
this.theProfiler.startSection("checkLight");
|
||||
this.checkLight(pos);
|
||||
this.theProfiler.endSection();
|
||||
}
|
||||
|
||||
- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated())
|
||||
+ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates
|
||||
{
|
||||
+ this.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags);
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Split off from original setBlockState(BlockPos, IBlockState, int) method in order to directly send client and physic updates
|
||||
+ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState iblockstate, IBlockState newState, int flags)
|
||||
+ {
|
||||
+ {
|
||||
+ {
|
||||
+ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated()))
|
||||
+ {
|
||||
this.func_184138_a(pos, iblockstate, newState, flags);
|
||||
}
|
||||
|
||||
@@ -317,11 +360,9 @@
|
||||
|
||||
if (newState.func_185912_n())
|
||||
{
|
||||
- this.updateComparatorOutputLevel(pos, block);
|
||||
+ this.updateComparatorOutputLevel(pos, newState.getBlock());
|
||||
}
|
||||
}
|
||||
-
|
||||
- return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -336,7 +377,7 @@
|
||||
IBlockState iblockstate = this.getBlockState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
- if (iblockstate.func_185904_a() == Material.air)
|
||||
+ if (block.isAir(iblockstate, this, pos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -409,6 +450,9 @@
|
||||
|
||||
public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType)
|
||||
{
|
||||
|
@ -55,7 +138,7 @@
|
|||
this.notifyBlockOfStateChange(pos.west(), blockType);
|
||||
this.notifyBlockOfStateChange(pos.east(), blockType);
|
||||
this.notifyBlockOfStateChange(pos.down(), blockType);
|
||||
@@ -419,6 +439,11 @@
|
||||
@@ -419,6 +463,11 @@
|
||||
|
||||
public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide)
|
||||
{
|
||||
|
@ -67,7 +150,16 @@
|
|||
if (skipSide != EnumFacing.WEST)
|
||||
{
|
||||
this.notifyBlockOfStateChange(pos.west(), blockType);
|
||||
@@ -782,7 +807,7 @@
|
||||
@@ -514,7 +563,7 @@
|
||||
{
|
||||
IBlockState iblockstate = this.getBlockState(blockpos);
|
||||
|
||||
- if (iblockstate.func_185891_c() > 0 && !iblockstate.func_185904_a().isLiquid())
|
||||
+ if (iblockstate.getBlock().getLightOpacity(iblockstate, this, blockpos) > 0 && !iblockstate.func_185904_a().isLiquid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -782,7 +831,7 @@
|
||||
|
||||
public boolean isDaytime()
|
||||
{
|
||||
|
@ -76,33 +168,21 @@
|
|||
}
|
||||
|
||||
public RayTraceResult rayTraceBlocks(Vec3d p_72933_1_, Vec3d p_72933_2_)
|
||||
@@ -994,6 +1019,12 @@
|
||||
@@ -982,6 +1031,13 @@
|
||||
|
||||
public void func_184149_a(BlockPos p_184149_1_, SoundEvent p_184149_2_)
|
||||
public void func_184148_a(EntityPlayer p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_)
|
||||
{
|
||||
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(entityIn, name, volume, pitch);
|
||||
+ if (event.isCanceled() || event.name == null) return;
|
||||
+ name = event.name;
|
||||
+ volume = event.newVolume;
|
||||
+ pitch = event.newPitch;
|
||||
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_);
|
||||
+ if (event.isCanceled() || event.getSound() == null) return;
|
||||
+ p_184148_8_ = event.getSound();
|
||||
+ p_184148_9_ = event.getCategory();
|
||||
+ p_184148_10_ = event.getVolume();
|
||||
+ p_184148_11_ = event.getPitch();
|
||||
+
|
||||
for (int i = 0; i < this.worldAccesses.size(); ++i)
|
||||
{
|
||||
((IWorldEventListener)this.worldAccesses.get(i)).func_184377_a(p_184149_2_, p_184149_1_);
|
||||
@@ -1013,6 +1044,12 @@
|
||||
|
||||
private void spawnParticle(int particleID, boolean p_175720_2_, double xCood, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int... p_175720_15_)
|
||||
{
|
||||
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(player, name, volume, pitch);
|
||||
+ if (event.isCanceled() || event.name == null) return;
|
||||
+ name = event.name;
|
||||
+ volume = event.newVolume;
|
||||
+ pitch = event.newPitch;
|
||||
+
|
||||
for (int i = 0; i < this.worldAccesses.size(); ++i)
|
||||
{
|
||||
((IWorldEventListener)this.worldAccesses.get(i)).spawnParticle(particleID, p_175720_2_, xCood, yCoord, zCoord, xOffset, yOffset, zOffset, p_175720_15_);
|
||||
@@ -1027,6 +1064,9 @@
|
||||
((IWorldEventListener)this.worldAccesses.get(i)).func_184375_a(p_184148_1_, p_184148_8_, p_184148_9_, p_184148_2_, p_184148_4_, p_184148_6_, p_184148_10_, p_184148_11_);
|
||||
@@ -1027,6 +1083,9 @@
|
||||
|
||||
public boolean spawnEntityInWorld(Entity entityIn)
|
||||
{
|
||||
|
@ -112,7 +192,7 @@
|
|||
int i = MathHelper.floor_double(entityIn.posX / 16.0D);
|
||||
int j = MathHelper.floor_double(entityIn.posZ / 16.0D);
|
||||
boolean flag = entityIn.forceSpawn;
|
||||
@@ -1049,6 +1089,8 @@
|
||||
@@ -1049,6 +1108,8 @@
|
||||
this.updateAllPlayersSleepingFlag();
|
||||
}
|
||||
|
||||
|
@ -121,7 +201,43 @@
|
|||
this.getChunkFromChunkCoords(i, j).addEntity(entityIn);
|
||||
this.loadedEntityList.add(entityIn);
|
||||
this.onEntityAdded(entityIn);
|
||||
@@ -1361,6 +1403,12 @@
|
||||
@@ -1285,7 +1346,6 @@
|
||||
return list;
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void removeWorldAccess(IWorldEventListener worldAccess)
|
||||
{
|
||||
this.worldAccesses.remove(worldAccess);
|
||||
@@ -1348,19 +1408,38 @@
|
||||
|
||||
public int calculateSkylightSubtracted(float p_72967_1_)
|
||||
{
|
||||
+ float f = provider.getSunBrightnessFactor(p_72967_1_);
|
||||
+ f = 1 - f;
|
||||
+ return (int)(f * 11);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The current sun brightness factor for this dimension.
|
||||
+ * 0.0f means no light at all, and 1.0f means maximum sunlight.
|
||||
+ * Highly recommended for sunlight detection like solar panel.
|
||||
+ *
|
||||
+ * @return The current brightness factor
|
||||
+ * */
|
||||
+ public float getSunBrightnessFactor(float p_72967_1_)
|
||||
+ {
|
||||
float f = this.getCelestialAngle(p_72967_1_);
|
||||
float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F);
|
||||
f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
|
||||
f1 = 1.0F - f1;
|
||||
f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D));
|
||||
f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D));
|
||||
- f1 = 1.0F - f1;
|
||||
- return (int)(f1 * 11.0F);
|
||||
+ return f1;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getSunBrightness(float p_72971_1_)
|
||||
{
|
||||
|
@ -134,7 +250,7 @@
|
|||
float f = this.getCelestialAngle(p_72971_1_);
|
||||
float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.2F);
|
||||
f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
|
||||
@@ -1373,6 +1421,12 @@
|
||||
@@ -1373,6 +1452,12 @@
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Vec3d getSkyColor(Entity entityIn, float partialTicks)
|
||||
{
|
||||
|
@ -142,12 +258,12 @@
|
|||
+ }
|
||||
+
|
||||
+ @SideOnly(Side.CLIENT)
|
||||
+ public Vec3 getSkyColorBody(Entity entityIn, float partialTicks)
|
||||
+ public Vec3d getSkyColorBody(Entity entityIn, float partialTicks)
|
||||
+ {
|
||||
float f = this.getCelestialAngle(partialTicks);
|
||||
float f1 = MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F;
|
||||
f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
|
||||
@@ -1380,9 +1434,7 @@
|
||||
@@ -1380,9 +1465,7 @@
|
||||
int j = MathHelper.floor_double(entityIn.posY);
|
||||
int k = MathHelper.floor_double(entityIn.posZ);
|
||||
BlockPos blockpos = new BlockPos(i, j, k);
|
||||
|
@ -158,7 +274,7 @@
|
|||
float f3 = (float)(l >> 16 & 255) / 255.0F;
|
||||
float f4 = (float)(l >> 8 & 255) / 255.0F;
|
||||
float f5 = (float)(l & 255) / 255.0F;
|
||||
@@ -1442,11 +1494,22 @@
|
||||
@@ -1442,6 +1525,11 @@
|
||||
|
||||
public float getCurrentMoonPhaseFactor()
|
||||
{
|
||||
|
@ -170,20 +286,34 @@
|
|||
return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())];
|
||||
}
|
||||
|
||||
public float getCelestialAngleRadians(float partialTicks)
|
||||
@@ -1454,6 +1542,12 @@
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Vec3d getCloudColour(float partialTicks)
|
||||
{
|
||||
+ return this.provider.drawClouds(partialTicks);
|
||||
+ return this.provider.getCloudColor(partialTicks);
|
||||
+ }
|
||||
+
|
||||
+ @SideOnly(Side.CLIENT)
|
||||
+ public Vec3 drawCloudsBody(float partialTicks)
|
||||
+ public Vec3d getCloudColorBody(float partialTicks)
|
||||
+ {
|
||||
float f = this.getCelestialAngle(partialTicks);
|
||||
return f * ((float)Math.PI * 2F);
|
||||
}
|
||||
@@ -1454,6 +1517,12 @@
|
||||
float f1 = MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F;
|
||||
f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
|
||||
@@ -1509,9 +1603,9 @@
|
||||
for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
|
||||
{
|
||||
blockpos1 = blockpos.down();
|
||||
- Material material = chunk.getBlockState(blockpos1).func_185904_a();
|
||||
+ IBlockState state = chunk.getBlockState(blockpos1);
|
||||
|
||||
- if (material.blocksMovement() && material != Material.leaves)
|
||||
+ if (state.func_185904_a().blocksMovement() && !state.getBlock().isLeaves(state, this, blockpos1) && !state.getBlock().isFoliage(this, blockpos1))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -1523,6 +1617,12 @@
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Vec3d getCloudColour(float partialTicks)
|
||||
public float getStarBrightness(float partialTicks)
|
||||
{
|
||||
+ return this.provider.getStarBrightness(partialTicks);
|
||||
+ }
|
||||
|
@ -192,26 +322,49 @@
|
|||
+ public float getStarBrightnessBody(float partialTicks)
|
||||
+ {
|
||||
float f = this.getCelestialAngle(partialTicks);
|
||||
float f1 = MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F;
|
||||
float f1 = 1.0F - (MathHelper.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.25F);
|
||||
f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
|
||||
@@ -1574,7 +1643,15 @@
|
||||
@@ -1574,6 +1674,12 @@
|
||||
entity.addEntityCrashInfo(crashreportcategory);
|
||||
}
|
||||
|
||||
- throw new ReportedException(crashreport);
|
||||
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities)
|
||||
+ {
|
||||
+ net.minecraftforge.fml.common.FMLLog.severe(crashreport.getCompleteReport());
|
||||
+ removeEntity(entity);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ throw new ReportedException(crashreport);
|
||||
+ }
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
|
||||
if (entity.isDead)
|
||||
@@ -1701,15 +1778,20 @@
|
||||
@@ -1635,6 +1741,12 @@
|
||||
CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity");
|
||||
CrashReportCategory crashreportcategory1 = crashreport1.makeCategory("Entity being ticked");
|
||||
entity2.addEntityCrashInfo(crashreportcategory1);
|
||||
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities)
|
||||
+ {
|
||||
+ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.getCompleteReport());
|
||||
+ removeEntity(entity2);
|
||||
+ }
|
||||
+ else
|
||||
throw new ReportedException(crashreport1);
|
||||
}
|
||||
}
|
||||
@@ -1684,6 +1796,13 @@
|
||||
CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity");
|
||||
CrashReportCategory crashreportcategory2 = crashreport2.makeCategory("Block entity being ticked");
|
||||
tileentity.addInfoToCrashReport(crashreportcategory2);
|
||||
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities)
|
||||
+ {
|
||||
+ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.getCompleteReport());
|
||||
+ tileentity.invalidate();
|
||||
+ this.removeTileEntity(tileentity.getPos());
|
||||
+ }
|
||||
+ else
|
||||
throw new ReportedException(crashreport2);
|
||||
}
|
||||
}
|
||||
@@ -1701,15 +1820,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,7 +387,7 @@
|
|||
this.theProfiler.endStartSection("pendingBlockEntities");
|
||||
|
||||
if (!this.addedTileEntityList.isEmpty())
|
||||
@@ -1748,7 +1830,8 @@
|
||||
@@ -1748,7 +1872,8 @@
|
||||
|
||||
public boolean addTileEntity(TileEntity tile)
|
||||
{
|
||||
|
@ -244,7 +397,7 @@
|
|||
|
||||
if (flag && tile instanceof ITickable)
|
||||
{
|
||||
@@ -1782,9 +1865,13 @@
|
||||
@@ -1782,9 +1907,13 @@
|
||||
{
|
||||
int i = MathHelper.floor_double(entityIn.posX);
|
||||
int j = MathHelper.floor_double(entityIn.posZ);
|
||||
|
@ -260,7 +413,16 @@
|
|||
{
|
||||
entityIn.lastTickPosX = entityIn.posX;
|
||||
entityIn.lastTickPosY = entityIn.posY;
|
||||
@@ -1983,6 +2070,10 @@
|
||||
@@ -1913,7 +2042,7 @@
|
||||
{
|
||||
IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2));
|
||||
|
||||
- if (iblockstate.func_185904_a() != Material.air)
|
||||
+ if (iblockstate.getBlock().isAir(iblockstate, this, new BlockPos(k1, l1, i2)))
|
||||
{
|
||||
blockpos$pooledmutableblockpos.func_185344_t();
|
||||
return true;
|
||||
@@ -1983,6 +2112,10 @@
|
||||
blockpos$pooledmutableblockpos.func_185344_t();
|
||||
return true;
|
||||
}
|
||||
|
@ -271,16 +433,16 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -2022,6 +2113,16 @@
|
||||
@@ -2022,6 +2155,16 @@
|
||||
IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
+ Boolean result = block.isEntityInsideMaterial(this, blockpos$mutableblockpos, iblockstate, entityIn, (double)l, materialIn, false);
|
||||
+ Boolean result = block.isEntityInsideMaterial(this, blockpos$pooledmutableblockpos, iblockstate, entityIn, (double)l, materialIn, false);
|
||||
+ if (result != null && result == true)
|
||||
+ {
|
||||
+ // Forge: When requested call blocks modifyAcceleration method, and more importantly cause this method to return true, which results in an entity being "inWater"
|
||||
+ flag = true;
|
||||
+ vec3 = block.modifyAcceleration(this, blockpos$mutableblockpos, entityIn, vec3);
|
||||
+ vec3d = block.modifyAcceleration(this, blockpos$pooledmutableblockpos, entityIn, vec3d);
|
||||
+ continue;
|
||||
+ }
|
||||
+ else if (result != null && result == false) continue;
|
||||
|
@ -288,7 +450,17 @@
|
|||
if (iblockstate.func_185904_a() == materialIn)
|
||||
{
|
||||
double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
|
||||
@@ -2130,6 +2231,7 @@
|
||||
@@ -2098,6 +2241,9 @@
|
||||
{
|
||||
IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos.func_185343_d(k1, l1, i2));
|
||||
|
||||
+ Boolean result = iblockstate.getBlock().isAABBInsideMaterial(this, blockpos$pooledmutableblockpos, bb, materialIn);
|
||||
+ if (result != null) return result;
|
||||
+
|
||||
if (iblockstate.func_185904_a() == materialIn)
|
||||
{
|
||||
int j2 = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue();
|
||||
@@ -2130,6 +2276,7 @@
|
||||
public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking)
|
||||
{
|
||||
Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking);
|
||||
|
@ -296,7 +468,7 @@
|
|||
explosion.doExplosionA();
|
||||
explosion.doExplosionB(true);
|
||||
return explosion;
|
||||
@@ -2276,19 +2378,27 @@
|
||||
@@ -2276,19 +2423,27 @@
|
||||
else
|
||||
{
|
||||
this.addTileEntity(tileEntityIn);
|
||||
|
@ -325,7 +497,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
@@ -2301,6 +2411,7 @@
|
||||
@@ -2301,6 +2456,7 @@
|
||||
|
||||
this.getChunkFromBlockCoords(pos).removeTileEntity(pos);
|
||||
}
|
||||
|
@ -333,7 +505,16 @@
|
|||
}
|
||||
|
||||
public void markTileEntityForRemoval(TileEntity tileEntityIn)
|
||||
@@ -2350,6 +2461,7 @@
|
||||
@@ -2327,7 +2483,7 @@
|
||||
if (chunk != null && !chunk.isEmpty())
|
||||
{
|
||||
IBlockState iblockstate = this.getBlockState(pos);
|
||||
- return iblockstate.func_185904_a().isOpaque() && iblockstate.func_185917_h();
|
||||
+ return iblockstate.getBlock().isNormalCube(iblockstate, this, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2350,6 +2506,7 @@
|
||||
{
|
||||
this.spawnHostileMobs = hostile;
|
||||
this.spawnPeacefulMobs = peaceful;
|
||||
|
@ -341,7 +522,7 @@
|
|||
}
|
||||
|
||||
public void tick()
|
||||
@@ -2359,6 +2471,11 @@
|
||||
@@ -2359,6 +2516,11 @@
|
||||
|
||||
protected void calculateInitialWeather()
|
||||
{
|
||||
|
@ -353,7 +534,7 @@
|
|||
if (this.worldInfo.isRaining())
|
||||
{
|
||||
this.rainingStrength = 1.0F;
|
||||
@@ -2372,6 +2489,11 @@
|
||||
@@ -2372,6 +2534,11 @@
|
||||
|
||||
protected void updateWeather()
|
||||
{
|
||||
|
@ -365,7 +546,7 @@
|
|||
if (!this.provider.getHasNoSky())
|
||||
{
|
||||
if (!this.isRemote)
|
||||
@@ -2491,6 +2613,11 @@
|
||||
@@ -2491,6 +2658,11 @@
|
||||
|
||||
public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj)
|
||||
{
|
||||
|
@ -377,7 +558,7 @@
|
|||
BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos);
|
||||
float f = biomegenbase.getFloatTemperature(pos);
|
||||
|
||||
@@ -2532,6 +2659,11 @@
|
||||
@@ -2532,6 +2704,11 @@
|
||||
|
||||
public boolean canSnowAt(BlockPos pos, boolean checkLight)
|
||||
{
|
||||
|
@ -389,7 +570,40 @@
|
|||
BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos);
|
||||
float f = biomegenbase.getFloatTemperature(pos);
|
||||
|
||||
@@ -2789,10 +2921,10 @@
|
||||
@@ -2549,7 +2726,7 @@
|
||||
{
|
||||
IBlockState iblockstate = this.getBlockState(pos);
|
||||
|
||||
- if (iblockstate.func_185904_a() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos))
|
||||
+ if (iblockstate.getBlock().isAir(iblockstate, this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -2581,10 +2758,11 @@
|
||||
else
|
||||
{
|
||||
IBlockState iblockstate = this.getBlockState(pos);
|
||||
- int i = lightType == EnumSkyBlock.SKY ? 0 : iblockstate.func_185906_d();
|
||||
- int j = iblockstate.func_185891_c();
|
||||
+ int blockLight = iblockstate.getBlock().getLightValue(iblockstate, this, pos);
|
||||
+ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight;
|
||||
+ int j = iblockstate.getBlock().getLightOpacity(iblockstate, this, pos);
|
||||
|
||||
- if (j >= 15 && iblockstate.func_185906_d() > 0)
|
||||
+ if (j >= 15 && blockLight > 0)
|
||||
{
|
||||
j = 1;
|
||||
}
|
||||
@@ -2683,7 +2861,7 @@
|
||||
int j4 = j2 + enumfacing.getFrontOffsetY();
|
||||
int k4 = k2 + enumfacing.getFrontOffsetZ();
|
||||
blockpos$pooledmutableblockpos.func_185343_d(i4, j4, k4);
|
||||
- int l4 = Math.max(1, this.getBlockState(blockpos$pooledmutableblockpos).func_185891_c());
|
||||
+ int l4 = Math.max(1, this.getBlockState(blockpos$pooledmutableblockpos).getBlock().getLightOpacity(this.getBlockState(blockpos$pooledmutableblockpos), this, blockpos$pooledmutableblockpos));
|
||||
i3 = this.getLightFor(lightType, blockpos$pooledmutableblockpos);
|
||||
|
||||
if (i3 == l2 - l4 && j < this.lightUpdateBlockList.length)
|
||||
@@ -2789,10 +2967,10 @@
|
||||
public List<Entity> getEntitiesInAABBexcluding(Entity entityIn, AxisAlignedBB boundingBox, Predicate <? super Entity > predicate)
|
||||
{
|
||||
List<Entity> list = Lists.<Entity>newArrayList();
|
||||
|
@ -404,7 +618,22 @@
|
|||
|
||||
for (int i1 = i; i1 <= j; ++i1)
|
||||
{
|
||||
@@ -2926,11 +3058,13 @@
|
||||
@@ -2845,10 +3023,10 @@
|
||||
|
||||
public <T extends Entity> List<T> getEntitiesWithinAABB(Class <? extends T > clazz, AxisAlignedBB aabb, Predicate <? super T > filter)
|
||||
{
|
||||
- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D);
|
||||
- int j = MathHelper.ceiling_double_int((aabb.maxX + 2.0D) / 16.0D);
|
||||
- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D);
|
||||
- int l = MathHelper.ceiling_double_int((aabb.maxZ + 2.0D) / 16.0D);
|
||||
+ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D);
|
||||
+ int j = MathHelper.ceiling_double_int((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D);
|
||||
+ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D);
|
||||
+ int l = MathHelper.ceiling_double_int((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D);
|
||||
List<T> list = Lists.<T>newArrayList();
|
||||
|
||||
for (int i1 = i; i1 < j; ++i1)
|
||||
@@ -2926,11 +3104,13 @@
|
||||
|
||||
public void loadEntities(Collection<Entity> entityCollection)
|
||||
{
|
||||
|
@ -421,7 +650,25 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -3215,7 +3349,7 @@
|
||||
@@ -2943,7 +3123,7 @@
|
||||
{
|
||||
IBlockState iblockstate = this.getBlockState(pos);
|
||||
AxisAlignedBB axisalignedbb = p_175716_3_ ? null : blockIn.getDefaultState().func_185890_d(this, pos);
|
||||
- return axisalignedbb != Block.field_185506_k && !this.checkNoEntityCollision(axisalignedbb.func_186670_a(pos), entityIn) ? false : (iblockstate.func_185904_a() == Material.circuits && blockIn == Blocks.anvil ? true : iblockstate.func_185904_a().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn));
|
||||
+ return axisalignedbb != Block.field_185506_k && !this.checkNoEntityCollision(axisalignedbb.func_186670_a(pos), entityIn) ? false : (iblockstate.func_185904_a() == Material.circuits && blockIn == Blocks.anvil ? true : iblockstate.getBlock().isReplaceable(this, pos) && blockIn.canReplace(this, pos, side, itemStackIn));
|
||||
}
|
||||
|
||||
public int getSeaLevel()
|
||||
@@ -3026,7 +3206,7 @@
|
||||
public int getRedstonePower(BlockPos pos, EnumFacing facing)
|
||||
{
|
||||
IBlockState iblockstate = this.getBlockState(pos);
|
||||
- return iblockstate.func_185915_l() ? this.getStrongPower(pos) : iblockstate.func_185911_a(this, pos, facing);
|
||||
+ return iblockstate.getBlock().shouldCheckWeakPower(iblockstate, this, pos, facing) ? this.getStrongPower(pos) : iblockstate.func_185911_a(this, pos, facing);
|
||||
}
|
||||
|
||||
public boolean isBlockPowered(BlockPos pos)
|
||||
@@ -3215,7 +3395,7 @@
|
||||
|
||||
public long getSeed()
|
||||
{
|
||||
|
@ -430,7 +677,7 @@
|
|||
}
|
||||
|
||||
public long getTotalWorldTime()
|
||||
@@ -3225,17 +3359,17 @@
|
||||
@@ -3225,17 +3405,17 @@
|
||||
|
||||
public long getWorldTime()
|
||||
{
|
||||
|
@ -451,7 +698,7 @@
|
|||
|
||||
if (!this.getWorldBorder().contains(blockpos))
|
||||
{
|
||||
@@ -3247,7 +3381,7 @@
|
||||
@@ -3247,7 +3427,7 @@
|
||||
|
||||
public void setSpawnPoint(BlockPos pos)
|
||||
{
|
||||
|
@ -460,7 +707,7 @@
|
|||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -3267,12 +3401,18 @@
|
||||
@@ -3267,12 +3447,18 @@
|
||||
|
||||
if (!this.loadedEntityList.contains(entityIn))
|
||||
{
|
||||
|
@ -479,7 +726,7 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
@@ -3366,8 +3506,7 @@
|
||||
@@ -3366,8 +3552,7 @@
|
||||
|
||||
public boolean isBlockinHighHumidity(BlockPos pos)
|
||||
{
|
||||
|
@ -489,7 +736,7 @@
|
|||
}
|
||||
|
||||
public MapStorage getMapStorage()
|
||||
@@ -3426,12 +3565,12 @@
|
||||
@@ -3426,12 +3611,12 @@
|
||||
|
||||
public int getHeight()
|
||||
{
|
||||
|
@ -504,7 +751,7 @@
|
|||
}
|
||||
|
||||
public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_)
|
||||
@@ -3481,7 +3620,7 @@
|
||||
@@ -3481,7 +3666,7 @@
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getHorizon()
|
||||
{
|
||||
|
@ -513,7 +760,7 @@
|
|||
}
|
||||
|
||||
public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress)
|
||||
@@ -3515,7 +3654,7 @@
|
||||
@@ -3515,7 +3700,7 @@
|
||||
|
||||
public void updateComparatorOutputLevel(BlockPos pos, Block blockIn)
|
||||
{
|
||||
|
@ -522,7 +769,30 @@
|
|||
{
|
||||
BlockPos blockpos = pos.offset(enumfacing);
|
||||
|
||||
@@ -3600,6 +3739,83 @@
|
||||
@@ -3523,18 +3708,14 @@
|
||||
{
|
||||
IBlockState iblockstate = this.getBlockState(blockpos);
|
||||
|
||||
- if (Blocks.unpowered_comparator.func_185547_C(iblockstate))
|
||||
+ iblockstate.getBlock().onNeighborChange(this, blockpos, pos);
|
||||
+ if (iblockstate.getBlock().isNormalCube(iblockstate, this, blockpos))
|
||||
{
|
||||
- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn);
|
||||
- }
|
||||
- else if (iblockstate.func_185915_l())
|
||||
- {
|
||||
blockpos = blockpos.offset(enumfacing);
|
||||
iblockstate = this.getBlockState(blockpos);
|
||||
-
|
||||
- if (Blocks.unpowered_comparator.func_185547_C(iblockstate))
|
||||
+ if (iblockstate.getBlock().getWeakChanges(this, blockpos))
|
||||
{
|
||||
- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn);
|
||||
+ iblockstate.getBlock().onNeighborChange(this, blockpos, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3600,6 +3781,83 @@
|
||||
return i >= -k && i <= k && j >= -k && j <= k;
|
||||
}
|
||||
|
||||
|
|
|
@ -262,9 +262,9 @@
|
|||
+ }
|
||||
+
|
||||
+ @SideOnly(Side.CLIENT)
|
||||
+ public Vec3d drawClouds(float partialTicks)
|
||||
+ public Vec3d getCloudColor(float partialTicks)
|
||||
+ {
|
||||
+ return worldObj.drawCloudsBody(partialTicks);
|
||||
+ return worldObj.getCloudColorBody(partialTicks);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
|
|
@ -246,7 +246,14 @@
|
|||
}
|
||||
|
||||
public BiomeGenBase getBiome(BlockPos pos, BiomeProvider chunkManager)
|
||||
@@ -1239,7 +1253,7 @@
|
||||
@@ -1233,13 +1247,13 @@
|
||||
BlockPos blockpos1 = blockpos.add(k, (j << 4) + i1, l);
|
||||
boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15;
|
||||
|
||||
- if (this.storageArrays[j] == field_186036_a && flag || this.storageArrays[j] != field_186036_a && this.storageArrays[j].get(k, i1, l).func_185904_a() == Material.air)
|
||||
+ if (this.storageArrays[j] == field_186036_a && flag || this.storageArrays[j] != field_186036_a && this.storageArrays[j].get(k, i1, l).getBlock().isAir(this.storageArrays[j].get(k, i1, l), this.worldObj, blockpos1))
|
||||
{
|
||||
for (EnumFacing enumfacing : EnumFacing.values())
|
||||
{
|
||||
BlockPos blockpos2 = blockpos1.offset(enumfacing);
|
||||
|
||||
|
|
|
@ -1,211 +1,3 @@
|
|||
++++ REJECTED PATCH 5
|
||||
|
||||
public boolean isAirBlock(BlockPos pos)
|
||||
{
|
||||
- return this.getBlockState(pos).getBlock().getMaterial() == Material.air;
|
||||
+ return this.getBlockState(pos).getBlock().isAir(this, pos);
|
||||
}
|
||||
|
||||
public boolean isBlockLoaded(BlockPos pos)
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 6
|
||||
{
|
||||
Chunk chunk = this.getChunkFromBlockCoords(pos);
|
||||
Block block = newState.getBlock();
|
||||
+
|
||||
+ net.minecraftforge.common.util.BlockSnapshot blockSnapshot = null;
|
||||
+ if (this.captureBlockSnapshots && !this.isRemote)
|
||||
+ {
|
||||
+ blockSnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this, pos, flags);
|
||||
+ this.capturedBlockSnapshots.add(blockSnapshot);
|
||||
+ }
|
||||
+ Block oldBlock = getBlockState(pos).getBlock();
|
||||
+ int oldLight = oldBlock.getLightValue(this, pos);
|
||||
+ int oldOpacity = oldBlock.getLightOpacity(this, pos);
|
||||
+
|
||||
IBlockState iblockstate = chunk.setBlockState(pos, newState);
|
||||
|
||||
if (iblockstate == null)
|
||||
{
|
||||
+ if (blockSnapshot != null) this.capturedBlockSnapshots.remove(blockSnapshot);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Block block1 = iblockstate.getBlock();
|
||||
|
||||
- if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue())
|
||||
+ if (block.getLightOpacity(this, pos) != oldOpacity || block.getLightValue(this, pos) != oldLight)
|
||||
{
|
||||
this.theProfiler.startSection("checkLight");
|
||||
this.checkLight(pos);
|
||||
this.theProfiler.endSection();
|
||||
}
|
||||
|
||||
- if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated())
|
||||
+ if (blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates
|
||||
{
|
||||
- this.markBlockForUpdate(pos);
|
||||
+ this.markAndNotifyBlock(pos, chunk, iblockstate, newState, flags); // Modularize client and physic updates
|
||||
}
|
||||
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Split off from original setBlockState(BlockPos, IBlockState Block p_147465_4_, int) method in order to directly send client and physic updates
|
||||
+ public void markAndNotifyBlock(BlockPos pos, Chunk chunk, IBlockState old, IBlockState new_, int flags)
|
||||
+ {
|
||||
+ if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && (chunk == null || chunk.isPopulated()))
|
||||
+ {
|
||||
+ this.markBlockForUpdate(pos);
|
||||
+ }
|
||||
+ {
|
||||
+ {
|
||||
if (!this.isRemote && (flags & 1) != 0)
|
||||
{
|
||||
- this.notifyNeighborsRespectDebug(pos, iblockstate.getBlock());
|
||||
+ this.notifyNeighborsRespectDebug(pos, new_.getBlock());
|
||||
|
||||
- if (block.hasComparatorInputOverride())
|
||||
+ if (new_.getBlock().hasComparatorInputOverride())
|
||||
{
|
||||
- this.updateComparatorOutputLevel(pos, block);
|
||||
+ this.updateComparatorOutputLevel(pos, new_.getBlock());
|
||||
}
|
||||
}
|
||||
-
|
||||
- return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 14
|
||||
|
||||
public int calculateSkylightSubtracted(float p_72967_1_)
|
||||
{
|
||||
+ float f = provider.getSunBrightnessFactor(p_72967_1_);
|
||||
+ f = 1 - f;
|
||||
+ return (int)(f * 11);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The current sun brightness factor for this dimension.
|
||||
+ * 0.0f means no light at all, and 1.0f means maximum sunlight.
|
||||
+ * Highly recommended for sunlight detection like solar panel.
|
||||
+ *
|
||||
+ * @return The current brightness factor
|
||||
+ * */
|
||||
+ public float getSunBrightnessFactor(float p_72967_1_)
|
||||
+ {
|
||||
float f = this.getCelestialAngle(p_72967_1_);
|
||||
float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F);
|
||||
f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
|
||||
f1 = 1.0F - f1;
|
||||
f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D));
|
||||
f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D));
|
||||
- f1 = 1.0F - f1;
|
||||
- return (int)(f1 * 11.0F);
|
||||
+ return f1;
|
||||
}
|
||||
|
||||
- @SideOnly(Side.CLIENT)
|
||||
public void removeWorldAccess(IWorldAccess worldAccess)
|
||||
{
|
||||
this.worldAccesses.remove(worldAccess);
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 20
|
||||
for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
|
||||
{
|
||||
blockpos1 = blockpos.down();
|
||||
- Material material = chunk.getBlock(blockpos1).getMaterial();
|
||||
+ Block block = chunk.getBlock(blockpos1);
|
||||
|
||||
- if (material.blocksMovement() && material != Material.leaves)
|
||||
+ if (block.getMaterial().blocksMovement() && !block.isLeaves(this, blockpos1) && !block.isFoliage(this, blockpos1))
|
||||
{
|
||||
break;
|
||||
}
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 23
|
||||
CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity");
|
||||
CrashReportCategory crashreportcategory2 = crashreport1.makeCategory("Entity being ticked");
|
||||
entity2.addEntityCrashInfo(crashreportcategory2);
|
||||
- throw new ReportedException(crashreport1);
|
||||
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringEntities)
|
||||
+ {
|
||||
+ net.minecraftforge.fml.common.FMLLog.severe(crashreport1.getCompleteReport());
|
||||
+ removeEntity(entity2);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ throw new ReportedException(crashreport1);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 24
|
||||
CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity");
|
||||
CrashReportCategory crashreportcategory1 = crashreport2.makeCategory("Block entity being ticked");
|
||||
tileentity.addInfoToCrashReport(crashreportcategory1);
|
||||
- throw new ReportedException(crashreport2);
|
||||
+ if (net.minecraftforge.common.ForgeModContainer.removeErroringTileEntities)
|
||||
+ {
|
||||
+ net.minecraftforge.fml.common.FMLLog.severe(crashreport2.getCompleteReport());
|
||||
+ tileentity.invalidate();
|
||||
+ this.removeTileEntity(tileentity.getPos());
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ throw new ReportedException(crashreport2);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 28
|
||||
{
|
||||
Block block = this.getBlockState(blockpos$mutableblockpos.set(k1, l1, i2)).getBlock();
|
||||
|
||||
- if (block.getMaterial() != Material.air)
|
||||
+ if (!block.isAir(this, new BlockPos(k1, l1, i2)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 31
|
||||
IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos.set(k1, l1, i2));
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
+ Boolean result = block.isAABBInsideMaterial(this, blockpos$mutableblockpos, bb, materialIn);
|
||||
+ if (result != null) return result;
|
||||
+
|
||||
if (block.getMaterial() == materialIn)
|
||||
{
|
||||
int j2 = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue();
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 35
|
||||
{
|
||||
IBlockState iblockstate = blockAccess.getBlockState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
- return block.getMaterial().isOpaque() && block.isFullCube() ? true : (block instanceof BlockStairs ? iblockstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() == 7 : false))));
|
||||
+ return block.isSideSolid(blockAccess, pos, EnumFacing.UP);
|
||||
}
|
||||
|
||||
public boolean isBlockNormalCube(BlockPos pos, boolean _default)
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 36
|
||||
else
|
||||
{
|
||||
Block block = this.getBlockState(pos).getBlock();
|
||||
- return block.getMaterial().isOpaque() && block.isFullCube();
|
||||
+ return block.isNormalCube(this, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 40
|
||||
{
|
||||
this.activeChunkSet.clear();
|
||||
|
@ -215,105 +7,3 @@
|
|||
for (int i = 0; i < this.playerEntities.size(); ++i)
|
||||
{
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 41
|
||||
Block block = chunkIn.getBlock(blockpos);
|
||||
j = j + p_147467_1_;
|
||||
k = k + p_147467_2_;
|
||||
+ BlockPos worldpos = blockpos.add(p_147467_1_, 0, p_147467_2_);
|
||||
|
||||
- if (block.getMaterial() == Material.air && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0)
|
||||
+ if (block.isAir(this, worldpos) && this.getLight(worldpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, worldpos) <= 0) //Forge: isAir, and fix arguments to world positions instead of chunk position
|
||||
{
|
||||
EntityPlayer entityplayer = this.getClosestPlayer((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D);
|
||||
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 44
|
||||
{
|
||||
Block block = this.getBlockState(pos).getBlock();
|
||||
|
||||
- if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos))
|
||||
+ if (block.isAir(this, pos) && Blocks.snow_layer.canPlaceBlockAt(this, pos))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 45
|
||||
else
|
||||
{
|
||||
Block block = this.getBlockState(pos).getBlock();
|
||||
- int i = lightType == EnumSkyBlock.SKY ? 0 : block.getLightValue();
|
||||
- int j = block.getLightOpacity();
|
||||
+ int blockLight = block.getLightValue(this, pos);
|
||||
+ int i = lightType == EnumSkyBlock.SKY ? 0 : blockLight;
|
||||
+ int j = block.getLightOpacity(this, pos);
|
||||
|
||||
- if (j >= 15 && block.getLightValue() > 0)
|
||||
+ if (j >= 15 && blockLight > 0)
|
||||
{
|
||||
j = 1;
|
||||
}
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 47
|
||||
|
||||
public <T extends Entity> List<T> getEntitiesWithinAABB(Class <? extends T > clazz, AxisAlignedBB aabb, Predicate <? super T > filter)
|
||||
{
|
||||
- int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D);
|
||||
- int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D);
|
||||
- int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D);
|
||||
- int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D);
|
||||
+ int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D);
|
||||
+ int j = MathHelper.floor_double((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D);
|
||||
+ int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D);
|
||||
+ int l = MathHelper.floor_double((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D);
|
||||
List<T> list = Lists.<T>newArrayList();
|
||||
|
||||
for (int i1 = i; i1 <= j; ++i1)
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 49
|
||||
{
|
||||
Block block = this.getBlockState(pos).getBlock();
|
||||
AxisAlignedBB axisalignedbb = p_175716_3_ ? null : blockIn.getCollisionBoundingBox(this, pos, blockIn.getDefaultState());
|
||||
- return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn) ? false : (block.getMaterial() == Material.circuits && blockIn == Blocks.anvil ? true : block.getMaterial().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn));
|
||||
+ if (axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn)) return false;
|
||||
+ if (block.getMaterial() == Material.circuits && blockIn == Blocks.anvil) return true;
|
||||
+ return block.isReplaceable(this, pos) && blockIn.canReplace(this, pos, side, itemStackIn);
|
||||
}
|
||||
|
||||
public int getSeaLevel()
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 50
|
||||
{
|
||||
IBlockState iblockstate = this.getBlockState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
- return block.isNormalCube() ? this.getStrongPower(pos) : block.getWeakPower(this, pos, iblockstate, facing);
|
||||
+ return block.shouldCheckWeakPower(this, pos, facing) ? this.getStrongPower(pos) : block.getWeakPower(this, pos, iblockstate, facing);
|
||||
}
|
||||
|
||||
public boolean isBlockPowered(BlockPos pos)
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 59
|
||||
{
|
||||
IBlockState iblockstate = this.getBlockState(blockpos);
|
||||
|
||||
- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock()))
|
||||
+ iblockstate.getBlock().onNeighborChange(this, blockpos, pos);
|
||||
+ if (iblockstate.getBlock().isNormalCube(this, blockpos))
|
||||
{
|
||||
- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn);
|
||||
- }
|
||||
- else if (iblockstate.getBlock().isNormalCube())
|
||||
- {
|
||||
- blockpos = blockpos.offset(enumfacing);
|
||||
- iblockstate = this.getBlockState(blockpos);
|
||||
-
|
||||
- if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock()))
|
||||
+ BlockPos posOther = blockpos.offset(enumfacing);
|
||||
+ Block other = getBlockState(posOther).getBlock();
|
||||
+ if (other.getWeakChanges(this, posOther))
|
||||
{
|
||||
- iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn);
|
||||
+ other.onNeighborChange(this, posOther, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
++++ END PATCH
|
||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.util.DamageSource;
|
|||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
|
@ -336,9 +337,9 @@ public class ForgeEventFactory
|
|||
return event.canUpdate;
|
||||
}
|
||||
|
||||
public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, float volume, float pitch)
|
||||
public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, SoundCategory category, float volume, float pitch)
|
||||
{
|
||||
PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, volume, pitch);
|
||||
PlaySoundAtEntityEvent event = new PlaySoundAtEntityEvent(entity, name, category, volume, pitch);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.minecraftforge.event.entity;
|
|||
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
|
||||
/**
|
||||
|
@ -28,27 +29,31 @@ import net.minecraft.util.SoundEvent;
|
|||
public class PlaySoundAtEntityEvent extends EntityEvent
|
||||
{
|
||||
private SoundEvent name;
|
||||
private SoundCategory category;
|
||||
private final float volume;
|
||||
private final float pitch;
|
||||
private float newVolume;
|
||||
private float newPitch;
|
||||
|
||||
public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, float volume, float pitch)
|
||||
public PlaySoundAtEntityEvent(Entity entity, SoundEvent name, SoundCategory category, float volume, float pitch)
|
||||
{
|
||||
super(entity);
|
||||
this.name = name;
|
||||
this.category = category;
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
this.newVolume = volume;
|
||||
this.newPitch = pitch;
|
||||
}
|
||||
|
||||
public SoundEvent getSound(){ return this.name; }
|
||||
public SoundEvent getSound() { return this.name; }
|
||||
public SoundCategory getCategory() { return this.category; }
|
||||
public float getDefaultVolume() { return this.volume; }
|
||||
public float getDefaultPitch() { return this.pitch; }
|
||||
public float getVolume() { return this.newVolume; }
|
||||
public float getPitch() { return this.newPitch; }
|
||||
public void setSound(SoundEvent value) { this.name = value; }
|
||||
public void setCategory(SoundCategory category) { this.category = category; }
|
||||
public void setVolume(float value) { this.newVolume = value; }
|
||||
public void setPitch(float value) { this.newPitch = value; }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue