reformatted all src files (#141)

This commit is contained in:
YoungOnion
2022-09-17 05:08:02 -06:00
committed by GitHub
parent 3328bfcda2
commit 9011273229
1056 changed files with 88127 additions and 110597 deletions
@@ -19,9 +19,12 @@
package appeng.entity;
import java.util.Date;
import java.util.List;
import appeng.api.AEApi;
import appeng.api.definitions.IMaterials;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.helpers.Reflected;
import appeng.util.Platform;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
@@ -31,124 +34,98 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.definitions.IMaterials;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.helpers.Reflected;
import appeng.util.Platform;
import java.util.Date;
import java.util.List;
public final class EntitySingularity extends AEBaseEntityItem
{
public final class EntitySingularity extends AEBaseEntityItem {
private static int randTickSeed = 0;
private static int randTickSeed = 0;
@Reflected
public EntitySingularity( final World w )
{
super( w );
}
@Reflected
public EntitySingularity(final World w) {
super(w);
}
public EntitySingularity( final World w, final double x, final double y, final double z, final ItemStack is )
{
super( w, x, y, z, is );
}
public EntitySingularity(final World w, final double x, final double y, final double z, final ItemStack is) {
super(w, x, y, z, is);
}
@Override
public boolean attackEntityFrom( final DamageSource src, final float dmg )
{
if( src.isExplosion() )
{
this.doExplosion();
return false;
}
@Override
public boolean attackEntityFrom(final DamageSource src, final float dmg) {
if (src.isExplosion()) {
this.doExplosion();
return false;
}
return super.attackEntityFrom( src, dmg );
}
return super.attackEntityFrom(src, dmg);
}
private void doExplosion()
{
if( Platform.isClient() )
{
return;
}
private void doExplosion() {
if (Platform.isClient()) {
return;
}
if( !AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_SINGULARITY ) )
{
return;
}
if (!AEConfig.instance().isFeatureEnabled(AEFeature.IN_WORLD_SINGULARITY)) {
return;
}
final ItemStack item = this.getItem();
final ItemStack item = this.getItem();
final IMaterials materials = AEApi.instance().definitions().materials();
final IMaterials materials = AEApi.instance().definitions().materials();
if( materials.singularity().isSameAs( item ) )
{
final AxisAlignedBB region = new AxisAlignedBB( this.posX - 4, this.posY - 4, this.posZ - 4, this.posX + 4, this.posY + 4, this.posZ + 4 );
final List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
if (materials.singularity().isSameAs(item)) {
final AxisAlignedBB region = new AxisAlignedBB(this.posX - 4, this.posY - 4, this.posZ - 4, this.posX + 4, this.posY + 4, this.posZ + 4);
final List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity(region);
for( final Entity e : l )
{
if( e instanceof EntityItem )
{
final ItemStack other = ( (EntityItem) e ).getItem();
if( !other.isEmpty() )
{
boolean matches = false;
for( final ItemStack is : OreDictionary.getOres( "dustEnder" ) )
{
if( OreDictionary.itemMatches( other, is, false ) )
{
matches = true;
break;
}
}
for (final Entity e : l) {
if (e instanceof EntityItem) {
final ItemStack other = ((EntityItem) e).getItem();
if (!other.isEmpty()) {
boolean matches = false;
for (final ItemStack is : OreDictionary.getOres("dustEnder")) {
if (OreDictionary.itemMatches(other, is, false)) {
matches = true;
break;
}
}
// check... other name.
if( !matches )
{
for( final ItemStack is : OreDictionary.getOres( "dustEnderPearl" ) )
{
if( OreDictionary.itemMatches( other, is, false ) )
{
matches = true;
break;
}
}
}
// check... other name.
if (!matches) {
for (final ItemStack is : OreDictionary.getOres("dustEnderPearl")) {
if (OreDictionary.itemMatches(other, is, false)) {
matches = true;
break;
}
}
}
if( matches )
{
while( item.getCount() > 0 && other.getCount() > 0 )
{
other.grow( -1 );
;
if( other.getCount() == 0 )
{
e.setDead();
}
if (matches) {
while (item.getCount() > 0 && other.getCount() > 0) {
other.grow(-1);
if (other.getCount() == 0) {
e.setDead();
}
materials.qESingularity().maybeStack( 2 ).ifPresent( singularityStack ->
{
final NBTTagCompound cmp = Platform.openNbtData( singularityStack );
cmp.setLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 );
randTickSeed++;
item.grow( -1 );
materials.qESingularity().maybeStack(2).ifPresent(singularityStack ->
{
final NBTTagCompound cmp = Platform.openNbtData(singularityStack);
cmp.setLong("freq", (new Date()).getTime() * 100 + (randTickSeed) % 100);
randTickSeed++;
item.grow(-1);
final EntitySingularity entity = new EntitySingularity( this.world, this.posX, this.posY, this.posZ, singularityStack );
this.world.spawnEntity( entity );
} );
}
final EntitySingularity entity = new EntitySingularity(this.world, this.posX, this.posY, this.posZ, singularityStack);
this.world.spawnEntity(entity);
});
}
if( item.getCount() <= 0 )
{
this.setDead();
}
}
}
}
}
}
}
if (item.getCount() <= 0) {
this.setDead();
}
}
}
}
}
}
}
}