use of icbm.classic.content.items.ItemLaserDetonator in project ICBM-Classic by BuiltBrokenModding.
the class ItemReg method registerItems.
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {
// Items
event.getRegistry().register(new ItemGrenade().setName("grenade").setCreativeTab(ICBMClassic.CREATIVE_TAB));
event.getRegistry().register(new ItemBombCart().setName("bombcart").setCreativeTab(ICBMClassic.CREATIVE_TAB));
// TODO fix name _
event.getRegistry().register(new ItemBase().setName("poisonPowder").setCreativeTab(ICBMClassic.CREATIVE_TAB));
Item sulfurItem = new ItemBase().setName("sulfurDust").setCreativeTab(ICBMClassic.CREATIVE_TAB);
// TODO fix name _
event.getRegistry().register(sulfurItem);
OreDictionary.registerOre("dustSulfur", sulfurItem);
Item saltpeterItem = new ItemBase().setName("saltpeter").setCreativeTab(ICBMClassic.CREATIVE_TAB);
event.getRegistry().register(saltpeterItem);
OreDictionary.registerOre("dustSaltpeter", saltpeterItem);
event.getRegistry().register(new ItemAntidote().setName("antidote"));
event.getRegistry().register(new ItemSignalDisrupter());
event.getRegistry().register(new ItemTracker());
event.getRegistry().register(new ItemDefuser());
event.getRegistry().register(new ItemRadarGun());
event.getRegistry().register(new ItemRemoteDetonator());
event.getRegistry().register(new ItemLaserDetonator());
event.getRegistry().register(new ItemRocketLauncher());
event.getRegistry().register(new ItemMissile());
// Block items
event.getRegistry().register(new ItemBlock(BlockReg.blockGlassPlate).setRegistryName(BlockReg.blockGlassPlate.getRegistryName()));
event.getRegistry().register(new ItemBlock(BlockReg.blockGlassButton).setRegistryName(BlockReg.blockGlassButton.getRegistryName()));
event.getRegistry().register(new ItemBlockSubTypes(BlockReg.blockSpikes));
event.getRegistry().register(new ItemBlockSubTypes(BlockReg.blockConcrete));
event.getRegistry().register(new ItemBlock(BlockReg.blockReinforcedGlass).setRegistryName(BlockReg.blockReinforcedGlass.getRegistryName()));
event.getRegistry().register(new ItemBlockExplosive(BlockReg.blockExplosive).setRegistryName(BlockReg.blockExplosive.getRegistryName()));
event.getRegistry().register(new ItemBlock(BlockReg.blockEmpTower).setRegistryName(BlockReg.blockEmpTower.getRegistryName()));
event.getRegistry().register(new ItemBlock(BlockReg.blockRadarStation).setRegistryName(BlockReg.blockRadarStation.getRegistryName()));
event.getRegistry().register(new ItemBlockSubTypes(BlockReg.blockLaunchSupport));
event.getRegistry().register(new ItemBlockRotatedMultiTile(BlockReg.blockLaunchBase, e -> TileLauncherBase.getLayoutOfMultiBlock(e)));
event.getRegistry().register(new ItemBlockSubTypes(BlockReg.blockLaunchScreen));
event.getRegistry().register(new ItemBlock(BlockReg.blockCruiseLauncher).setRegistryName(BlockReg.blockCruiseLauncher.getRegistryName()));
// Crafting resources
if (ConfigItems.ENABLE_CRAFTING_ITEMS) {
if (ConfigItems.ENABLE_INGOTS_ITEMS) {
event.getRegistry().register(new ItemCrafting("ingot", "steel", "copper"));
event.getRegistry().register(new ItemCrafting("clump", "steel"));
}
if (ConfigItems.ENABLE_PLATES_ITEMS) {
event.getRegistry().register(new ItemCrafting("plate", "steel", "iron"));
}
if (ConfigItems.ENABLE_CIRCUIT_ITEMS) {
event.getRegistry().register(new ItemCrafting("circuit", "basic", "advanced", "elite"));
}
if (ConfigItems.ENABLE_WIRES_ITEMS) {
event.getRegistry().register(new ItemCrafting("wire", "copper", "gold"));
}
}
// Optional items
if (ConfigItems.ENABLE_BATTERY) {
event.getRegistry().register(new ItemBattery());
}
}
use of icbm.classic.content.items.ItemLaserDetonator in project ICBM-Classic by BuiltBrokenModding.
the class BlockLaunchScreen method onBlockActivated.
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity instanceof TileLauncherScreen) {
TileLauncherScreen screen = (TileLauncherScreen) tileEntity;
ItemStack stack = player.getHeldItem(hand);
if (stack.getItem() == Items.REDSTONE) {
if ((screen._tier == EnumTier.ONE && !ConfigLauncher.LAUNCHER_REDSTONE_TIER1) || (screen._tier == EnumTier.TWO && !ConfigLauncher.LAUNCHER_REDSTONE_TIER2) || (screen._tier == EnumTier.THREE && !ConfigLauncher.LAUNCHER_REDSTONE_TIER3)) {
return false;
}
if (// canLaunch is called in launch and launch returns false if cannot launch
!screen.launch()) {
player.sendMessage(new TextComponentString(LanguageUtility.getLocal("chat.launcher.failedToFire")));
String translation = LanguageUtility.getLocal("chat.launcher.status");
translation = translation.replace("%s", screen.getStatus());
player.sendMessage(new TextComponentString(translation));
}
} else if (stack.getItem() instanceof ItemRemoteDetonator) {
((ItemRemoteDetonator) stack.getItem()).setBroadCastHz(stack, screen.getFrequency());
player.sendMessage(new TextComponentString(LanguageUtility.getLocal("chat.launcher.toolFrequencySet").replace("%s", "" + screen.getFrequency())));
} else if (stack.getItem() instanceof ItemLaserDetonator) {
((ItemLaserDetonator) stack.getItem()).setBroadCastHz(stack, screen.getFrequency());
player.sendMessage(new TextComponentString(LanguageUtility.getLocal("chat.launcher.toolFrequencySet").replace("%s", "" + screen.getFrequency())));
} else if (stack.getItem() instanceof IWorldPosItem) {
IWorldPosition location = ((IWorldPosItem) stack.getItem()).getLocation(stack);
if (location != null) {
if (location.world() == world) {
screen.setTarget(new Pos(location.x(), location.y(), location.z()));
player.sendMessage(new TextComponentString(LanguageUtility.getLocal("chat.launcher.toolTargetSet")));
} else {
player.sendMessage(new TextComponentString(LanguageUtility.getLocal("chat.launcher.toolWorldNotMatch")));
}
} else {
player.sendMessage(new TextComponentString(LanguageUtility.getLocal("chat.launcher.noTargetInTool")));
}
} else if (screen.launcherBase == null || !screen.launcherBase.tryInsertMissile(player, hand, player.getHeldItem(hand))) {
player.openGui(ICBMClassic.INSTANCE, 0, world, pos.getX(), pos.getY(), pos.getZ());
}
}
}
return true;
}
use of icbm.classic.content.items.ItemLaserDetonator in project ICBM-Classic by BuiltBrokenModding.
the class BlockCruiseLauncher method onBlockActivated.
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity instanceof TileCruiseLauncher) {
TileCruiseLauncher launcher = (TileCruiseLauncher) tileEntity;
ItemStack stack = player.getHeldItem(hand);
if (stack.getItem() == Items.REDSTONE) {
if (// canLaunch is called in launch and launch returns false if cannot launch
!launcher.launch()) {
player.sendMessage(new TextComponentString(LanguageUtility.getLocal("chat.launcher.failedToFire")));
String translation = LanguageUtility.getLocal("chat.launcher.status");
translation = translation.replace("%s", launcher.getStatus());
player.sendMessage(new TextComponentString(translation));
}
} else if (stack.getItem() instanceof ItemRemoteDetonator) {
((ItemRemoteDetonator) stack.getItem()).setBroadCastHz(stack, launcher.getFrequency());
player.sendMessage(new TextComponentString(LanguageUtility.getLocal("chat.launcher.toolFrequencySet").replace("%s", "" + launcher.getFrequency())));
} else if (stack.getItem() instanceof ItemLaserDetonator) {
((ItemLaserDetonator) stack.getItem()).setBroadCastHz(stack, launcher.getFrequency());
player.sendMessage(new TextComponentString(LanguageUtility.getLocal("chat.launcher.toolFrequencySet").replace("%s", "" + launcher.getFrequency())));
} else if (stack.getItem() instanceof IWorldPosItem) {
IWorldPosition location = ((IWorldPosItem) stack.getItem()).getLocation(stack);
if (location != null) {
if (location.world() == world) {
launcher.setTarget(new Pos(location.x(), location.y(), location.z()));
player.sendMessage(new TextComponentString(LanguageUtility.getLocal("chat.launcher.toolTargetSet")));
} else {
player.sendMessage(new TextComponentString(LanguageUtility.getLocal("chat.launcher.toolWorldNotMatch")));
}
} else {
player.sendMessage(new TextComponentString(LanguageUtility.getLocal("chat.launcher.noTargetInTool")));
}
} else {
player.openGui(ICBMClassic.INSTANCE, 0, world, pos.getX(), pos.getY(), pos.getZ());
}
}
}
return true;
}
Aggregations