Skip to content

Commit

Permalink
Improve object holder usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Jan 22, 2025
1 parent 4052e24 commit b30374a
Show file tree
Hide file tree
Showing 15 changed files with 188 additions and 267 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import net.minecraft.world.World;

import mod.emt.harkenscythe.init.HSItems;
import mod.emt.harkenscythe.init.HSMaterials;
import mod.emt.harkenscythe.init.HSSoundEvents;
import mod.emt.harkenscythe.item.armor.HSArmorDyeable;
import mod.emt.harkenscythe.tileentity.HSTileEntityCrucible;
Expand Down Expand Up @@ -139,7 +140,7 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
else if (essenceCount > 0 && heldItem instanceof HSArmorDyeable)
{
HSArmorDyeable armor = (HSArmorDyeable) heldItem;
if (armor.hasColor(heldStack) && ((armor.getArmorMaterial() == HSItems.ARMOR_BLOODWEAVE && this instanceof HSBlockBloodCrucible) || (armor.getArmorMaterial() == HSItems.ARMOR_SOULWEAVE && this instanceof HSBlockSoulCrucible)))
if (armor.hasColor(heldStack) && ((armor.getArmorMaterial() == HSMaterials.ARMOR_BLOODWEAVE && this instanceof HSBlockBloodCrucible) || (armor.getArmorMaterial() == HSMaterials.ARMOR_SOULWEAVE && this instanceof HSBlockSoulCrucible)))
{
armor.removeColor(heldStack);
((HSTileEntityCrucible) te).setEssenceCount(world, pos, state, essenceCount - 10);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/mod/emt/harkenscythe/entity/HSEntitySoul.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import mod.emt.harkenscythe.event.HSEventLivingDeath;
import mod.emt.harkenscythe.init.HSItems;
import mod.emt.harkenscythe.init.HSMaterials;
import mod.emt.harkenscythe.init.HSSoundEvents;
import mod.emt.harkenscythe.item.armor.HSArmor;
import mod.emt.harkenscythe.item.tool.IHSTool;
Expand Down Expand Up @@ -257,6 +258,6 @@ private ItemStack getRandomDamagedLivingmetalEquipment(EntityPlayer player)

private boolean isLivingmetalItem(Item item)
{
return (item instanceof HSArmor && ((HSArmor) item).getArmorMaterial() == HSItems.ARMOR_LIVINGMETAL) || (item instanceof IHSTool && ((IHSTool) item).getToolMaterial() == HSItems.TOOL_LIVINGMETAL);
return (item instanceof HSArmor && ((HSArmor) item).getArmorMaterial() == HSMaterials.ARMOR_LIVINGMETAL) || (item instanceof IHSTool && ((IHSTool) item).getToolMaterial() == HSMaterials.TOOL_LIVINGMETAL);
}
}
58 changes: 21 additions & 37 deletions src/main/java/mod/emt/harkenscythe/init/HSBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,37 @@
import mod.emt.harkenscythe.HarkenScythe;
import mod.emt.harkenscythe.block.*;

@SuppressWarnings("unused")
@SuppressWarnings({"DataFlowIssue", "unused"})
@Mod.EventBusSubscriber(modid = HarkenScythe.MOD_ID)
@GameRegistry.ObjectHolder(HarkenScythe.MOD_ID)
public class HSBlocks
{
@GameRegistry.ObjectHolder("biomass_block")
public static HSBlockMaterial biomass_block;
@GameRegistry.ObjectHolder("biomass_crop")
public static HSBlockBiomassCrop biomass_crop;
public static final HSBlockMaterial biomass_block = null;
public static final HSBlockMaterial livingmetal_block = null;

@GameRegistry.ObjectHolder("livingmetal_block")
public static HSBlockMaterial livingmetal_block;
@GameRegistry.ObjectHolder("livingmetal_core")
public static HSBlockLivingmetalCore livingmetal_core;
public static final HSBlockSpectralGlass spectral_glass = null;
public static final HSBlockSpectralGlass spectral_glass_inverted = null;
public static final HSBlockSpectralGlassPane spectral_glass_pane = null;
public static final HSBlockSpectralGlassPane spectral_glass_pane_inverted = null;

@GameRegistry.ObjectHolder("spectral_glass")
public static HSBlockSpectralGlass spectral_glass;
@GameRegistry.ObjectHolder("spectral_glass_inverted")
public static HSBlockSpectralGlass spectral_glass_inverted;
@GameRegistry.ObjectHolder("spectral_glass_pane")
public static HSBlockSpectralGlassPane spectral_glass_pane;
@GameRegistry.ObjectHolder("spectral_glass_pane_inverted")
public static HSBlockSpectralGlassPane spectral_glass_pane_inverted;
public static final HSBlockCreep creep_block = null;
public static final HSBlockCreep creep_block_tilled = null;
public static final HSBlockCreep creep_block_tilled_bloodied = null;

@GameRegistry.ObjectHolder("creep_block")
public static HSBlockCreep creep_block;
@GameRegistry.ObjectHolder("creep_block_tilled")
public static HSBlockCreep creep_block_tilled;
@GameRegistry.ObjectHolder("creep_block_tilled_bloodied")
public static HSBlockCreep creep_block_tilled_bloodied;
public static final HSBlockCloth bloodweave_cloth = null;
public static final HSBlockCloth soulweave_cloth = null;

@GameRegistry.ObjectHolder("bloodweave_cloth")
public static HSBlockCloth bloodweave_cloth;
@GameRegistry.ObjectHolder("soulweave_cloth")
public static HSBlockCloth soulweave_cloth;
public static final HSBlockBloodCrucible blood_crucible = null;
public static final HSBlockSoulCrucible soul_crucible = null;

@GameRegistry.ObjectHolder("blood_altar")
public static HSBlockBloodAltar blood_altar;
@GameRegistry.ObjectHolder("soul_altar")
public static HSBlockSoulAltar soul_altar;
@GameRegistry.ObjectHolder("blood_crucible")
public static HSBlockBloodCrucible blood_crucible;
@GameRegistry.ObjectHolder("soul_crucible")
public static HSBlockSoulCrucible soul_crucible;
public static final HSBlockBloodAltar blood_altar = null;
public static final HSBlockSoulAltar soul_altar = null;

@GameRegistry.ObjectHolder("soul_cake")
public static HSBlockSoulCake soul_cake;
public static final HSBlockSoulCake soul_cake = null;

public static final HSBlockBiomassCrop biomass_crop = null;

public static final HSBlockLivingmetalCore livingmetal_core = null;

@SubscribeEvent
public static void onRegisterBlocksEvent(@Nonnull final RegistryEvent.Register<Block> event)
Expand Down
Loading

0 comments on commit b30374a

Please sign in to comment.