use of net.minecraft.crash.CrashReportCategory in project minecolonies by Minecolonies.
the class InventoryCitizen method addItemStackToInventory.
/**
* Adds the item stack to the inventory, returns false if it is impossible.
*
* @param itemStackIn stack to add.
* @return true if possible.
*/
public boolean addItemStackToInventory(final ItemStack itemStackIn) {
if (itemStackIn.isEmpty()) {
return false;
} else {
try {
if (itemStackIn.isItemDamaged()) {
final int j = this.getFirstEmptyStack();
if (j >= 0) {
this.mainInventory.set(j, itemStackIn.copy());
(this.mainInventory.get(j)).setAnimationsToGo(5);
itemStackIn.setCount(0);
return true;
} else {
return false;
}
} else {
int i;
while (true) {
i = itemStackIn.getCount();
itemStackIn.setCount(this.storePartialItemStack(itemStackIn));
if (itemStackIn.isEmpty() || itemStackIn.getCount() >= i) {
break;
}
}
return itemStackIn.getCount() < i;
}
} catch (final RuntimeException exception) {
final CrashReport crashreport = CrashReport.makeCrashReport(exception, "Adding item to inventory");
final CrashReportCategory crashreportcategory = crashreport.makeCategory("Item being added");
crashreportcategory.addCrashSection("Item ID", Item.getIdFromItem(itemStackIn.getItem()));
crashreportcategory.addCrashSection("Item data", itemStackIn.getMetadata());
crashreportcategory.setDetail("Item name", itemStackIn::getDisplayName);
throw new ReportedException(crashreport);
}
}
}
use of net.minecraft.crash.CrashReportCategory in project Engine by VoltzEngine-Project.
the class FXSmoke method moveEntity.
@Override
public void moveEntity(double xx, double yy, double zz) {
if (this.noClip) {
this.boundingBox.offset(xx, yy, zz);
this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D;
this.posY = this.boundingBox.minY + (double) this.yOffset - (double) this.ySize;
this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D;
} else {
this.worldObj.theProfiler.startSection("move");
this.ySize *= 0.4F;
if (this.isInWeb) {
this.isInWeb = false;
xx *= 0.25D;
yy *= 0.05000000074505806D;
zz *= 0.25D;
this.motionX = 0.0D;
this.motionY = 0.0D;
this.motionZ = 0.0D;
}
double d6 = xx;
double d7 = yy;
double d8 = zz;
List list = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.addCoord(xx, yy, zz));
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); ++i) {
if (list.get(i) != null) {
yy = ((AxisAlignedBB) list.get(i)).calculateYOffset(this.boundingBox, yy);
}
}
}
this.boundingBox.offset(0.0D, yy, 0.0D);
if (!this.field_70135_K && d7 != yy) {
zz = 0.0D;
yy = 0.0D;
xx = 0.0D;
}
if (list != null && list.size() > 0) {
for (int j = 0; j < list.size(); ++j) {
if (list.get(j) != null) {
xx = ((AxisAlignedBB) list.get(j)).calculateXOffset(this.boundingBox, xx);
}
}
}
this.boundingBox.offset(xx, 0.0D, 0.0D);
if (!this.field_70135_K && d6 != xx) {
zz = 0.0D;
yy = 0.0D;
xx = 0.0D;
}
if (list != null && list.size() > 0) {
for (int j = 0; j < list.size(); ++j) {
if (list.get(j) != null) {
zz = ((AxisAlignedBB) list.get(j)).calculateZOffset(this.boundingBox, zz);
}
}
}
this.boundingBox.offset(0.0D, 0.0D, zz);
if (!this.field_70135_K && d8 != zz) {
zz = 0.0D;
yy = 0.0D;
xx = 0.0D;
}
this.worldObj.theProfiler.endSection();
this.worldObj.theProfiler.startSection("rest");
this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D;
this.posY = this.boundingBox.minY + (double) this.yOffset - (double) this.ySize;
this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D;
this.isCollidedHorizontally = d6 != xx || d8 != zz;
this.isCollidedVertically = d7 != yy;
this.onGround = d7 != yy && d7 < 0.0D;
this.isCollided = this.isCollidedHorizontally || this.isCollidedVertically;
this.updateFallState(yy, this.onGround);
if (d6 != xx) {
this.motionX = 0.0D;
}
if (d7 != yy) {
this.motionY = 0.0D;
}
if (d8 != zz) {
this.motionZ = 0.0D;
}
try {
this.func_145775_I();
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Checking entity block collision");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being checked for collision");
this.addEntityCrashInfo(crashreportcategory);
throw new ReportedException(crashreport);
}
this.worldObj.theProfiler.endSection();
}
}
use of net.minecraft.crash.CrashReportCategory in project RecurrentComplex by Ivorforce.
the class SpawnCommandLogic method trigger.
public void trigger(World worldIn) {
if (!worldIn.isRemote) {
MinecraftServer minecraftserver = this.getServer();
if (minecraftserver != null && minecraftserver.isAnvilFileSet() && minecraftserver.isCommandBlockEnabled()) {
ICommandManager icommandmanager = minecraftserver.getCommandManager();
ICommandListener cachedAdmin = null;
if (!RCConfig.notifyAdminOnBlockCommands) {
cachedAdmin = RCAccessorCommandBase.getCommandAdmin();
CommandBase.setCommandListener(null);
}
try {
icommandmanager.executeCommand(this, this.commandStored);
} catch (Exception ex) {
CrashReport crashreport = CrashReport.makeCrashReport(ex, "Executing command block");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Command to be executed");
crashreportcategory.addDetail("Command", this::getCommand);
crashreportcategory.addDetail("Name", this::getName);
throw new ReportedException(crashreport);
}
if (!RCConfig.notifyAdminOnBlockCommands)
CommandBase.setCommandListener(cachedAdmin);
}
}
}
use of net.minecraft.crash.CrashReportCategory in project Realistic-Terrain-Generation by Team-RTG.
the class StructureOceanMonumentRTG method areBiomesViable.
public boolean areBiomesViable(int x, int z, int radius, List<Biome> allowed) {
// Are we in an RTG world?
if (!DimensionManagerRTG.isValidDimension(this.world.provider.getDimension())) {
//Logger.debug("Could not generate ocean monument. This is not an RTG world.");
return false;
}
// Do we have RTG's chunk manager?
if (!(this.world.getBiomeProvider() instanceof BiomeProviderRTG)) {
//Logger.debug("Could not generate ocean monument. Incompatible chunk manager detected.");
return false;
}
IntCache.resetIntCache();
int i = x - radius >> 2;
int j = z - radius >> 2;
int k = x + radius >> 2;
int l = z + radius >> 2;
int i1 = k - i + 1;
int j1 = l - j + 1;
BiomeProviderRTG cmr = (BiomeProviderRTG) this.world.getBiomeProvider();
int[] aint = cmr.getBiomesGens(i, j, i1, j1);
try {
for (int k1 = 0; k1 < i1 * j1; ++k1) {
Biome biome = Biome.getBiome(aint[k1]);
if (!allowed.contains(biome)) {
//Logger.debug("Could not generate ocean monument. Biome (%d) nearby.", BiomeUtils.getId(biome));
return false;
}
}
return true;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Layer");
crashreportcategory.addCrashSection("Layer", Arrays.toString(aint));
crashreportcategory.addCrashSection("x", x);
crashreportcategory.addCrashSection("z", z);
crashreportcategory.addCrashSection("radius", radius);
crashreportcategory.addCrashSection("allowed", allowed);
throw new ReportedException(crashreport);
}
}
Aggregations