Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c40c4af
Update ACTagRegistry.java
PikachuGabe Dec 23, 2024
f77c890
hopefully make hazmat protection use tags instead
PikachuGabe Dec 23, 2024
e9d68cf
fix method
PikachuGabe Dec 23, 2024
64db89d
Adding acid tag support
PikachuGabe Dec 25, 2024
a54d951
Update naming
PikachuGabe Dec 25, 2024
65b6eb2
Merge pull request #1 from AlexModGuy/main
PikachuGabe Jan 16, 2025
d0fd19b
fix addons breaking
PikachuGabe Jan 27, 2025
e8b114f
Update ACTagRegistry.java
PikachuGabe Apr 24, 2025
75bba53
add varying radiation levels
PikachuGabe Apr 24, 2025
908726b
fix the damned tags
PikachuGabe Apr 28, 2025
9d4f33a
comment the tags
PikachuGabe Apr 28, 2025
26a46c3
adding group tags
PikachuGabe Apr 28, 2025
011390d
populating radioactive blocks list
PikachuGabe Apr 28, 2025
e3c7df8
populating radioactive items list
PikachuGabe Apr 28, 2025
0b85d02
remembered i need the mod id
PikachuGabe Apr 28, 2025
6579ce6
Create weak_radioactive_blocks.json
PikachuGabe Apr 28, 2025
fa70f86
Populate the radiactive blocks tag
PikachuGabe Apr 28, 2025
9a22b3e
populate strong radioactive blocks list
PikachuGabe Apr 28, 2025
24c051a
populate weak radioactive items list
PikachuGabe Apr 28, 2025
af6eefe
Populate radioactive items list
PikachuGabe Apr 28, 2025
7e2c9f4
populating strong radioactive item list
PikachuGabe Apr 28, 2025
4552229
add a tag-based way of making items radioactive
PikachuGabe Apr 30, 2025
343b1b7
enable the item mixin
PikachuGabe Apr 30, 2025
cba4eac
remove unused item properties
PikachuGabe Apr 30, 2025
3eaa74c
disable old radioactive item method
PikachuGabe Apr 30, 2025
dece615
disable the radioactive block item math
PikachuGabe Apr 30, 2025
482c6de
fix a stupid mistake i made
PikachuGabe Apr 30, 2025
dadf893
whoops, forgot about this
PikachuGabe Apr 30, 2025
4a5b326
Tag support for RadioactiveOnDestroyedBlockItem?
PikachuGabe Aug 9, 2025
c4a6d42
Revert d0fd19b103e82dc8e1da704236fd91fec784ba06
PikachuGabe Aug 9, 2025
198b590
Merge branch 'main' into main
PikachuGabe Aug 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.github.alexmodguy.alexscaves.mixin;

import com.github.alexmodguy.alexscaves.AlexsCaves;
import com.github.alexmodguy.alexscaves.server.item.HazmatArmorItem;
import com.github.alexmodguy.alexscaves.server.message.UpdateEffectVisualityEntityMessage;
import com.github.alexmodguy.alexscaves.server.potion.ACEffectRegistry;
import com.github.alexmodguy.alexscaves.server.misc.ACTagRegistry;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Level;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Item.class)
public class ItemMixin {

@Inject(method = "inventoryTick", at = @At("HEAD"))
public void inventoryTick(ItemStack stack, Level level, Entity entity, int i, boolean held, CallbackInfo info) {

if (!stack.is(ACTagRegistry.ALL_RADIOACTIVE_ITEMS)) {
return;
}

if (!level.isClientSide && entity instanceof LivingEntity living && !(living instanceof Player player && player.isCreative())) {

float randomChanceOfRadiation = 0.0F;

if (stack.is(ACTagRegistry.WEAK_RADIOACTIVE_ITEMS)) {
randomChanceOfRadiation = 0.0005F;
}

if (stack.is(ACTagRegistry.RADIOACTIVE_ITEMS)) {
randomChanceOfRadiation = 0.001F;
}

if (stack.is(ACTagRegistry.STRONG_RADIOACTIVE_ITEMS)) {
randomChanceOfRadiation = 0.01F;
}

float stackChance = stack.getCount() * randomChanceOfRadiation;
float hazmatMultiplier = 1F - HazmatArmorItem.getRadProtection(living) / 4F;

if (!living.hasEffect(ACEffectRegistry.IRRADIATED.get()) && level.random.nextFloat() < stackChance * hazmatMultiplier) {
MobEffectInstance instance = new MobEffectInstance(ACEffectRegistry.IRRADIATED.get(), 1800);
living.addEffect(instance);
AlexsCaves.sendMSGToAll(new UpdateEffectVisualityEntityMessage(entity.getId(), entity.getId(), 0, instance.getDuration()));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ public void entityInside(BlockState blockState, Level level, BlockPos pos, Entit
for (EquipmentSlot slot : EquipmentSlot.values()) {
if (slot.isArmor()) {
ItemStack item = living.getItemBySlot(slot);
if (item != null && item.isDamageableItem() && !(item.getItem() instanceof HazmatArmorItem)) {
if (item != null && item.isDamageableItem() && !(item.is(ACTagRegistry.ACID_PROTECTIVE_ARMOR))) {
armor = true;
if (living.getRandom().nextFloat() < 0.05F && !(entity instanceof Player player && player.isCreative())) {
item.hurtAndBreak(1, living, e -> e.broadcastBreakEvent(slot));
}
}
}
}
dmgMultiplier = 1.0F - (HazmatArmorItem.getWornAmount(living) / 4F);
dmgMultiplier = 1.0F - (HazmatArmorItem.getAcidProtection(living) / 4F);
}
if (armor) {
ACAdvancementTriggerRegistry.ENTER_ACID_WITH_ARMOR.triggerForEntity(entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public class ACItemRegistry {
public static final RegistryObject<Item> RADGILL_BUCKET = DEF_REG.register("radgill_bucket", () -> new ModFishBucketItem(ACEntityRegistry.RADGILL, ACFluidRegistry.ACID_FLUID_SOURCE, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1)));
public static final RegistryObject<Item> RADGILL = DEF_REG.register("radgill", () -> new Item(new Item.Properties().food(ACFoods.RADGILL)));
public static final RegistryObject<Item> COOKED_RADGILL = DEF_REG.register("cooked_radgill", () -> new Item(new Item.Properties().food(ACFoods.RADGILL_COOKED)));
public static final RegistryObject<Item> URANIUM = DEF_REG.register("uranium", () -> new RadioactiveItem(new Item.Properties(), 0.001F));
public static final RegistryObject<Item> URANIUM_SHARD = DEF_REG.register("uranium_shard", () -> new RadioactiveItem(new Item.Properties(), 0.001F));
public static final RegistryObject<Item> URANIUM = DEF_REG.register("uranium", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> URANIUM_SHARD = DEF_REG.register("uranium_shard", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> SULFUR_DUST = DEF_REG.register("sulfur_dust", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> RADON_BOTTLE = DEF_REG.register("radon_bottle", () -> new Item(new Item.Properties().craftRemainder(Items.GLASS_BOTTLE).stacksTo(16)));
public static final RegistryObject<Item> CINDER_BRICK = DEF_REG.register("cinder_brick", () -> new ThrownProjectileItem(new Item.Properties(), player -> new CinderBrickEntity(player.level(), player), -20.0F, 0.65F, 0.9F));
Expand All @@ -127,8 +127,8 @@ public class ACItemRegistry {
public static final RegistryObject<Item> HAZMAT_CHESTPLATE = DEF_REG.register("hazmat_chestplate", () -> new HazmatArmorItem(HAZMAT_SUIT_ARMOR_MATERIAL, ArmorItem.Type.CHESTPLATE));
public static final RegistryObject<Item> HAZMAT_LEGGINGS = DEF_REG.register("hazmat_leggings", () -> new HazmatArmorItem(HAZMAT_SUIT_ARMOR_MATERIAL, ArmorItem.Type.LEGGINGS));
public static final RegistryObject<Item> HAZMAT_BOOTS = DEF_REG.register("hazmat_boots", () -> new HazmatArmorItem(HAZMAT_SUIT_ARMOR_MATERIAL, ArmorItem.Type.BOOTS));
public static final RegistryObject<Item> FISSILE_CORE = DEF_REG.register("fissile_core", () -> new RadioactiveItem(new Item.Properties().rarity(Rarity.UNCOMMON), 0.001F));
public static final RegistryObject<Item> CHARRED_REMNANT = DEF_REG.register("charred_remnant", () -> new RadioactiveItem(new Item.Properties(), 0.0005F));
public static final RegistryObject<Item> FISSILE_CORE = DEF_REG.register("fissile_core", () -> new Item(new Item.Properties().rarity(Rarity.UNCOMMON)));
public static final RegistryObject<Item> CHARRED_REMNANT = DEF_REG.register("charred_remnant", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> REMOTE_DETONATOR = DEF_REG.register("remote_detonator", () -> new RemoteDetonatorItem());
public static final RegistryObject<Item> RAYGUN = DEF_REG.register("raygun", () -> new RaygunItem());
public static final RegistryObject<Item> MUSIC_DISC_FUSION_FRAGMENT = DEF_REG.register("disc_fragment_fusion", () -> new DiscFragmentItem(new Item.Properties()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.alexmodguy.alexscaves.server.item;

import com.github.alexmodguy.alexscaves.AlexsCaves;
import com.github.alexmodguy.alexscaves.server.misc.ACTagRegistry;
import com.github.alexmodguy.alexscaves.client.particle.ACParticleRegistry;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
Expand Down Expand Up @@ -50,18 +51,35 @@ public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot
}
}

public static int getWornAmount(LivingEntity entity) {
public static int getRadProtection(LivingEntity entity) {
int i = 0;
if (entity.getItemBySlot(EquipmentSlot.HEAD).is(ACItemRegistry.HAZMAT_MASK.get())) {
if (entity.getItemBySlot(EquipmentSlot.HEAD).is(ACTagRegistry.RAD_PROTECTIVE_ARMOR)) {
i++;
}
if (entity.getItemBySlot(EquipmentSlot.CHEST).is(ACItemRegistry.HAZMAT_CHESTPLATE.get())) {
if (entity.getItemBySlot(EquipmentSlot.CHEST).is(ACTagRegistry.RAD_PROTECTIVE_ARMOR)) {
i++;
}
if (entity.getItemBySlot(EquipmentSlot.LEGS).is(ACItemRegistry.HAZMAT_LEGGINGS.get())) {
if (entity.getItemBySlot(EquipmentSlot.LEGS).is(ACTagRegistry.RAD_PROTECTIVE_ARMOR)) {
i++;
}
if (entity.getItemBySlot(EquipmentSlot.FEET).is(ACItemRegistry.HAZMAT_BOOTS.get())) {
if (entity.getItemBySlot(EquipmentSlot.FEET).is(ACTagRegistry.RAD_PROTECTIVE_ARMOR)) {
i++;
}
return i;
}

public static int getAcidProtection(LivingEntity entity) {
int i = 0;
if (entity.getItemBySlot(EquipmentSlot.HEAD).is(ACTagRegistry.ACID_PROTECTIVE_ARMOR)) {
i++;
}
if (entity.getItemBySlot(EquipmentSlot.CHEST).is(ACTagRegistry.ACID_PROTECTIVE_ARMOR)) {
i++;
}
if (entity.getItemBySlot(EquipmentSlot.LEGS).is(ACTagRegistry.ACID_PROTECTIVE_ARMOR)) {
i++;
}
if (entity.getItemBySlot(EquipmentSlot.FEET).is(ACTagRegistry.ACID_PROTECTIVE_ARMOR)) {
i++;
}
return i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ public RadioactiveBlockItem(RegistryObject<Block> blockSupplier, Properties prop
this.randomChanceOfRadiation = randomChanceOfRadiation;
}

public void inventoryTick(ItemStack stack, Level level, Entity entity, int i, boolean held) {
/*public void inventoryTick(ItemStack stack, Level level, Entity entity, int i, boolean held) {
super.inventoryTick(stack, level, entity, i, held);
if (!level.isClientSide && entity instanceof LivingEntity living && !(living instanceof Player player && player.isCreative())) {
float stackChance = stack.getCount() * randomChanceOfRadiation;
float hazmatMultiplier = 1F - HazmatArmorItem.getWornAmount(living) / 4F;
float hazmatMultiplier = 1F - HazmatArmorItem.getRadProtection(living) / 4F;
if (!living.hasEffect(ACEffectRegistry.IRRADIATED.get()) && level.random.nextFloat() < stackChance * hazmatMultiplier) {
MobEffectInstance instance = new MobEffectInstance(ACEffectRegistry.IRRADIATED.get(), 1800);
living.addEffect(instance);
AlexsCaves.sendMSGToAll(new UpdateEffectVisualityEntityMessage(entity.getId(), entity.getId(), 0, instance.getDuration()));
}
}
}
}*/


}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.alexmodguy.alexscaves.server.item;
/*package com.github.alexmodguy.alexscaves.server.item;

import com.github.alexmodguy.alexscaves.AlexsCaves;
import com.github.alexmodguy.alexscaves.server.message.UpdateEffectVisualityEntityMessage;
Expand All @@ -24,7 +24,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int i, bo
super.inventoryTick(stack, level, entity, i, held);
if (!level.isClientSide && entity instanceof LivingEntity living && !(living instanceof Player player && player.isCreative())) {
float stackChance = stack.getCount() * randomChanceOfRadiation;
float hazmatMultiplier = 1F - HazmatArmorItem.getWornAmount(living) / 4F;
float hazmatMultiplier = 1F - HazmatArmorItem.getRadProtection(living) / 4F;
if (!living.hasEffect(ACEffectRegistry.IRRADIATED.get()) && level.random.nextFloat() < stackChance * hazmatMultiplier) {
MobEffectInstance instance = new MobEffectInstance(ACEffectRegistry.IRRADIATED.get(), 1800);
living.addEffect(instance);
Expand All @@ -33,3 +33,4 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int i, bo
}
}
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.alexmodguy.alexscaves.client.particle.ACParticleRegistry;
import com.github.alexmodguy.alexscaves.server.potion.ACEffectRegistry;
import com.github.alexmodguy.alexscaves.server.misc.ACTagRegistry;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.AreaEffectCloud;
Expand All @@ -18,6 +19,10 @@ public RadioactiveOnDestroyedBlockItem(RegistryObject<Block> blockSupplier, Prop

@Override
public void onDestroyed(ItemEntity itemEntity, DamageSource damageSource){
var stack = itemEntity.getItem();
if (!stack.is(ACTagRegistry.ALL_RADIOACTIVE_ITEMS)) {
return;
}
super.onDestroyed(itemEntity, damageSource);
if(!damageSource.isCreativePlayer() && !itemEntity.isRemoved()){
itemEntity.discard();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ public class ACTagRegistry {
public static final TagKey<Structure> GINGERBREAD_MEN_WANDER_THROUGH = registerStructureTag("gingerbread_men_wander_through");
public static final TagKey<DamageType> DEEP_ONE_IGNORES = registerDamageTypeTag("deep_one_ignores");
public static final TagKey<Fluid> DOES_NOT_FLOW_INTO_WATERLOGGABLE_BLOCKS = registerFluidTag("does_not_flow_into_waterloggable_blocks");
public static final TagKey<Item> RAD_PROTECTIVE_ARMOR = registerItemTag("rad_protective_armor");
public static final TagKey<Item> ACID_PROTECTIVE_ARMOR = registerItemTag("acid_protective_armor");
public static final TagKey<Item> WEAK_RADIOACTIVE_ITEMS = registerItemTag("weak_radioactive_items"); // 0.0005F
public static final TagKey<Block> WEAK_RADIOACTIVE_BLOCKS = registerBlockTag("weak_radioactive_blocks"); // 0.0005F
public static final TagKey<Item> RADIOACTIVE_ITEMS = registerItemTag("radioactive_items"); // 0.001F
public static final TagKey<Block> RADIOACTIVE_BLOCKS = registerBlockTag("radioactive_blocks"); // 0.001F
public static final TagKey<Item> STRONG_RADIOACTIVE_ITEMS = registerItemTag("strong_radioactive_items"); // 0.01F
public static final TagKey<Block> STRONG_RADIOACTIVE_BLOCKS = registerBlockTag("strong_radioactive_blocks"); // 0.01F
public static final TagKey<Item> ALL_RADIOACTIVE_ITEMS = registerItemTag("all_radioactive_items"); // contains a list of all radioactive items
public static final TagKey<Block> ALL_RADIOACTIVE_BLOCKS = registerBlockTag("all_radioactive_blocks"); // contains a list of all radioactive blocks

private static TagKey<EntityType<?>> registerEntityTag(String name) {
return TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(AlexsCaves.MODID, name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected IrradiatedEffect() {
}

public void applyEffectTick(LivingEntity entity, int tick) {
int hazmat = HazmatArmorItem.getWornAmount(entity);
int hazmat = HazmatArmorItem.getRadProtection(entity);
float damageScale = 1F - hazmat * 0.25F;
if (entity instanceof Player player && hazmat == 0) {
player.causeFoodExhaustion(0.4F);
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/alexscaves.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"CoralFeatureMixin",
"EnchantRandomlyFunctionMixin",
"EntityMixin",
"ItemMixin",
"FallingBlockEntityMixin",
"FlowingFluidMixin",
"FoodDataMixin",
Expand Down Expand Up @@ -64,4 +65,4 @@
"defaultRequire": 1
},
"minVersion": "0.8"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"#alexscaves:weak_radioactive_blocks",
"#alexscaves:radioactive_blocks",
"#alexscaves:strong_radioactive_blocks"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"alexscaves:radrock_uranium_ore",
"alexscaves:block_of_uranium",
"alexscaves:unrefined_waste"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"alexscaves:waste_drum"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"replace": false,
"values": [
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"values": [
"alexscaves:hazmat_mask",
"alexscaves:hazmat_chestplate",
"alexscaves:hazmat_leggings",
"alexscaves:hazmat_boots"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"#alexscaves:weak_radioactive_items",
"#alexscaves:radioactive_items",
"#alexscaves:strong_radioactive_items"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"values": [
"alexscaves:hazmat_mask",
"alexscaves:hazmat_chestplate",
"alexscaves:hazmat_leggings",
"alexscaves:hazmat_boots"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"replace": false,
"values": [
"alexscaves:radrock_uranium_ore",
"alexscaves:block_of_uranium",
"alexscaves:unrefined_waste",
"alexscaves:fissile_core",
"alexscaves:uranium_shard",
"alexscaves:uranium"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"alexscaves:waste_drum"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"alexscaves:charred_remnant"
]
}