broadened stat reregistering exception ignoring scope, meteorite gen fix

This commit is contained in:
Bob 2023-04-02 20:54:48 +02:00
parent 92bed8ae6c
commit da1b4b24f1
7 changed files with 15 additions and 58 deletions

View File

@ -94,37 +94,6 @@ public class Guide extends Block implements ILookOverlay {
return null;
}
private void setDefaultDirection(World world, int x, int y, int z) {
if(!world.isRemote)
{
Block block1 = world.getBlock(x, y, z - 1);
Block block2 = world.getBlock(x, y, z + 1);
Block block3 = world.getBlock(x - 1, y, z);
Block block4 = world.getBlock(x + 1, y, z);
byte b0 = 3;
if(block1.func_149730_j() && !block2.func_149730_j())
{
b0 = 3;
}
if(block2.func_149730_j() && !block1.func_149730_j())
{
b0 = 2;
}
if(block3.func_149730_j() && !block4.func_149730_j())
{
b0 = 5;
}
if(block4.func_149730_j() && !block3.func_149730_j())
{
b0 = 4;
}
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
}
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;

View File

@ -3,7 +3,6 @@ package com.hbm.blocks.machine;
import java.util.List;
import api.hbm.block.IToolable;
import api.hbm.block.IToolable.ToolType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer;
@ -133,9 +132,6 @@ public class MachineFan extends BlockContainer implements IToolable {
if(meta == 4) world.setBlockMetadataWithNotify(x, y, z, 5, 3);
if(meta == 5) world.setBlockMetadataWithNotify(x, y, z, 4, 3);
//TileEntityFan fan = (TileEntityFan) world.getTileEntity(x, y, z);
//fan.blockMetadata = -1;
return true;
}
}

View File

@ -51,7 +51,7 @@ public class EntityMeteor extends Entity {
ExplosionLarge.spawnParticles(worldObj, posX, posY, posZ - 5, 75);
}
(new Meteorite()).generate(worldObj, rand, (int) Math.round(this.posX - 0.5D), (int) Math.round(this.posY - 0.5D), (int) Math.round(this.posZ - 0.5D), safe, true);
(new Meteorite()).generate(worldObj, rand, (int) Math.round(this.posX - 0.5D), (int) Math.round(this.posY - 0.5D), (int) Math.round(this.posZ - 0.5D), safe, true, true);
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "hbm:entity.oldExplosion", 10000.0F, 0.5F + this.rand.nextFloat() * 0.1F);
this.setDead();
}

View File

@ -630,7 +630,7 @@ public class HbmWorldGen implements IWorldGenerator {
int x = i + rand.nextInt(16);
int z = j + rand.nextInt(16);
int y = world.getHeightValue(x, z) - rand.nextInt(10);
(new Meteorite()).generate(world, rand, x, y, z, false, true);
(new Meteorite()).generate(world, rand, x, y, z, false, true, false);
}
if (GeneralConfig.enableNITAN) {

View File

@ -26,18 +26,8 @@ import net.minecraftforge.client.model.IModelCustom;
public class RendererObjTester extends TileEntitySpecialRenderer {
private static final ResourceLocation objTesterModelRL = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/TestObj.obj");
//private static final ResourceLocation objTesterModelRL = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/Prototype.obj");
private IModelCustom objTesterModel;
private ResourceLocation objTesterTexture;
public RendererObjTester()
{
objTesterModel = AdvancedModelLoader.loadModel(objTesterModelRL);
objTesterTexture = new ResourceLocation(RefStrings.MODID, "textures/models/TestObj.png");
//objTesterTexture = new ResourceLocation(RefStrings.MODID, "textures/models/Prototype.png");
}
@Override
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y, z + 0.5);

View File

@ -50,7 +50,7 @@ public class StatHelper {
initBlockMineStats();
initItemUseStats();
initItemBreakStats();
} catch(Exception ex) { } // just to be sure
} catch(Throwable ex) { } // just to be sure
}
/**
@ -69,7 +69,7 @@ public class StatHelper {
int i = Item.getIdFromItem(item);
try {
StatList.objectCraftStats[i] = registerStat(new StatCrafting("stat.craftItem." + i, new ChatComponentTranslation("stat.craftItem", new Object[] { (new ItemStack(item)).func_151000_E() }), item));
} catch(Exception ex) { }
} catch(Throwable ex) { }
}
}
@ -89,7 +89,7 @@ public class StatHelper {
StatList.mineBlockStatArray[i] = registerStat(new StatCrafting("stat.mineBlock." + i, new ChatComponentTranslation("stat.mineBlock", new Object[] { (new ItemStack(block)).func_151000_E() }), Item.getItemFromBlock(block)));
StatList.objectMineStats.add((StatCrafting) StatList.mineBlockStatArray[i]);
}
} catch(Exception ex) { }
} catch(Throwable ex) { }
}
}
@ -109,7 +109,7 @@ public class StatHelper {
if(!(item instanceof ItemBlock)) {
StatList.itemStats.add((StatCrafting) StatList.objectUseStats[i]);
}
} catch(Exception ex) { }
} catch(Throwable ex) { }
}
}
@ -128,7 +128,7 @@ public class StatHelper {
if(item.isDamageable()) {
StatList.objectBreakStats[i] = registerStat(new StatCrafting("stat.breakItem." + i, new ChatComponentTranslation("stat.breakItem", new Object[] { (new ItemStack(item)).func_151000_E() }), item));
}
} catch(Exception ex) { }
} catch(Throwable ex) { }
}
}

View File

@ -25,17 +25,19 @@ public class Meteorite {
public static boolean safeMode = false;
public void generate(World world, Random rand, int x, int y, int z, boolean safe, boolean allowSpecials) {
public void generate(World world, Random rand, int x, int y, int z, boolean safe, boolean allowSpecials, boolean damagingImpact) {
safeMode = safe;
if(replacables.isEmpty()) {
generateReplacables();
}
List<Entity> list = (List<Entity>) world.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(x - 7.5, y - 7.5, z - 7.5, x + 7.5, y + 7.5, z + 7.5));
for(Entity e : list) {
e.attackEntityFrom(ModDamageSource.meteorite, 1000);
if(damagingImpact) {
List<Entity> list = (List<Entity>) world.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(x - 7.5, y - 7.5, z - 7.5, x + 7.5, y + 7.5, z + 7.5));
for(Entity e : list) {
e.attackEntityFrom(ModDamageSource.meteorite, 1000);
}
}
if(WorldConfig.enableSpecialMeteors && allowSpecials)