Skip to content

Commit

Permalink
Merge branch 'dev/main' into dev/avalon/main
Browse files Browse the repository at this point in the history
  • Loading branch information
Avalon2106 committed Jan 27, 2025
2 parents 40af521 + cfda62a commit df5be62
Show file tree
Hide file tree
Showing 118 changed files with 3,434 additions and 3,152 deletions.
41 changes: 33 additions & 8 deletions gradle/docs/schemas/amt_particle_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
"type": "string"
}
},
"life_time": {
"description": "Life time of this particle in ticks",
"max_lifetime": {
"description": "Maximum life time of this particle in ticks",
"type": "integer"
},
"lifetime": {
"description": "Starting life time of this particle in ticks",
"type": "integer"
},
"draw_stage": {
Expand Down Expand Up @@ -56,34 +60,55 @@
"type": "integer"
},
"generator": {
"type": "string"
"type": "string",
"enum": [
"same",
"rand_xz",
"circle_xz",
"cone_xz",
"cone_xy",
"cone_zy",
"sphere",
"square",
"star",
"orb",
"cube"
]
},
"type": {
"type": "string"
},
"size": {
"type": "number"
},
"count": {
"amount": {
"type": "integer",
"minimum": 0
},
"min_count": {
"min_amount": {
"type": "integer",
"minimum": 0
},
"max_count": {
"max_amount": {
"type": "integer",
"minimum": 0
}
},
"required": ["time", "generator", "distance", "min_amount", "max_amount", "type"]
"required": ["time", "generator", "distance", "type"],
"oneOf": [
{
"required": ["amount"]
},
{
"required": ["min_amount", "max_amount"]
}
]
}
},
"chained": {
"type": "array",
"description": "Particles spawned after death of this one"
}
},
"required": ["type", "life_time", "draw_stage"]
"required": ["type", "max_lifetime", "draw_stage"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import pl.pabilo8.immersiveintelligence.api.ammo.penetration.PenetrationHandler;
import pl.pabilo8.immersiveintelligence.api.ammo.penetration.PenetrationHandlerInvulnerable;
import pl.pabilo8.immersiveintelligence.api.ammo.penetration.PenetrationHandlerMetal;
import pl.pabilo8.immersiveintelligence.client.fx.IIParticles;
import pl.pabilo8.immersiveintelligence.common.IIContent;
import pl.pabilo8.immersiveintelligence.common.IISounds;
import pl.pabilo8.immersiveintelligence.common.IIUtils;
Expand All @@ -35,10 +34,26 @@
*/
public class PenetrationRegistry
{
public static final String PARTICLE_DEBRIS_PEBBLE = "debris/pebble";
//Explosion Debris
public static final String PARTICLE_DEBRIS_BRANCH_LEAF = "debris/branch_leaf";
public static final String PARTICLE_DEBRIS_BRANCH_NEEDLE = "debris/branch_needle";
public static final String PARTICLE_DEBRIS_BRANCH_CACTUS = "debris/branch_cactus";
public static final String PARTICLE_DEBRIS_BRICK = "debris/brick";
public static final String PARTICLE_DEBRIS_BRICK_BIG = "debris/big_brick";
public static final String PARTICLE_DEBRIS_CLOTH = "debris/cloth";
public static final String PARTICLE_DEBRIS_FLESH = "debris/flesh";
public static final String PARTICLE_DEBRIS_METAL = "debris/metal";
public static final String PARTICLE_DEBRIS_GLASS = "debris/glass";
public static final String PARTICLE_DEBRIS_PLANK = "debris/plank";
public static final String PARTICLE_DEBRIS_STRAW = "debris/straw";
public static final String PARTICLE_DEBRIS_MECHANICAL = "debris/rivet";
public static final String PARTICLE_DEBRIS_LIGHT_MACHINE = "debris/light_machine";
public static final String PARTICLE_DEBRIS_HEAVY_MACHINE = "debris/heavy_machine";
/**
* Default penetration handler used as fallback
*/
private static final IPenetrationHandler DEFAULT = new PenetrationHandler(PenetrationHardness.ROCK, 1f, 150f, IIParticles.PARTICLE_DEBRIS_PEBBLE, null, null);
private static final IPenetrationHandler DEFAULT = new PenetrationHandler(PenetrationHardness.ROCK, 1f, 150f, PARTICLE_DEBRIS_PEBBLE, null, null);
/**
* Registry of PenetrationHandlers for entities
*/
Expand Down Expand Up @@ -85,11 +100,11 @@ public static void init()

//Multiblocks and machines
PenetrationHandler penHandlerMechanical = new PenetrationHandler(PenetrationHardness.IRON,
1f, 250, IIParticles.PARTICLE_DEBRIS_MECHANICAL, IISounds.hitMetal);
1f, 250, PARTICLE_DEBRIS_MECHANICAL, IISounds.hitMetal);
PenetrationHandler penHandlerHeavyMachine = new PenetrationHandler(PenetrationHardness.STEEL,
1.3f, 350, IIParticles.PARTICLE_DEBRIS_HEAVY_MACHINE, IISounds.hitMetal);
1.3f, 350, PARTICLE_DEBRIS_HEAVY_MACHINE, IISounds.hitMetal);
PenetrationHandler penHandlerLightMachine = new PenetrationHandler(PenetrationHardness.STEEL,
1.1f, 200, IIParticles.PARTICLE_DEBRIS_LIGHT_MACHINE, IISounds.hitMetal);
1.1f, 200, PARTICLE_DEBRIS_LIGHT_MACHINE, IISounds.hitMetal);

batchRegisterHandler(penHandlerMechanical, IEContent.blockMetalMultiblock,
IIContent.blockWoodenMultiblock,
Expand All @@ -104,60 +119,73 @@ public static void init()

//Concrete
registerState(iBlockState -> IIUtils.compareBlockstateOredict(iBlockState, "uberConcrete"),
new PenetrationHandler(PenetrationHardness.UBERCONCRETE, 3f, 350, IIParticles.PARTICLE_DEBRIS_BRICK_BIG, IISounds.hitStone));
new PenetrationHandler(PenetrationHardness.UBERCONCRETE, 3f, 350, PARTICLE_DEBRIS_BRICK_BIG, IISounds.hitStone));
registerState(iBlockState -> IIUtils.compareBlockstateOredict(iBlockState, "sturdyBricksConcrete"),
new PenetrationHandler(PenetrationHardness.PANZERCONCRETE, 2f, 250, IIParticles.PARTICLE_DEBRIS_BRICK_BIG, IISounds.hitStone));
new PenetrationHandler(PenetrationHardness.PANZERCONCRETE, 2f, 250, PARTICLE_DEBRIS_BRICK_BIG, IISounds.hitStone));
registerState(iBlockState -> IIUtils.compareBlockstateOredict(iBlockState, "bricksConcrete"),
new PenetrationHandler(PenetrationHardness.CONCRETE, 1.33f, 200, IIParticles.PARTICLE_DEBRIS_BRICK, IISounds.hitStone));
new PenetrationHandler(PenetrationHardness.CONCRETE, 1.33f, 200, PARTICLE_DEBRIS_BRICK, IISounds.hitStone));
registerState(iBlockState -> IIUtils.compareBlockstateOredict(iBlockState, "leadedConcrete"),
new PenetrationHandler(PenetrationHardness.CONCRETE, 1.66f, 200, IIParticles.PARTICLE_DEBRIS_BRICK, IISounds.hitStone));
new PenetrationHandler(PenetrationHardness.CONCRETE, 1.66f, 200, PARTICLE_DEBRIS_BRICK, IISounds.hitStone));
registerState(iBlockState -> IIUtils.compareBlockstateOredict(iBlockState, "concrete"),
new PenetrationHandler(PenetrationHardness.CONCRETE, 1f, 150, IIParticles.PARTICLE_DEBRIS_PEBBLE, IISounds.hitStone));
new PenetrationHandler(PenetrationHardness.CONCRETE, 1f, 150, PARTICLE_DEBRIS_PEBBLE, IISounds.hitStone));

//Bricks, Stone, Rocks
registerState(state -> state.getBlock()==Blocks.BRICK_BLOCK||state.getBlock()==Blocks.BRICK_STAIRS,
new PenetrationHandler(PenetrationHardness.BRICKS, 1f, 250, IIParticles.PARTICLE_DEBRIS_BRICK, IISounds.hitStone));
new PenetrationHandler(PenetrationHardness.BRICKS, 1f, 250, PARTICLE_DEBRIS_BRICK, IISounds.hitStone));
registerState(state -> state.getBlock()==Blocks.STONEBRICK||state.getBlock()==Blocks.STONE_BRICK_STAIRS,
new PenetrationHandler(PenetrationHardness.BRICKS, 1f, 250, IIParticles.PARTICLE_DEBRIS_BRICK, IISounds.hitStone));
registerOre("stone", new PenetrationHandler(PenetrationHardness.ROCK, 1f, 200, IIParticles.PARTICLE_DEBRIS_PEBBLE, IISounds.hitStone));
registerOre("cobblestone", new PenetrationHandler(PenetrationHardness.ROCK, 1f, 200, IIParticles.PARTICLE_DEBRIS_PEBBLE, IISounds.hitStone));
registerOre("sandstone", new PenetrationHandler(PenetrationHardness.ROCK, 1f, 200, IIParticles.PARTICLE_DEBRIS_PEBBLE, IISounds.hitStone));
new PenetrationHandler(PenetrationHardness.BRICKS, 1f, 250, PARTICLE_DEBRIS_BRICK, IISounds.hitStone));
registerOre("stone", new PenetrationHandler(PenetrationHardness.ROCK, 1f, 200, PARTICLE_DEBRIS_PEBBLE, IISounds.hitStone));
registerOre("cobblestone", new PenetrationHandler(PenetrationHardness.ROCK, 1f, 200, PARTICLE_DEBRIS_PEBBLE, IISounds.hitStone));
registerOre("sandstone", new PenetrationHandler(PenetrationHardness.ROCK, 1f, 200, PARTICLE_DEBRIS_PEBBLE, IISounds.hitStone));

//ground
registerMaterial(Material.ROCK, new PenetrationHandler(PenetrationHardness.ROCK, 1f, 150, IIParticles.PARTICLE_DEBRIS_PEBBLE, IISounds.hitStone));
registerMaterial(Material.GRASS, new PenetrationHandler(PenetrationHardness.GROUND, 1f, 150, IIParticles.PARTICLE_DEBRIS_PEBBLE, IISounds.hitGrass));
registerMaterial(Material.GROUND, new PenetrationHandler(PenetrationHardness.GROUND, 1f, 150, IIParticles.PARTICLE_DEBRIS_PEBBLE, IISounds.hitDirt));
registerMaterial(Material.SAND, new PenetrationHandler(PenetrationHardness.GROUND, 1f, 150, IIParticles.PARTICLE_DEBRIS_PEBBLE, IISounds.hitSand));
registerMaterial(Material.ROCK, new PenetrationHandler(PenetrationHardness.ROCK, 1f, 150, PARTICLE_DEBRIS_PEBBLE, IISounds.hitStone));
registerMaterial(Material.GRASS, new PenetrationHandler(PenetrationHardness.GROUND, 1f, 150, PARTICLE_DEBRIS_PEBBLE, IISounds.hitGrass));
registerMaterial(Material.GROUND, new PenetrationHandler(PenetrationHardness.GROUND, 1f, 150, PARTICLE_DEBRIS_PEBBLE, IISounds.hitDirt));
registerMaterial(Material.SAND, new PenetrationHandler(PenetrationHardness.GROUND, 1f, 150, PARTICLE_DEBRIS_PEBBLE, IISounds.hitSand));

//wood
registerOre("planksWood",
new PenetrationHandler(PenetrationHardness.WOOD, 0.8f, 100, IIParticles.PARTICLE_DEBRIS_PLANK, IISounds.hitWood));
registerOre("plankWood",
new PenetrationHandler(PenetrationHardness.WOOD, 0.8f, 100, PARTICLE_DEBRIS_PLANK, IISounds.hitWood));
registerOre("stairWood",
new PenetrationHandler(PenetrationHardness.WOOD, 0.8f, 100, PARTICLE_DEBRIS_PLANK, IISounds.hitWood));
registerOre("slabWood",
new PenetrationHandler(PenetrationHardness.WOOD, 0.8f, 100, PARTICLE_DEBRIS_PLANK, IISounds.hitWood));
registerOre("plankTreatedWood",
new PenetrationHandler(PenetrationHardness.WOOD, 0.8f, 100, PARTICLE_DEBRIS_PLANK, IISounds.hitWood));
registerOre("stairTreatedWood",
new PenetrationHandler(PenetrationHardness.WOOD, 0.8f, 100, PARTICLE_DEBRIS_PLANK, IISounds.hitWood));
registerOre("slabTreatedWood",
new PenetrationHandler(PenetrationHardness.WOOD, 0.8f, 100, PARTICLE_DEBRIS_PLANK, IISounds.hitWood));
//TODO: 03.01.2025 custom model for wooden logs
registerOre("logWood",
new PenetrationHandler(PenetrationHardness.WOOD, 1f, 250, IIParticles.PARTICLE_DEBRIS_PLANK, IISounds.hitWood));
new PenetrationHandler(PenetrationHardness.WOOD, 1f, 250, PARTICLE_DEBRIS_BRICK, IISounds.hitWood));

//Glass
registerOre("paneGlass", new PenetrationHandler(PenetrationHardness.FRAGILE, 0.125f, 20, IIParticles.PARTICLE_DEBRIS_GLASS, SoundEvents.BLOCK_GLASS_BREAK, null));
registerMaterial(Material.GLASS, new PenetrationHandler(PenetrationHardness.FRAGILE, 0.75f, 80, IIParticles.PARTICLE_DEBRIS_GLASS, SoundEvents.BLOCK_GLASS_BREAK, null));
registerOre("paneGlass", new PenetrationHandler(PenetrationHardness.FRAGILE, 0.125f, 20, PARTICLE_DEBRIS_GLASS, SoundEvents.BLOCK_GLASS_BREAK, null));
registerMaterial(Material.GLASS, new PenetrationHandler(PenetrationHardness.FRAGILE, 0.75f, 80, PARTICLE_DEBRIS_GLASS, SoundEvents.BLOCK_GLASS_BREAK, null));

//Wool
registerMaterial(new Material[]{Material.CARPET, Material.CLOTH},
new PenetrationHandler(PenetrationHardness.FRAGILE, 1f, 50, IIParticles.PARTICLE_DEBRIS_CLOTH, IISounds.impactFoliage, null));
new PenetrationHandler(PenetrationHardness.FRAGILE, 1f, 50, PARTICLE_DEBRIS_CLOTH, IISounds.impactFoliage, null));

//leaves
registerMaterial(new Material[]{Material.LEAVES, Material.VINE},
new PenetrationHandler(PenetrationHardness.FRAGILE, 0.5f, 300, IIParticles.PARTICLE_DEBRIS_BRANCH_LEAF, IISounds.impactFoliage, null));
new PenetrationHandler(PenetrationHardness.FRAGILE, 0.5f, 300, PARTICLE_DEBRIS_BRANCH_LEAF, IISounds.impactFoliage, null));
registerState(state -> state.getBlock()==Blocks.LEAVES&&state.getBlock().getMetaFromState(state)==2, //spruce leaves
new PenetrationHandler(PenetrationHardness.FRAGILE, 0.5f, 300, PARTICLE_DEBRIS_BRANCH_NEEDLE, IISounds.impactFoliage, null));
registerMaterial(new Material[]{Material.CACTUS},
new PenetrationHandler(PenetrationHardness.FRAGILE, 0.8f, 100, IIParticles.PARTICLE_DEBRIS_BRANCH_LEAF, IISounds.impactFoliage, null));
new PenetrationHandler(PenetrationHardness.FRAGILE, 0.8f, 100, PARTICLE_DEBRIS_BRANCH_CACTUS, IISounds.impactFoliage, null));


//grass, crops, etc.
registerState(state -> state.getMaterial()==Material.GRASS&&state.getBlock() instanceof IPlantable,
new PenetrationHandler(PenetrationHardness.GROUND, 1f, 300, IIParticles.PARTICLE_DEBRIS_STRAW, IISounds.hitGrass));
registerMaterial(Material.GOURD, new PenetrationHandler(PenetrationHardness.FRAGILE, 1f, 150, IIParticles.PARTICLE_DEBRIS_STRAW, IISounds.impactFoliage, null));
new PenetrationHandler(PenetrationHardness.GROUND, 1f, 300, PARTICLE_DEBRIS_STRAW, IISounds.hitGrass));
registerMaterial(Material.GOURD, new PenetrationHandler(PenetrationHardness.FRAGILE, 1f, 150, PARTICLE_DEBRIS_STRAW, IISounds.impactFoliage, null));

//EntityLivingBase
REGISTERED_ENTITIES.put(entity -> entity instanceof EntityLivingBase,
new PenetrationHandler(PenetrationHardness.FRAGILE, 1f, 0, IIParticles.PARTICLE_DEBRIS_FLESH, IISounds.impactFlesh, null));
new PenetrationHandler(PenetrationHardness.FRAGILE, 1f, 0, PARTICLE_DEBRIS_FLESH, IISounds.impactFlesh, null));
}

//--- Registration ---//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package pl.pabilo8.immersiveintelligence.api.ammo.penetration;

import pl.pabilo8.immersiveintelligence.api.ammo.PenetrationRegistry;
import pl.pabilo8.immersiveintelligence.api.ammo.enums.HitEffect;
import pl.pabilo8.immersiveintelligence.api.ammo.enums.PenetrationHardness;
import pl.pabilo8.immersiveintelligence.client.fx.IIParticles;
import pl.pabilo8.immersiveintelligence.common.IISounds;
import pl.pabilo8.immersiveintelligence.common.IIUtils;
import pl.pabilo8.immersiveintelligence.common.util.IIStringUtil;

import javax.annotation.Nonnull;
Expand All @@ -22,7 +21,7 @@ public class PenetrationHandlerMetal extends PenetrationHandler

private PenetrationHandlerMetal(String name, PenetrationHardness hardness, float thickness, float integrity)
{
super(hardness, thickness, integrity, IIParticles.PARTICLE_DEBRIS_METAL,
super(hardness, thickness, integrity, PenetrationRegistry.PARTICLE_DEBRIS_METAL,
IISounds.hitMetal.getSpecialSound(HitEffect.IMPACT),
IISounds.hitMetal.getSpecialSound(HitEffect.RICOCHET));
this.name = IIStringUtil.toCamelCase(name.toLowerCase(), false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package pl.pabilo8.immersiveintelligence.api.data.operations.itemstack;

import net.minecraft.item.ItemStack;
import net.minecraftforge.items.ItemHandlerHelper;
import pl.pabilo8.immersiveintelligence.api.data.DataPacket;
import pl.pabilo8.immersiveintelligence.api.data.operations.DataOperation;
import pl.pabilo8.immersiveintelligence.api.data.types.DataTypeBoolean;
Expand All @@ -26,6 +26,7 @@ public DataType execute(DataPacket packet, DataTypeExpression data)
DataTypeItemStack t1 = packet.getVarInType(DataTypeItemStack.class, data.getArgument(0));
DataTypeItemStack t2 = packet.getVarInType(DataTypeItemStack.class, data.getArgument(1));
//Yes
return new DataTypeBoolean(ItemStack.areItemStacksEqual(t1.value, t2.value));

return new DataTypeBoolean(ItemHandlerHelper.canItemStacksStackRelaxed(t1.value, t2.value));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1448,9 +1448,22 @@ public void onPostClientTick(ClientTickEvent event)
/**
* @param pos position of the explosion / screenshake source
* @param strength strength of the shake
* @param duration duration of the shake in ticks
*/
public static void addScreenshakeSource(Vec3d pos, float strength, float duration)
{
SCREEN_SHAKE_EFFECTS.add(new ScreenShake(strength, duration, pos));
}

/**
* @param pos position of the explosion / screenshake source
* @param strength strength of the shake
* @param duration duration of the shake in ticks
*/
public static void addScreenshakeSource(Vec3d pos, float strength, float duration, float delay)
{
SCREEN_SHAKE_EFFECTS.add(new ScreenShake(strength, duration, delay, pos));
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import pl.pabilo8.immersiveintelligence.api.ammo.parts.IAmmoTypeItem;
import pl.pabilo8.immersiveintelligence.api.utils.IUpgradableMachine;
import pl.pabilo8.immersiveintelligence.client.fx.IIParticles;
import pl.pabilo8.immersiveintelligence.client.fx.utils.ParticleRegistry;
import pl.pabilo8.immersiveintelligence.client.gui.block.GuiUpgrade;
import pl.pabilo8.immersiveintelligence.client.manual.IIManualCategory;
import pl.pabilo8.immersiveintelligence.client.manual.categories.*;
Expand Down Expand Up @@ -341,6 +342,7 @@ public void preInit()
//Load particle models
IIParticles.preInit();
IIParticles.init();
ParticleRegistry.loadAllParticleFiles();

//Register entity renderers
registerEntityRenderer(EntitySkyCrate.class, SkyCrateRenderer::new);
Expand All @@ -356,7 +358,6 @@ public void preInit()
registerEntityRenderer(EntityFieldHowitzer.class, FieldHowitzerRenderer::new);
registerEntityRenderer(EntityTripodPeriscope.class, TripodPeriscopeRenderer::new);
registerEntityRenderer(EntityMortar.class, MortarRenderer::new);
registerEntityRenderer(EntityHMXDynamitePrimed.class, HMXDynamitePrimedRenderer::new);
//Thanks Blu!
registerEntityRenderer(EntityCamera.class, EntityRenderNone::new);
registerEntityRenderer(EntitySkycrateInternal.class, EntityRenderNone::new);
Expand Down
Loading

0 comments on commit df5be62

Please sign in to comment.