Skip to content

Commit

Permalink
Rework item registry
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Jan 25, 2025
1 parent 143f747 commit 9de0db3
Show file tree
Hide file tree
Showing 25 changed files with 211 additions and 241 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public void preInitClient(FMLPreInitializationEvent event) {
public void initClient(FMLInitializationEvent event) {
IItemColor itemCrystalPlanterColourHandler = (stack, tintIndex) -> {
Item item = stack.getItem();
if (item == CRItems.manaBeanItem) {
if (item == CRItems.MANA_BEAN) {
return ((CRItemManaBean) item).getColor(stack, tintIndex);
}
return 16777215;
};
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(itemCrystalPlanterColourHandler, CRItems.manaBeanItem);
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(itemCrystalPlanterColourHandler, CRItems.MANA_BEAN);
}

@SideOnly(Side.CLIENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockSta
aspect = ((CRTileManaPod) tile).aspect;
}
for (int k1 = 0; k1 < b0; k1++) {
ItemStack i = new ItemStack(CRItems.manaBeanItem);
ItemStack i = new ItemStack(CRItems.MANA_BEAN);
((CRItemManaBean) i.getItem()).setAspects(i, (new AspectList()).add(aspect, CRConfig.general_settings.MANA_BEAN_ASPECT));
dropped.add(i);
}
Expand All @@ -217,7 +217,7 @@ public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockSta
@SideOnly(Side.CLIENT)
@Override
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) {
return CRItems.manaBeanItem.getDefaultInstance();
return CRItems.MANA_BEAN.getDefaultInstance();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ protected void applyEntityAttributes() {

@Override
protected void setLoot(DifficultyInstance diff) {
this.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(CRItems.crimsonArcherHelmet));
this.setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(CRItems.crimsonArcherChestplate));
this.setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(CRItems.crimsonArcherGreaves));
this.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(CRItems.CRIMSON_ARCHER_HELMET));
this.setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(CRItems.CRIMSON_ARCHER_CHESTPLATE));
this.setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(CRItems.CRIMSON_ARCHER_LEGGINGS));
this.setItemStackToSlot(EntityEquipmentSlot.FEET, new ItemStack(ItemsTC.crimsonBoots));
this.setHeldItem(this.getActiveHand(), new ItemStack(Items.BOW));
}
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/mod/icarus/crimsonrevelations/events/CREvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static void runicShieldHurtEvent(LivingHurtEvent event) {

// Kinetic Girdle of Shielding - Explodes when the Runic Shielding is pierced (20 second cooldown).
if (charge > 0) {
if (charge <= event.getAmount() && BaublesApi.isBaubleEquipped(player, CRItems.runicGirdleKinetic) > 2 && !(player.getCooldownTracker().hasCooldown(CRItems.runicGirdleKinetic))) {
if (charge <= event.getAmount() && BaublesApi.isBaubleEquipped(player, CRItems.RUNIC_GIRDLE_KINETIC) > 2 && !(player.getCooldownTracker().hasCooldown(CRItems.RUNIC_GIRDLE_KINETIC))) {
player.world.playSound(null, player.posX, player.posY, player.posZ, CRSoundEvents.RUNIC_BAUBLE_KINETIC, SoundCategory.PLAYERS, 0.8F, 1.0F);
player.world.createExplosion(player, player.posX, player.posY + player.height / 2.0F, player.posZ, 2.0F, false);

Expand All @@ -50,34 +50,34 @@ public static void runicShieldHurtEvent(LivingHurtEvent event) {
}
}

((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.runicGirdleKinetic));
((EntityPlayer) player).getCooldownTracker().setCooldown(CRItems.runicGirdleKinetic, 20 * 20);
((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.RUNIC_GIRDLE_KINETIC));
((EntityPlayer) player).getCooldownTracker().setCooldown(CRItems.RUNIC_GIRDLE_KINETIC, 20 * 20);
}

// Revitalizing Ring of Shielding - Gives 6 seconds of Regeneration II when the Runic Shielding is pierced (20 second cooldown).
if (charge <= event.getAmount() && BaublesApi.isBaubleEquipped(player, CRItems.runicRingRegen) > 0 && !(player.getCooldownTracker().hasCooldown(CRItems.runicRingRegen))) {
if (charge <= event.getAmount() && BaublesApi.isBaubleEquipped(player, CRItems.RUNIC_RING_REGEN) > 0 && !(player.getCooldownTracker().hasCooldown(CRItems.RUNIC_RING_REGEN))) {
player.world.playSound(null, player.posX, player.posY, player.posZ, CRSoundEvents.RUNIC_BAUBLE_REGEN, SoundCategory.PLAYERS, 1.5F, 1.0F);
player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 6 * 20, 1, true, true));

((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.runicRingRegen));
((EntityPlayer) player).getCooldownTracker().setCooldown(CRItems.runicRingRegen, 20 * 20);
((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.RUNIC_RING_REGEN));
((EntityPlayer) player).getCooldownTracker().setCooldown(CRItems.RUNIC_RING_REGEN, 20 * 20);
}

// Amulet of Emergency Shielding - Gives 8 points of Runic Shielding when the Runic Shielding is pierced (40 second cooldown).
if (charge <= event.getAmount() && BaublesApi.isBaubleEquipped(player, CRItems.runicAmuletEmergency) > -1 && !(player.getCooldownTracker().hasCooldown(CRItems.runicAmuletEmergency))) {
if (charge <= event.getAmount() && BaublesApi.isBaubleEquipped(player, CRItems.RUNIC_AMULET_EMERGENCY) > -1 && !(player.getCooldownTracker().hasCooldown(CRItems.RUNIC_AMULET_EMERGENCY))) {
player.world.playSound(null, player.posX, player.posY, player.posZ, CRSoundEvents.RUNIC_BAUBLE_EMERGENCY, SoundCategory.PLAYERS, 1.0F, 1.0F);
player.setAbsorptionAmount(charge + 8);

((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.runicAmuletEmergency));
((EntityPlayer) player).getCooldownTracker().setCooldown(CRItems.runicAmuletEmergency, 40 * 20);
((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.RUNIC_AMULET_EMERGENCY));
((EntityPlayer) player).getCooldownTracker().setCooldown(CRItems.RUNIC_AMULET_EMERGENCY, 40 * 20);
}

// Charged Ring of Shielding - 25% chance to give 1 point of Runic Shielding, often restoring the Runic Shielding lost from damage.
if (BaublesApi.isBaubleEquipped(player, CRItems.runicRingCharged) > 0 && !(player.getCooldownTracker().hasCooldown(CRItems.runicRingCharged)) && player.world.rand.nextDouble() <= 0.25D) {
if (BaublesApi.isBaubleEquipped(player, CRItems.RUNIC_RING_CHARGED) > 0 && !(player.getCooldownTracker().hasCooldown(CRItems.RUNIC_RING_CHARGED)) && player.world.rand.nextDouble() <= 0.25D) {
player.world.playSound(null, player.posX, player.posY, player.posZ, CRSoundEvents.RUNIC_BAUBLE_CHARGE, SoundCategory.PLAYERS, 1.0F, 1.0F + (float) player.getEntityWorld().rand.nextGaussian() * 0.05F);
player.setAbsorptionAmount(charge + 1);

((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.runicRingCharged));
((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.RUNIC_RING_CHARGED));
}
}
}
Expand All @@ -88,7 +88,7 @@ public static void onAttackEvent(LivingAttackEvent event) {
for (ItemStack stack : event.getEntityLiving().getArmorInventoryList()) {

// Prevents screen shaking and damage sound.
if (stack.getItem() == CRItems.meteorBoots) {
if (stack.getItem() == CRItems.METEOR_BOOTS) {
if (event.getSource() == DamageSource.HOT_FLOOR) {
event.setCanceled(true);
}
Expand All @@ -101,7 +101,7 @@ public static void onDamageEvent(LivingDamageEvent event) {
for (ItemStack stack : event.getEntityLiving().getArmorInventoryList()) {

// Immune to these damage types.
if (stack.getItem() == CRItems.meteorBoots) {
if (stack.getItem() == CRItems.METEOR_BOOTS) {
if (event.getSource() == DamageSource.HOT_FLOOR) {
event.setAmount(0.0F);
event.setCanceled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.AspectRegistryEvent;

@SuppressWarnings("deprecation")
@EventBusSubscriber(modid = NewCrimsonRevelations.MODID)
@GameRegistry.ObjectHolder(NewCrimsonRevelations.MODID)
public class CRAspects {
@SubscribeEvent
public static void registerAspects(AspectRegistryEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import thaumcraft.common.entities.monster.EntityBrainyZombie;
import thaumcraft.common.entities.monster.EntityGiantBrainyZombie;

@EventBusSubscriber(modid = NewCrimsonRevelations.MODID)
@GameRegistry.ObjectHolder(NewCrimsonRevelations.MODID)
public class CREntities {
@SubscribeEvent
public static void registerEntities(RegistryEvent.Register<EntityEntry> event) {
Expand Down
Loading

0 comments on commit 9de0db3

Please sign in to comment.